/* ═══════════════════════════════════════════════════════════════════════════
   CINEMATIC ATLAS — premium pannable chapter board
   Architecture:
     .atlas            fixed full-viewport container, owns cursor behaviour
       .atlas-sky      atmospheric layers (gradient mesh, stars, grain)
       .atlas-chrome   fixed navigation band
       .atlas-stage    pannable viewport (overflow hidden)
         .atlas-parallax-*   depth layers transformed at partial speed
         .atlas-world        the actual world, transformed by camera
           .atlas-threads    SVG connectors between related nodes/media
           .atlas-nodes      chapter nodes + their media satellites
       .atlas-hint           onboarding
       .atlas-navigator      minimap
       .atlas-index          collapsible chapter index
       .atlas-compass        coordinate readout
       .atlas-veil           loading state
       .atlas-detail         focused chapter overlay
═══════════════════════════════════════════════════════════════════════════ */

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: #050403;
  color: var(--limestone, #e8e2d6);
  font-family: var(--font-body, 'EB Garamond', serif);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;            /* prevent page scroll; stage handles motion */
  overscroll-behavior: none;
  height: 100%;
}
body.atlas-body { touch-action: none; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ══════════════════════════════════════════════════════════════════════════
   LAYOUT ROOT
══════════════════════════════════════════════════════════════════════════ */
.atlas {
  position: fixed;
  inset: 0;
  display: block;
  overflow: hidden;
  color: var(--limestone, #e8e2d6);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.atlas[data-dragging="true"] { cursor: grabbing; }
.atlas[data-loading="true"]  .atlas-stage { opacity: 0.3; filter: blur(8px); }

/* ══════════════════════════════════════════════════════════════════════════
   SKY / ATMOSPHERE
══════════════════════════════════════════════════════════════════════════ */
.atlas-sky {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.sky-mesh {
  position: absolute; inset: -5%;
  background:
    radial-gradient(ellipse 60% 50% at 18% 22%, rgba(176,141,87,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 55% 45% at 82% 78%, rgba(45,74,62,0.35)  0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 50% 50%, rgba(196,167,108,0.05) 0%, transparent 70%),
    linear-gradient(165deg, #0c0a08 0%, #050403 45%, #0a0806 100%);
  animation: skyDrift 32s ease-in-out infinite alternate;
  filter: saturate(0.95);
}
@keyframes skyDrift {
  0%   { transform: scale(1)    translate3d(0,0,0); }
  100% { transform: scale(1.08) translate3d(1.5%, -1%, 0); }
}
.sky-stars { position: absolute; inset: 0; opacity: 0.55; }
.sky-stars span {
  position: absolute;
  width: 1.5px; height: 1.5px;
  background: rgba(232,226,214,0.85);
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(232,226,214,0.4);
  animation: starPulse 6s ease-in-out infinite;
}
@keyframes starPulse { 0%,100% { opacity: 0.2; } 50% { opacity: 1; } }

.sky-grain {
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
  opacity: 0.5;
}
.sky-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 38%, rgba(5,4,3,0.78) 100%);
}

/* ══════════════════════════════════════════════════════════════════════════
   CHROME (top nav band)
══════════════════════════════════════════════════════════════════════════ */
.atlas-chrome {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 400;
  padding: 22px clamp(24px, 4vw, 56px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
  background: linear-gradient(to bottom, rgba(5,4,3,0.6), transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.atlas-chrome > * { pointer-events: auto; }
.chrome-mark {
  font-family: var(--font-display, serif);
  font-size: 17px;
  letter-spacing: 0.01em;
  color: var(--warm-white, #f6f2ec);
  justify-self: start;
  transition: color 0.3s ease;
}
.chrome-mark:hover { color: var(--bronze-pale, #c4a76c); }

.chrome-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.chrome-eyebrow {
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.48em;
  text-transform: uppercase;
  color: rgba(196,167,108,0.62);
}
.chrome-label {
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: 15px;
  color: var(--warm-white, #f6f2ec);
  letter-spacing: 0.02em;
}

.chrome-nav {
  justify-self: end;
  display: flex;
  gap: 32px;
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}
.chrome-nav a {
  color: rgba(232,226,214,0.55);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.chrome-nav a:hover { color: var(--bronze-pale, #c4a76c); border-color: var(--bronze-pale, #c4a76c); }

@media (max-width: 900px) {
  .atlas-chrome { grid-template-columns: 1fr auto; gap: 16px; }
  .chrome-nav   { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   STAGE + WORLD
══════════════════════════════════════════════════════════════════════════ */
.atlas-stage {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  transition: opacity 0.8s ease, filter 0.8s ease;
}

.atlas-parallax-far,
.atlas-parallax-mid {
  position: absolute;
  inset: -20%;               /* allow movement room */
  pointer-events: none;
  will-change: transform;
}
.atlas-parallax-far {
  background:
    radial-gradient(circle 180px at 15% 25%, rgba(196,167,108,0.05), transparent),
    radial-gradient(circle 240px at 78% 65%, rgba(45,74,62,0.08),    transparent),
    radial-gradient(circle 120px at 48% 82%, rgba(196,167,108,0.04), transparent);
  filter: blur(24px);
}
.atlas-parallax-mid {
  background:
    radial-gradient(circle 80px  at 35% 45%, rgba(196,167,108,0.09), transparent),
    radial-gradient(circle 100px at 88% 22%, rgba(196,167,108,0.07), transparent);
  filter: blur(8px);
  opacity: 0.7;
}

.atlas-world {
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;       /* virtual origin, children positioned absolutely */
  transform-origin: 0 0;
  will-change: transform;
}

/* SVG connector threads between related items */
.atlas-threads {
  position: absolute;
  top: 0; left: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}
.atlas-threads path {
  fill: none;
  stroke: rgba(196,167,108,0.16);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  transition: stroke 0.5s ease, stroke-width 0.5s ease, opacity 0.5s ease;
}
.atlas-threads path.is-active {
  stroke: rgba(196,167,108,0.52);
  stroke-width: 1.2;
  stroke-dasharray: none;
}
.atlas-threads path.is-dim { opacity: 0.35; }

.atlas-nodes { position: absolute; top: 0; left: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   CHAPTER NODES
   Positioned absolutely in world (x/y set by JS).
   Two parts: .node-card (the anchor) + satellites (.media-plate)
══════════════════════════════════════════════════════════════════════════ */
.node {
  position: absolute;
  transform: translate(-50%, -50%);
  transition: opacity 0.6s var(--ease-out, ease), filter 0.6s ease;
  will-change: transform, opacity;
}
.atlas-nodes[data-any-hover="true"] .node:not(.is-hovered):not(.is-focus) {
  opacity: 0.42;
  filter: saturate(0.65);
}
.node.is-hovered { z-index: 50; }
.node.is-focus   { z-index: 70; }

/* ── Card ──────────────────────────────────────────────────────────────── */
.node-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  padding: 12px;
  background: rgba(10, 8, 6, 0.32);
  border: 1px solid rgba(200, 190, 172, 0.06);
  backdrop-filter: blur(4px) saturate(1.1);
  -webkit-backdrop-filter: blur(4px) saturate(1.1);
  transition:
    transform 0.9s var(--ease-out, cubic-bezier(0.16,1,0.3,1)),
    background 0.5s ease,
    border-color 0.5s ease,
    box-shadow 0.6s ease;
}
.node-card:hover,
.node.is-focus .node-card {
  background: rgba(14, 11, 8, 0.62);
  border-color: rgba(196, 167, 108, 0.42);
  box-shadow:
    0 40px 80px -40px rgba(0,0,0,0.85),
    0 0 0 1px rgba(196,167,108,0.08),
    0 0 120px -20px rgba(196,167,108,0.28);
  transform: translateY(-4px) scale(1.01);
}

/* Image well */
.node-image {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #1a1612;
}
.node-image::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(10,9,8,0.82) 100%);
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.node-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1.4s var(--ease-out, cubic-bezier(0.16,1,0.3,1)),
              filter 0.6s ease,
              opacity 0.6s ease;
  filter: brightness(0.88) saturate(0.92);
  opacity: 0;
}
.node-image img.is-loaded { opacity: 1; }
.node-card:hover .node-image img,
.node.is-focus  .node-image img {
  transform: scale(1.05);
  filter: brightness(1) saturate(1);
}

/* Caption */
.node-caption {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 0 2px;
}
.node-roman {
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: 22px;
  line-height: 1;
  color: rgba(196,167,108,0.72);
  min-width: 30px;
}
.node-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.node-title {
  font-family: var(--font-display, serif);
  font-weight: 300;
  font-size: clamp(18px, 1.4vw, 26px);
  line-height: 1.1;
  color: var(--warm-white, #f6f2ec);
  letter-spacing: -0.005em;
}
.node-mood {
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: rgba(232,226,214,0.42);
}

/* Scale variants — assigned by JS based on chapter weight */
.node[data-scale="xl"] { --node-w: 340px; }
.node[data-scale="l"]  { --node-w: 280px; }
.node[data-scale="m"]  { --node-w: 230px; }
.node[data-scale="s"]  { --node-w: 190px; }
.node-card { width: var(--node-w, 260px); }

/* Focused node glows and sharpens */
.node.is-focus .node-card {
  box-shadow:
    0 60px 120px -40px rgba(0,0,0,0.9),
    0 0 0 1px rgba(196,167,108,0.2),
    0 0 200px -30px rgba(196,167,108,0.42);
}

/* Halo pulse on focus */
.node-halo {
  position: absolute;
  top: 50%; left: 50%;
  width: calc(var(--node-w, 260px) + 60px);
  aspect-ratio: 4 / 5;
  transform: translate(-50%, -50%);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
  background:
    radial-gradient(ellipse at center, rgba(196,167,108,0.18) 0%, transparent 62%);
  filter: blur(14px);
}
.node.is-focus .node-halo,
.node.is-hovered .node-halo { opacity: 1; }

/* ── Media satellites (around node) ────────────────────────────────────── */
.media-plate {
  position: absolute;
  transform: translate(-50%, -50%);
  width: var(--plate-w, 140px);
  aspect-ratio: var(--plate-ar, 4 / 5);
  overflow: hidden;
  background: #1a1612;
  border: 1px solid rgba(200, 190, 172, 0.04);
  opacity: 0.55;
  transition:
    opacity 0.7s var(--ease-out, ease),
    transform 0.9s var(--ease-out, ease),
    filter 0.6s ease,
    box-shadow 0.6s ease;
  pointer-events: auto;
  cursor: pointer;
  filter: brightness(0.62) saturate(0.78);
}
.media-plate img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.7s ease;
}
.media-plate img.is-loaded { opacity: 1; }

.node.is-hovered .media-plate,
.node.is-focus   .media-plate {
  opacity: 1;
  filter: brightness(1) saturate(1);
}
.node.is-focus .media-plate {
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.7);
}

.media-plate:hover {
  opacity: 1 !important;
  transform: translate(-50%, -50%) scale(1.05);
  filter: brightness(1.08) saturate(1.05);
  z-index: 5;
}

/* Decorative plate variants */
.media-plate[data-rot="-2"] { transform: translate(-50%, -50%) rotate(-2deg); }
.media-plate[data-rot="-1"] { transform: translate(-50%, -50%) rotate(-1deg); }
.media-plate[data-rot="1"]  { transform: translate(-50%, -50%) rotate(1deg);  }
.media-plate[data-rot="2"]  { transform: translate(-50%, -50%) rotate(2deg);  }
.media-plate[data-rot="3"]  { transform: translate(-50%, -50%) rotate(3deg);  }
.media-plate[data-rot="-3"] { transform: translate(-50%, -50%) rotate(-3deg); }
.media-plate:hover { transform: translate(-50%, -50%) scale(1.05) rotate(0deg) !important; }

/* Node title label that appears floating near node when hovered */
.node-badge {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--bronze-pale, #c4a76c);
  background: rgba(10, 8, 6, 0.85);
  border: 1px solid rgba(196, 167, 108, 0.22);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  white-space: nowrap;
}
.node.is-hovered .node-badge { opacity: 1; transform: none; }

/* ══════════════════════════════════════════════════════════════════════════
   ONBOARDING HINT
══════════════════════════════════════════════════════════════════════════ */
.atlas-hint {
  position: fixed;
  left: 50%;
  bottom: clamp(100px, 18vh, 160px);
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  background: rgba(10, 8, 6, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(196, 167, 108, 0.14);
  opacity: 0;
  transition: opacity 1s 1s ease, transform 1s 1s ease;
  pointer-events: none;
}
.atlas-hint.is-visible { opacity: 1; }
.atlas-hint.is-dismiss { opacity: 0 !important; transform: translate(-50%, 8px); }
.hint-line {
  width: 42px; height: 1px;
  background: var(--bronze-pale, #c4a76c);
  opacity: 0.6;
  animation: hintPulse 3s ease-in-out infinite;
}
@keyframes hintPulse { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }
.hint-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: 14px;
  color: rgba(232,226,214,0.82);
}
.hint-eyebrow {
  font-family: var(--font-sc, serif);
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(196,167,108,0.62);
}

/* ══════════════════════════════════════════════════════════════════════════
   NAVIGATOR MINIMAP
══════════════════════════════════════════════════════════════════════════ */
.atlas-navigator {
  position: fixed;
  left: clamp(20px, 2.4vw, 32px);
  bottom: clamp(20px, 3vh, 32px);
  z-index: 280;
  padding: 14px;
  background: rgba(10, 8, 6, 0.66);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(196, 167, 108, 0.12);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s 0.6s var(--ease-out, ease),
              transform 0.7s 0.6s var(--ease-out, ease);
}
.atlas-navigator.is-visible { opacity: 1; transform: none; }

.nav-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.nav-eyebrow {
  font-family: var(--font-sc, serif);
  font-size: 8px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(196,167,108,0.6);
}
.nav-recenter {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: rgba(232,226,214,0.5);
  border: 1px solid rgba(200,190,172,0.12);
  border-radius: 50%;
  transition: color 0.3s, border-color 0.3s, transform 0.4s var(--ease-out, ease);
}
.nav-recenter:hover { color: var(--bronze-pale, #c4a76c); border-color: var(--bronze-pale, #c4a76c); transform: rotate(90deg); }

.nav-frame {
  position: relative;
  width: 180px;
  aspect-ratio: 3 / 2;
  background: rgba(5,4,3,0.5);
  border: 1px solid rgba(200,190,172,0.05);
  overflow: hidden;
}
.nav-dots {
  position: absolute; inset: 0;
  pointer-events: none;
}
.nav-dots span {
  position: absolute;
  width: 4px; height: 4px;
  background: rgba(196, 167, 108, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: background 0.3s ease, transform 0.3s ease;
}
.nav-dots span.is-active {
  background: var(--bronze-pale, #c4a76c);
  transform: translate(-50%, -50%) scale(1.8);
  box-shadow: 0 0 8px rgba(196,167,108,0.7);
}
.nav-viewport {
  position: absolute;
  border: 1px solid rgba(196, 167, 108, 0.55);
  background: rgba(196, 167, 108, 0.06);
  pointer-events: none;
  transition: background 0.3s ease;
}

/* ══════════════════════════════════════════════════════════════════════════
   INDEX
══════════════════════════════════════════════════════════════════════════ */
.atlas-index {
  position: fixed;
  top: 88px;
  right: clamp(20px, 2.4vw, 32px);
  z-index: 280;
  width: 260px;
  background: rgba(10, 8, 6, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(196, 167, 108, 0.14);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s 0.6s var(--ease-out, ease),
              transform 0.7s 0.6s var(--ease-out, ease);
}
.atlas-index.is-visible { opacity: 1; transform: none; }

.index-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--limestone, #e8e2d6);
  text-align: left;
  transition: color 0.3s ease;
}
.index-toggle:hover { color: var(--bronze-pale, #c4a76c); }
.index-dot {
  width: 5px; height: 5px;
  background: var(--bronze-pale, #c4a76c);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--bronze-pale, #c4a76c);
}
.index-count { color: rgba(232,226,214,0.42); letter-spacing: 0.32em; }
.index-chev { transition: transform 0.4s var(--ease-out, ease); color: rgba(232,226,214,0.55); }
.atlas-index[data-open="true"] .index-chev { transform: rotate(180deg); }

.index-list {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s var(--ease-out, ease);
  border-top: 1px solid rgba(196, 167, 108, 0.08);
}
.atlas-index[data-open="true"] .index-list { max-height: min(60vh, 560px); overflow-y: auto; }

.index-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(200, 190, 172, 0.04);
  color: rgba(232,226,214,0.68);
  transition: background 0.3s ease, color 0.3s ease;
}
.index-item:last-child { border-bottom: 0; }
.index-item:hover,
.index-item.is-active {
  background: rgba(196, 167, 108, 0.07);
  color: var(--bronze-pale, #c4a76c);
}
.ix-roman {
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: 14px;
  color: rgba(196,167,108,0.6);
}
.ix-title {
  font-family: var(--font-display, serif);
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.ix-count-num {
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: rgba(232,226,214,0.34);
}

/* Scrollbar */
.index-list::-webkit-scrollbar { width: 4px; }
.index-list::-webkit-scrollbar-thumb { background: rgba(196,167,108,0.22); }

/* ══════════════════════════════════════════════════════════════════════════
   COMPASS
══════════════════════════════════════════════════════════════════════════ */
.atlas-compass {
  position: fixed;
  right: clamp(20px, 2.4vw, 32px);
  bottom: clamp(20px, 3vh, 32px);
  z-index: 280;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: rgba(10, 8, 6, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(196, 167, 108, 0.1);
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(232,226,214,0.58);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s 0.8s var(--ease-out, ease),
              transform 0.7s 0.8s var(--ease-out, ease);
  pointer-events: none;
}
.atlas-compass.is-visible { opacity: 1; transform: none; }
.compass-coord {
  color: var(--bronze-pale, #c4a76c);
  font-variant-numeric: tabular-nums;
  min-width: 120px;
}
.compass-rule { width: 28px; height: 1px; background: rgba(196,167,108,0.3); }
.compass-hint { color: rgba(232,226,214,0.34); }
@media (max-width: 720px) {
  .atlas-compass { display: none; }
  .atlas-navigator { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   LOADING VEIL
══════════════════════════════════════════════════════════════════════════ */
.atlas-veil {
  position: fixed; inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  background: rgba(5, 4, 3, 0.95);
  transition: opacity 0.9s 0.2s ease, visibility 0.9s;
  opacity: 1;
  visibility: visible;
}
.atlas-veil.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.veil-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.veil-eyebrow {
  font-family: var(--font-sc, serif);
  font-size: 10px;
  letter-spacing: 0.48em;
  text-transform: uppercase;
  color: rgba(196, 167, 108, 0.7);
}
.veil-title {
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: 22px;
  color: var(--warm-white, #f6f2ec);
  letter-spacing: 0.02em;
}
.veil-bar {
  display: block;
  width: 220px;
  height: 1px;
  background: rgba(196, 167, 108, 0.12);
  overflow: hidden;
}
.veil-bar-inner {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--bronze-pale, #c4a76c);
  transition: width 0.4s ease;
}

/* ══════════════════════════════════════════════════════════════════════════
   DETAIL OVERLAY (focused chapter)
══════════════════════════════════════════════════════════════════════════ */
.atlas-detail {
  position: fixed; inset: 0;
  z-index: 600;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgba(5, 4, 3, 0.62);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s var(--ease-out, ease);
}
.atlas-detail.is-open { opacity: 1; pointer-events: auto; }

.detail-close {
  position: absolute;
  top: 28px; left: clamp(24px, 4vw, 48px);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: rgba(232,226,214,0.7);
  border: 1px solid rgba(200,190,172,0.14);
  border-radius: 999px;
  transition: color 0.3s, border-color 0.3s, gap 0.3s;
  background: rgba(10, 8, 6, 0.54);
}
.detail-close:hover { color: var(--bronze-pale, #c4a76c); border-color: var(--bronze-pale, #c4a76c); gap: 14px; }

.detail-inner {
  display: grid;
  grid-template-columns: minmax(0, 560px) 1fr;
  gap: clamp(40px, 5vw, 72px);
  align-items: center;
  max-width: 1280px;
  margin-inline: auto;
  width: 100%;
  padding: clamp(80px, 9vh, 120px) clamp(32px, 5vw, 80px) 40px;
  transform: translateY(24px);
  opacity: 0;
  transition: opacity 0.9s 0.25s var(--ease-out, ease), transform 0.9s 0.25s var(--ease-out, ease);
}
.atlas-detail.is-open .detail-inner { transform: none; opacity: 1; }

@media (max-width: 960px) {
  .detail-inner { grid-template-columns: 1fr; padding-top: 96px; }
}

/* Stage (main image) */
.detail-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.detail-stage-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #1a1612;
  border: 1px solid rgba(200, 190, 172, 0.07);
  box-shadow: 0 80px 160px -60px rgba(0,0,0,0.9);
}
.detail-stage-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 12s linear, opacity 0.8s ease;
  opacity: 0;
}
.detail-stage-frame img.is-loaded { opacity: 1; }
.atlas-detail.is-open .detail-stage-frame img.is-loaded {
  transform: scale(1.06);     /* slow ken-burns */
}
.detail-media-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(200,190,172,0.24);
  background: rgba(10, 8, 6, 0.54);
  color: rgba(232,226,214,0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
  z-index: 2;
}
.detail-media-prev { left: 12px; }
.detail-media-next { right: 12px; }
.detail-media-nav:hover {
  color: var(--bronze-pale, #c4a76c);
  border-color: rgba(196,167,108,0.75);
}
.detail-media-prev:hover { transform: translateY(-50%) translateX(-2px); }
.detail-media-next:hover { transform: translateY(-50%) translateX(2px); }
.detail-media-nav:disabled {
  opacity: 0.28;
  cursor: default;
  pointer-events: none;
}
.detail-caption {
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(232,226,214,0.4);
}

/* Text column */
.detail-text { max-width: 500px; }
.detail-text-top {
  display: flex; align-items: flex-start; gap: 22px;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(200, 190, 172, 0.08);
}
.detail-index {
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: clamp(48px, 6vw, 80px);
  line-height: 0.85;
  color: var(--bronze-pale, #c4a76c);
  letter-spacing: -0.02em;
}
.detail-eyebrow {
  display: block;
  font-family: var(--font-sc, serif);
  font-size: 10px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(196,167,108,0.72);
  margin-bottom: 8px;
}
.detail-title {
  font-family: var(--font-display, serif);
  font-weight: 300;
  font-size: clamp(1.8rem, 3.2vw, 2.8rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: var(--warm-white, #f6f2ec);
}

.detail-lede {
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.65;
  color: rgba(232,226,214,0.78);
  margin-bottom: 28px;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 28px;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(200, 190, 172, 0.08);
}
.detail-meta dt {
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: rgba(196,167,108,0.55);
  margin-bottom: 4px;
}
.detail-meta dd {
  font-family: var(--font-display, serif);
  font-size: 16px;
  color: var(--warm-white, #f6f2ec);
}

.detail-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}
.detail-cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 26px;
  font-family: var(--font-sc, serif);
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--ink-deep, #0a0908);
  background: var(--bronze-pale, #c4a76c);
  transition: background 0.4s, gap 0.4s var(--ease-out, ease);
}
.detail-cta:hover { background: #d4b87a; gap: 20px; }
.detail-prev,
.detail-next {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid rgba(200,190,172,0.12);
  color: rgba(232,226,214,0.7);
  transition: color 0.3s, border-color 0.3s, transform 0.4s var(--ease-out, ease);
}
.detail-prev:hover,
.detail-next:hover { color: var(--bronze-pale, #c4a76c); border-color: var(--bronze-pale, #c4a76c); }
.detail-prev:hover { transform: translateX(-3px); }
.detail-next:hover { transform: translateX(3px); }

/* Strip of thumbnails at bottom */
.detail-strip {
  padding: 20px clamp(24px, 4vw, 56px) clamp(20px, 3vh, 32px);
  overflow: hidden;
  border-top: 1px solid rgba(200,190,172,0.06);
  background: rgba(5,4,3,0.42);
}
.strip-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  cursor: grab;
  user-select: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.strip-track.is-dragging { cursor: grabbing; }
.strip-track::-webkit-scrollbar { display: none; }
.strip-thumb {
  flex: 0 0 auto;
  width: 140px; height: 94px;
  overflow: hidden;
  background: #1a1612;
  border: 1px solid rgba(200,190,172,0.05);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.4s, transform 0.4s var(--ease-out, ease);
}
.strip-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(0.6) saturate(0.75);
  transition: filter 0.4s ease;
}
.strip-thumb.is-active { border-color: rgba(196,167,108,0.58); transform: translateY(-4px); }
.strip-thumb.is-active img { filter: brightness(1) saturate(1); }
.strip-thumb:hover img { filter: brightness(0.9) saturate(0.95); }

/* ══════════════════════════════════════════════════════════════════════════
   REDUCED MOTION
══════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .sky-mesh,
  .sky-stars span,
  .hint-line { animation: none !important; }
  .node,
  .media-plate,
  .node-card,
  .atlas-world,
  .atlas-parallax-far,
  .atlas-parallax-mid { transition-duration: 0.12s !important; }
  .detail-stage-frame img { transition: opacity 0.3s ease !important; transform: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   SCENE REEL — full-chapter cinematic scroll showing every plate
══════════════════════════════════════════════════════════════════════════ */
.atlas-scene {
  position: fixed;
  inset: 0;
  z-index: 9600;
  background: #050403;
  color: var(--limestone, #e8e2d6);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.55s var(--ease-out, cubic-bezier(0.16,1,0.3,1)), visibility 0s linear 0.55s;
  overflow: hidden;
}
.atlas-scene.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.55s var(--ease-out, cubic-bezier(0.16,1,0.3,1)), visibility 0s linear 0s;
}

/* atmospheric backdrop */
.scene-atmos { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.scene-atmos-mesh {
  position: absolute; inset: -10%;
  background:
    radial-gradient(ellipse 60% 50% at 30% 30%, rgba(176,141,87,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 70% 55% at 75% 75%, rgba(45,74,62,0.22) 0%, transparent 60%),
    linear-gradient(160deg, #0a0806 0%, #050403 100%);
  animation: sceneAtmos 38s ease-in-out infinite alternate;
}
@keyframes sceneAtmos {
  0%   { transform: scale(1) translate3d(0,0,0); }
  100% { transform: scale(1.08) translate3d(-1%, 1%, 0); }
}
.scene-atmos-grain {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
  opacity: 0.5;
}

/* ── Chrome (fixed header bar) ─────────────────────────────────────────── */
.scene-chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 24px;
  align-items: center;
  padding: 18px clamp(20px, 3vw, 40px);
  background: linear-gradient(to bottom, rgba(5,4,3,0.85), transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.scene-exit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 9px 10px;
  background: rgba(10,9,8,0.55);
  border: 1px solid rgba(196,167,108,0.2);
  border-radius: 999px;
  color: rgba(232,226,214,0.78);
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.scene-exit:hover {
  color: var(--bronze-pale, #c4a76c);
  border-color: var(--bronze-pale, #c4a76c);
  background: rgba(22,17,12,0.75);
}
.scene-chrome-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
  overflow: hidden;
}
.scene-chrome-roman {
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: 22px;
  color: var(--bronze-pale, #c4a76c);
  letter-spacing: -0.01em;
}
.scene-chrome-name {
  font-family: var(--font-display, serif);
  font-weight: 300;
  font-size: clamp(16px, 1.6vw, 22px);
  color: var(--warm-white, #f6f2ec);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scene-chrome-progress {
  height: 1px;
  background: rgba(196,167,108,0.15);
  min-width: 120px;
  max-width: 320px;
  position: relative;
  justify-self: end;
  align-self: center;
  width: 200px;
}
.scene-chrome-progress-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  background: var(--bronze-pale, #c4a76c);
  transition: width 0.2s linear;
}
.scene-chrome-counter {
  font-family: var(--font-sc, serif);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: rgba(232,226,214,0.55);
  min-width: 70px;
  text-align: right;
}
@media (max-width: 720px) {
  .scene-chrome { grid-template-columns: auto 1fr auto; gap: 14px; }
  .scene-chrome-progress { display: none; }
}

/* ── Reel ──────────────────────────────────────────────────────────────── */
.scene-reel {
  position: relative;
  z-index: 10;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.scene-reel::-webkit-scrollbar { display: none; }

.scene-plate {
  position: relative;
  height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 90px clamp(20px, 5vw, 80px) 60px;
  overflow: hidden;
}
.scene-plate-frame {
  position: relative;
  max-width: min(1280px, 100%);
  max-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(20px) scale(0.98);
  opacity: 0;
  transition: opacity 0.9s var(--ease-out, cubic-bezier(0.16,1,0.3,1)),
              transform 1.1s var(--ease-out, cubic-bezier(0.16,1,0.3,1));
}
.scene-plate.is-visible .scene-plate-frame {
  opacity: 1;
  transform: none;
}
.scene-plate-frame img {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  object-fit: contain;
  box-shadow: 0 60px 140px -30px rgba(0,0,0,0.8), 0 0 120px -40px rgba(196,167,108,0.12);
}
.scene-plate-index {
  position: absolute;
  left: clamp(20px, 4vw, 60px);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: clamp(60px, 9vw, 140px);
  line-height: 1;
  color: rgba(196,167,108,0.08);
  letter-spacing: -0.03em;
  pointer-events: none;
  user-select: none;
}
@media (max-width: 900px) { .scene-plate-index { display: none; } }

.scene-plate-caption {
  position: absolute;
  bottom: clamp(18px, 3vh, 40px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 80vw;
  text-align: center;
  opacity: 0;
  transition: opacity 1s ease 0.3s;
}
.scene-plate.is-visible .scene-plate-caption { opacity: 1; }
.scene-plate-caption-roman {
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: rgba(196,167,108,0.68);
}
.scene-plate-caption-text {
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: 15px;
  color: rgba(232,226,214,0.72);
  max-width: 56ch;
  line-height: 1.5;
}

/* Opening & closing plates (title card + coda) */
.scene-plate--opening,
.scene-plate--coda {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 90px clamp(24px, 6vw, 80px) 60px;
}
.scene-plate-eyebrow {
  font-family: var(--font-sc, serif);
  font-size: 10px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--bronze-pale, #c4a76c);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s var(--ease-out, cubic-bezier(0.16,1,0.3,1)), transform 0.9s var(--ease-out, cubic-bezier(0.16,1,0.3,1));
}
.scene-plate.is-visible .scene-plate-eyebrow { opacity: 1; transform: none; }

.scene-plate-heading {
  font-family: var(--font-display, serif);
  font-weight: 300;
  font-size: clamp(40px, 6.5vw, 96px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--warm-white, #f6f2ec);
  max-width: 18ch;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1.1s var(--ease-out, cubic-bezier(0.16,1,0.3,1)) 0.15s,
              transform 1.1s var(--ease-out, cubic-bezier(0.16,1,0.3,1)) 0.15s;
}
.scene-plate.is-visible .scene-plate-heading { opacity: 1; transform: none; }
.scene-plate-heading em { font-style: italic; color: var(--bronze-pale, #c4a76c); font-weight: 400; }

.scene-plate-lede {
  font-family: var(--font-display, serif);
  font-style: italic;
  font-size: clamp(15px, 1.3vw, 19px);
  line-height: 1.7;
  color: rgba(232,226,214,0.68);
  max-width: 54ch;
  margin-top: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s var(--ease-out, cubic-bezier(0.16,1,0.3,1)) 0.4s,
              transform 0.9s var(--ease-out, cubic-bezier(0.16,1,0.3,1)) 0.4s;
}
.scene-plate.is-visible .scene-plate-lede { opacity: 1; transform: none; }

.scene-plate-rule {
  width: 42px; height: 1px;
  background: var(--bronze-pale, #c4a76c);
  opacity: 0.55;
  margin-top: 18px;
}

.scene-hint {
  position: absolute;
  bottom: clamp(14px, 2vh, 26px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sc, serif);
  font-size: 9px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: rgba(232,226,214,0.4);
  opacity: 0;
  animation: sceneHint 2s ease 1.2s forwards;
}
@keyframes sceneHint {
  to { opacity: 1; }
}
.scene-hint-arrow {
  width: 1px; height: 28px;
  background: rgba(196,167,108,0.5);
  animation: sceneHintPulse 2s ease-in-out infinite;
}
@keyframes sceneHintPulse {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50%      { transform: translateY(6px); opacity: 1; }
}

/* ── Side nav buttons ──────────────────────────────────────────────────── */
.scene-nav {
  position: fixed;
  right: clamp(14px, 2vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}
.scene-nav-btn {
  width: 42px; height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,9,8,0.55);
  border: 1px solid rgba(196,167,108,0.2);
  border-radius: 999px;
  color: rgba(232,226,214,0.78);
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.scene-nav-btn:hover {
  color: var(--bronze-pale, #c4a76c);
  border-color: var(--bronze-pale, #c4a76c);
  background: rgba(22,17,12,0.75);
}
@media (max-width: 540px) {
  .scene-nav { right: 8px; }
  .scene-nav-btn { width: 38px; height: 38px; }
}

/* detail-cta ghost variant */
.detail-cta-ghost {
  background: transparent;
  border: 1px solid rgba(196,167,108,0.25);
  color: rgba(232,226,214,0.78);
}
.detail-cta-ghost:hover {
  border-color: var(--bronze-pale, #c4a76c);
  color: var(--bronze-pale, #c4a76c);
}

/* Reduced motion for scene */
@media (prefers-reduced-motion: reduce) {
  .scene-atmos-mesh { animation: none !important; }
  .scene-plate-frame,
  .scene-plate-eyebrow,
  .scene-plate-heading,
  .scene-plate-lede,
  .scene-plate-caption { transition: opacity 0.25s ease !important; transform: none !important; }
  .scene-reel { scroll-behavior: auto; }
  .scene-hint { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BACK BUTTON — hidden on desktop, revealed on mobile
═══════════════════════════════════════════════════════════════════════════ */
.cin-back-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  font-family: var(--font-sc, 'Cormorant SC', serif);
  font-size: 9px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(232, 226, 214, 0.70);
  background: rgba(10, 8, 6, 0.50);
  border: 1px solid rgba(196, 167, 108, 0.18);
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: auto;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
  flex-shrink: 0;
}
.cin-back-btn:hover {
  color: var(--bronze-pale, #c4a76c);
  border-color: rgba(196, 167, 108, 0.50);
  background: rgba(22, 17, 12, 0.72);
}
.cin-back-btn svg { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — ≤ 768px
   Covers: chrome, back btn, index bottom-sheet, detail overlay, scene reel.
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Back button ─────────────────────────────────────────────────────── */
  .cin-back-btn { display: inline-flex; }

  /* ── Chrome: back btn + title only (brand hidden to save space) ──────── */
  .atlas-chrome {
    grid-template-columns: auto 1fr !important;
    padding: 12px 16px !important;
    gap: 12px !important;
  }
  .chrome-mark  { display: none !important; }  /* back btn handles navigation */
  .chrome-title { justify-self: start; text-align: left; }
  .chrome-eyebrow { font-size: 8px; }
  .chrome-label   { font-size: 13px; }

  /* ── Onboarding hint ──────────────────────────────────────────────────── */
  .atlas-hint {
    bottom: 100px;
    padding: 10px 16px;
    gap: 12px;
    max-width: calc(100vw - 32px);
  }
  .hint-text { font-size: 13px; }

  /* ── Index: convert from top-right popover to bottom-sheet ───────────── */
  .atlas-index {
    top: auto !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    border-radius: 14px 14px 0 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-top: 1px solid rgba(196, 167, 108, 0.16) !important;
    /* Override desktop translateY(10px) entry animation */
    transform: none !important;
    padding-bottom: max(0px, env(safe-area-inset-bottom, 0)) !important;
    /* Pull handle */
    position: fixed !important;
  }
  .atlas-index.is-visible { opacity: 1 !important; transform: none !important; }

  /* Add a visual drag handle to the index bottom sheet */
  .atlas-index::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: rgba(196, 167, 108, 0.22);
    border-radius: 2px;
    margin: 12px auto 0;
  }

  .index-toggle {
    padding: 14px 20px;
    font-size: 10px;
    min-height: 52px;
  }
  .atlas-index[data-open="true"] .index-list {
    max-height: 55vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y;
  }
  .index-item {
    min-height: 50px;
    padding: 13px 20px;
  }
  .ix-title { font-size: 16px; }

  /* ── Detail overlay: full-screen scrollable ──────────────────────────── */
  .atlas-detail {
    grid-template-rows: 1fr auto !important;
  }
  .detail-close {
    top: 14px !important;
    left: 14px !important;
    padding: 7px 12px !important;
    font-size: 8px !important;
    gap: 8px !important;
    min-height: 36px;
  }
  .detail-inner {
    grid-template-columns: 1fr !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 68px 18px 24px !important;
    gap: 20px !important;
    align-items: start !important;
    /* Don't animate translateY on mobile — can interfere with scroll */
    transform: none !important;
  }
  .atlas-detail.is-open .detail-inner { transform: none !important; }

  /* Image frame: 16/9 on phones to conserve vertical space */
  .detail-stage-frame { aspect-ratio: 16 / 9 !important; }
  .detail-caption { font-size: 8px !important; }

  /* Text column */
  .detail-text { max-width: 100% !important; }
  .detail-text-top {
    gap: 12px !important;
    margin-bottom: 16px !important;
    padding-bottom: 16px !important;
  }
  .detail-index { font-size: clamp(32px, 10vw, 52px) !important; line-height: 1 !important; }
  .detail-eyebrow { font-size: 9px !important; }
  .detail-title { font-size: clamp(1.25rem, 5.5vw, 1.8rem) !important; }
  .detail-lede { font-size: 14px !important; line-height: 1.6 !important; margin-bottom: 16px !important; }
  .detail-meta {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px 16px !important;
    margin-bottom: 16px !important;
    padding-bottom: 16px !important;
  }
  .detail-meta dt { font-size: 8px !important; }
  .detail-meta dd { font-size: 14px !important; }

  /* Actions: wrap onto two lines, full-width CTAs */
  .detail-actions {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  .detail-cta {
    flex: 1 1 auto !important;
    justify-content: center !important;
    min-height: 48px !important;
    padding: 12px 16px !important;
    font-size: 9px !important;
  }
  .detail-prev,
  .detail-next {
    flex: 0 0 48px !important;
    width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
  }

  /* Strip */
  .detail-strip { padding: 12px 16px 14px !important; }
  .strip-thumb  { width: 90px !important; height: 62px !important; }

  /* ── Scene chrome ────────────────────────────────────────────────────── */
  .scene-chrome {
    padding: 12px 14px !important;
    padding-top: max(12px, env(safe-area-inset-top, 12px)) !important;
    gap: 10px !important;
  }
  .scene-exit {
    padding: 7px 12px !important;
    font-size: 8px !important;
    gap: 8px !important;
    min-height: 36px;
  }
  .scene-chrome-name { font-size: 14px !important; }
  .scene-chrome-counter { font-size: 9px !important; min-width: 50px !important; }

  /* ── Scene plates ────────────────────────────────────────────────────── */
  .scene-plate {
    padding: 68px 14px 46px !important;
  }
  .scene-plate--opening,
  .scene-plate--coda {
    padding: 80px 22px 50px !important;
    gap: 10px !important;
  }
  .scene-plate-heading { font-size: clamp(26px, 8vw, 50px) !important; }
  .scene-plate-lede    { font-size: 14px !important; max-width: 36ch !important; }
  .scene-plate-frame img {
    box-shadow: 0 20px 60px -20px rgba(0,0,0,0.8) !important;
  }

  /* ── Scene nav: move to bottom-centre for one-thumb reach ───────────── */
  .scene-nav {
    right: auto !important;
    left: 50% !important;
    top: auto !important;
    bottom: max(16px, env(safe-area-inset-bottom, 16px)) !important;
    transform: translateX(-50%) !important;
    flex-direction: row !important;
    gap: 20px !important;
    background: rgba(10, 9, 8, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px 12px;
    border: 1px solid rgba(196, 167, 108, 0.16);
    border-radius: 999px;
  }
  .scene-nav-btn { width: 44px !important; height: 44px !important; border: none !important; background: none !important; }

  /* ── Node cards: smaller on phones ──────────────────────────────────── */
  .node[data-scale="xl"] { --node-w: 200px; }
  .node[data-scale="l"]  { --node-w: 170px; }
  .node[data-scale="m"]  { --node-w: 145px; }
  .node[data-scale="s"]  { --node-w: 120px; }

  /* ── Badge: disable on touch (no hover) ─────────────────────────────── */
  .node-badge { display: none; }
  /* Show badge only when node is focused */
  .node.is-focus .node-badge { display: inline-flex; opacity: 1; transform: none; }
}

/* ≤ 480px — very compact phones ────────────────────────────────────────── */
@media (max-width: 480px) {
  .chrome-label   { display: none; }          /* only keep eyebrow "The Folio" */
  .chrome-eyebrow { font-size: 9px; letter-spacing: 0.28em; }

  .atlas-hint { padding: 8px 14px; gap: 10px; }
  .hint-text  { font-size: 12px; }

  .detail-inner { padding: 60px 14px 18px !important; }
  .detail-stage-frame { aspect-ratio: 4 / 3 !important; } /* portrait OK since inner scrolls */
  .detail-lede { display: none; }              /* hidden to save space, meta still shows */

  .scene-plate { padding: 62px 10px 44px !important; }
  .scene-chrome-name { display: none; }        /* roman numeral alone is enough */

  /* Very small nodes */
  .node[data-scale="xl"] { --node-w: 170px; }
  .node[data-scale="l"]  { --node-w: 145px; }
  .node[data-scale="m"]  { --node-w: 118px; }
  .node[data-scale="s"]  { --node-w: 100px; }
}

