/* ============== EDIT MODE — activates when URL has ?edit=1 ==============
   Browser-side editor. Adds a top toolbar, makes text content editable
   in place, and lets the user download the modified HTML.
   Default OFF — only loaded by _edit-mode.js when ?edit=1 is present. */

.em-toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 99999;
  background: #BD5532;
  color: #F9F9F9;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
.em-label {
  font-weight: 700;
  letter-spacing: 0.32em;
  margin-inline-end: auto;
}
.em-label::before {
  content: "●";
  color: #F9F9F9;
  margin-inline-end: 8px;
  animation: emPulse 1.4s ease-in-out infinite;
}
@keyframes emPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.em-counter {
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 10px;
  margin-inline-end: 4px;
  font-size: 10px;
  letter-spacing: 0.18em;
}
.em-counter strong {
  color: #F9F9F9;
  font-weight: 700;
  margin-inline-end: 4px;
}
.em-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #F9F9F9;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.em-btn:hover { background: rgba(255, 255, 255, 0.3); border-color: rgba(255, 255, 255, 0.6); }
.em-btn.is-primary {
  background: #F9F9F9;
  color: #BD5532;
  border-color: #F9F9F9;
  font-weight: 700;
}
.em-btn.is-primary:hover { background: #ffffff; }
.em-btn.is-exit { background: #0A0A0A; border-color: #0A0A0A; }
.em-btn.is-exit:hover { background: #1A1A1A; }

/* Push the page down so the toolbar doesn't cover content */
body.edit-mode-active { padding-top: 56px !important; }
body.edit-mode-active .splash { display: none !important; } /* skip splash in edit mode */

/* Editable elements — subtle hover, strong focus */
.em-editable {
  outline: 1px dashed transparent;
  outline-offset: 4px;
  transition: outline-color 0.15s, background 0.15s;
  cursor: text;
}
.em-editable:hover {
  outline-color: rgba(189, 85, 50, 0.55);
  background: rgba(189, 85, 50, 0.04);
}
.em-editable:focus {
  outline: 2px solid #BD5532;
  outline-offset: 4px;
  background: rgba(189, 85, 50, 0.06);
}
.em-editable.em-changed {
  outline-color: rgba(189, 85, 50, 0.8) !important;
  outline-style: solid !important;
}

/* Diff modal */
.em-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.78);
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 32px;
}
.em-modal {
  background: #F9F9F9;
  color: #0A0A0A;
  padding: 28px;
  max-width: 760px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  font-family: 'Noto Serif', serif;
  border: 2px solid #BD5532;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.em-modal h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  margin-block-end: 6px;
}
.em-modal h3 em {
  font-family: 'Noto Serif', serif;
  font-style: italic;
  font-weight: 300;
  color: #BD5532;
  text-transform: none;
  margin-inline-start: 8px;
}
.em-modal .em-modal-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.55);
  margin-block-end: 20px;
  padding-block-end: 14px;
  border-block-end: 1px solid rgba(0, 0, 0, 0.1);
}
.em-modal ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}
.em-modal li {
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-inline-start: 3px solid #BD5532;
  margin-block-end: 10px;
  font-size: 13px;
  line-height: 1.55;
}
.em-modal li code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: rgba(189, 85, 50, 0.1);
  color: #BD5532;
  padding: 2px 8px;
  margin-block-end: 8px;
  display: inline-block;
  letter-spacing: 0.18em;
}
.em-modal li > div { margin-block: 6px; }
.em-modal li strong {
  color: #BD5532;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: inline-block;
  width: 70px;
}
.em-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-block-start: 12px;
  border-block-start: 1px solid rgba(0, 0, 0, 0.1);
}

@media (max-width: 720px) {
  .em-toolbar {
    padding: 8px 12px;
    font-size: 9px;
    gap: 6px;
  }
  .em-label { font-size: 9px; letter-spacing: 0.24em; }
  .em-btn { padding: 6px 10px; font-size: 9px; }
  .em-counter { padding: 3px 8px; font-size: 9px; }
  body.edit-mode-active { padding-top: 64px !important; }
}
