/* Admin inline-edit affordances. Injected/loaded on every page but only takes
   visible effect once <body> gets the .editing class (edit-mode.js). Cosmic
   tokens (var(--qa-*)) to match the theme. */

/* Floating control bar (bottom-right). */
#ed-bar {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 200;
  display: flex; gap: .5rem; align-items: center;
  padding: .5rem .6rem; border-radius: var(--qa-radius-pill, 999px);
  background: rgba(10, 12, 24, .82); border: 1px solid var(--qa-line, #2a2f45);
  backdrop-filter: blur(8px); box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
#ed-bar button, #ed-bar .ed-upload {
  font: inherit; font-size: .82rem; cursor: pointer;
  color: var(--qa-ink, #eef); background: rgba(255, 255, 255, .06);
  border: 1px solid var(--qa-line, #2a2f45); border-radius: var(--qa-radius-pill, 999px);
  padding: .35rem .8rem;
}
#ed-bar button:hover, #ed-bar .ed-upload:hover { border-color: var(--qa-cyan, #38bdf8); }
#ed-bar .ed-save { color: #05210f; background: var(--qa-cyan, #38bdf8); border-color: transparent; font-weight: 600; }
#ed-bar button:disabled { opacity: .6; cursor: default; }
/* Save / Discard / Photo appear only while editing. */
#ed-bar .ed-save, #ed-bar .ed-discard, #ed-bar .ed-upload { display: none; }
#ed-bar.on .ed-save, #ed-bar.on .ed-discard, #ed-bar.on .ed-upload { display: inline-block; }

/* Array add/remove controls — hidden unless editing. */
.ed-add, .ed-del { display: none; }
body.editing .ed-add {
  display: inline-block; font: inherit; font-size: .78rem; cursor: pointer;
  margin-top: .4rem; padding: .2rem .6rem; border-radius: var(--qa-radius-pill, 999px);
  color: var(--qa-cyan, #38bdf8); background: transparent; border: 1px dashed var(--qa-line, #2a2f45);
}
body.editing .ed-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.3rem; height: 1.3rem; margin-left: .3rem; cursor: pointer;
  font-size: .9rem; line-height: 1; border-radius: 50%;
  color: #fff; background: rgba(220, 60, 60, .8); border: none; vertical-align: middle;
}

/* Editable field outline while editing. */
body.editing [contenteditable="true"] {
  outline: 1px dashed rgba(56, 189, 248, .5); outline-offset: 3px; border-radius: 3px;
}
body.editing [contenteditable="true"]:focus { outline: 2px solid var(--qa-cyan, #38bdf8); }

/* Per-section hide/show toggle (e.g. contact), edit mode only. */
.ed-section-toggle {
  display: inline-block; margin: 0 0 1rem; cursor: pointer;
  font: inherit; font-size: .8rem; padding: .35rem .9rem;
  border-radius: var(--qa-radius-pill, 999px);
  color: var(--qa-ink, #eef); background: rgba(255, 255, 255, .06);
  border: 1px dashed var(--qa-cyan, #38bdf8);
}
.ed-section-toggle:hover { background: rgba(56, 189, 248, .15); }

/* CV download is admin-only (in the edit bar). Hide the public "Download CV"
   buttons so the PDF's contact info is never exposed to anonymous visitors. */
[data-cv] { display: none !important; }

/* Contact is hidden by default (privacy). JS reveals it only when it is NOT in
   doc.hidden, or for an admin in edit mode — so it never flashes for visitors. */
#contact { display: none; }

/* Admin-only CV/PDF content panel — hidden entirely unless editing. */
.cv-only { display: none; }
body.editing .cv-only { display: block; }
.cv-note { color: var(--qa-cyan, #38bdf8); font-size: .8rem; margin: 0 0 .8rem; }
.cv-lbl { display: block; font-size: .8rem; font-weight: 600; color: var(--qa-muted, #9aa); margin: .8rem 0 .3rem; }
.cv-field { margin: 0; }
.cv-hl-list { display: flex; flex-direction: column; gap: .3rem; }
.cv-hl { display: flex; align-items: center; gap: .4rem; }

/* Toast. */
#ed-toast {
  position: fixed; left: 50%; bottom: 4.5rem; transform: translateX(-50%) translateY(1rem);
  z-index: 210; padding: .6rem 1rem; border-radius: var(--qa-radius, 12px);
  background: rgba(20, 24, 40, .95); color: var(--qa-ink, #eef);
  border: 1px solid var(--qa-line, #2a2f45); font-size: .88rem;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
#ed-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#ed-toast.err { border-color: rgba(220, 60, 60, .8); }

/* Never print the editing chrome. */
@media print { #ed-bar, #ed-toast, .ed-add, .ed-del, .ed-section-toggle { display: none !important; } }
