/* Top-center unsaved-changes bar — 1:1 from kaleidoscope-data-migration/
   index.html:513-526 (#unsaved-bar). Sits next to #dev-indicator at the
   top centre of the viewport, visible only when isAdmin + devMode +
   content-store dirty. Click navigates to Developer Dashboard. */
#unsaved-bar {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 6px);
  left: calc(50% + 26px);
  width: 6px;
  height: 3px;
  border-radius: 2px;
  background: #e74c3c;
  z-index: 100;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0.9;
}

/* Content-page block rendering — 1:1 from kaleidoscope-data-migration/
   index.html:1180-1332. Fold uses heading/text/quote only; image/video
   styles are intentionally omitted (no such blocks in Fold's content).

   Reverie pairs these with a scroll-reveal IntersectionObserver
   (.indepth-block default opacity:0, .visible toggles in on scroll).
   Fold skips the reveal — content is short and tap-to-open already
   feels like an arrival, so blocks render fully visible immediately. */

.indepth-heading {
  max-width: 540px;
  margin: clamp(30px, 6vh, 60px) auto 0;
  padding: 0 24px;
}
.indepth-heading h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: var(--fg-strong);
  margin: 0;
}
.indepth-heading + .indepth-text {
  padding-top: clamp(8px, 1.5vh, 16px);
}
.indepth-heading + .indepth-quote {
  margin-top: clamp(10px, 2vh, 20px);
}

.indepth-text {
  max-width: 540px;
  margin: 0 auto;
  padding: clamp(30px, 6vh, 60px) 24px;
}
.indepth-text p {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--fg);
  margin-bottom: 1.5em;
}
.indepth-text p:last-child { margin-bottom: 0; }
.indepth-text ul { margin-bottom: 1.5em; }
.indepth-text ul:last-child { margin-bottom: 0; }
.indepth-text li {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--fg);
}
.indepth-text strong { font-weight: 600; }
.indepth-text em { font-style: italic; }

.indepth-quote {
  max-width: 540px;
  margin: clamp(30px, 6vh, 60px) auto;
  padding: 0 24px;
  text-align: center;
}
.indepth-quote blockquote {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 300;
  font-style: italic;
  line-height: 1.5;
  color: var(--gold);
  white-space: pre-line;
}
.indepth-quote blockquote::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--gold);
  margin: 0 auto 1.5em;
  opacity: 0.5;
}

/* Image block — 1:1 from kaleidoscope-data-migration/index.html:1230-1249. */
.indepth-image {
  width: 100%;
  padding: 0 24px;
  margin: clamp(30px, 6vh, 60px) auto;
  max-width: 900px;
}
.indepth-image img {
  width: 100%;
  display: block;
  border-radius: 2px;
}
.indepth-image-caption {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--fg-dim);
  letter-spacing: 0.06em;
  text-align: center;
  margin-top: 12px;
  white-space: pre-line;
}

/* Video block — 1:1 from kaleidoscope-data-migration/index.html:1276-1322. */
.indepth-video {
  width: 100%;
  padding: 0 24px;
  margin: clamp(30px, 6vh, 60px) auto;
  max-width: 900px;
}
.indepth-video.portrait {
  max-width: 360px;
}
.indepth-video iframe {
  width: 100%;
  border: none;
  display: block;
}
.indepth-video-wrap {
  position: relative;
  width: 100%;
  cursor: pointer;
  border-radius: 2px;
  overflow: hidden;
}
.indepth-video-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.indepth-video-wrap .play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  transition: background 0.2s ease;
}
.indepth-video-wrap:hover .play-btn {
  background: rgba(0,0,0,0.5);
}
.indepth-video-wrap .play-btn::after {
  content: '';
  border-style: solid;
  border-width: 18px 0 18px 30px;
  border-color: transparent transparent transparent rgba(255,255,255,0.9);
}

/* Fold-specific: no scroll-reveal (see header comment). Set blocks
   visible directly rather than relying on JS to toggle .visible. */
.indepth-block {
  opacity: 1;
}

/* ─── Content editor overlay (admin-only) ─────────────────────────
   1:1 from kaleidoscope-data-migration/reverie.css:670-686
   (.content-overlay) plus index.html:1078-1148 (.content-editor-*).
   Hosts the openContentEditor UI: title field, description, block
   editor, locale switcher, tabs. Strings hardcoded English. */

.content-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow-y: auto;
  padding: var(--space-lg);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0s 0s;
  display: block !important; /* override global .hidden display:none */
  z-index: 60;
}
.content-overlay.closed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0s 0.4s;
}

/* ─── Collection-style info header (Reverie reuse) ────────────── */
.coll-info-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.coll-info-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--fg);
  margin: 0;
}

/* Description — 1:1 reverie.css area index.html:944-954.
   Cormorant italic dim, sibling between header and body, hidden when
   empty (info.js toggles display by content). */
.coll-info-desc {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-style: italic;
  color: var(--fg-dim);
  line-height: 1.6;
  max-width: 500px;
  margin: 0 0 var(--space-lg);
  white-space: pre-line;
  padding: 0 var(--space-lg);
}
.coll-info-desc:empty { display: none; }

/* Tab bar in viewer — 1:1 from kaleidoscope-data-migration/index.html:987-1024. */
.coll-info-tabs {
  display: flex;
  justify-content: center;
  gap: clamp(28px, 5vw, 48px);
  padding: var(--space-sm) var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}
.coll-info-tab {
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  padding: var(--space-xs) 0;
  cursor: pointer;
  position: relative;
  transition: color var(--t-fast);
}
.coll-info-tab:hover { color: var(--fg); }
.coll-info-tab.active { color: var(--fg-strong); }
.coll-info-tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -13px;
  height: 1px;
  background: var(--gold, var(--fg-strong));
  opacity: 0.7;
}

/* ─── Collection-Manager primitives (cm-*) — 1:1 reverie.css:1358-1397, 1534-1539. */

.cm-input {
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  width: 100%;
  outline: none;
}
.cm-input:focus { border-color: var(--gold); }
.cm-input::placeholder { color: var(--fg-muted); }
textarea.cm-input {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.cm-btn {
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t-fast);
}
.cm-btn:hover { background: var(--control-hover); }
.cm-btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}
.cm-btn.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.cm-section-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--fg-dim);
  margin-bottom: var(--space-sm);
}

/* ─── Editor tabs — 1:1 index.html:1078-1148 ────────────────── */

.content-editor-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) 0 var(--space-md);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-md);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
  flex-wrap: wrap;
}
.content-editor-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-dim);
  font-family: var(--font-display);
  font-size: 0.8rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.content-editor-tab:hover { color: var(--fg); border-color: var(--fg-dim); }
.content-editor-tab.active {
  color: var(--fg-strong);
  border-color: var(--gold);
}
.content-editor-tab-label-input {
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  min-width: 80px;
  padding: 0;
}
.content-editor-tab-label-input:focus { outline: 1px solid var(--gold); }
.content-editor-tab-controls {
  display: flex;
  gap: 2px;
  margin-left: 4px;
  opacity: 0.5;
  transition: opacity var(--t-fast);
}
.content-editor-tab:hover .content-editor-tab-controls,
.content-editor-tab.active .content-editor-tab-controls { opacity: 1; }
.content-editor-tab-controls button {
  background: none;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.7rem;
}
.content-editor-tab-controls button:hover { color: var(--fg); }
.content-editor-tab-add {
  background: none;
  border: 1px dashed var(--fg-dim);
  border-radius: var(--radius-sm);
  color: var(--fg-dim);
  font-family: var(--font-display);
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
}
.content-editor-tab-add:hover { color: var(--fg); border-color: var(--fg); }

/* Just-moved highlight — 1:1 reverie.css:1276-1282. Flashes a 3px gold
   ring around a block right after it's reordered. */
@keyframes blockMovedHighlight {
  0%   { box-shadow: 0 0 0 3px var(--gold); }
  100% { box-shadow: 0 0 0 3px transparent; }
}
.block-just-moved {
  animation: blockMovedHighlight 2s ease-out forwards;
}

/* ─── Dev / Content view (admin-only) ─────────────────────────────
   Hosts the content-page editor entry points + content export/import.
   Strings hardcoded English by design — see index.html #dev. */

.dev-page-list {
  max-width: 540px;
  margin: clamp(20px, 4vh, 40px) auto 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dev-page-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dev-page-btn:hover {
  border-color: var(--gold);
}
.dev-page-label {
  font-weight: 400;
}
.dev-page-action {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  text-transform: uppercase;
}

.dev-divider {
  max-width: 540px;
  margin: clamp(30px, 6vh, 60px) auto 0;
  padding: 0 24px;
  border-top: 1px solid var(--border);
}

.dev-meta {
  max-width: 540px;
  margin: clamp(16px, 3vh, 24px) auto 0;
  padding: 0 24px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-dim);
}

.dev-actions {
  max-width: 540px;
  margin: clamp(16px, 3vh, 24px) auto clamp(30px, 6vh, 60px);
  padding: 0 24px;
  display: flex;
  gap: 12px;
}
