/* ═══════════════════════════════════════════════════════════════════════════
   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;
  display: inline-flex;
  align-items: center;
}
.chrome-mark:hover { color: var(--bronze-pale, #c4a76c); }
.chrome-mark img {
  height: 60px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.82;
  margin: -10px 0;
  transition: opacity 0.3s;
}
.chrome-mark:hover img { opacity: 1; }

.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;
  min-width: 0;
}
.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;
  min-width: 0;
}
.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;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.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);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 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; }

/* Desktop: the pill button + collapsible panel live in one block.
   .index-head and .index-close are hidden on desktop (toggle handles collapse).
   On mobile they become the drawer header with a visible close control. */
.index-head { display: none; }
.index-close { display: none; }
.index-panel { display: contents; }

.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; }

  /* ── Mobile index drawer ────────────────────────────────────────────
     The .atlas-index wrapper becomes a right-edge slide-in drawer.
     The .index-toggle remains a floating pill (open button) when closed.
     The .index-panel holds the full-height drawer content with a header
     and a dedicated close button so users can always dismiss it.
  ──────────────────────────────────────────────────────────────────── */
  .atlas-index {
    top: 0;
    right: 0;
    bottom: 0;
    width: 100vw;            /* full viewport; drawer panel is an inner child */
    height: 100dvh;
    background: transparent; /* drawer panel paints its own bg */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
    pointer-events: none;    /* let through to map until opened */
    transition: opacity 0.4s var(--ease-out, ease);
  }
  .atlas-index.is-visible { opacity: 1; transform: none; }

  /* Floating pill toggle (the "open index" button on mobile) */
  .index-toggle {
    position: absolute;
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    right: 12px;
    width: auto;
    min-height: 44px;
    padding: 12px 18px;
    grid-template-columns: auto auto;
    gap: 10px;
    background: rgba(10, 8, 6, 0.86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(196, 167, 108, 0.22);
    border-radius: 999px;
    pointer-events: auto;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  .index-toggle .index-count,
  .index-toggle .index-chev { display: none; }

  /* Hide the pill once the drawer is open — user closes via X or backdrop */
  .atlas-index[data-open="true"] .index-toggle {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
  }

  /* The slide-in panel itself */
  .index-panel {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 360px);
    max-width: 100vw;
    background: rgba(8, 7, 6, 0.97);
    backdrop-filter: blur(18px) saturate(1.1);
    -webkit-backdrop-filter: blur(18px) saturate(1.1);
    border-left: 1px solid rgba(196, 167, 108, 0.18);
    box-shadow: -16px 0 48px rgba(0, 0, 0, 0.6);
    transform: translateX(100%);
    transition: transform 0.36s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .atlas-index[data-open="true"] .index-panel {
    transform: translateX(0);
  }

  /* Drawer header with close button */
  .index-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(196, 167, 108, 0.12);
  }
  .index-head-title {
    font-family: var(--font-sc, serif);
    font-size: 10px;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: var(--bronze-pale, #c4a76c);
  }
  .index-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    background: transparent;
    border: 0;
    color: rgba(232, 226, 214, 0.78);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.25s ease, color 0.25s ease;
  }
  .index-close:hover,
  .index-close:focus-visible {
    background: rgba(196, 167, 108, 0.12);
    color: var(--bronze-pale, #c4a76c);
    outline: 0;
  }

  /* List fills the panel and scrolls */
  .index-list {
    flex: 1 1 auto;
    max-height: none !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-top: 0;
    padding-bottom: 24px;
  }
  .atlas-index[data-open="true"] .index-list {
    max-height: none !important;
  }
  .atlas-index[data-open="false"] .index-list {
    /* Still rendered but hidden inside the translated panel —
       we keep it visible in the flex flow so the drawer has content ready */
    max-height: none !important;
  }

  .index-item {
    min-height: 56px;           /* comfortable touch target */
    padding: 14px 20px;
    font-size: 15px;
  }
  .ix-title { font-size: 17px; }

  /* Backdrop: visible and tappable only when drawer is open */
  .atlas-index-backdrop {
    position: fixed;
    inset: 0;
    z-index: 270;
    background: rgba(5, 4, 3, 0.55);
    border: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.32s ease;
    cursor: pointer;
  }
  .atlas-index-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  /* detail-inner: single column, top padding for back button */
  .detail-inner {
    padding-top: 72px;
    padding-bottom: 80px;
  }
}

/* Desktop: backdrop element never interferes */
@media (min-width: 721px) {
  .atlas-index-backdrop { 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: 2200;
  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.1);
  background: rgba(10, 8, 6, 0.18);
  color: rgba(232,226,214,0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: color 0.3s ease, border-color 0.3s ease, background 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);
  background: rgba(10, 8, 6, 0.54);
}
.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 "Archives" */
  .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; }
}


/* ---------------------------------------------------------------------------
   v20 � CINEMATIC LUXURY POLISH LAYER (additive, atlas-preserving)
   - Refined atmosphere (deeper sky, soft bronze bloom on focus)
   - Tightened typography rhythm via clamp()
   - Aggressive mobile/tablet performance trims (blurs, animations, grain)
   - Reduced-motion safety
   --------------------------------------------------------------------------- */

/* -- Loading veil: more editorial entrance ----------------------------- */
.atlas-veil {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(28, 22, 16, 0.85) 0%, rgba(5, 4, 3, 0.96) 70%);
}
.veil-mark::before {
  content: '';
  display: block;
  width: 1px;
  height: clamp(34px, 6vh, 56px);
  margin: 0 auto 14px;
  background: linear-gradient(to bottom, transparent, rgba(196, 167, 108, 0.55));
}
.veil-eyebrow { font-size: clamp(9px, 0.85vw, 11px); }
.veil-title  { font-size: clamp(18px, 2vw, 24px); }
.veil-bar    { width: clamp(160px, 22vw, 240px); }

/* -- Sky: layered radial light � softer, warmer focal point ------------ */
.sky-vignette {
  background:
    radial-gradient(ellipse 70% 60% at 50% 35%, transparent 0%, rgba(5, 4, 3, 0.35) 50%, rgba(5, 4, 3, 0.86) 100%);
}

/* -- Node cards: refined shadow + bronze bloom on focus ---------------- */
.node-card {
  border-radius: 1px;
}
.node-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(196, 167, 108, 0);
  transition: border-color 0.6s ease, inset 0.6s var(--ease-out, ease);
}
.node.is-focus .node-card::after {
  inset: -10px;
  border-color: rgba(196, 167, 108, 0.18);
}

/* Slight ambient glow inside hovered/focused image well */
.node-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(196,167,108,0.0) 0%, rgba(196,167,108,0.0) 70%);
  pointer-events: none;
  transition: background 0.6s ease;
  z-index: 1;
}
.node-card:hover .node-image::before,
.node.is-focus .node-image::before {
  background: radial-gradient(ellipse at 50% 25%, rgba(196,167,108,0.10) 0%, transparent 65%);
}

/* -- Detail caption + meta polish -------------------------------------- */
.detail-caption {
  font-style: italic;
  font-family: var(--font-display, serif);
  letter-spacing: 0.06em;
  text-transform: none;
  font-size: clamp(12px, 1vw, 14px);
  color: rgba(196, 167, 108, 0.82);
}

/* -- Scene plate: softer bronze bloom around the framed image ---------- */
.scene-plate-frame::before {
  content: '';
  position: absolute;
  inset: -8%;
  background: radial-gradient(ellipse at 50% 50%, rgba(196, 167, 108, 0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.scene-plate.is-visible .scene-plate-frame::before { opacity: 1; }

/* -----------------------------------------------------------------------
   PERFORMANCE TIER � Tablet & below
   Trim heavy blurs/animations to keep 60fps on mid-range devices.
   ----------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .atlas-parallax-far,
  .atlas-parallax-mid { display: none; }   /* only marginal visual impact, big perf win */
  .sky-mesh { animation-duration: 60s; }
  .sky-grain { opacity: 0.3; }
  .node-card { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
  .atlas-detail { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
}

@media (max-width: 768px) {
  /* Kill the slow background drift on phones � costly compositor work */
  .sky-mesh { animation: none; transform: scale(1.04) translate3d(0.5%, -0.5%, 0); }
  .scene-atmos-mesh { animation: none; transform: scale(1.04); }
  .sky-stars { display: none; }            /* no twinkles on phones */
  .sky-grain { opacity: 0.22; }
  .node-card { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .atlas-index { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  /* Soften shadow stack so paint cost is lower */
  .node-card:hover,
  .node.is-focus .node-card {
    box-shadow:
      0 22px 50px -28px rgba(0,0,0,0.85),
      0 0 60px -22px rgba(196,167,108,0.22);
  }
  .scene-plate-frame img {
    box-shadow: 0 18px 44px -18px rgba(0,0,0,0.75) !important;
  }
}

@media (max-width: 480px) {
  /* Last-mile trims on the smallest devices */
  .sky-grain { display: none; }
  .scene-atmos-grain { display: none; }
  .node-image { aspect-ratio: 3 / 4; }     /* slightly less tall on tiny screens */
}

/* No horizontal overflow guard � cheap and defensive */
html, body, .atlas, .atlas-stage { max-width: 100vw; }

/* -----------------------------------------------------------------------
   REDUCED MOTION � comprehensive
   ----------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sky-mesh,
  .scene-atmos-mesh,
  .sky-stars span,
  .hint-line,
  .scene-hint-arrow,
  .scene-hint { animation: none !important; }
  .atlas-world,
  .atlas-parallax-far,
  .atlas-parallax-mid {
    transition: none !important;
  }
  .scene-reel { scroll-behavior: auto !important; }
  .detail-stage-frame img { transform: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAPTER LEDGER — single authoritative atlas-index design (v21)
   Replaces all earlier .atlas-index / .index-* rules at every breakpoint.
   Two states only: collapsed pill (always visible top-right) and an
   expanded glass panel that adapts: side-popover on desktop, full
   bottom-sheet with drag handle on touch / small viewports.
   Higher specificity (body prefix) ensures this layer wins the cascade.
═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset every prior side-effect ─────────────────────────────────────── */
body .atlas-index,
body .atlas-index .index-toggle,
body .atlas-index .index-panel,
body .atlas-index .index-list,
body .atlas-index .index-item {
  all: unset;
  box-sizing: border-box;
  font-family: inherit;
}

/* ── 1. Container ─────────────────────────────────────────────────────── */
body .atlas-index {
  position: fixed;
  top: calc(var(--nav-height, 76px) + 14px);
  right: clamp(16px, 2.4vw, 28px);
  z-index: 70;
  display: block;
  pointer-events: none;       /* let toggle/panel opt back in */
  font-family: var(--font-sc, 'Cormorant SC', serif);
  color: var(--warm-white, #f6f2ec);
  isolation: isolate;
}

/* ── 2. Toggle pill — always visible, classy ──────────────────────────── */
body .atlas-index .index-toggle {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 14px;
  background: linear-gradient(
    180deg,
    rgba(28, 22, 16, 0.78),
    rgba(20, 16, 12, 0.82)
  );
  border: 1px solid rgba(196, 167, 108, 0.32);
  border-radius: 999px;
  color: var(--warm-white);
  font-family: var(--font-sc);
  font-size: 10.5px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 10px 32px -16px rgba(0, 0, 0, 0.7);
  transition: transform 0.35s var(--ease-out, cubic-bezier(.22,1,.36,1)),
              border-color 0.3s ease,
              background 0.3s ease,
              box-shadow 0.3s ease;
}
body .atlas-index .index-toggle:hover {
  border-color: rgba(196, 167, 108, 0.6);
  background: linear-gradient(180deg, rgba(38, 30, 20, 0.85), rgba(26, 20, 14, 0.9));
  transform: translateY(-1px);
}
body .atlas-index .index-toggle:focus-visible {
  outline: none;
  border-color: var(--bronze-pale, #c4a76c);
  box-shadow: 0 0 0 3px rgba(196, 167, 108, 0.22);
}

/* Index dot pulses softly to invite */
body .atlas-index .index-toggle .index-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--bronze-pale, #c4a76c);
  box-shadow: 0 0 0 0 rgba(196, 167, 108, 0.55);
  animation: idx-pulse 2.6s ease-in-out infinite;
}
@keyframes idx-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 167, 108, 0.45); }
  50%      { box-shadow: 0 0 0 7px rgba(196, 167, 108, 0); }
}

body .atlas-index .index-toggle .index-label {
  font-weight: 500;
}
body .atlas-index .index-toggle .index-count {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid rgba(196, 167, 108, 0.28);
  color: var(--bronze-pale, #c4a76c);
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: none;
}
body .atlas-index .index-toggle .index-chev {
  width: 11px; height: 11px;
  margin-left: 2px;
  opacity: 0.7;
  transition: transform 0.4s var(--ease-out), opacity 0.3s ease;
}
body .atlas-index[data-open="true"] .index-toggle .index-chev {
  transform: rotate(180deg);
  opacity: 1;
}
body .atlas-index[data-open="true"] .index-toggle {
  border-color: rgba(196, 167, 108, 0.55);
  background: linear-gradient(180deg, rgba(40, 32, 22, 0.92), rgba(26, 20, 14, 0.94));
}

/* ── 3. Panel — desktop popover ───────────────────────────────────────── */
body .atlas-index .index-panel {
  pointer-events: auto;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: clamp(280px, 22vw, 320px);
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(
    180deg,
    rgba(22, 17, 12, 0.92),
    rgba(16, 12, 9, 0.95)
  );
  border: 1px solid rgba(196, 167, 108, 0.22);
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(125%);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 28px 60px -24px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(-8px) scale(0.985);
  transform-origin: top right;
  visibility: hidden;
  transition:
    opacity 0.32s var(--ease-out, cubic-bezier(.22,1,.36,1)),
    transform 0.42s var(--ease-out, cubic-bezier(.22,1,.36,1)),
    visibility 0s linear 0.42s;
}
body .atlas-index[data-open="true"] .index-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  transition:
    opacity 0.32s var(--ease-out, cubic-bezier(.22,1,.36,1)),
    transform 0.42s var(--ease-out, cubic-bezier(.22,1,.36,1)),
    visibility 0s linear 0s;
}

/* Panel header */
body .atlas-index .index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(196, 167, 108, 0.16);
  flex: 0 0 auto;
}
body .atlas-index .index-head-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sc);
  font-size: 9.5px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--bronze-pale, #c4a76c);
}
body .atlas-index .index-head-eyebrow::before {
  content: '';
  width: 18px; height: 1px;
  background: rgba(196, 167, 108, 0.5);
}
body .atlas-index .index-head-title {
  display: block;
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-style: italic;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--warm-white);
  margin-top: 4px;
}
body .atlas-index .index-head-titles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
body .atlas-index .index-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(196, 167, 108, 0.22);
  background: rgba(255, 255, 255, 0.02);
  color: var(--warm-white);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
body .atlas-index .index-close:hover {
  background: rgba(196, 167, 108, 0.12);
  border-color: rgba(196, 167, 108, 0.55);
  transform: rotate(90deg);
}

/* ── 4. List ──────────────────────────────────────────────────────────── */
body .atlas-index .index-list {
  display: flex;
  flex-direction: column;
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  flex: 1 1 auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 167, 108, 0.4) transparent;
}
body .atlas-index .index-list::-webkit-scrollbar { width: 6px; }
body .atlas-index .index-list::-webkit-scrollbar-track { background: transparent; }
body .atlas-index .index-list::-webkit-scrollbar-thumb {
  background: rgba(196, 167, 108, 0.32);
  border-radius: 3px;
}

/* ── 5. Item ──────────────────────────────────────────────────────────── */
body .atlas-index .index-item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 12px 18px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition:
    background 0.22s ease,
    border-color 0.22s ease,
    padding 0.22s var(--ease-out);
  position: relative;
}
body .atlas-index .index-item + .index-item {
  box-shadow: inset 0 1px 0 rgba(196, 167, 108, 0.08);
}
body .atlas-index .index-item:hover {
  background: rgba(196, 167, 108, 0.07);
  padding-left: 22px;
}
body .atlas-index .index-item.is-active {
  background: linear-gradient(
    90deg,
    rgba(196, 167, 108, 0.14),
    rgba(196, 167, 108, 0) 70%
  );
  border-left-color: var(--bronze-pale, #c4a76c);
}

body .atlas-index .index-item .ix-roman {
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-style: italic;
  font-size: 17px;
  color: var(--bronze-pale, #c4a76c);
  letter-spacing: 0.02em;
  opacity: 0.85;
  text-align: left;
}
body .atlas-index .index-item.is-active .ix-roman {
  opacity: 1;
}
body .atlas-index .index-item .ix-title {
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.25;
  color: var(--warm-white);
  letter-spacing: 0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body .atlas-index .index-item .ix-count-num {
  font-family: var(--font-sc);
  font-size: 9.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(246, 242, 236, 0.45);
  align-self: center;
  justify-self: end;
  white-space: nowrap;
}
body .atlas-index .index-item.is-active .ix-count-num {
  color: var(--bronze-pale, #c4a76c);
}

/* ── 6. Backdrop — only meaningful on touch / small screens ───────────── */
body .atlas-index-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(8, 6, 4, 0.55);
  backdrop-filter: blur(6px) saturate(110%);
  -webkit-backdrop-filter: blur(6px) saturate(110%);
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s ease, visibility 0s linear 0.32s;
}
body .atlas-index-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.32s ease, visibility 0s linear 0s;
}

/* ── 7. Touch / tablet / mobile — bottom sheet ────────────────────────── */
@media (max-width: 768px), (pointer: coarse) and (max-width: 1024px) {
  body .atlas-index {
    top: auto;
    bottom: clamp(14px, 3vw, 22px);
    right: clamp(14px, 3vw, 22px);
    left: auto;
  }
  body .atlas-index .index-toggle {
    padding: 11px 16px;
    font-size: 10px;
    letter-spacing: 0.3em;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.05) inset,
      0 14px 38px -10px rgba(0, 0, 0, 0.75);
  }

  /* Panel becomes a bottom sheet: full-width, anchored to viewport */
  body .atlas-index .index-panel {
    position: fixed;
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 78vh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    transform: translateY(100%);
    transform-origin: bottom center;
    box-shadow:
      0 -1px 0 rgba(255, 255, 255, 0.04) inset,
      0 -22px 60px -10px rgba(0, 0, 0, 0.7);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  body .atlas-index[data-open="true"] .index-panel {
    transform: translateY(0);
  }

  /* Drag-handle pull tab */
  body .atlas-index .index-panel::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: rgba(196, 167, 108, 0.4);
    pointer-events: none;
  }

  body .atlas-index .index-head {
    padding: 22px 22px 14px;
  }
  body .atlas-index .index-head-title { font-size: 20px; }
  body .atlas-index .index-close {
    width: 36px; height: 36px;
    font-size: 18px;
  }

  body .atlas-index .index-list {
    padding: 6px 0 14px;
  }
  body .atlas-index .index-item {
    padding: 16px 22px;
    grid-template-columns: 42px 1fr auto;
  }
  body .atlas-index .index-item:hover {
    padding-left: 22px; /* no shift on touch */
  }
  body .atlas-index .index-item .ix-roman { font-size: 19px; }
  body .atlas-index .index-item .ix-title { font-size: 17px; white-space: normal; }
}

/* ── 8. Very small screens — tighten ──────────────────────────────────── */
@media (max-width: 420px) {
  body .atlas-index {
    bottom: 12px;
    right: 12px;
  }
  body .atlas-index .index-toggle {
    padding: 10px 14px;
    gap: 8px;
    font-size: 9.5px;
    letter-spacing: 0.26em;
  }
  body .atlas-index .index-toggle .index-count { padding-left: 8px; font-size: 12px; }
  body .atlas-index .index-panel { max-height: 82vh; }
  body .atlas-index .index-head { padding: 20px 18px 12px; }
  body .atlas-index .index-item { padding: 14px 18px; }
}

/* ── 9. Lock body scroll while open on touch ──────────────────────────── */
body.atlas-index-open { overflow: hidden; }

/* Text collision guards for long archive/category names. */
body .atlas-index .index-item,
.detail-text,
.detail-text-top,
.detail-text-top > div,
.scene-chrome-title {
  min-width: 0;
}

body .atlas-index .index-item .ix-title,
.detail-title,
.detail-lede,
.detail-meta dd,
.scene-chrome-name {
  overflow-wrap: anywhere;
  hyphens: auto;
}

body .atlas-index .index-item .ix-title {
  min-width: 0;
}

.detail-actions {
  flex-wrap: wrap;
}

.detail-cta {
  max-width: 100%;
  justify-content: center;
  text-align: center;
}

@media (max-width: 520px) {
  .detail-cta { width: 100%; }
  .scene-chrome {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .scene-exit span { display: none; }
}

/* ── 10. Reduced motion ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  body .atlas-index .index-toggle .index-dot { animation: none; }
  body .atlas-index .index-panel,
  body .atlas-index .index-toggle,
  body .atlas-index .index-item {
    transition: opacity 0.15s linear, visibility 0s linear !important;
    transform: none !important;
  }
}
