/* ============================================================
   MITHRA — Product story: the context stack
   Pinned scroll section. 8 procurement intelligence layers
   assemble into a 3D glass stack while a left accordion
   narrates each step.
   ============================================================ */

.story-stack { background: var(--page); position: relative; }

/* instant reset (no tween) when the section is snapped back to its starting
   position after scrolling out of view, so re-entry never shows a mid-build
   frame animating into place */
.story-stack.ss-snap .ss-slab,
.story-stack.ss-snap .ss-bottom,
.story-stack.ss-snap .ss-face,
.story-stack.ss-snap .ss-frost,
.story-stack.ss-snap .ss-ext,
.story-stack.ss-snap .ss-tab,
.story-stack.ss-snap .ss-tab-body { transition: none !important; }

/* The scroll runway — its height defines the scrub length. */
.ss-runway { --steps: 8; height: calc(100vh + var(--steps) * 72vh); position: relative; }

.ss-pin {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  display: flex; flex-direction: column;
}

/* faint light field behind the stack */
.ss-pin::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(820px 560px at 68% 46%, rgba(11,14,20,.05), transparent 64%),
    radial-gradient(620px 420px at 70% 40%, rgba(255,255,255,.9), transparent 60%);
}

.ss-inner { display: flex; flex-direction: column; height: 100%; }

.ss-head {
  position: relative; z-index: 3;
  padding-top: clamp(84px, 9vh, 120px);
  text-align: left;
}
.ss-head .ss-kicker {
  font-family: var(--font-head); font-weight: 600;
  font-size: clamp(19px, 1.6vw, 24px); color: var(--ink);
  letter-spacing: -.01em; margin-top: 14px; max-width: 560px;
  line-height: 1.25; text-wrap: balance;
}

.ss-grid {
  position: relative; z-index: 2; flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(330px, 400px) 1fr;
  gap: clamp(24px, 4vw, 64px); align-items: center;
}

/* ---------- Left rail: vertical accordion ---------- */
.ss-rail { display: flex; flex-direction: column; gap: 0; align-items: stretch;
  align-self: start; margin-top: clamp(28px, 6vh, 76px);
  position: relative; border-bottom: 1px solid var(--soft-border); }
/* corner dots on the rail frame (right side) */
.ss-rail::before, .ss-rail::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); z-index: 1; }
.ss-rail::before { top: -2.5px; right: -2px; }
.ss-rail::after { bottom: -2.5px; right: -2px; }

.ss-tab {
  display: block; text-align: left; border: 0; border-top: 1px solid var(--soft-border);
  background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none;
  color: var(--ink); border-radius: 0; box-shadow: none;
  padding: 0; max-width: 100%; position: relative;
  transition: color .3s var(--ease);
}
/* left-end dot on every rule */
.ss-tab::before { content: ""; position: absolute; top: -2.5px; left: -2px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); z-index: 1; }
.ss-tab:last-child::after { content: ""; position: absolute; bottom: -2.5px; left: -2px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); z-index: 1; }

.ss-tab-head {
  display: flex; align-items: center; gap: 12px;
  padding: 17px 6px 17px 14px; line-height: 1.1;
}
.ss-tab-num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: auto; height: auto; border: 0; background: none; border-radius: 0;
  font-family: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  color: var(--slate-light);
  transition: color .3s var(--ease);
}
/* layers already assembled read as completed process steps */
.ss-tab.is-done .ss-tab-num { color: var(--slate); }
.ss-tab.is-done .ss-tab-title { color: var(--slate); }
.ss-tab-title { font-family: var(--font-head); font-weight: 600; font-size: 16px; letter-spacing: -.01em; color: var(--ink); }
.ss-tab-plus {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  margin-left: auto; width: 18px; height: 18px; position: relative;
  transition: opacity .25s var(--ease);
}
.ss-tab-plus::before, .ss-tab-plus::after {
  content: ""; position: absolute; background: var(--slate-light); border-radius: 1px;
}
.ss-tab-plus::before { width: 13px; height: 1.5px; }
.ss-tab-plus::after { width: 1.5px; height: 13px; }

.ss-tab-body {
  display: block; height: 0; opacity: 0; overflow: hidden;
  transition: height .55s var(--ease), opacity .4s var(--ease);
}
.ss-tab-body p {
  padding: 0 28px 22px 40px; margin: 0;
  font-size: 14px; line-height: 1.6; color: var(--slate);
  max-width: 360px;
}

.ss-tab:hover .ss-tab-title { color: var(--ink); }
.ss-tab:hover .ss-tab-num { color: var(--slate); }
.ss-tab:hover .ss-tab-plus::before, .ss-tab:hover .ss-tab-plus::after { background: var(--slate); }

.ss-tab.is-active {
  background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none;
  border-color: var(--soft-border); color: var(--ink);
  border-radius: 0; cursor: default;
}
.ss-tab.is-active .ss-tab-head { padding: 17px 6px 9px 14px; }
.ss-tab.is-active .ss-tab-num { color: var(--ink); }
.ss-tab.is-active .ss-tab-plus { opacity: 0; }
.ss-tab.is-active .ss-tab-body { height: 104px; opacity: 1; }

/* ---------- Right: the 3D stack ---------- */
.ss-scene { position: relative; height: 100%; min-height: 480px; }
.ss-stage-wrap {
  position: absolute; inset: 0;
  /* orthographic — no perspective, so the stack reads as a perfectly symmetric isometric object */
}
.ss-stage {
  position: absolute; left: 50%; top: 33%; width: 0; height: 0;
  transform-style: preserve-3d;
  transform: rotateX(60deg) rotateZ(-45deg) scale(var(--ss-scale, 1));
}

/* ground shadow — directional: displaced down-screen, denser at the leading edge */
.ss-ground {
  position: absolute; left: -290px; top: -290px; width: 580px; height: 580px;
  border-radius: 50%; transform: translate3d(-42px, 42px, -46px);
  background: radial-gradient(closest-side at 44% 56%, rgba(11,14,20,.15), rgba(11,14,20,.04) 52%, transparent 68%);
  filter: blur(7px);
}

/* The slab is a real extruded body: the .ss-slab element itself is the BOTTOM
   face (z=0), .ss-ext wall layers (injected by JS) form the rounded sides, and
   .ss-face is the TOP face at z=12px. Orthographic projection makes the result
   a geometrically correct isometric object with visible thickness. */
.ss-slab {
  position: absolute; left: -225px; top: -225px; width: 450px; height: 450px;
  border-radius: 24px; transform-style: preserve-3d;
  /* the slab element is ONLY a 3D container — painting lives on child planes,
     because filter/opacity here would flatten preserve-3d and break the walls */
  transition: transform .9s var(--ease);
  will-change: transform;
}
/* bottom face (z=0) — carries body colour + the cast shadow */
.ss-bottom {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(140deg, rgba(233,231,224,.84), rgba(211,208,200,.72));
  border: 1px solid rgba(11,14,20,.14);
  /* shadow cast straight down on SCREEN: local (-x, +y) offset → screen-down
     under the two lower edges; blur capped so the upper edges stay clean */
  box-shadow: -6px 6px 12px -4px rgba(11,14,20,.07);
  transition: opacity .55s var(--ease), box-shadow .9s var(--ease);
}
/* side walls — per-layer edge colour set by JS; only the two camera-facing
   edges are painted so the slab reads as a solid rounded box */
.ss-ext {
  position: absolute; inset: 0; border-radius: inherit;
  border: 1.6px solid transparent;
  pointer-events: none;
  backface-visibility: hidden;
  transition: opacity .55s var(--ease);
}
/* (glass sheen is baked into the .ss-face background layers) */
.ss-slab.is-active .ss-bottom {
  /* firm soft contact shadow right under the floating slab + wider ambient fall-off */
  box-shadow:
    -10px 10px 16px -6px rgba(11,14,20,.26),
    -30px 30px 50px -16px rgba(11,14,20,.22);
}
/* the evidence layer glows — the stack's neon payoff */
.ss-slab.is-active[data-layer="evidence"] .ss-face {
  background: linear-gradient(140deg, rgba(255,255,255,.98), rgba(238,243,255,.9));
}
.ss-slab.is-active[data-layer="evidence"] .ss-bottom {
  box-shadow:
    0 0 0 1px rgba(15,98,254,.18),
    0 0 70px 6px rgba(15,98,254,.12),
    -4px 4px 7px -3px rgba(11,14,20,.1);
}
/* once the pack has landed flush on the stack (steps 5+), its underside
   shadow shrinks to a faint contact line — a big soft shadow there reads as
   a gap that doesn't exist */
#storyStack[data-step="5"] .ss-slab[data-layer="pack"] .ss-bottom,
#storyStack[data-step="6"] .ss-slab[data-layer="pack"] .ss-bottom,
#storyStack[data-step="7"] .ss-slab[data-layer="pack"] .ss-bottom {
  box-shadow: -4px 4px 7px -3px rgba(11,14,20,.1);
}

/* ---------- Slab face content (top face, z=12) ---------- */
.ss-face {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  /* content rotated 90° in the slab plane so text reads along the other edge */
  transform: translateZ(12px) rotate(90deg);
  background:
    linear-gradient(118deg, rgba(255,255,255,.55) 0%, transparent 34%, transparent 70%, rgba(255,255,255,.35) 100%),
    linear-gradient(140deg, rgba(255,255,255,.86) 0%, rgba(248,247,243,.76) 48%, rgba(240,238,231,.68) 100%);
  border: 1px solid rgba(11,14,20,.12);
  /* even glass edge — no directional shading */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 0 0 1px rgba(255,255,255,.3);
  transition: opacity .55s var(--ease);
}
/* frost veil — stands in for blur on receded layers (set by JS) */
.ss-frost {
  position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(140deg, rgba(248,247,243,.97), rgba(240,238,231,.92));
  opacity: 0; transition: opacity .55s var(--ease);
}
.ss-face svg.wire { position: absolute; inset: 0; width: 100%; height: 100%; }

.ss-label {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  font-family: var(--font-head); font-weight: 600; font-size: 26px;
  letter-spacing: -.015em; color: rgba(11,14,20,.85); white-space: nowrap;
  transition: opacity .5s var(--ease);
}
.ss-slab:not(.is-active) .ss-label { opacity: .08; }

/* generic face chip */
.fc {
  position: absolute; display: inline-flex; align-items: center; gap: 7px;
  font: 500 12.5px/1 var(--font-body); color: var(--ink);
  background: #fff; border: 1px solid var(--soft-border); border-radius: 9px;
  padding: 8px 11px; white-space: nowrap;
  /* face-local (+x,+y) projects straight down on screen after the 90° face
     rotation — all raised elements share this one consistent shadow direction */
  box-shadow: 3px 3px 5px -1px rgba(11,14,20,.13);
}
.fc.bad { border-style: dashed; color: var(--slate); background: rgba(255,255,255,.66); }
.fc.hub { font-weight: 600; border-color: var(--border-strong); padding: 10px 14px; }
.fc .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--really-blue); flex: 0 0 auto; }
.fc .dot.green { background: var(--green); }
.fc .amt { color: var(--slate); font-weight: 400; }
.fc.tagline {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--slate); padding: 6px 9px; border-radius: 7px;
}

/* scribble tangle (messy layer) — contracts + fades once the story moves past
   step 1, as if the chaos is being absorbed for structuring */
.ss-slab[data-layer="messy"] .scribble {
  transform-origin: 50% 50%;
  transition: transform 1.1s var(--ease), opacity 1.1s var(--ease);
}
#storyStack:not([data-step="1"]) .ss-slab[data-layer="messy"] .scribble {
  transform: scale(.5) rotate(22deg);
  opacity: .3;
}
@media (prefers-reduced-motion: reduce) {
  .ss-slab[data-layer="messy"] .scribble { transition-duration: .01s; }
}

/* external signal streams — flow inward while the enrichment layer is active */
.streams path {
  fill: none; stroke: rgba(15,98,254,.42); stroke-width: 1.6;
  stroke-dasharray: 7 9;
}
.ss-slab.is-active .streams path { animation: ssFlow 1.1s linear infinite; }
@keyframes ssFlow { to { stroke-dashoffset: -16; } }
@media (prefers-reduced-motion: reduce) {
  .streams path { animation: none !important; }
}

/* glass tile grid (enrichment layer) — mini frosted tiles like the reference */
.tile-grid {
  position: absolute; inset: 34px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr;
  gap: 13px;
}
.tile {
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 8px 10px; border-radius: 16px;
  font: 600 14px/1.25 var(--font-head); letter-spacing: -.01em;
  color: rgba(11,14,20,.72); text-wrap: balance;
  background: linear-gradient(150deg, rgba(255,255,255,.92), rgba(255,255,255,.5));
  border: 1px solid rgba(11,14,20,.1);
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,.95),
    inset 0 0 0 1px rgba(255,255,255,.4),
    4px 4px 7px -2px rgba(11,14,20,.15);
}
.tile.core {
  color: rgba(11,14,20,.92);
  background: linear-gradient(150deg, rgba(255,255,255,.98), rgba(238,243,255,.8));
  border-color: rgba(15,98,254,.28);
}

/* flat variant (Mithra Benchmarks) — bare hairline squares like the context
   pack rings: no fill at all, just light strokes on the glass */
.tile-grid.flat .tile {
  background: none;
  border: 1px solid rgba(11,14,20,.13);
  border-radius: 10px;
  box-shadow: none;
  color: rgba(11,14,20,.55);
}
.tile-grid.flat .tile.core {
  background: none;
  border-color: rgba(15,98,254,.3);
  color: rgba(11,14,20,.8);
}
/* 2×2 variant — four squares, label lives below the grid */
.tile-grid.two {
  grid-template-columns: repeat(2, 1fr);
  inset: 56px 56px 92px 56px;
}
.tile-grid.two .tile { font-size: 16px; }
/* sharp variant (Evidence-Based Opportunities) — like the enrichment grid but
   hard-edged squares, clearing the bottom title */
.tile-grid.sharp { inset: 44px 44px 88px 44px; }
.tile-grid.sharp .tile { border-radius: 0; font-size: 13px; }
.tile-grid.sharp .tile.core { font-size: 14px; }

/* Animated orb cores — the LIVE agent orbs from the home page, scaled up:
   rotating blurred colour mesh + animated turbulence. The filter lives on a
   DESCENDANT of the face plane (2D subtree), not on a 3D-context child, so it
   cannot trigger the depth-sorting corruption. */
.ring.core.orb-core {
  border-radius: 50%; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(70% 76% at 30% 28%, var(--c1) 0%, var(--c1) 28%, transparent 74%),
    radial-gradient(74% 80% at 72% 26%, var(--c4) 0%, var(--c4) 28%, transparent 76%),
    radial-gradient(82% 88% at 70% 74%, var(--c3) 0%, var(--c3) 32%, transparent 78%),
    radial-gradient(72% 78% at 28% 73%, var(--c5) 0%, var(--c5) 28%, transparent 76%),
    radial-gradient(110% 110% at 50% 50%, var(--c2) 0%, var(--c3) 100%);
  box-shadow: 0 0 0 1px rgba(11,14,20,.06), var(--core-glow, 0 0 46px 6px rgba(123,192,180,.3));
}
.ring.core.orb-core::before {
  content: ""; position: absolute; inset: -28%; border-radius: 50%;
  background:
    radial-gradient(46% 46% at 32% 30%, var(--c1) 0%, var(--c1) 32%, transparent 72%),
    radial-gradient(48% 48% at 70% 28%, var(--c4) 0%, var(--c4) 32%, transparent 74%),
    radial-gradient(54% 54% at 68% 72%, var(--c3) 0%, var(--c3) 36%, transparent 76%),
    radial-gradient(46% 46% at 30% 72%, var(--c5) 0%, var(--c5) 32%, transparent 74%),
    radial-gradient(44% 44% at 50% 50%, var(--c2) 0%, transparent 68%);
  filter: blur(6px) saturate(1.32) var(--ink, url(#orbInk8));
  animation: ssOrbSwirl var(--swirl, 24s) linear infinite;
  animation-direction: var(--swirl-dir, normal);
}
.ring.core.orb-core::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
@keyframes ssOrbSwirl { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ring.core.orb-core::before { animation: none; }
}
/* Atlas palette (home page .orb-atlas) — data harmonization engine */
.ring.core.atlas-core {
  --c1: #e0a187; --c2: #7bc0b4; --c3: #7db4e6; --c4: #e0c479; --c5: #c2e6de;
  --ink: url(#orbInk8);
  --core-glow: 0 0 46px 6px rgba(123,192,180,.3);
}
/* Pulse palette (home page .orb-pulse) — opportunity discovery agents */
.ring.core.pulse-core {
  --c1: #6f7a32; --c2: #a8702a; --c3: #8f3f34; --c4: #3f4f86; --c5: #b388ad;
  --ink: url(#orbInk9);
  --swirl-dir: reverse;
  --core-glow: 0 0 46px 6px rgba(168,112,42,.26);
}

/* classification lanes */
.lane {
  position: absolute; width: 108px; top: 64px; bottom: 64px;
  border: 1px solid var(--soft-border); border-radius: 12px;
  background: rgba(255,255,255,.55);
  box-shadow: 3px 3px 5px -1px rgba(11,14,20,.1);
}
.lane b {
  display: block; font: 600 11px/1 var(--font-body); letter-spacing: .05em;
  text-transform: uppercase; color: var(--slate); padding: 10px 10px 6px;
}
.lane i {
  display: block; height: 9px; margin: 6px 10px; border-radius: 4px;
  background: rgba(11,14,20,.1);
}
.lane i.hl { background: rgba(15,98,254,.3); }

/* big-circle variant (Evidence-Based Opportunities) — fills the slab, breathes */
.ring.r1.big { inset: 58px; border-radius: 50%; border-color: rgba(15,98,254,.22); }
.ring.r2.big { inset: 92px; border-radius: 50%; border-color: rgba(15,98,254,.34); }
.ring.core.big {
  inset: 124px; border: none; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(15,98,254,.4), rgba(15,98,254,.14) 60%, transparent 80%);
  box-shadow: 0 0 70px 10px rgba(15,98,254,.22);
  animation: ssBreathe 4.2s ease-in-out infinite;
}
@keyframes ssBreathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 70px 10px rgba(15,98,254,.22); }
  50% { transform: scale(1.06); box-shadow: 0 0 95px 16px rgba(15,98,254,.32); }
}
/* orbiting sparks riding the rings */
/* the circle composition sits slightly high so the bottom title keeps clear air */
.ring.big, .orbiter { margin-top: -18px; }
.orbiter { position: absolute; inset: 58px; border-radius: 50%; animation: ssSpin 10s linear infinite; }
.orbiter.o2 { inset: 92px; animation-duration: 16s; animation-direction: reverse; }
.orbiter::before {
  content: ""; position: absolute; left: 50%; top: -4.5px; width: 9px; height: 9px;
  margin-left: -4.5px; border-radius: 50%;
  background: var(--really-blue);
  box-shadow: 0 0 14px 3px rgba(15,98,254,.55);
}
@keyframes ssSpin { to { transform: rotate(360deg); } }
.ss-slab:not(.is-active) .ring.core.big,
.ss-slab:not(.is-active) .orbiter { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .ring.core.big, .orbiter { animation: none; }
}

/* concentric pack rings */
.ring { position: absolute; border: 1px solid rgba(15,98,254,.2); border-radius: 5px; }
.ring.r1 { inset: 86px; }
.ring.r2 { inset: 122px; border-color: rgba(15,98,254,.3); }
.ring.core {
  inset: 158px; border: none; border-radius: 20px;
  background: radial-gradient(closest-side, rgba(15,98,254,.22), rgba(15,98,254,.06) 70%, transparent);
}

/* agent orbs */
.aorb {
  position: absolute; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #3A4356, #0B0E14 68%);
  box-shadow: 4px 4px 10px -1px rgba(11,14,20,.28), inset 0 1px 1px rgba(255,255,255,.35);
}
.aorb::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgba(120,170,255,.95), rgba(15,98,254,.35) 72%);
  filter: blur(.5px);
}

/* ---------- Agent-ready context: the transparent cover (lid) ----------
   Lands like every other layer but oversized and glass-clear, so the whole
   finished stack stays visible through it. */
.ss-slab[data-layer="cover"] .ss-bottom {
  background: linear-gradient(140deg, rgba(238,236,229,.3), rgba(216,213,205,.2));
  border-color: rgba(11,14,20,.08);
}
.ss-slab[data-layer="cover"] .ss-face {
  background:
    linear-gradient(118deg, rgba(255,255,255,.52) 0%, rgba(255,255,255,.14) 34%, rgba(255,255,255,.1) 70%, rgba(255,255,255,.4) 100%);
  border-color: rgba(255,255,255,.7);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 0 0 1px rgba(255,255,255,.25);
}
.ss-slab[data-layer="cover"] .ss-label { color: rgba(11,14,20,.74); }

/* the lid's skirt — four vertical glass walls hanging from its edges down
   around the entire compressed stack (each is one flat 3D plane) */
.ss-skirt {
  position: absolute; pointer-events: none;
  transition: opacity .55s var(--ease);
}
/* panes are inset by the lid's corner radius so they never protrude past its
   rounded silhouette, and the attached edge is borderless — the skirt reads
   as a seamless extension of the lid's own border */
.ss-skirt-xa, .ss-skirt-xb {
  top: 23px; width: 60px; height: 404px;
  transform-origin: 0 50%; transform: rotateY(90deg);
  background: linear-gradient(90deg, rgba(252,251,248,.78), rgba(238,236,229,.32));
  border: 1px solid rgba(255,255,255,.6); border-left: none;
}
.ss-skirt-xa { left: 0; }
.ss-skirt-xb { left: 450px; }
.ss-skirt-ya, .ss-skirt-yb {
  left: 23px; width: 404px; height: 60px;
  transform-origin: 50% 0; transform: rotateX(-90deg);
  background: linear-gradient(180deg, rgba(252,251,248,.78), rgba(238,236,229,.32));
  border: 1px solid rgba(255,255,255,.6); border-top: none;
}
.ss-skirt-ya { top: 0; }
.ss-skirt-yb { top: 450px; }
.ss-slab[data-layer="cover"].is-active .ss-bottom {
  /* much lighter contact shadow — it's clear glass */
  box-shadow:
    -8px 8px 14px -6px rgba(11,14,20,.12),
    -20px 20px 36px -14px rgba(11,14,20,.1);
}

/* agents layer sits flush on the lid at the final steps — contact line only */
#storyStack[data-step="6"] .ss-slab[data-layer="agents"] .ss-bottom,
#storyStack[data-step="7"] .ss-slab[data-layer="agents"] .ss-bottom {
  box-shadow: -4px 4px 7px -3px rgba(11,14,20,.1);
}

/* the dot field for Evidence-Based Opportunities is drawn procedurally
   (see buildDots in story-stack.js) */

/* ---------- Progress indicator ---------- */
.ss-progress {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--soft-border); border-radius: var(--radius-pill);
  padding: 9px 14px;
}
.ss-progress .seg-row { display: flex; gap: 5px; }
.ss-progress .seg {
  width: 16px; height: 3px; border-radius: 2px; border: none; padding: 0;
  background: var(--soft-border); transition: background .3s var(--ease);
  cursor: pointer;
}
.ss-progress .seg:hover { background: var(--border-strong); }
.ss-progress .seg.is-on { background: var(--ink); }
.ss-progress .ss-count {
  font: 600 11px/1 ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  letter-spacing: .08em; color: var(--slate); white-space: nowrap;
}

.ss-progress .ss-step-name {
  display: none; /* desktop: the rail already names the active step */
  font: 500 11.5px/1 var(--font-body); color: var(--slate);
  white-space: nowrap; border-left: 1px solid var(--soft-border); padding-left: 12px;
}

/* ---------- Short viewports: compact rail + head ---------- */
@media (min-width: 901px) and (max-height: 760px) {
  .ss-head { padding-top: 60px; }
  .ss-head .ss-kicker { font-size: 17px; margin-top: 8px; max-width: 460px; }
  .ss-rail { gap: 0; }
  .ss-tab-head { padding: 12px 6px 12px 14px; }
  .ss-tab-title { font-size: 14.5px; }
  .ss-tab.is-active .ss-tab-head { padding: 12px 6px 7px 14px; }
  .ss-tab-body p { font-size: 13px; line-height: 1.5; padding: 0 24px 15px 40px; }
  .ss-tab.is-active .ss-tab-body { height: 94px; }
  .ss-progress { bottom: 12px; padding: 7px 12px; }
}
@media (min-width: 901px) and (max-height: 620px) {
  .ss-head { padding-top: 52px; }
  .ss-head .ss-kicker { display: none; }
  .ss-tab-body p { font-size: 12.5px; }
}

/* ---------- Mobile: scroll-driven stack, no side rail ---------- */
@media (max-width: 900px) {
  /* tighter scrub per step so the pin isn't an endless scroll on phones */
  .ss-runway { height: calc(100vh + var(--steps) * 56vh); }
  .ss-head { padding-top: clamp(72px, 9vh, 110px); }

  /* Drop the side menu + descriptions entirely — on mobile this is just the
     stack assembling as you scroll, with the bottom bar naming each layer. */
  .ss-grid { grid-template-columns: 1fr; gap: 0; }
  .ss-rail { display: none; }
  .ss-scene { min-height: 0; }
  /* sit the stack a little lower in the frame on phones */
  .ss-stage { top: 58%; }

  /* Bottom pill: current step name above the tappable progress dots. */
  .ss-progress { flex-direction: column; gap: 9px; bottom: 18px; padding: 11px 18px; }
  .ss-progress .seg-row { order: 2; gap: 7px; }
  .ss-progress .seg { width: 16px; height: 2px; padding: 0; border-radius: 1px; }
  .ss-progress .ss-count { display: none; }
  .ss-progress .ss-step-name {
    order: 1; display: block; border-left: 0; padding-left: 0;
    text-align: center; white-space: normal; text-wrap: balance; max-width: 72vw;
    font: 600 14px/1.2 var(--font-head); color: var(--ink); letter-spacing: -.01em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ss-slab, .ss-tab, .ss-tab-body, .ss-tab-plus { transition-duration: .01s; }
}
