/* =========================================================================
   Radiate Studio — Scroll Journey
   Scattered creative work drifts, gathers, and organizes into the studio.
   Motion is driven by a single --p (0..1) per pinned act, set in journey.js.
   Only transform/opacity animate (GPU-friendly). Phase math via calc/clamp.
   ========================================================================= */

.journey {
  position: relative;
  background:
    radial-gradient(120% 80% at 12% 0%, rgba(46, 163, 255, 0.10), transparent 60%),
    radial-gradient(100% 70% at 88% 100%, rgba(60, 240, 255, 0.08), transparent 62%),
    linear-gradient(180deg, #0a0c1a 0%, #0b0e20 45%, #090b18 100%);
  color: #eaf2ff;
}

.journey-chapters {
  position: sticky;
  top: var(--header-height, 72px);
  z-index: 8;
  width: min(920px, calc(100% - 32px));
  min-height: 52px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 auto;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(9, 13, 27, 0.88);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.journey-chapters a {
  min-width: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 11px;
  color: rgba(188, 202, 224, 0.64);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.journey-chapters a span {
  color: rgba(127, 220, 255, 0.62);
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 9px;
}

.journey-chapters a:hover,
.journey-chapters a:focus-visible,
.journey-chapters a.is-active {
  background: rgba(60, 240, 255, 0.09);
  color: #ffffff;
}

.journey-chapters a.is-active {
  box-shadow: inset 0 -2px #3cf0ff;
}

.journey-chapters a:focus-visible {
  outline: 2px solid #3cf0ff;
  outline-offset: 2px;
}

/* Slim progress rail that tracks the whole journey.
   The site header is fixed (z-index 1000, ~76px tall), so the rail sticks
   just below it — at top:0 it would be hidden behind the header. */
.journey-rail {
  position: sticky;
  top: calc(var(--header-height, 72px) + 51px);
  z-index: 9;
  height: 2px;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
}
.journey-rail__fill {
  display: block;
  height: 100%;
  width: var(--rail, 0%);
  background: linear-gradient(90deg, #2ea3ff, #3cf0ff);
  box-shadow: 0 0 16px rgba(60, 240, 255, 0.6);
  transition: width 0.08s linear;
}

/* ---- Pinned act scaffold ------------------------------------------------ */
.journey-act {
  position: relative;
  z-index: 1;
  --p: 0;
  --copy-a-start: 0.66;
  --copy-a-window: 0.06;
  --copy-b-start: 0.74;
  --copy-b-window: 0.08;
  scroll-margin-top: calc(var(--header-height, 72px) + 58px);
}
.journey-act--tall { height: 210svh; }
.journey-act--mid  { height: 210svh; }

.journey-act + .journey-act {
  margin-top: -100svh;
  z-index: 2;
}

.journey-act .journey-stage {
  --stage-entry: 1;
  --stage-exit: calc(1 - clamp(0, (var(--p) - 0.985) / 0.015, 1));
  opacity: min(var(--stage-entry), var(--stage-exit));
  will-change: opacity;
}

.journey-act + .journey-act .journey-stage {
  --stage-entry: clamp(0, var(--p) / 0.025, 1);
}

.journey-act[data-journey-name='ship'] .journey-stage {
  --stage-exit: 1;
}

.journey-act[data-journey-name='ideas'] {
  --copy-a-start: 0.72;
  --copy-a-window: 0.06;
  --copy-b-start: 0.80;
  --copy-b-window: 0.06;
}

.journey-act[data-journey-name='storyboard'] {
  --copy-a-start: 0.66;
  --copy-a-window: 0.06;
  --copy-b-start: 0.90;
  --copy-b-window: 0.06;
}

.journey-act[data-journey-name='studio'] {
  --copy-a-start: 0.66;
  --copy-a-window: 0.06;
  --copy-b-start: 0.74;
  --copy-b-window: 0.08;
}

.journey-act[data-journey-name='ship'] {
  --copy-a-start: 0.58;
  --copy-a-window: 0.06;
  --copy-b-start: 0.84;
  --copy-b-window: 0.06;
}

.journey-stage {
  position: sticky;
  top: 0;
  height: 100svh;
  min-height: 0;
  display: grid;
  grid-template-rows: max-content minmax(0, 1fr);
  gap: clamp(14px, 2.4vh, 24px);
  box-sizing: border-box;
  overflow: hidden;
  padding: calc(var(--header-height, 72px) + 58px) 24px 20px;
  background:
    radial-gradient(105% 75% at 10% 4%, rgba(46, 163, 255, 0.09), transparent 62%),
    radial-gradient(90% 70% at 90% 96%, rgba(60, 240, 255, 0.06), transparent 64%),
    #0a0d1b;
}

/* ---- Copy / crossfading headlines --------------------------------------- */
/* Copy floats at the top; the scene is centred in the viewport independently
   so every act frames its animation the same way regardless of copy length. */
.journey-copy {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  z-index: 4;
  justify-self: center;
  text-align: center;
  width: min(760px, 92vw);
  pointer-events: none;
}
.journey-eyebrow {
  display: inline-block;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #7fdcff;
  margin-bottom: 14px;
  opacity: 0.9;
}
.journey-title {
  display: grid;
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-weight: 600;
  font-size: clamp(28px, 4.4vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}
.journey-sub {
  display: grid;
  margin: 14px auto 0;
  max-width: 620px;
  font-size: clamp(15px, 1.5vw, 19px);
  line-height: 1.5;
  color: #a7b6d4;
}
/* stack the two phases so they crossfade in the same spot */
.journey-title .j-line,
.journey-sub .j-line { grid-area: 1 / 1; }

/* Crossfade with direction: the outgoing line drifts up as it fades, the
   incoming line rises into place — reads as motion, not superimposed text.
   No CSS transition here: motion is scrubbed by --p every frame. */
.j-line--a {
  opacity: calc(1 - clamp(0, (var(--p) - var(--copy-a-start)) / var(--copy-a-window), 1));
  transform: translateY(calc(-16px * clamp(0, (var(--p) - var(--copy-a-start)) / var(--copy-a-window), 1)));
}
.j-line--b {
  opacity: clamp(0, (var(--p) - var(--copy-b-start)) / var(--copy-b-window), 1);
  transform: translateY(calc(18px * (1 - clamp(0, (var(--p) - var(--copy-b-start)) / var(--copy-b-window), 1))));
}

.j-accent { color: #3cf0ff; }

/* ---- Shared scene box ---------------------------------------------------- */
.journey-scene {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  z-index: 2;
  width: min(1160px, 100%);
  height: 100%;
  /* Fill the free viewport height instead of floating small in dead space. */
  max-height: min(560px, 64svh);
  min-height: 0;
  align-self: center;
  justify-self: center;
  will-change: transform;
}
@media (min-height: 940px) { .journey-scene { max-height: 600px; } }

/* Generic card chrome used across acts */
.j-card {
  position: absolute;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(22, 30, 54, 0.94), rgba(12, 17, 34, 0.96));
  border: 1px solid rgba(120, 170, 255, 0.16);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  will-change: transform, opacity;
  transition: border-color 0.25s ease;
}
.j-card:hover { border-color: rgba(60, 240, 255, 0.4); }
.j3-scene-row { transition: background 0.2s ease; }
.j3-scene-row:hover { background: rgba(46, 163, 255, 0.1); }
.j4-ver { transition: border-color 0.25s ease; }
.j4-ver:hover { border-color: rgba(60, 240, 255, 0.45); }

/* =========================================================================
   ACT 1 — Scattered fragments gather into a script
   ========================================================================= */
.scatter-field { position: absolute; inset: 0; }

.frag {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  --fx: 0px; --fy: 0px; --fr: 0deg;
  /* Staggered gather: each fragment has its own delay (--gd, 0..0.2) before
     it starts collapsing toward the centre, so the pile "untangles" one
     piece at a time instead of imploding in unison. --gp is this fragment's
     personal 0..1 progress. */
  --gd: 0;
  --gp: clamp(0, (var(--p) - 0.10 - calc(var(--gd) * 0.25)) / 0.42, 1);
  transform:
    translate(-50%, -50%)
    translate(calc(var(--fx) * (1 - var(--gp))), calc(var(--fy) * (1 - var(--gp))))
    rotate(calc(var(--fr) * (1 - var(--gp))))
    scale(calc(1 - 0.28 * var(--gp)));
  opacity: calc(1 - clamp(0, (var(--p) - 0.48) / 0.18, 1));
  animation: frag-float 7s ease-in-out infinite;
  animation-play-state: paused;
  will-change: transform, opacity;
}
.journey-act.is-active .frag { animation-play-state: running; }
@keyframes frag-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

.frag-inner {
  border-radius: 12px;
  border: 1px solid rgba(140, 180, 255, 0.18);
  background: linear-gradient(160deg, rgba(24, 32, 56, 0.96), rgba(13, 18, 36, 0.96));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42);
  padding: 12px 14px;
  font-size: 13px;
  color: #d6e2fb;
}
.frag--img .frag-inner { padding: 0; overflow: hidden; width: 176px; height: 116px; }
.frag--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frag--note .frag-inner { width: 208px; background: linear-gradient(160deg, #2a2f18, #23260f); border-color: rgba(255, 210, 110, 0.28); color: #ffe6ab; }
.frag--chip .frag-inner { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.frag--ref .frag-inner { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 12px; color: #8fd4ff; }
.frag--bubble .frag-inner { border-radius: 16px 16px 16px 4px; background: linear-gradient(160deg, rgba(46,163,255,0.22), rgba(20,28,52,0.95)); border-color: rgba(120,200,255,0.35); }
.frag--tag .frag-inner { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 11px; color: #9fe7c7; border-color: rgba(36,226,138,0.4); }
.frag__dot { width: 8px; height: 8px; border-radius: 50%; background: #24e28a; box-shadow: 0 0 10px #24e28a; }
.frag__wave { display: inline-block; width: 44px; height: 14px; background:
  repeating-linear-gradient(90deg, #3cf0ff 0 2px, transparent 2px 5px); mask: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent); opacity: 0.85; }

/* Resolved script card — fades/scales in during the back half */
.script-resolve {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(610px, 88vw);
  transform: translate(-50%, -50%) translateY(calc(20px * (1 - clamp(0, (var(--p) - 0.48) / 0.18, 1)))) scale(calc(0.9 + 0.1 * clamp(0, (var(--p) - 0.48) / 0.18, 1)));
  opacity: clamp(0, (var(--p) - 0.48) / 0.18, 1);
  padding: 22px 26px 18px;
  overflow: hidden;
  z-index: 3;
  border-color: rgba(95, 216, 255, 0.28);
  background:
    linear-gradient(90deg, rgba(60, 240, 255, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(60, 240, 255, 0.035) 1px, transparent 1px),
    linear-gradient(155deg, rgba(22, 34, 61, 0.98), rgba(9, 15, 31, 0.98));
  background-size: 24px 24px, 24px 24px, auto;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.54), 0 0 60px rgba(60, 240, 255, 0.08), inset 0 1px rgba(255, 255, 255, 0.06);
}
.script-resolve::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(#3cf0ff, #2ea3ff 58%, #9c86ff);
  box-shadow: 0 0 22px rgba(60, 240, 255, 0.62);
}
.script-resolve__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.script-resolve__label { font-family: var(--font-display, sans-serif); font-weight: 650; font-size: 17px; letter-spacing: -0.02em; }
.script-resolve__pill { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #0a1020; background: linear-gradient(120deg, #3cf0ff, #2ea3ff); border-radius: 999px; padding: 4px 10px; }
.script-resolve__line { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px dashed rgba(120, 160, 220, 0.16); }
.script-resolve__line:last-child { border-bottom: 0; }
.script-resolve__num { font-family: ui-monospace, monospace; font-size: 11px; color: #6f86ac; }
.script-resolve__text { font-size: 14px; line-height: 1.4; color: #dbe6fb; }
.script-resolve__text b { color: #9fd8ff; font-weight: 600; }
.script-resolve__footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #7890b7;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.script-resolve__footer span { display: inline-flex; align-items: center; gap: 7px; }
.script-resolve__footer i { width: 7px; height: 7px; border-radius: 50%; background: #24e28a; box-shadow: 0 0 10px rgba(36, 226, 138, 0.8); }

/* =========================================================================
   ACT 2 — Script blooms into storyboards, then pulls back to a canvas
   ========================================================================= */
.j2 { position: absolute; inset: 0; }

/* Script column. Starts centred — visually continuing Act 1's resolved
   script card — then glides left as the storyboard frames bloom from it. */
.j2-script {
  position: absolute;
  left: 0; top: 50%;
  width: min(320px, 40%);
  --arrive: clamp(0, var(--p) / 0.20, 1);
  --exit: clamp(0, (var(--p) - 0.64) / 0.10, 1);
  /* (scene width - own width) / 2 centres the panel; decays to 0 as it docks */
  transform:
    translateY(-50%)
    translateX(calc((min(1120px, 94vw) - 100%) / 2 * (1 - var(--arrive))))
    translateX(calc(-72px * var(--exit)))
    scale(calc(1 - 0.06 * var(--exit)));
  padding: 16px 18px;
  opacity: calc(1 - var(--exit));
}
.j2-script__h { font-family: var(--font-display, sans-serif); font-weight: 600; font-size: 14px; margin-bottom: 12px; color: #cfe0ff; }
.j2-script__line { display: flex; gap: 10px; padding: 6px 0; font-size: 12.5px; color: #b7c6e6; }
.j2-script__line span:first-child { color: #5f79a2; font-family: ui-monospace, monospace; font-size: 10.5px; }

/* Storyboard frames spread on the right, forming a small canvas */
.j2-board {
  position: absolute;
  right: 0; top: 50%;
  width: min(790px, 72%);
  height: 100%;
  --canvas: clamp(0, (var(--p) - 0.72) / 0.16, 1);
  transform: translateY(-50%) translateX(calc(-18% * var(--canvas))) scale(calc(0.96 + 0.04 * var(--canvas)));
  border-radius: 20px;
}
/* dot-grid surface materialises as the boards become a canvas */
.j2-board::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 1px solid rgba(120, 180, 255, 0.22);
  border-radius: inherit;
  background-color: rgba(10, 16, 33, 0.94);
  background-image: radial-gradient(rgba(120, 170, 255, 0.2) 1px, transparent 1.5px);
  background-size: 26px 26px;
  box-shadow: 0 30px 72px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 255, 255, 0.05);
  opacity: var(--canvas);
}
.j2-frame {
  position: absolute;
  width: 44%;
  height: 40%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(120, 180, 255, 0.22);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  background: #0d1430;
  transform: translateY(24px) scale(0.7);
  opacity: 0;
  will-change: transform, opacity;
  z-index: 1;
}
.j2-frame img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.35s ease;
}
/* Tactile: glow + inner-image zoom on hover. Never animate the frame's own
   transform — that channel belongs to the scroll scrub. */
.j2-frame { transition: border-color 0.25s ease, box-shadow 0.25s ease; }
.j2-frame:hover {
  border-color: rgba(60, 240, 255, 0.55);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 0 0 24px rgba(60, 240, 255, 0.18);
}
.j2-frame:hover img { transform: scale(1.05); }
.j2-frame__tag {
  position: absolute; left: 8px; bottom: 8px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 6px;
  background: rgba(10, 16, 32, 0.72); color: #d7e6ff; backdrop-filter: blur(4px);
}
/* frames are children 3-6 of .j2-board (chrome + svg precede them) */
.j2-frame:nth-child(3) { left: 3%;  top: 7%;  }
.j2-frame:nth-child(4) { right: 3%; top: 11%;  }
.j2-frame:nth-child(5) { left: 10%;  bottom: 5%; }
.j2-frame:nth-child(6) { right: 6%; bottom: 9%; }
/* staggered emergence: each frame keyed off --p using its --i.
   Starts at p=0.2, after the script panel has docked left. */
.j2-frame {
  --i: 0;
  --e: clamp(0, (var(--p) - 0.20 - calc(var(--i) * 0.08)) / 0.14, 1);
  transform: translateY(calc(24px * (1 - var(--e)))) scale(calc(0.7 + 0.3 * var(--e)));
  opacity: var(--e);
}

/* connector lines + canvas chrome appear as it becomes a canvas */
.j2-links { display: none; }
.j2-links path { stroke: #3cf0ff; stroke-width: 1.6; fill: none; stroke-dasharray: 100; stroke-dashoffset: calc(100 - 100 * clamp(0,(var(--p) - 0.55)/0.4,1)); filter: drop-shadow(0 0 5px rgba(60,240,255,0.5)); }
.j2-links circle { fill: #2ea3ff; opacity: clamp(0,(var(--p) - 0.7)/0.3,1); }

.j2-chrome {
  position: absolute; left: 8px; right: 0; top: 10px; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  opacity: var(--canvas);
  transform: translateY(calc(-10px * (1 - var(--canvas))));
}
.j2-chip { font-size: 11px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: rgba(20, 30, 56, 0.9); border: 1px solid rgba(120,180,255,0.24); color: #cfe0ff; }
.j2-chip--live { color: #9fe7c7; border-color: rgba(36,226,138,0.4); }
.j2-chip--live::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #24e28a; margin-right: 7px; box-shadow: 0 0 8px #24e28a; vertical-align: middle; }

.j2-canvas-node {
  position: absolute;
  z-index: 3;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid rgba(120, 180, 255, 0.2);
  border-radius: 11px;
  background: rgba(11, 17, 34, 0.94);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34);
  opacity: var(--canvas);
  transform: translateY(calc(14px * (1 - var(--canvas)))) scale(calc(0.94 + 0.06 * var(--canvas)));
  color: #aabbd8;
  font-size: 9px;
  line-height: 1.4;
}
.j2-canvas-node strong { color: #7fdcff; font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; }
.j2-canvas-node--note { top: 5%; left: 37%; width: 31%; }
.j2-canvas-node--tasks { top: 42%; right: 1%; width: 25%; }
.j2-canvas-node--tasks span { display: flex; align-items: center; gap: 6px; }
.j2-canvas-node--tasks i { width: 7px; height: 7px; border: 1px solid #6681ac; border-radius: 2px; }
.j2-canvas-node--tasks i.is-done { border-color: #24e28a; background: #24e28a; }
.j2-canvas-node--reference { bottom: 3%; left: 1%; width: 27%; }
.j2-canvas-node--reference span { color: #76d3ff; font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; }

/* =========================================================================
   ACT 3 — The studio assembles: create + collaborate
   ========================================================================= */
.j3 { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.j3-studio {
  position: relative;
  width: min(1000px, 94%);
  height: 90%;
  border-radius: 18px;
  border: 1px solid rgba(120, 170, 255, 0.16);
  background: linear-gradient(160deg, rgba(18, 25, 46, 0.96), rgba(10, 15, 30, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: scale(calc(0.94 + 0.06 * clamp(0, var(--p) / 0.5, 1)));
  opacity: clamp(0, var(--p) / 0.2, 1);
}
.j3-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid rgba(120,170,255,0.12);
  font-size: 13px; color: #cfe0ff;
}
.j3-topbar__title { font-family: var(--font-display, sans-serif); font-weight: 600; }
.j3-presence { display: flex; }
.j3-av {
  width: 28px; height: 28px; border-radius: 50%; margin-left: -8px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #04101f;
  border: 2px solid #0d1430;
  background: linear-gradient(135deg, #3cf0ff, #2ea3ff);
  transform: translateY(calc(-16px * (1 - var(--av)))) scale(var(--av));
  opacity: var(--av);
  --av: clamp(0, (var(--p) - calc(0.82 + var(--i) * 0.012)) / 0.04, 1);
  --i: 0;
}
.j3-av:nth-child(2){ background: linear-gradient(135deg,#ffb347,#ff7a59);}
.j3-av:nth-child(3){ background: linear-gradient(135deg,#24e28a,#12b6c8);}
.j3-av:nth-child(4){ background: linear-gradient(135deg,#a78bfa,#6366f1);}

.j3-body { display: flex; height: calc(100% - 50px); }
.j3-side {
  width: 168px; flex: none; padding: 14px 12px;
  border-right: 1px solid rgba(120,170,255,0.1);
  transform: translateX(calc(-100% * (1 - clamp(0, (var(--p) - 0.12) / 0.24, 1))));
}
.j3-side__h { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #6f86ac; margin-bottom: 10px; }
.j3-scene-row { display: flex; align-items: center; gap: 9px; padding: 7px; border-radius: 9px; margin-bottom: 6px; font-size: 12px; color: #c2d2f0; }
.j3-scene-row.is-on { background: rgba(46, 163, 255, 0.14); }
.j3-scene-row span:first-child { width: 34px; height: 24px; border-radius: 5px; background: linear-gradient(135deg,#22345f,#16223f); flex: none; }

.j3-main { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.j3-stage-img {
  flex: 1; border-radius: 12px; overflow: hidden; position: relative; min-height: 0;
  border: 1px solid rgba(120,180,255,0.16);
  opacity: clamp(0, (var(--p) - 0.2) / 0.24, 1);
}
.j3-stage-img img { width: 100%; height: 100%; object-fit: cover; }
.j3-comment {
  position: absolute; left: 44%; top: 40%;
  transform: scale(var(--c)); opacity: var(--c);
  --c: clamp(0, (var(--p) - 0.90) / 0.035, 1);
}
.j3-comment__pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 2px; background: linear-gradient(135deg,#3cf0ff,#2ea3ff); box-shadow: 0 6px 16px rgba(0,0,0,0.5); }
.j3-comment__bubble {
  position: absolute; left: 30px; top: -6px; white-space: nowrap;
  font-size: 12px; padding: 7px 11px; border-radius: 10px;
  background: rgba(12,18,36,0.95); border: 1px solid rgba(120,180,255,0.3); color: #dbe8ff;
}
.j3-tracks { flex: none; display: flex; flex-direction: column; gap: 7px; }
.j3-track { display: flex; align-items: center; gap: 10px; }
.j3-track__label { width: 54px; flex: none; font-size: 10.5px; color: #6f86ac; text-transform: uppercase; letter-spacing: 0.06em; }
.j3-track__bar { position: relative; flex: 1; height: 12px; border-radius: 6px; background: rgba(255,255,255,0.05); overflow: hidden; }
.j3-track__fill {
  position: absolute; top: 0; bottom: 0; left: 0; border-radius: 6px;
  width: calc(var(--w, 60%) * clamp(0, (var(--p) - 0.34) / 0.24, 1));
}
.j3-track__fill.is-a { background: linear-gradient(90deg,#2ea3ff,#3cf0ff); }
.j3-track__fill.is-b { background: linear-gradient(90deg,#24e28a,#1bc8ff); }
.j3-track__fill.is-c { background: linear-gradient(90deg,#ff9f40,#ffb347); }

/* =========================================================================
   ACT 4 — Feedback + versions resolve, then the project ships
   ========================================================================= */
.j4 { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

/* Version compare (beat 1) fades out as the ship (beat 2) takes over */
.j4-compare {
  position: absolute; width: min(880px, 94%); height: 76%;
  display: flex; gap: 20px; align-items: stretch; justify-content: center;
  opacity: calc(1 - clamp(0, (var(--p) - 0.62) / 0.08, 1));
  transform: translateY(12px) scale(calc(1 - 0.06 * clamp(0, (var(--p) - 0.62) / 0.08, 1)));
}
.j4-ver {
  flex: 1; border-radius: 14px; overflow: hidden; position: relative;
  border: 1px solid rgba(120,170,255,0.18); background: #0d1430;
  box-shadow: 0 20px 46px rgba(0,0,0,0.45);
}
.j4-ver--v2 { transform: translateX(calc(40px * (1 - clamp(0, var(--p) / 0.28, 1)))) rotate(calc(-3deg * (1 - clamp(0, var(--p)/0.28,1)))); }
.j4-ver--v3 { transform: translateX(calc(-40px * (1 - clamp(0, var(--p) / 0.28, 1)))) rotate(calc(3deg * (1 - clamp(0, var(--p)/0.28,1)))); }
.j4-ver img { width: 100%; height: 68%; object-fit: cover; display: block; }
.j4-ver__foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; }
.j4-ver__label { font-size: 12px; font-weight: 600; color: #cfe0ff; }
.j4-ver--v3 .j4-ver__label::after { content: ' · approved'; color: #57e39c; }
.j4-ver__badge { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; }
.j4-ver--v2 .j4-ver__badge { color: #9fb0d0; background: rgba(255,255,255,0.06); }
.j4-ver--v3 .j4-ver__badge { color: #04140c; background: linear-gradient(120deg,#57e39c,#24e28a); opacity: clamp(0,(var(--p) - 0.28)/0.16,1); }

/* approvals checklist between the two versions */
.j4-approvals {
  width: 220px; flex: none; align-self: center;
  padding: 16px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(20,28,52,0.95), rgba(11,16,34,0.97));
  border: 1px solid rgba(120,170,255,0.16);
}
.j4-approvals__h { font-size: 12px; color: #8ea6cf; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.j4-approve { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; color: #c7d6f2; }
.j4-check {
  width: 20px; height: 20px; border-radius: 6px; flex: none;
  border: 1.5px solid rgba(140,170,220,0.4);
  display: grid; place-items: center; font-size: 12px; color: transparent;
  --k: clamp(0, (var(--p) - calc(0.22 + var(--i) * 0.09)) / 0.08, 1);
  --i: 0;
  background: linear-gradient(135deg,#24e28a,#1bc8ff);
  background-size: calc(100% * var(--k)) 100%;
  background-repeat: no-repeat;
  border-color: rgba(36,226,138,calc(0.4 + 0.6*var(--k)));
  color: rgba(6,20,12,var(--k));
}

/* Ship (beat 2) — a single master card converges and launches */
.j4-ship {
  position: absolute; width: min(460px, 86%);
  left: 50%; top: 54%;
  --ship: clamp(0, (var(--p) - 0.70) / 0.12, 1);
  transform: translate(-50%, -50%)
             translateY(calc(22px * (1 - var(--ship))))
             scale(calc(0.86 + 0.14 * var(--ship)));
  opacity: var(--ship);
  padding: 0; overflow: hidden; z-index: 3;
}
.j4-ship__media { position: relative; height: 190px; }
.j4-ship__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.j4-ship__glow {
  position: absolute; inset: 0;
  background: radial-gradient(80% 120% at 50% 120%, rgba(60,240,255,0.55), transparent 70%);
  opacity: clamp(0, (var(--p) - 0.78) / 0.22, 1);
}
.j4-ship__body { padding: 16px 18px 18px; }
.j4-ship__row { display: flex; align-items: center; justify-content: space-between; }
.j4-ship__title { font-family: var(--font-display, sans-serif); font-weight: 600; font-size: 16px; color: #eaf3ff; }
.j4-ship__meta { font-size: 12px; color: #8ea6cf; }
.j4-ship__bar { margin-top: 14px; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.j4-ship__bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg,#2ea3ff,#3cf0ff); width: calc(100% * clamp(0, (var(--p) - 0.82) / 0.14, 1)); }
.j4-ship__status { margin-top: 10px; font-size: 12px; font-weight: 600; color: #57e39c; opacity: clamp(0,(var(--p) - 0.96)/0.04,1); }

/* Journey close — CTA that hands off to the detailed sections below */
.journey-cta {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 40px 24px 96px;
}
.journey-cta h2 {
  font-family: var(--font-display, sans-serif);
  font-size: clamp(26px, 3.6vw, 44px);
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.journey-cta p { color: #a7b6d4; margin: 0 auto 26px; max-width: 520px; font-size: 17px; }
.journey-cta__row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.journey-cta__hint {
  display: block; margin-top: 34px; font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: #5f76a0;
  animation: hint-bob 2.4s ease-in-out infinite;
}
@keyframes hint-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 5px; }
}

/* =========================================================================
   Reduced motion / small screens — reveal final states, drop the pinning
   ========================================================================= */
@media (max-width: 760px) {
  .journey-chapters {
    width: calc(100% - 20px);
    min-height: 46px;
    overflow-x: auto;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    border-radius: 13px;
    scrollbar-width: none;
  }
  .journey-chapters::-webkit-scrollbar { display: none; }
  .journey-chapters a { min-height: 34px; padding: 7px 8px; font-size: 10px; }
  .journey-rail { top: calc(var(--header-height, 68px) + 45px); }
  .journey-act--tall { height: 195svh; }
  .journey-act--mid  { height: 185svh; }
  .journey-stage {
    padding: calc(var(--header-height, 68px) + 66px) 14px 14px;
    gap: 12px;
  }
  .journey-copy { width: min(94vw, 620px); }
  .journey-eyebrow { margin-bottom: 8px; font-size: 9px; }
  .journey-title { font-size: clamp(25px, 7.8vw, 34px); }
  .journey-sub { margin-top: 8px; font-size: 14px; line-height: 1.4; }
  .journey-scene { width: 100%; max-height: 420px; }
  /* comment bubble text clips on narrow phones — keep just the pin */
  .j3-comment__bubble { display: none; }
  .frag--img .frag-inner { width: 124px; height: 82px; }
  .frag--note .frag-inner, .frag--bubble .frag-inner { width: 148px; font-size: 11.5px; }
  /* Narrow screens can't fit the full scatter — drop the small text-chip
     fragments that pile up and hide each other's labels. */
  .frag--ref, .frag--tag { display: none; }
  /* Act 2 keeps a compact script state, then clears it completely as the
     four frames take over the canvas. */
  .j2-script {
    left: 50%;
    width: min(290px, 84%);
    transform: translate(-50%, -50%) translateY(calc(-18px * var(--exit))) scale(calc(1 - 0.06 * var(--exit)));
    z-index: 4;
  }
  .j2-links { display: none; }
  .j2-board { width: 100%; height: 100%; transform: translateY(-50%) scale(calc(0.96 + 0.04 * var(--canvas))); }
  .j2-frame { width: 46%; height: 30%; }
  .j2-frame:nth-child(3) { left: 2%;  top: 6%;  }
  .j2-frame:nth-child(4) { right: 2%; top: 6%;  }
  .j2-frame:nth-child(5) { left: 2%;  bottom: 8%; }
  .j2-frame:nth-child(6) { right: 2%; bottom: 8%; }
  .j2-canvas-node--note { top: 39%; left: 22%; width: 56%; }
  .j2-canvas-node--tasks,
  .j2-canvas-node--reference { display: none; }
  /* Act 4 keeps the approval state visible as a compact strip. */
  .j4-compare { gap: 8px; height: 92%; align-items: flex-start; }
  .j4-ver { height: 72%; }
  .j4-approvals {
    position: absolute;
    right: 7%;
    bottom: 0;
    left: 7%;
    z-index: 4;
    width: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 9px 10px;
  }
  .j4-approvals__h { grid-column: 1 / -1; margin-bottom: 2px; }
  .j4-approve { gap: 5px; padding: 4px 0; font-size: 10px; }
  .j4-check { width: 15px; height: 15px; border-radius: 4px; }
  .j4-ship { width: 92%; }
  /* Act 3: tighten sidebar */
  .j3-side { width: 120px; }
}

/* Laptop-height viewports keep the entire product shell visible, including
   every scene row and timeline lane. */
@media (min-width: 761px) and (max-height: 900px) {
  .journey-chapters { min-height: 46px; }
  .journey-chapters a { min-height: 34px; }
  .journey-rail { top: calc(var(--header-height, 72px) + 45px); }
  .journey-stage {
    gap: 10px;
    padding: calc(var(--header-height, 72px) + 48px) 20px 14px;
  }
  .journey-eyebrow { margin-bottom: 8px; font-size: 10px; }
  .journey-title { font-size: clamp(30px, 3.3vw, 44px); }
  .journey-sub { margin-top: 8px; font-size: 15px; line-height: 1.4; }
  .journey-scene { max-height: min(500px, 60svh); }
  .j3-studio { width: min(1000px, 96%); height: 100%; }
  .j3-topbar { min-height: 44px; padding: 8px 14px; }
  .j3-body { height: calc(100% - 44px); }
  .j3-side { width: 184px; padding: 10px; }
  .j3-side__h { margin-bottom: 7px; }
  .j3-scene-row {
    gap: 7px;
    margin-bottom: 4px;
    padding: 6px;
    font-size: 11px;
    white-space: nowrap;
  }
  .j3-scene-row span:first-child { width: 28px; height: 20px; }
  .j3-main { gap: 8px; padding: 10px; }
  .j3-tracks { gap: 5px; }
  .j3-track { gap: 8px; }
  .j3-track__label { width: 48px; font-size: 9px; }
  .j3-track__bar { height: 10px; }
}

/* Short viewports (landscape phones): fit the pinned stage to the viewport,
   drop the connector SVG (non-uniform scaling makes its strokes look fat),
   and tuck the scene lower under the compact copy. */
@media (max-height: 600px) {
  .journey-chapters { min-height: 42px; }
  .journey-chapters a { min-height: 30px; }
  .journey-stage { padding-top: calc(var(--header-height, 68px) + 54px); gap: 8px; }
  .journey-scene { max-height: 290px; }
  .j2-links { display: none; }
  .journey-title { font-size: clamp(22px, 3.4vw, 34px); }
  .journey-sub { display: none; }
  .journey-eyebrow { margin-bottom: 6px; }
}

.journey--reduced .journey-act { height: auto !important; margin-top: 0 !important; --p: 1 !important; }
.journey--reduced .journey-stage {
  position: relative; height: auto; min-height: 0; overflow: visible;
  display: flex; flex-direction: column; align-items: center; gap: 30px;
  padding: 72px 24px;
  --stage-entry: 1;
  --stage-exit: 1;
  opacity: 1;
}
.journey--reduced .journey-copy { position: static; transform: none; }
.journey--reduced .journey-scene {
  position: relative; top: auto; left: auto; transform: none;
  height: min(520px, 70vh);
}
.journey--reduced .frag { display: none; }
.journey--reduced .j-line--a { display: none; }
.journey--reduced .frag { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .frag { animation: none; }
  .journey-cta__hint { animation: none; }
  .journey-rail__fill { transition: none; }
  .journey-chapters a { transition: none; }
}
