/* MYTHVECTOR studio layer (homepage only).
   Loaded after style.css and worlds.css. style.css is shared with the download pages and is not
   modified; everything the redesign needs lives here.

   Two chapters, one family:
   - the studio: warm, lit, pixel art and CRT glass (.chapter-studio, .return, cost, footer)
   - Project One: cosmic, vector, the WebGL world behind glass-clear sections (.chapter-game)

   Motion is opt-in. studio.js adds .tour-live, .portal-live and .reveal-live to <html> only when
   JavaScript runs and the visitor has not asked for reduced motion. Without them, every part of
   this page has a complete static layout. CSS keyframe loops live inside
   @media (prefers-reduced-motion: no-preference) and stop under html.motion-paused. */

:root {
  --office: #120f22;
  --office-wall: #1d1834;
  --office-line: #2e2550;
  --warm: #ffd789;
  --lilac: #b494f3;
}

/* ---------------------------------------------------------------- shared -- */
.chapter-studio { background: var(--office); }
.chapter-studio .studio-process { border-bottom: 0; padding-bottom: 96px; }
.full-bleed, .return, .cost-section, body > .footer {
  box-shadow: 0 0 0 100vmax var(--office);
  clip-path: inset(0 -100vmax);
  background: var(--office);
}
.text-link:focus-visible, .button:focus-visible { outline: 3px solid var(--pink); outline-offset: 6px; }
.tour-step a:focus-visible, .studio-does a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }

/* ------------------------------------------------- opening: studio ident -- */
.hero.opening { min-height: clamp(640px, calc(100svh - 112px), 860px); display: flex; flex-direction: column; justify-content: center; background: #090818; }
.opening-sky {
  position: absolute; inset: 0; z-index: -4;
  background:
    radial-gradient(1px 1px at 12% 18%, #f4f4ffcc 50%, transparent),
    radial-gradient(1px 1px at 27% 64%, #c2c1d9aa 50%, transparent),
    radial-gradient(1.5px 1.5px at 41% 12%, #fff4c5cc 50%, transparent),
    radial-gradient(1px 1px at 58% 38%, #f4f4ff99 50%, transparent),
    radial-gradient(1px 1px at 66% 8%, #74f5efaa 50%, transparent),
    radial-gradient(1.5px 1.5px at 79% 27%, #f4f4ffcc 50%, transparent),
    radial-gradient(1px 1px at 88% 52%, #ff70ca99 50%, transparent),
    radial-gradient(1px 1px at 94% 14%, #c2c1d9aa 50%, transparent),
    radial-gradient(1px 1px at 6% 46%, #f4f4ff88 50%, transparent),
    radial-gradient(1px 1px at 35% 34%, #f4f4ff77 50%, transparent),
    radial-gradient(120% 70% at 70% 100%, #ff70ca2e, transparent 60%),
    radial-gradient(90% 60% at 20% 0%, #4a2a7a55, transparent 70%),
    linear-gradient(#090818, #120d26 62%, #1c1033);
}
.opening-grid-floor {
  position: absolute; left: -50%; right: -50%; bottom: -2px; height: 46%; z-index: -3;
  background:
    repeating-linear-gradient(90deg, #74f5ef55 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, #ff70ca55 0 1px, transparent 1px 48px);
  transform: perspective(380px) rotateX(64deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(transparent, #000 38%);
  mask-image: linear-gradient(transparent, #000 38%);
  opacity: .55;
}
.opening-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr); gap: 56px; align-items: center; }
.opening .hero-content { padding-block: 40px 104px; }
.opening h1 { font-size: clamp(42px, 4.9vw, 76px); }
.opening-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 30px; margin-top: 30px; }
.opening-actions .button { margin-top: 0; }
.opening-actions .text-link { margin-top: 0; }

/* The ident: a CRT that boots, then draws the MV mark from the studio's own vector geometry. */
.ident { justify-self: center; width: min(100%, 470px); padding-bottom: 72px; }
.ident-screen {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border: 12px solid #2b2440; border-radius: 26px / 30px;
  background: radial-gradient(120% 90% at 50% 45%, #13213a, #070a16 70%);
  box-shadow: inset 0 0 0 2px #0b0918, inset 0 0 60px #000a, 8px 8px 0 #171932, 9px 9px 0 #4a4270;
  display: grid; grid-template-rows: auto 1fr auto; padding: 22px 26px 24px;
}
.ident-screen::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, #0205194d 2px 3px);
}
.ident-screen::before {
  content: ''; position: absolute; left: 0; right: 0; height: 30%; top: -30%; pointer-events: none;
  background: linear-gradient(transparent, #74f5ef0f 50%, transparent);
}
.ident-boot { list-style: none; margin: 0; padding: 0; font-size: 10px; line-height: 1.75; letter-spacing: 1px; color: #74f5efcc; }
.ident-boot li { display: flex; gap: 6px; white-space: nowrap; }
.ident-boot li:first-child { color: var(--pink); }
.ident-boot i { flex: 1; border-bottom: 1px dotted #74f5ef66; transform: translateY(-5px); }
.ident-mark { width: 74%; justify-self: center; align-self: center; overflow: visible; }
.ident-face path { fill: var(--cyan); stroke: var(--cyan); stroke-width: 18; stroke-linejoin: round; }
.ident-depth-1 { fill: #962d97; transform: translate(40px, 40px); }
.ident-depth-2 { fill: #3e2866; opacity: .85; transform: translate(80px, 80px); }
.ident-word { text-align: center; font-family: var(--display); font-weight: 900; font-size: clamp(13px, 1.5vw, 18px); letter-spacing: 3px; color: #f5e7ff; line-height: 1.3; }
.ident-word span { display: block; font-family: var(--body); font-weight: 400; color: var(--pink); font-size: .58em; letter-spacing: 1.2em; margin-top: 4px; padding-left: 1.2em; }
.ident-base { display: flex; justify-content: center; gap: 0; margin-top: -2px; }
.ident-base span:first-child { width: 22%; height: 16px; background: #231d3b; clip-path: polygon(14% 0, 86% 0, 100% 100%, 0 100%); }
.ident-base span:last-child { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .js .opening-grid-floor { animation: floor 3.2s linear infinite; }
  @keyframes floor { to { background-position: 0 0, 0 48px; } }
  .ident-boot li { animation: boot .01s steps(1) both; }
  .ident-boot li:nth-child(1) { animation-delay: .15s; }
  .ident-boot li:nth-child(2) { animation-delay: .45s; }
  .ident-boot li:nth-child(3) { animation-delay: .75s; }
  .ident-boot li:nth-child(4) { animation-delay: 1.05s; }
  @keyframes boot { from { visibility: hidden; } to { visibility: visible; } }
  .ident-face path { stroke-dasharray: 1; animation: draw 1.3s cubic-bezier(.6, 0, .3, 1) 1.2s both, fillin .45s ease-out 2.4s both; }
  @keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
  @keyframes fillin { from { fill: transparent; } to { fill: var(--cyan); } }
  .ident-depth-1 { animation: extrude1 .5s cubic-bezier(.2, .8, .2, 1) 2.6s both; }
  .ident-depth-2 { animation: extrude2 .6s cubic-bezier(.2, .8, .2, 1) 2.7s both; }
  @keyframes extrude1 { from { transform: translate(0, 0); } }
  @keyframes extrude2 { from { transform: translate(0, 0); } }
  .ident-word { animation: word .7s ease-out 2.9s both; }
  @keyframes word { from { opacity: 0; letter-spacing: 12px; } }
  .ident-mark { animation: glitch .32s steps(2) 3.5s 1 both; }
  @keyframes glitch { 0% { transform: none; } 30% { transform: translateX(4px) skewX(-8deg); filter: drop-shadow(-3px 0 #ff70ca); } 60% { transform: translateX(-3px); } 100% { transform: none; filter: none; } }
  .js .ident-screen::before { animation: roll 7s linear 4s infinite; }
  @keyframes roll { to { top: 130%; } }
}

/* ------------------------------------------------------- studio section -- */
.studio h2 { scroll-margin-top: 32px; }
.studio-does { margin: 34px 0 0; display: grid; gap: 0; max-width: 640px; border-top: 1px solid #724987; }
.studio-does > div { display: grid; grid-template-columns: 190px 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid #3d2a55; }
.studio-does dt { font-family: var(--display); font-weight: 800; font-size: 14px; letter-spacing: .5px; text-transform: uppercase; color: var(--paper); line-height: 1.6; }
.studio-does dt span { display: block; font-family: var(--body); font-weight: 700; color: var(--pink); font-size: 11px; letter-spacing: 2px; }
.studio-does dd { margin: 0; font-size: 14px; line-height: 1.85; color: var(--muted); }
.studio-does a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------ the tour -- */
.tour { background: var(--office); padding-block: 84px 72px; border-top: 1px solid var(--office-line); }
.tour .eyebrow { color: var(--warm); }
.tour-intro { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: end; }
.tour-intro .eyebrow { grid-column: 1 / -1; }
.tour-intro h2 { font-family: var(--display); font-size: clamp(27px, 3.2vw, 46px); font-weight: 800; line-height: 1.3; text-transform: uppercase; }
.tour-intro h2 em { color: var(--warm); }
.tour-intro > p:not(.eyebrow) { font-size: 15px; color: var(--muted); max-width: 520px; }

.tour-stage { width: min(1280px, calc(100% - 96px)); margin: 40px auto 0; position: relative; }
.tour-camera { position: relative; overflow: hidden; aspect-ratio: 480 / 200; background: #1d1834; border: 1px solid var(--warm); box-shadow: 7px 7px 0 #272047; }
.tour-picture, .tour-art { display: block; }
.tour-camera:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
.tour-art { width: 100%; height: auto; image-rendering: pixelated; object-fit: fill; }
.tour-caption { margin-top: 12px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--warm); }
.tour-marker { display: none; }

.tour-steps { list-style: none; padding: 0; margin: 34px auto 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.tour-step article { height: 100%; padding: 22px 22px 26px; background: #171330; border: 1px solid var(--office-line); border-top: 3px solid var(--warm); }
.tour-step:nth-child(2) article { border-top-color: var(--cyan); }
.tour-step:nth-child(3) article { border-top-color: var(--pink); }
.tour-step:nth-child(4) article { border-top-color: var(--accent); }
.tour-step:nth-child(5) article { border-top-color: var(--lilac); }
.tour-step:nth-child(6) article { border-top-color: var(--cyan); }
.station-tag { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.station-tag span { color: var(--pink); margin-right: 8px; }
.station-tag span::before { content: '['; }
.station-tag span::after { content: ']'; }
.tour-step h3 { font-family: var(--display); font-size: 19px; font-weight: 800; line-height: 1.45; margin: 12px 0 12px; }
.tour-step p:not(.station-tag) { font-size: 14px; line-height: 1.9; color: var(--muted); }
.tour-step .text-link { margin-top: 16px; }

/* Live tour: the office fills the screen and the camera walks from station to station. */
.tour-live .tour-body { position: relative; }
.tour-live .tour-stage { position: sticky; top: 0; width: 100%; height: 100vh; height: 100svh; margin: 0; overflow: hidden; }
.tour-live .tour-camera { position: absolute; inset: 0; aspect-ratio: auto; border: 0; box-shadow: none; background: linear-gradient(#1d1834 0 74%, #110e20 74%); }
.tour-live .tour-picture { position: absolute; left: 0; top: 0; }
.tour-live .tour-art { width: var(--art-w, 100%); max-width: none; transform-origin: 0 0; transform: var(--cam, none); transition: transform 1.25s cubic-bezier(.65, 0, .25, 1); will-change: transform; }
.tour-live .tour-stage::before { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0 3px, #02051924 3px 4px); }
.tour-live .tour-stage::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(90deg, #0a0818cc, #0a081800 46%), linear-gradient(0deg, #0a0818aa, transparent 22%); }
.tour-live .tour-caption { position: absolute; right: 24px; bottom: 18px; z-index: 3; margin: 0; padding: 5px 10px; background: #251129; border: 1px solid var(--pink); color: #ffa8de; font-size: 9px; box-shadow: 3px 3px 0 #47204f; }
.tour-live .tour-steps { position: relative; z-index: 4; display: block; margin: -100vh auto 0; margin-top: -100svh; width: min(1280px, calc(100% - 96px)); pointer-events: none; }
.tour-live .tour-step { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; }
.tour-live .tour-step[data-side="right"] { justify-content: flex-end; }
.tour-live .tour-step[data-side="right"]:not(.is-active) article { transform: translateX(10px); }
.tour-live .tour-step article { width: min(410px, 38%); height: auto; pointer-events: auto; background: #120f22f2; box-shadow: 6px 6px 0 #0a0818; transition: opacity .5s, transform .5s; }
.tour-live .tour-step:not(.is-active) article { opacity: .38; transform: translateX(-10px); }
.tour-live .tour-marker {
  display: block; position: absolute; left: 0; top: 0; z-index: 1; width: 18px; height: 12px;
  background: var(--pink); clip-path: polygon(0 0, 100% 0, 100% 34%, 67% 34%, 67% 67%, 50% 100%, 33% 67%, 33% 34%, 0 34%);
  transform: translate(var(--mx, -99px), var(--my, -99px)); transition: transform 1.25s cubic-bezier(.65, 0, .25, 1);
  filter: drop-shadow(2px 2px 0 #47204f);
}
@media (prefers-reduced-motion: no-preference) {
  .tour-live .tour-marker { animation: marker 1s steps(2) infinite; }
  @keyframes marker { 50% { margin-top: -5px; } }
}

/* ------------------------------------------------------------ portal -- */
.portal { position: relative; --s: 1.35; --open: 1; --f: .55; --t: 1; --hint: 0; }
.portal-stage {
  --fw: clamp(118px, 13vw, 196px); --fh: calc(var(--fw) * 1.5625);
  --hw: calc(var(--fw) * .8125 * var(--s)); --hh: calc(var(--fh) * .85 * var(--s));
  position: relative; height: clamp(460px, 78vh, 700px); overflow: hidden;
}
.portal-cosmos {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 50% 50%, #fff4c5 0 .7%, #ff956b88 1.6%, transparent 7%),
    radial-gradient(ellipse 46% 10% at 50% 50%, #c98a7a55, transparent 70%),
    radial-gradient(ellipse 30% 6% at 50% 50%, #c98a7a66, transparent 70%),
    radial-gradient(1px 1px at 18% 30%, #fff 50%, transparent), radial-gradient(1px 1px at 72% 22%, #fff 50%, transparent),
    radial-gradient(1px 1px at 33% 76%, #c2c1d9 50%, transparent), radial-gradient(1px 1px at 84% 64%, #74f5ef 50%, transparent),
    radial-gradient(1px 1px at 58% 84%, #fff 50%, transparent), radial-gradient(1px 1px at 9% 58%, #ff70ca 50%, transparent),
    radial-gradient(80% 60% at 50% 50%, #241040, #05060f 70%);
  transition: opacity 1s;
}
.world-on:not(.world-in-hero) .portal-cosmos { opacity: 0; }
.portal-wall {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(var(--fw) * .75 - 1px), #231d3f calc(var(--fw) * .75 - 1px) calc(var(--fw) * .75)),
    #1d1834;
  background-position: center;
  -webkit-mask: linear-gradient(#000 0 0) center / 100% 100% no-repeat, linear-gradient(#000 0 0) center / var(--hw) var(--hh) no-repeat;
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) center / 100% 100% no-repeat exclude, linear-gradient(#000 0 0) center / var(--hw) var(--hh) no-repeat;
}
/* the floor meets the bottom of the door, wherever the door has got to */
.portal-wall::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; top: calc(50% + var(--hh) / 2); background: #110e20; border-top: 2px solid #3d3268; }
.portal-door {
  position: absolute; left: calc(50% - var(--fw) / 2); top: calc(50% - var(--fh) * .575);
  width: var(--fw); height: var(--fh); transform-origin: 50% 57.5%; transform: scale(var(--s));
}
.portal-frame { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.portal-leaf {
  position: absolute; left: 9.375%; top: 15%; width: 81.25%; height: 85%;
  transform-origin: 100% 50%; transform: perspective(calc(var(--fw) * 4)) rotateY(calc(var(--open) * 108deg));
  background:
    linear-gradient(#3a2f5c 0 0) 18% 10% / 64% 30% no-repeat,
    linear-gradient(#2a2246 0 0) 22% 13% / 56% 24% no-repeat,
    linear-gradient(#3a2f5c 0 0) 18% 78% / 64% 36% no-repeat,
    linear-gradient(#2a2246 0 0) 22% 75.5% / 56% 30% no-repeat,
    linear-gradient(var(--warm) 0 0) 12% 56% / 6% 4% no-repeat,
    #2a2246;
  box-shadow: inset 2px 0 #4b3d74;
  backface-visibility: hidden;
}
.portal-shuttle {
  position: absolute; left: 50%; top: 50%; width: clamp(160px, 22vw, 340px); height: auto; z-index: 3;
  transform: translate(calc(-50% - (1 - var(--f)) * 46vw), calc(-50% + (1 - var(--f)) * 26vh)) rotate(calc((1 - var(--f)) * -14deg)) scale(calc(1.15 - var(--f) * 1.05));
  opacity: calc(1 - max(0, var(--f) - .82) * 6);
  filter: drop-shadow(0 0 10px #74f5ef55);
}
.portal-title {
  position: absolute; inset: auto 0 9%; z-index: 4; text-align: center; pointer-events: none;
  opacity: var(--t); transform: scale(calc(.94 + var(--t) * .06));
}
.portal-kicker { display: block; font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--cyan); }
.portal-name { display: block; font-family: var(--display); font-size: clamp(40px, 7vw, 104px); font-weight: 900; line-height: 1.1; text-transform: uppercase; letter-spacing: -2px; color: #f0eafe; text-shadow: 3px 3px 0 #6a2f90; }
.portal-name em { color: var(--cyan); text-shadow: 3px 3px 0 #315f8f; }
.portal-title .working-title-label { margin-top: 6px; }
/* Still portal (no JS or reduced motion): the title stands beside the open door. */
@media (min-width: 721px) {
  html:not(.portal-live) .portal-title { inset: 50% 4% auto calc(50% + var(--fw) * .9); transform: translateY(-50%); text-align: left; }
  html:not(.portal-live) .portal-name { font-size: clamp(34px, 3.8vw, 64px); }
  html:not(.portal-live) .portal-shuttle { left: 27%; top: 64%; transform: translate(-50%, -50%) rotate(-6deg) scale(.62); }
}
.portal-hint { position: absolute; left: 0; right: 0; bottom: 4%; z-index: 4; text-align: center; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--warm); opacity: var(--hint); }

.portal-live .portal { height: 280vh; height: 280svh; }
.portal-live .portal-stage { position: sticky; top: 0; height: 100vh; height: 100svh; }
.portal-live .portal-title { inset: 50% 0 auto; transform: translateY(-50%) scale(calc(.9 + var(--t) * .1)); filter: blur(calc((1 - var(--t)) * 6px)); }

/* ------------------------------------------------- Project One chapter -- */
html:not(.world-on) .chapter-game,
.world-in-hero .chapter-game {
  background:
    radial-gradient(60% 40% at 85% 8%, #3b1a5844, transparent 70%),
    radial-gradient(50% 30% at 10% 40%, #1d3a5a40, transparent 70%),
    radial-gradient(60% 40% at 80% 75%, #2a124044, transparent 70%),
    var(--bg);
}
.chapter-game .eyebrow::before { content: ''; display: inline-block; width: 18px; height: 1px; margin-right: 12px; vertical-align: middle; background: currentColor; }
.chapter-game .project-art img { transform: none; }

/* Worked-example demos inside the science cards */
.demo { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.demo[hidden] { display: none; }
.demo-title { font-size: 12px !important; font-weight: 700; color: var(--paper) !important; text-transform: uppercase; letter-spacing: 1px; margin-top: 0 !important; }
.demo-title span { display: block; font-weight: 400; color: var(--muted); letter-spacing: .5px; text-transform: none; font-size: 11px; }
.demo-controls { display: grid; gap: 10px; margin-top: 14px; }
.demo-controls label { display: grid; grid-template-columns: 7.5em 1fr 2.2em; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.demo-controls b { color: var(--accent); text-align: right; font-weight: 700; }
.demo input[type=range] { width: 100%; accent-color: var(--cyan); height: 28px; margin: 0; background: transparent; }
.demo input[type=range]:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.demo-bars { display: grid; gap: 6px; margin-top: 14px; }
.demo-bar { display: block; height: 10px; background: #1a1d36; border: 1px solid var(--line); }
.demo-bar i { display: block; height: 100%; width: var(--w, 0%); background: var(--cyan); transition: width .3s ease; }
.demo-bar + .demo-bar i { background: var(--pink); }
.demo-out { display: block; margin-top: 12px; font-size: 13px; line-height: 1.7; color: var(--paper); }
.demo-note { font-size: 11px !important; line-height: 1.8; }

/* ------------------------------------------------ back at the office -- */
.return { padding-block: 64px 4px; border-top: 1px solid var(--office-line); position: relative; }
.return::before {
  content: ''; position: absolute; left: 0; right: 0; top: -1px; height: 8px;
  background: repeating-linear-gradient(90deg, var(--warm) 0 8px, transparent 8px 16px); opacity: .5;
}
.return .eyebrow { color: var(--warm); }
.return-line { margin-top: 10px; font-size: 14px; color: var(--muted); }
.chapter-game + .return { margin-top: 30px; }
.cost-section { padding-top: 40px; }
body > .footer { border-top-color: var(--office-line); }

/* ------------------------------------------------------- chapter rail -- */
.rail { display: none; }
@media (min-width: 1180px) {
  .rail { display: block; position: fixed; left: 16px; top: 50%; z-index: 14; transform: translateY(-50%); }
  .rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
  .rail .rail-gap { margin-top: 12px; }
  .rail a { position: relative; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
  .rail a::before { content: ''; width: 8px; height: 8px; border: 1px solid #74f5ef99; background: transparent; transition: background .2s, transform .2s; }
  .rail a[aria-current]::before { background: var(--pink); border-color: var(--pink); transform: scale(1.25); }
  .rail a span {
    position: absolute; left: 30px; top: 50%; transform: translateY(-50%); white-space: nowrap;
    padding: 4px 9px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
    background: #251129; border: 1px solid var(--pink); color: #ffa8de; box-shadow: 3px 3px 0 #47204f;
    clip-path: inset(0 100% 0 0); transition: clip-path .25s steps(6);
  }
  .rail a:hover span, .rail a:focus-visible span { clip-path: inset(-4px -4px -4px -4px); }
  .rail a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 0; }
  .rail-pause {
    margin-top: 16px; width: 24px; height: 24px; padding: 0; border: 1px solid #74f5ef99; background: #080916cc;
    color: transparent; overflow: visible; cursor: pointer; position: relative; font: 10px var(--body);
  }
  .rail-pause[hidden] { display: none; }
  .rail-pause::before { content: ''; position: absolute; left: 7px; top: 6px; width: 3px; height: 10px; background: var(--cyan); box-shadow: 6px 0 var(--cyan); }
  .rail-pause[data-state="paused"]::before { left: 8px; width: 0; height: 0; background: none; box-shadow: none; border-left: 9px solid var(--pink); border-top: 6px solid transparent; border-bottom: 6px solid transparent; top: 5px; }
  .rail-pause:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
  .rail-pause:hover::after, .rail-pause:focus-visible::after {
    content: attr(data-label); position: absolute; left: 30px; top: 50%; transform: translateY(-50%); white-space: nowrap; color: #ffa8de;
    padding: 4px 9px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; background: #251129; border: 1px solid var(--pink);
  }
}

/* ------------------------------------------------------------ reveals -- */
.reveal-live [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.reveal-live [data-reveal="wipe"] { opacity: 1; transform: none; clip-path: inset(0 100% 0 0); transition: clip-path 1.1s steps(18); }
.reveal-live [data-reveal].is-in { opacity: 1; transform: none; clip-path: inset(-20px -20px -20px -20px); }
/* Keyboard focus never waits for a fade. */
.reveal-live [data-reveal]:focus-within { opacity: 1; transform: none; clip-path: none; transition: none; }

/* ------------------------------------------------------- paused state -- */
html.motion-paused *, html.motion-paused *::before, html.motion-paused *::after {
  animation-play-state: paused !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
/* Pausing never conceals reading content while the visitor keeps scrolling. */
html.motion-paused [data-reveal] { opacity: 1 !important; transform: none !important; clip-path: none !important; }
html.motion-paused .tour-step article { opacity: 1 !important; transform: none !important; }
/* Panels stay readable until the tabs script has successfully enhanced them. */
.studio-process:not(.tabs-ready) .process-tabs { display: none; }
.studio-process:not(.tabs-ready) .process-panel { margin-top: 20px; }
.tour-live .tour-step:focus-within article { opacity: 1; transform: none; }

/* ---------------------------------------------------------- responsive -- */
@media (max-width: 1100px) {
  .opening-layout { gap: 32px; }
  .opening h1 { font-size: clamp(38px, 5.4vw, 58px); }
  .tour-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tour-stage { width: calc(100% - 64px); }
  .tour-live .tour-steps { width: calc(100% - 64px); }
  .tour-live .tour-step article { width: min(400px, 46%); }
}
@media (max-width: 720px) {
  .hero.opening { min-height: 0; }
  .opening-layout { grid-template-columns: 1fr; gap: 6px; }
  .opening .hero-content { padding-block: 48px 8px; }
  .opening h1 { font-size: clamp(32px, 9vw, 52px); }
  .opening-actions { gap: 18px 24px; }
  .ident { width: min(100%, 330px); padding-bottom: 96px; }
  .ident-screen { border-width: 9px; padding: 16px 18px 18px; }
  .ident-boot { font-size: 9px; }
  .studio-does > div { grid-template-columns: 1fr; gap: 6px; }
  .tour { padding-block: 56px 52px; }
  .tour-intro { grid-template-columns: 1fr; gap: 18px; }
  .tour-stage { width: calc(100% - 40px); margin-top: 28px; }
  .tour-camera { aspect-ratio: auto; overflow-x: auto; scrollbar-color: var(--warm) #1d1834; }
  .tour-picture, .tour-art { width: 576px; height: 240px; max-width: none; }
  .tour-steps { grid-template-columns: 1fr; gap: 14px; }
  .tour-live .tour-camera { overflow: hidden; height: auto; }
  .tour-live .tour-picture { width: auto; height: auto; }
  .tour-live .tour-art { width: var(--art-w, 100%); height: auto; }
  .tour-live .tour-stage::after { background: linear-gradient(0deg, #0a0818f0, #0a081800 52%); }
  .tour-live .tour-steps { width: calc(100% - 32px); }
  .tour-live .tour-step { align-items: flex-end; padding-bottom: 5svh; }
  .tour-live .tour-step article { width: 100%; padding: 18px 18px 20px; }
  .tour-live .tour-step:not(.is-active) article { transform: translateY(12px); }
  .tour-live .tour-caption { top: 12px; bottom: auto; right: 12px; left: 12px; text-align: center; }
  .portal-stage { --fw: clamp(104px, 28vw, 150px); height: 520px; }
  .portal-name { font-size: clamp(34px, 11vw, 56px); letter-spacing: -1px; }
  .return { padding-top: 48px; }
}

@media print {
  .rail, .portal, .world-canvas, .world-scan, .world-hud, .ident-boot { display: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; clip-path: none !important; }
}

@media (forced-colors: active) {
  .tour-camera, .ident-screen { forced-color-adjust: none; }
  .portal { display: none; }
  .rail a::before { border-color: LinkText; }
  .rail a[aria-current]::before { background: Highlight; }
  .demo-bar i { background: Highlight; }
  /* The rail is decoration-heavy; header navigation and the footer's Pause visuals cover it here. */
  .rail { display: none !important; }
}

/* Keep the generated-world disclosure in the document flow on narrow screens.
   Desktop retains the fixed HUD; mobile text and controls can no longer sit under it. */
@media (max-width: 720px) {
  .chapter-game > .world-hud {
    position: static; inset: auto; max-width: none; width: auto;
    margin: 0 20px 24px; display: none;
  }
  .world-on .chapter-game > .world-hud { display: block; }
}

/* A scroll-led brand transition. The static/no-JS version is a complete vector mark. */
.studio-transit { --draw: 1; --recede: 0; --wire: 1; --grid: .55; --arrival: 0; position: relative; background: #090818; }
.transit-stage { position: relative; isolation: isolate; height: clamp(360px, 68svh, 660px); overflow: hidden; display: grid; place-items: center; background: linear-gradient(#090818, #120f22); }
.transit-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 42%, #49336570, transparent 60%); opacity: calc(1 - var(--arrival)); }
.transit-grid { position: absolute; inset: 0; width: 100%; height: 100%; color: #74f5ef; opacity: var(--grid); transform: translateY(calc(var(--recede) * -28px)); }
.transit-logo { width: clamp(220px, 45vw, 620px); z-index: 2; transform: translateY(calc(var(--recede) * -90px)) scale(calc(1 - var(--recede) * .82)); opacity: var(--wire); }
.transit-logo svg { display: block; width: 100%; overflow: visible; filter: drop-shadow(0 0 7px #74f5ef80) drop-shadow(0 0 20px #b494f340); }
.transit-logo path { fill: #17182b; fill-opacity: calc(.6 * var(--draw)); stroke: #74f5ef; stroke-width: 9; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--draw)); }
.transit-arrival { position: absolute; inset: 0; z-index: 3; background: linear-gradient(#120f2200 20%, #120f2280 80%), url('art/office-still.svg') center / cover no-repeat; image-rendering: pixelated; opacity: var(--arrival); }
.transit-live .studio-transit { height: 170vh; height: 170svh; }
.transit-live .transit-stage { position: sticky; top: 0; height: 100vh; height: 100svh; }
@media(max-width:720px) { .transit-logo { width: 70vw; max-width: 440px; }.transit-live .studio-transit { height: 145vh; height: 145svh; } }
@media(prefers-reduced-motion:reduce) { .transit-logo svg { filter: none; } }
@media print { .studio-transit { display: none; } }

/* Small, unaltered gameplay captures; ordinary links work without JavaScript. */
.prototype-gallery { margin-top: 42px; padding-top: 30px; border-top: 1px solid var(--line); }
.gallery-heading h3 { font-family: var(--display); font-size: clamp(20px,2.4vw,28px); line-height: 1.5; margin: 12px 0; }
.gallery-heading>p:last-child { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.gallery-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; }
.gallery-grid figure { margin: 0; min-width: 0; border: 1px solid var(--line); background: #0c0c19; }
.gallery-grid a { display: block; background: #000; }
.gallery-grid a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
.gallery-grid img { display: block; width: 100%; height: auto; aspect-ratio: 16/10; object-fit: contain; }
.gallery-grid figcaption { padding: 17px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.gallery-grid figcaption strong { display: block; color: var(--cyan); font-size: 14px; margin-bottom: 7px; }
@media(max-width:800px) { .gallery-grid { grid-template-columns: 1fr; gap: 22px; }.gallery-grid figcaption { font-size: 14px; } }

/* Current prototype captures retain the full interface in every viewport. */
.first-look-feature { grid-template-columns: minmax(0,1.7fr) minmax(240px,1fr); }
.first-look-feature figure>a { aspect-ratio: auto; }
.first-look-feature figure>a>img { display:block; width:100%; height:auto; object-fit:contain; }
.first-look-feature > div > p + p { margin-top: 14px; }
@media(max-width:800px) { .first-look-feature { grid-template-columns:1fr; } }

/* Latest authentic playtest captures: full frames, never cropped. */
.latest-playtest-gallery .gallery-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.latest-playtest-gallery .gallery-grid img { aspect-ratio: 16/9; object-fit: contain; }
@media(max-width:800px) { .latest-playtest-gallery .gallery-grid { grid-template-columns: 1fr; } }

/* Curated development journal: chronological, image-led, full-frame captures. */
.development-journal { margin-top: 88px; scroll-margin-top: 110px; }
.journal-heading { max-width: 760px; margin-bottom: 42px; }
.journal-heading h3 { font-size: clamp(28px,4vw,48px); line-height: 1.15; margin: 12px 0 18px; }
.journal-heading p { color: var(--muted); line-height: 1.8; }
.journal-chapter { position: relative; margin: 0 0 56px; padding-left: 28px; border-left: 1px solid var(--line); }
.journal-chapter::before { content: ''; position: absolute; left: -4px; top: 8px; width: 7px; height: 7px; background: var(--cyan); border-radius: 50%; }
.journal-date { color: var(--cyan); font-family: var(--display); font-size: 12px; letter-spacing: 1.3px; text-transform: uppercase; margin-bottom: 12px; }
.journal-chapter h4 { font-family: var(--display); font-size: clamp(21px,2.7vw,30px); line-height: 1.3; margin: 0 0 12px; }
.journal-intro { max-width: 730px; color: var(--muted); line-height: 1.8; margin: 0 0 24px; }
.journal-images { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.journal-image { min-width: 0; margin: 0; border: 1px solid var(--line); background: #0c0c19; }
.journal-image.journal-hero { grid-column: 1 / -1; }
.journal-image a { display: block; background: #000; }
.journal-image a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 5px; }
.journal-image img { display: block; width: 100%; height: auto; object-fit: contain; }
.journal-image figcaption { padding: 16px 20px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.journal-image figcaption strong { display: block; color: var(--cyan); font-size: 14px; margin-bottom: 4px; }
.journal-star { border-left-color: var(--warm); }
.journal-star::before { background: var(--warm); box-shadow: 0 0 18px #ffd78955; }
.journal-star .journal-date,.journal-star figcaption strong { color: var(--warm); }
@media(max-width:800px) {
 .development-journal { margin-top: 60px; }
 .journal-chapter { padding-left: 18px; margin-bottom: 40px; }
 .journal-images { grid-template-columns: 1fr; gap: 18px; }
 .journal-image figcaption { padding: 14px 16px; }
}

.journal-star .journal-images { grid-template-columns: minmax(0,1.25fr) minmax(0,1fr); align-items: center; }
@media(max-width:800px) { .journal-star .journal-images { grid-template-columns: 1fr; } }
