/* Playground · deep-space theme, in the spirit of Interstellar: near-total black, warm accretion light, a planet's dark
   crescent above, a cockpit deck below, wide-tracked serif capitals like the film's title card. Light-speed warp on
   arrival and between pages (stars.js). Shared by playground.html and pg/. */
:root {
  --void: #000; --ink: #EDE7DD; --muted: #C2BCB1; --faint: #8A847A; --line: rgba(237,231,221,.12); --glass: rgba(255,250,240,.035);
  --sun: #E9C08A; --ion: #A9C1D6; --plasma: #C9A77A; --mint: #B9D2C4;
  --disp: "Cormorant Garamond", "Times New Roman", serif; --sans: "Inter Tight", system-ui, sans-serif; --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--void); scroll-behavior: smooth; }
body { min-height: 100vh; color: var(--ink); font: 400 16.5px/1.6 var(--sans); background: var(--void); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.nebula { position: fixed; inset: -20%; z-index: 0; pointer-events: none; opacity: .55;
  background: radial-gradient(40% 35% at 20% 30%, rgba(124,64,255,.22), transparent 70%), radial-gradient(35% 30% at 80% 70%, rgba(0,180,255,.14), transparent 70%), radial-gradient(30% 25% at 60% 15%, rgba(255,120,80,.08), transparent 70%);
  animation: drift 160s linear infinite alternate; }
@keyframes drift { to { transform: translate3d(-1.5%, 1%, 0); } }
.wrap { position: relative; z-index: 1; width: min(1120px, 100% - 40px); margin: 0 auto; }

/* Top */
.pg-top { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; height: 68px; }
.pg-top a { text-decoration: none; font: 500 14px var(--sans); color: var(--muted); } .pg-top a:hover { color: var(--ink); }
.pg-top .coord { font: 400 11px var(--mono); letter-spacing: .18em; color: var(--faint); }

/* Hero */
.pg-hero { min-height: calc(100vh - 68px); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding-bottom: 60px; }
.kicker { font: 400 12px var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--ion); }
.pg-hero h1 { margin-top: 18px; font: 700 clamp(56px, 11vw, 150px)/.9 var(--disp); letter-spacing: -.05em;
  background: linear-gradient(180deg, #fff 30%, #B9B2FF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { margin-top: 22px; max-width: 46ch; font-size: clamp(17px, 1.7vw, 20px); color: var(--muted); }
.cue { margin-top: 44px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; text-decoration: none; color: var(--muted); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(6px); } }
body.arrive main { animation: arrive 1s cubic-bezier(.16,1,.3,1) both; }
@keyframes arrive { from { opacity: 0; transform: scale(1.04); } }

/* Section heads */
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin: 40px 0 26px; padding-top: 30px; border-top: 1px solid var(--line); }
.sec-h h2 { font: 600 clamp(26px, 3vw, 36px)/1.1 var(--disp); letter-spacing: -.03em; }
.sec-h p { font: 400 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }

/* Missions (case study cards) */
.missions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.mission { position: relative; display: flex; flex-direction: column; min-height: 420px; padding: 24px; border-radius: 22px; text-decoration: none; overflow: hidden;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .5s cubic-bezier(.16,1,.3,1), border-color .3s, background .3s; }
.mission:hover { transform: translateY(-6px); border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.08); }
.planet { position: relative; height: 170px; margin: -4px -4px 22px; }
.planet i { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, var(--p1), var(--p2) 60%, #05040c 100%); box-shadow: 0 0 60px -8px var(--p1); transition: transform .8s cubic-bezier(.16,1,.3,1); }
.planet b { position: absolute; left: 50%; top: 50%; width: 210px; height: 56px; margin: -28px 0 0 -105px; border-radius: 50%; border: 2px solid var(--p3, rgba(255,255,255,.35)); transform: rotate(-16deg); }
.mission:hover .planet i { transform: scale(1.06) rotate(-10deg); }
.mission small { font: 400 11px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ion); }
.mission h3 { margin-top: 10px; font: 600 24px/1.15 var(--disp); letter-spacing: -.02em; }
.mission p { margin-top: 10px; color: var(--muted); font-size: 15px; }
.mission .go { margin-top: auto; padding-top: 18px; font: 500 14px var(--sans); color: var(--ink); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; } .tags span { font: 400 11px var(--mono); padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }

/* Toys, restyled as cockpit panels */
.toys { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; padding-bottom: 60px; }
.toy { background: rgba(14,12,32,.72); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.toy-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font: 700 12px var(--mono); color: var(--ink); }
.toy-bar i { width: 9px; height: 9px; border-radius: 50%; background: #ff6b6b; } .toy-bar i + i { background: #ffd166; } .toy-bar i + i + i { background: #06d6a0; }
.toy-bar em { margin-left: auto; font-style: normal; font-weight: 400; color: var(--faint); font-size: 11px; }
.toy-body { position: relative; padding: 16px; flex: 1; min-height: 240px; color: var(--ink); }
.toy-hint { padding: 10px 14px; border-top: 1px solid var(--line); font: 400 12.5px var(--sans); color: var(--muted); }
.tbtn { font: 700 11.5px var(--mono); border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.tbtn:hover { border-color: rgba(255,255,255,.35); } .tbtn.on { background: var(--ink); color: #0b0a1c; }
.rl-area { position: relative; height: 230px; border-radius: 10px; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 10px 10px; }
.rl-box { position: absolute; width: 80px; height: 56px; border-radius: 8px; cursor: grab; display: grid; place-items: center; font: 700 11px var(--mono); color: #0b0a1c; touch-action: none; user-select: none; }
.rl-box.a { background: var(--ion); } .rl-box.b { background: var(--sun); }
.rl-line { position: absolute; background: #ff5d8f; pointer-events: none; } .rl-lbl { position: absolute; font: 700 11px var(--mono); background: #ff5d8f; color: #fff; padding: 1px 6px; border-radius: 4px; pointer-events: none; transform: translate(-50%, -50%); white-space: nowrap; }
.cc-sample { border-radius: 12px; padding: 18px; font-size: 22px; font-weight: 700; text-align: center; transition: background .2s, color .2s; }
.cc-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.cc-row input[type=color] { width: 44px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0; background: none; cursor: pointer; }
.cc-ratio { font: 700 30px var(--mono); margin-left: auto; } .badge-t { font: 700 11px var(--mono); border-radius: 999px; padding: 3px 9px; }
.badge-t.pass { background: var(--mint); color: #0b0a1c; } .badge-t.fail { background: #ff5d8f; color: #fff; }
.ez-track { position: relative; height: 54px; border-bottom: 1px dashed var(--line); margin: 6px 0 10px; }
.ez-ball { position: absolute; left: 0; top: 10px; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--sun) 55%, #b8590b); box-shadow: 0 0 22px -2px var(--sun); }
.ez-curve { width: 100%; height: 90px; } .ez-curve path { stroke: var(--ion); } .ez-btns { display: flex; flex-wrap: wrap; gap: 6px; } .ez-code { margin-top: 10px; font: 12px var(--mono); color: var(--muted); }
.ts-ctrl { display: flex; gap: 14px; align-items: center; font: 12px var(--mono); flex-wrap: wrap; color: var(--muted); } .ts-ctrl input[type=range] { accent-color: var(--ion); }
.ts-out { margin-top: 10px; display: grid; gap: 4px; } .ts-out div { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; overflow: hidden; } .ts-out small { font: 11px var(--mono); color: var(--faint); width: 64px; flex: none; }
.cw-area { position: relative; height: 250px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px dashed var(--line); cursor: crosshair; overflow: hidden; }
.cw-note { position: absolute; width: 130px; min-height: 80px; padding: 10px; font: 600 14px/1.25 var(--sans); color: #0b0a1c; border-radius: 4px; box-shadow: 0 10px 20px -8px rgba(0,0,0,.6); cursor: grab; touch-action: none; user-select: none; animation: pop .25s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.4) rotate(var(--r)); } to { transform: scale(1) rotate(var(--r)); } }
.cw-empty { position: absolute; inset: 0; display: grid; place-items: center; font: 400 15px var(--sans); color: var(--faint); pointer-events: none; }
.gs-area { position: relative; height: 230px; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.03); border: 1px dashed var(--line); }
.gs-dot { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 8px var(--ion); transition: transform .5s cubic-bezier(.2,1.4,.4,1), left .5s cubic-bezier(.2,1.4,.4,1), top .5s cubic-bezier(.2,1.4,.4,1); }

.pg-foot { padding: 50px 0 60px; color: var(--faint); font: 400 12px var(--mono); letter-spacing: .1em; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.pg-foot a { color: var(--muted); text-decoration: none; } .pg-foot a:hover { color: var(--ink); }

/* ---------- Case study pages (pg/*.html) ---------- */
.cs-hero { padding: 90px 0 50px; max-width: 860px; }
.cs-hero h1 { margin-top: 16px; font: 700 clamp(40px, 6.4vw, 84px)/.95 var(--disp); letter-spacing: -.05em; }
.cs-hero .lede { margin-left: 0; text-align: left; max-width: 58ch; }
.meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 34px 0 0; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.meta div { padding: 14px 16px; background: rgba(10,9,26,.85); } .meta small { display: block; font: 400 10.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); } .meta b { display: block; margin-top: 4px; font: 500 15px var(--sans); }
.note { margin-top: 18px; padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(255,180,94,.35); background: rgba(255,180,94,.08); color: #FFD9AE; font-size: 14.5px; }
.cs { max-width: 760px; }
.cs section { padding: 46px 0 6px; }
.cs h2 { font: 600 clamp(24px, 2.6vw, 32px)/1.15 var(--disp); letter-spacing: -.025em; }
.cs h2 + p, .cs h3 + p { margin-top: 14px; }
.cs h3 { margin-top: 30px; font: 600 18px var(--sans); color: var(--ink); }
.cs p { margin-top: 14px; color: #CFCBEA; }
.cs ul, .cs ol { margin: 14px 0 0 20px; color: #CFCBEA; } .cs li { margin-top: 8px; } .cs li::marker { color: var(--ion); }
.cs b, .cs strong { color: var(--ink); }
.cs code { font: 13.5px var(--mono); background: rgba(255,255,255,.07); padding: 1px 6px; border-radius: 5px; color: var(--mint); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 22px; }
.stat { padding: 16px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); } .stat b { display: block; font: 600 28px/1 var(--disp); letter-spacing: -.03em; color: var(--ink); } .stat span { display: block; margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.spec { width: 100%; margin-top: 18px; border-collapse: collapse; font-size: 14px; }
.spec th, .spec td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; } .spec th { font: 400 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); } .spec td { color: #CFCBEA; } .spec td:first-child { color: var(--ink); font-weight: 500; }
.spec-wrap { overflow-x: auto; }
.demo { margin: 26px 0 0; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #0b0a1c; }
.demo .bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font: 400 12px var(--mono); color: var(--muted); }
.demo .bar a { color: var(--ion); text-decoration: none; }
.demo iframe { display: block; width: 100%; height: min(78vh, 760px); border: 0; background: #f4f4f1; }
.pull { margin: 30px 0 0; padding-left: 18px; border-left: 2px solid var(--plasma); font: 500 clamp(19px, 2vw, 23px)/1.4 var(--sans); color: var(--ink); }
.next { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 70px 0 0; padding: 26px; border-radius: 20px; border: 1px solid var(--line); background: var(--glass); text-decoration: none; }
.next small { font: 400 11px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--faint); } .next b { display: block; margin-top: 4px; font: 600 22px var(--disp); }
.next:hover { border-color: rgba(255,255,255,.3); }

@media (max-width: 900px) { .missions { grid-template-columns: 1fr; } .mission { min-height: 0; } .meta { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .toys { grid-template-columns: 1fr; } .pg-top .coord { display: none; } .cs-hero { padding-top: 50px; } .demo iframe { height: 70vh; } }
@media (prefers-reduced-motion: reduce) { .nebula, .cue { animation: none; } body.arrive main { animation: none; } .mission, .planet i { transition: none; } }

/* ---------- Case-study figures ---------- */
.cs a { color: var(--ion); }
.shot, .paper { margin: 26px 0 0; }
.shot img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); background: #FBF8F2; }
.shot.wide { max-width: 1120px; margin-top: 10px; } .shot.wide img { border-radius: 18px; }
.shot figcaption, .paper figcaption, .strip figcaption, .cap { margin-top: 10px; font: 400 12.5px var(--mono); color: var(--faint); letter-spacing: .02em; }
.paper { padding: 18px 18px 14px; border-radius: 14px; background: #FBF8F2; color: #1B1512;
  background-image: linear-gradient(rgba(27,21,18,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(27,21,18,.05) 1px, transparent 1px); background-size: 20px 20px; box-shadow: 0 20px 40px -24px rgba(0,0,0,.7); }
.paper svg { display: block; width: 100%; height: auto; }
.paper figcaption { color: #6f675f; }
.board { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 22px; }
.board .tile { padding: 16px 18px; border-radius: 14px; background: #FBF8F2; color: #1B1512; transform: rotate(var(--r, -.6deg)); box-shadow: 0 14px 26px -18px rgba(0,0,0,.8); }
.board .tile:nth-child(2) { --r: .8deg; background: #FFF4D6; } .board .tile:nth-child(3) { --r: .4deg; background: #E6F0FB; } .board .tile:nth-child(4) { --r: -.9deg; background: #F3E8FF; }
.board b { display: block; font: 700 15px var(--sans); } .board span { display: block; margin-top: 6px; font-size: 14.5px; line-height: 1.5; color: #3a332d; }
.strip { display: grid; gap: 10px; margin-top: 22px; } .strip.six { grid-template-columns: repeat(6, 1fr); } .strip.four { grid-template-columns: repeat(4, 1fr); }
.strip figure { margin: 0; } .strip img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: #FBF8F2; }
.strip figcaption { text-align: center; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .pair .shot { margin-top: 22px; }
.mspec { margin-top: 22px; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--glass); }
.ms-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; } .ms-h b { font: 600 18px var(--disp); } .ms-h span { font: 400 12px var(--mono); color: var(--muted); }
.ms-states { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; max-width: 360px; } .ms-states figure { margin: 0; } .ms-states img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; } .ms-states figcaption { font: 400 11px var(--mono); color: var(--faint); margin-top: 6px; text-align: center; }
@media (max-width: 720px) { .strip.six { grid-template-columns: repeat(3, 1fr); } .strip.four, .pair, .board { grid-template-columns: 1fr 1fr; } .board { grid-template-columns: 1fr; } }

/* ---------- Motion bench (pg/bench.js) ---------- */
.bench { margin-top: 24px; border-radius: 20px; border: 1px solid var(--line); background: rgba(10,9,26,.75); overflow: hidden; }
.b-grid { display: grid; grid-template-columns: 1.05fr 1fr; }
.b-left { padding: 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.b-stage { --dur: 450ms; --delay: 80ms; --lid: -38deg; --lift: 6px; --tilt: -3deg; --s0: .28; --ease: cubic-bezier(.25,1.45,.45,1); --wob: 9deg; --fade: 180ms;
  height: 340px; border-radius: 14px; display: grid; place-items: end center; padding-bottom: 54px; background: #FBF8F2;
  background-image: linear-gradient(rgba(27,21,18,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(27,21,18,.05) 1px, transparent 1px); background-size: 20px 20px; }
.b-ball { position: relative; width: 112px; height: 112px; filter: drop-shadow(3px 3px 0 #1B1512); --b: #E23744; }
.b-ball > span { position: absolute; }
.b-lid, .b-base { left: 0; right: 0; height: 50%; border: 2px solid #1B1512; }
.b-lid { top: 0; z-index: 1; border-bottom: 0; border-radius: 56px 56px 0 0; transform-origin: 8% 100%; background: radial-gradient(rgba(255,255,255,.28) 2.4px, transparent 3px) 0 0 / 13px 13px, var(--b);
  transition: transform calc(var(--dur) * .9) cubic-bezier(.3,1.5,.5,1) var(--delay); }
.b-base { bottom: 0; z-index: 3; border-top: 0; border-radius: 0 0 56px 56px; background: #F6F4EF; }
.b-band { z-index: 5; left: 0; right: 0; top: 50%; height: 10px; margin-top: -5px; background: #1B1512; }
.b-knob { z-index: 6; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: #fff; border: 3px solid #1B1512; box-shadow: 0 0 0 3px var(--b) inset; display: grid; place-items: center; }
.b-knob img { width: 60%; }
.b-card { z-index: 2; left: 50%; bottom: 50%; width: 172px; height: 240px; opacity: 0; transform: translate(-50%, 70px) scale(var(--s0));
  transition: transform var(--dur) var(--ease), opacity var(--fade) linear; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: #F2C14E; border: 2px solid #1B1512; border-radius: 12px; color: #1B1512; font-family: "Hanken Grotesk", "Space Grotesk", sans-serif; }
.b-ball.open .b-card { opacity: 1; transform: translate(-50%, var(--lift)) rotate(var(--tilt)) scale(1); }
.b-ball.open .b-lid { transform: rotate(var(--lid)); }
.b-ball.open { animation: bwob var(--dur) ease-in-out; }
@keyframes bwob { 20% { rotate: calc(var(--wob) * -1); } 45% { rotate: calc(var(--wob) * .78); } 70% { rotate: calc(var(--wob) * -.44); } }
.b-card .h { display: flex; justify-content: space-between; font: 800 13px var(--sans); } .b-card .art { height: 66px; border: 1.5px solid #1B1512; border-radius: 7px; background: radial-gradient(rgba(255,255,255,.28) 2.4px, transparent 3px) 0 0 / 13px 13px, var(--b); display: grid; place-items: center; }
.b-card .art i { width: 42px; height: 42px; border-radius: 50%; background: #fff; border: 2px solid #1B1512; display: grid; place-items: center; } .b-card .art img { width: 62%; }
.b-card .ty { font: 700 10px var(--sans); letter-spacing: .03em; } .b-card .tx { flex: 1; background: #FFFDF8; border: 1.5px solid #1B1512; border-radius: 7px; padding: 7px; font: 600 13px/1.3 var(--sans); }
.b-card .ft { display: flex; justify-content: space-between; font: 500 10.5px var(--sans); }
.b-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.b-btns button, .b-tabs button { font: 600 12px var(--mono); border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--ink); border-radius: 999px; padding: 7px 13px; cursor: pointer; }
.b-btns button:hover, .b-tabs button:hover { border-color: rgba(255,255,255,.4); } .b-btns button.on, .b-tabs button.on { background: var(--ink); color: #0b0a1c; }
.b-curve { width: 100%; height: auto; background: rgba(255,255,255,.03); border-radius: 12px; border: 1px solid var(--line); }
.b-curve .grid { stroke: rgba(255,255,255,.08); } .b-curve .c { fill: none; stroke: var(--ion); stroke-width: 3; } .b-curve line.h1, .b-curve line.h2 { stroke: rgba(255,255,255,.35); stroke-dasharray: 3 4; }
.b-curve .p1, .b-curve .p2 { fill: var(--sun); } .b-curve .dot { fill: #fff; } .b-curve text { fill: var(--faint); font: 10px var(--mono); }
.b-levers { padding: 16px 18px; display: grid; gap: 12px; align-content: start; }
.lv { display: grid; gap: 4px; } .lv-t { display: flex; justify-content: space-between; } .lv-t b { font: 600 13.5px var(--sans); } .lv-t output { font: 400 12.5px var(--mono); color: var(--sun); }
.lv input { width: 100%; accent-color: var(--ion); } .lv small { font-size: 12px; color: var(--faint); }
.b-code { border-top: 1px solid var(--line); padding: 14px 16px 16px; }
.b-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.b-code pre { margin: 0; padding: 12px 14px; border-radius: 10px; background: #07060f; border: 1px solid var(--line); color: #CFCBEA; font: 12px/1.6 var(--mono); white-space: pre-wrap; max-height: 260px; overflow: auto; }
.b-plain { margin: 10px 0 0; font-size: 14.5px; color: #CFCBEA; } .b-plain b { color: var(--sun); }
/* before / after pipeline */
.lanes { display: grid; gap: 14px; margin-top: 22px; }
.lane { padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--glass); }
.lane > b { display: block; font: 600 14px var(--sans); margin-bottom: 10px; } .lane > b span { font: 400 12px var(--mono); color: var(--faint); margin-left: 8px; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.steps i { font-style: normal; color: var(--faint); }
.st2 { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid var(--line); font-size: 13.5px; }
.st2 em { font: 700 10px var(--mono); font-style: normal; padding: 1px 6px; border-radius: 999px; background: #3a3560; color: #d9d4ff; } .st2 em.ai { background: #1f4a3f; color: #9ff0cf; } .st2 em.both { background: #4a3a1f; color: #ffd9a0; }
.plan4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.plan4 div { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); } .plan4 small { display: block; font: 400 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); } .plan4 p { margin: 6px 0 0 !important; font-size: 14px; color: #CFCBEA; }
@media (max-width: 860px) { .b-grid { grid-template-columns: 1fr; } .b-left { border-right: 0; border-bottom: 1px solid var(--line); } .plan4 { grid-template-columns: 1fr 1fr; } }


/* ================= Interstellar layer ================= */
body { background: #000; font-weight: 400; }
.nebula { opacity: .18; background: radial-gradient(50% 35% at 70% 40%, rgba(233,192,138,.08), transparent 70%); animation: none; }
.wrap { width: min(1080px, 100% - 48px); }
.pg-top a, .pg-top .coord { font: 400 11px var(--mono); letter-spacing: .32em; text-transform: uppercase; color: var(--muted); }
.kicker { font: 400 11px var(--mono); letter-spacing: .5em; color: var(--sun); text-align: center; }
.pg-hero { min-height: 100vh; padding-top: 18vh; padding-bottom: 30vh; }
.pg-hero h1, .cs-hero h1 { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--ink);
  font: 500 clamp(32px, 5.1vw, 74px)/1.15 var(--disp); letter-spacing: .32em; margin-right: -.32em; text-transform: uppercase; text-shadow: 0 0 40px rgba(233,192,138,.15); }
.pg-hero h1::after { content: none; }
.lede { margin-left: auto; margin-right: auto; text-align: center; color: #E4DED3; font-weight: 400; font-size: clamp(16px, 1.5vw, 19px); text-shadow: 0 1px 12px #000, 0 0 2px #000; }
.pg-hero h1 { max-width: none; text-wrap: balance; }
.cs p, .cs li, .mission p, .exp p { color: #D6D1C7 !important; font-weight: 400; text-shadow: 0 1px 8px rgba(0,0,0,.9); }
.mission .ill { display: block; width: 100%; height: 210px; margin: 0 0 14px; }
.cue { border-radius: 50%; border-color: rgba(237,231,221,.25); }
.sec-h { justify-content: center; flex-direction: column; align-items: center; text-align: center; border-top: 0; margin-top: 70px; gap: 6px; }
.sec-h h2, .cs h2 { font: 500 clamp(22px, 2.4vw, 30px)/1.2 var(--disp); letter-spacing: .42em; text-transform: uppercase; }
.sec-h p { font: 400 10.5px var(--mono); letter-spacing: .4em; color: var(--faint); text-transform: uppercase; }
/* Glass cards: the visual leads, the words are few */
.missions, .exps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; justify-content: center; }
.mission, .exp { position: relative; min-height: 0; padding: 0 0 20px; border-radius: 14px; text-align: center; overflow: hidden; text-decoration: none;
  background: linear-gradient(180deg, rgba(255,250,240,.06), rgba(255,250,240,.015)); border: 1px solid rgba(237,231,221,.1);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); transition: transform .6s cubic-bezier(.16,1,.3,1), border-color .4s; }
.mission:hover, .exp:hover { transform: translateY(-6px); border-color: rgba(233,192,138,.35); }
.mission::before, .exp::before { content: none; }
.mission .planet { height: 210px; margin: 0 0 14px; background: radial-gradient(60% 70% at 50% 100%, rgba(233,192,138,.08), transparent 70%); }
.planet i { width: 132px; height: 132px; margin: -66px 0 0 -66px; background: radial-gradient(circle at 30% 28%, var(--p1), var(--p2) 55%, #000 100%); box-shadow: 0 0 70px -18px var(--p1); filter: saturate(.7); }
.planet b { border-color: rgba(233,192,138,.4); width: 250px; margin-left: -125px; }
.mission small, .exp small { display: block; font: 400 10px var(--mono); letter-spacing: .38em; color: var(--faint); text-transform: uppercase; }
.mission h3, .exp h3 { margin-top: 10px; font: 500 21px/1.2 var(--disp); letter-spacing: .32em; text-transform: uppercase; }
.mission p, .exp p { margin: 8px auto 0; padding: 0 20px; max-width: 34ch; color: var(--muted); font-size: 14px; }
.mission .tags, .exp .tags { display: none; }
.mission .go, .exp .go { display: block; margin-top: 14px; padding: 0; font: 400 10.5px var(--mono); letter-spacing: .32em; text-transform: uppercase; color: var(--sun); }
.exp { display: block; } .exp .viz { width: 100%; height: 210px; margin: 0 0 14px; display: block; background: radial-gradient(60% 70% at 50% 100%, rgba(169,193,214,.07), transparent 70%); }
.toy { border-radius: 14px; background: linear-gradient(180deg, rgba(255,250,240,.05), rgba(255,250,240,.012)); border: 1px solid rgba(237,231,221,.1); backdrop-filter: blur(14px); }
.toy-bar { font: 400 11px var(--mono); letter-spacing: .1em; } .toy-bar i { background: rgba(237,231,221,.3); } .toy-bar i + i { background: var(--sun); } .toy-bar i + i + i { background: var(--ion); }
.tbtn { border-radius: 999px; }
.cs-hero { text-align: center; margin: 0 auto; } .cs-hero .lede { text-align: center; margin: 22px auto 0; } .cs-hero h1 { font-size: clamp(32px, 5vw, 70px); letter-spacing: .38em; margin-right: -.38em; line-height: 1.15; }
.meta { border-radius: 14px; } .meta div { background: rgba(0,0,0,.7); } .meta small { font-family: var(--mono); letter-spacing: .2em; }
.note { border-radius: 10px; }
.stat b { font: 500 34px var(--disp); }
.next b { font: 500 24px var(--disp); letter-spacing: .3em; text-transform: uppercase; }
.pg-foot { font: 400 10.5px var(--mono); letter-spacing: .3em; text-transform: uppercase; justify-content: center; text-align: center; }
main, .pg-top { position: relative; z-index: 3; }

/* Scenery: planet crescent above, cockpit deck below, diagnostics on the right (built in stars.js) */
.sky-planet { position: fixed; left: 50%; top: 0; z-index: 1; width: 100vw; max-width: none; height: 24vh; transform: translateX(-50%); pointer-events: none; image-rendering: auto; }
.deck { position: fixed; left: 0; right: 0; bottom: 0; height: 30vh; z-index: 2; pointer-events: none; }
.deck .sweep { transform-origin: 600px 363px; animation: sweep 4s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.deck svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.diag { position: fixed; right: 18px; top: 56vh; width: 168px; height: 26vh; z-index: 2; overflow: hidden; pointer-events: none; opacity: .5;
  -webkit-mask: linear-gradient(transparent, #000 18%, #000 82%, transparent); mask: linear-gradient(transparent, #000 18%, #000 82%, transparent); }
.diag pre { margin: 0; font: 400 9px/1.75 var(--mono); color: var(--ion); letter-spacing: .06em; white-space: pre; animation: diag 40s linear infinite; }
@keyframes diag { to { transform: translateY(-50%); } }
.warp-ring { position: fixed; left: 50%; top: 50%; z-index: 40; width: 40vmax; height: 40vmax; margin: -20vmax 0 0 -20vmax; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, transparent 40%, rgba(233,192,138,.35) 52%, transparent 60%); animation: ringOut 1.3s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes ringOut { from { transform: scale(.05); opacity: 1; } to { transform: scale(3.2); opacity: 0; } }
body.leaving main, body.leaving .pg-top { transition: opacity .55s ease-in, filter .55s ease-in, transform .7s ease-in; opacity: 0; filter: blur(6px); transform: scale(.94); }
body.leaving::after { content: ""; position: fixed; inset: 0; z-index: 60; background: radial-gradient(circle, transparent 0%, #000 70%); animation: fadeBlack .75s ease-in forwards; }
@keyframes fadeBlack { from { opacity: 0; } to { opacity: 1; } }
body.arrive main { animation: arrive 1.4s cubic-bezier(.16,1,.3,1) both; }
body.from-portal main, body.from-portal .pg-top { animation: arrive 1.2s cubic-bezier(.16,1,.3,1) .7s both; }
@keyframes arrive { from { opacity: 0; transform: scale(1.08); filter: blur(8px); } }
@media (max-width: 760px) { .diag { display: none; } .deck { height: 18vh; } .sky-planet { height: 14vh; } .pg-hero h1 { letter-spacing: .18em; margin-right: -.18em; } }
@media (prefers-reduced-motion: reduce) { .diag pre, .warp-ring, .deck .sweep { animation: none; } .warp-ring { display: none; } body.arrive main { animation: none; } }

/* Folders: project cards as ship's files. Same anatomy as a paper folder (tab, cover, viewport, tags), built from
   gunmetal panels, a hazard-coloured tab per project, stencil labels and rivets. */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 40px 22px; padding-bottom: 20px; }
.fold { --f: #E9C08A; position: relative; display: block; padding-top: 30px; text-decoration: none; color: var(--ink); text-align: left; transition: transform .45s cubic-bezier(.16,1,.3,1); }
.f-tab { position: absolute; left: 0; top: 0; height: 32px; padding: 0 38px 0 10px; display: inline-flex; align-items: center; gap: 9px; background: var(--f); color: #0b0b0d;
  font: 500 10.5px var(--mono); letter-spacing: .24em; border-radius: 7px 0 0 0; clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 100%, 0 100%); transition: transform .45s cubic-bezier(.16,1,.3,1); }
.f-tab b { padding: 2px 5px; background: #0b0b0d; color: var(--f); font-weight: 500; letter-spacing: .08em; }
.f-body { position: relative; padding: 16px 16px 20px; border: 1px solid rgba(237,231,221,.1); border-top: 2px solid var(--f);
  background: linear-gradient(180deg, rgba(30,32,38,.94), rgba(14,15,18,.96)); box-shadow: 0 30px 50px -30px #000, inset 0 1px 0 rgba(255,255,255,.04);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%); }
.f-body::before { --rv: radial-gradient(circle, rgba(237,231,221,.3) 1.5px, transparent 2.2px); content: ""; position: absolute; inset: 5px; pointer-events: none;   /* rivets */
  background: var(--rv) left top / 8px 8px no-repeat, var(--rv) right top / 8px 8px no-repeat, var(--rv) left bottom / 8px 8px no-repeat; }
.f-body::after { content: ""; position: absolute; right: 0; bottom: 0; width: 28px; height: 28px; background: linear-gradient(135deg, transparent 50%, var(--f) 50% 54%, transparent 54%); opacity: .7; }
.f-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; font: 400 10px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--faint); }
.f-status { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); } .f-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--f); box-shadow: 0 0 8px var(--f); }
.f-view { position: relative; height: 190px; overflow: hidden; border: 1px solid rgba(237,231,221,.12); background: #050608; }
.f-view > svg, .f-view > img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.16,1,.3,1), filter .4s; }
.f-view > img { filter: saturate(.85) brightness(.9); }
.f-view::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(transparent 0 2px, rgba(0,0,0,.18) 2px 3px); mix-blend-mode: multiply; }
.f-file { position: absolute; z-index: 2; right: 8px; top: 8px; padding: 3px 7px; background: rgba(5,6,8,.85); border: 1px solid rgba(237,231,221,.18); font: 400 10px var(--mono); letter-spacing: .04em; color: #DCD6CC; }
.fold h3 { margin-top: 16px; font: 800 25px/1.1 "Hanken Grotesk", var(--sans); letter-spacing: -.015em; text-transform: none; color: var(--ink); }
.fold p { margin-top: 7px; font-size: 14.5px; line-height: 1.5; color: #D6D1C7; text-shadow: none; }
.f-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.f-tags span { padding: 4px 8px; background: #050608; border: 1px solid rgba(237,231,221,.16); font: 500 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--f); }
.fold:hover { transform: translateY(-6px); } .fold:hover .f-tab { transform: translateY(-3px); }
.fold:hover .f-view > svg, .fold:hover .f-view > img { transform: scale(1.04); filter: none; }
.fold:focus-visible { outline: 2px solid var(--f); outline-offset: 6px; }
@media (max-width: 560px) { .folders { grid-template-columns: 1fr; gap: 34px; } .f-view { height: 170px; } }
@media (prefers-reduced-motion: reduce) { .fold, .f-tab, .f-view > * { transition: none; } }

/* Reading mode: case-study pages put the text on a solid panel, in plain sans type, with the moving scenery
   (deck, diagnostics) out of the way. The stars stay at the edges so it still feels like the Outer Rim. */
body:has(.cs) .deck, body:has(.cs) .diag { display: none; }
body:has(.cs) .sky-planet { opacity: .35; }
main.wrap:has(.cs) { width: min(880px, 100% - 32px); margin: 40px auto 0; padding: 8px clamp(20px, 5vw, 64px) 10px; background: #0c0d11; border: 1px solid rgba(237,231,221,.1); border-radius: 22px;
  box-shadow: 0 40px 80px -40px #000; }
main.wrap:has(.cs) .cs-hero { text-align: left; margin: 0; padding: 56px 0 30px; max-width: none; }
main.wrap:has(.cs) .kicker { text-align: left; font: 500 12px var(--mono); letter-spacing: .14em; color: var(--sun); }
main.wrap:has(.cs) .cs-hero h1 { margin: 14px 0 0; font: 800 clamp(40px, 6vw, 68px)/1 "Hanken Grotesk", var(--sans); letter-spacing: -.03em; text-transform: none; text-shadow: none; }
main.wrap:has(.cs) .cs-hero .lede { margin: 20px 0 0; max-width: 62ch; text-align: left; font: 400 19px/1.6 var(--sans); color: #E9E5DD; text-shadow: none; }
main.wrap:has(.cs) .meta div { background: #14161b; } main.wrap:has(.cs) .meta b { color: var(--ink); }
main.wrap:has(.cs) .note { background: rgba(233,192,138,.08); color: #F3DEC0; }
main.wrap:has(.cs) .cs { max-width: 68ch; margin: 0; }
main.wrap:has(.cs) .cs section { padding: 44px 0 8px; border-top: 1px solid rgba(237,231,221,.08); margin-top: 8px; }
main.wrap:has(.cs) .cs h2 { font: 700 clamp(24px, 2.4vw, 30px)/1.2 "Hanken Grotesk", var(--sans); letter-spacing: -.015em; text-transform: none; text-align: left; }
main.wrap:has(.cs) .cs h3 { font: 700 19px/1.3 "Hanken Grotesk", var(--sans); letter-spacing: -.01em; text-transform: none; }
main.wrap:has(.cs) .cs p, main.wrap:has(.cs) .cs li { font: 400 17.5px/1.72 var(--sans) !important; color: #E3DFD7 !important; text-shadow: none !important; }
main.wrap:has(.cs) .cs b, main.wrap:has(.cs) .cs strong { color: #fff; font-weight: 600; }
main.wrap:has(.cs) .pull { font: 500 21px/1.45 var(--sans); color: #fff; border-left-color: var(--sun); }
main.wrap:has(.cs) .spec td { color: #E3DFD7; font-size: 15px; }
main.wrap:has(.cs) .next { background: #14161b; } main.wrap:has(.cs) .next b { font-family: "Hanken Grotesk", var(--sans); font-weight: 700; letter-spacing: -.01em; text-transform: none; }
main.wrap:has(.cs) .pg-foot { letter-spacing: .14em; }
@media (max-width: 560px) { main.wrap:has(.cs) { margin-top: 10px; border-radius: 16px; } main.wrap:has(.cs) .cs p, main.wrap:has(.cs) .cs li { font-size: 16.5px !important; } }

/* Folder actions: the whole card opens the case study (stretched link); a second link opens the prototype */
.fold { cursor: pointer; }
.f-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px dashed rgba(237,231,221,.14); }
.f-acts a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; font: 500 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; border: 1px solid rgba(237,231,221,.2); color: var(--ink); background: #07080a; transition: background .2s, color .2s, border-color .2s; }
.f-acts .f-main { background: var(--f); color: #0b0b0d; border-color: var(--f); }
.f-acts .f-main::after { content: ""; position: absolute; inset: 0; z-index: 1; }   /* whole card body → the main link (positioned to .f-body) */
.f-acts a:hover { border-color: var(--f); } .f-acts .f-proto:hover { background: rgba(255,255,255,.06); }
.f-acts .f-proto { position: relative; z-index: 2; }
.fold:focus-within { transform: translateY(-6px); }
/* Opening a file: a short "decrypting" readout over the viewport */
.f-crypt { position: absolute; inset: 0; z-index: 3; padding: 14px 16px; background: rgba(5,6,8,.92); font: 400 12px/1.8 var(--mono); color: var(--f); letter-spacing: .06em; white-space: pre; }
.f-crypt b { color: #fff; font-weight: 500; }

/* Sound toggle in the top bar */
.pg-top { gap: 18px; }
.pg-top .coord { margin-left: auto; }
.snd-t { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font: 400 10.5px var(--mono); letter-spacing: .16em; text-transform: uppercase; cursor: pointer; }
.snd-t:hover { color: var(--ink); border-color: rgba(237,231,221,.3); }
.snd-t i { display: inline-flex; gap: 2px; align-items: flex-end; height: 10px; }
.snd-t i::before, .snd-t i::after { content: ""; width: 2px; height: 10px; background: var(--sun); animation: eq 1s ease-in-out infinite; }
.snd-t i::after { animation-delay: -.5s; }
@keyframes eq { 50% { transform: scaleY(.3); } }
.snd-t .off { display: none; } .snd-t.muted .on { display: none; } .snd-t.muted .off { display: inline; } .snd-t.muted i::before, .snd-t.muted i::after { animation: none; background: var(--faint); transform: scaleY(.3); }

/* Entry gate: choose sound (browsers need a click before any audio) */
.gate { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: radial-gradient(60% 50% at 50% 50%, rgba(0,0,0,.2), rgba(0,0,0,.75)); transition: opacity .6s ease, visibility .6s; }
.gate.gone { opacity: 0; visibility: hidden; }
.gate-in { display: grid; justify-items: center; gap: 16px; text-align: center; padding: 0 20px; }
.gate small { font: 400 11px var(--mono); letter-spacing: .3em; color: var(--sun); text-transform: uppercase; }
.gate p { max-width: 36ch; color: var(--muted); font-size: 15px; }
.gate .go-snd { display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; padding: 14px 24px; border: 1px solid var(--sun); border-radius: 999px; background: rgba(233,192,138,.1); color: var(--ink); font: 500 14px var(--sans); cursor: pointer; box-shadow: 0 0 30px -6px rgba(233,192,138,.55); transition: background .2s, transform .2s; }
.gate .go-snd:hover { background: rgba(233,192,138,.2); transform: translateY(-1px); }
.gate .go-quiet { border: 0; background: none; color: var(--faint); font: 400 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; padding: 8px; } .gate .go-quiet:hover { color: var(--ink); }

/* Typed text: characters are laid out from the start (no reflow) and revealed one by one */
.ch { visibility: hidden; } .ch.on { visibility: visible; } .ch.scr { color: var(--sun); }
.js-type [data-type], .js-type .cs-hero h1, .js-type .cs-hero .kicker { visibility: hidden; }
.caret { display: inline-block; width: .5em; height: .9em; margin-left: .08em; background: var(--sun); vertical-align: -.05em; animation: caret .9s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* Cockpit deck v2 (drawn in stars.js): 20% of the view, over the content; the page scrolls above it */
.deck { height: max(20vh, 11.9vw); min-height: 120px; z-index: 6; transform-origin: 50% 160%; transition: none; }
.deck svg { position: absolute; inset: 0; width: 100%; height: 100%; }
body:not(:has(.cs)) main.wrap { padding-bottom: calc(max(20vh, 11.9vw) + 20px); }
.sky-planet { will-change: transform, opacity; transform-origin: 50% 0; }
#stars { will-change: transform; }
.deck .blink { animation: blink2 2.2s steps(2) infinite; } .deck .blink.b2 { animation-duration: 3.1s; } .deck .blink.b3 { animation-duration: 1.6s; }
@keyframes blink2 { 50% { opacity: .25; } }
.deck .hz { transition: transform .3s ease-out; }
.deck .nd-rose { transform-origin: center; transform-box: fill-box; }
.diag { display: none; }
@media (max-width: 760px) { .deck { height: 15vh; } .pg-top .coord { display: none; } }
@media (prefers-reduced-motion: reduce) { .snd-t i::before, .snd-t i::after, .caret, .deck .blink { animation: none; } }

/* Sound on by default: until the browser lets audio start, the toggle pulses "tap for sound" */
.snd-t.need { color: var(--sun); border-color: rgba(233,192,138,.5); animation: need 1.6s ease-in-out infinite; }
.snd-t.need .on { display: none; } .snd-t.need::after { content: "Click anywhere for sound"; }
@keyframes need { 50% { box-shadow: 0 0 0 4px rgba(233,192,138,.12); } }
/* Mouse energy layer */
.energy { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }   /* a canvas keeps its pixel size unless told: without width/height the trail drew at 2× on retina, off the pointer */
.f-soon { padding: 8px 12px; border: 1px dashed rgba(163,230,53,.45); font: 500 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--f); }
.fold-wip { cursor: default; } .fold-wip:hover { transform: none; }

/* A single toy sitting in the folder grid */
.toy-slot { display: contents; }
.toy-slot .toy { align-self: start; margin-top: 30px; }

/* Same-origin page changes cross-fade, so the jump from the home page lands without a flash */
@view-transition { navigation: auto; }
/* The jolt when the ship drops out of hyperspace: everything lurches forward, then springs back */
body.jolt main, body.jolt .pg-top { animation: jolt 1.2s cubic-bezier(.2,.7,.2,1) both; }
body.jolt .deck { animation: joltDeck 1.2s cubic-bezier(.2,.7,.2,1) both; }
body.jolt .sky-planet { animation: joltSky 1.2s cubic-bezier(.2,.7,.2,1) both; }
@keyframes jolt { 0% { transform: translateY(26px) scale(1.04); filter: blur(3px); } 18% { transform: translateY(-10px) scale(.99); filter: none; } 34% { transform: translateY(5px); } 52% { transform: translateY(-2px); } 100% { transform: none; } }
@keyframes joltDeck { 0% { transform: translateY(18px) rotate(.6deg); } 20% { transform: translateY(-8px) rotate(-.4deg); } 40% { transform: translateY(4px) rotate(.2deg); } 60% { transform: translateY(-1px); } 100% { transform: none; } }
@keyframes joltSky { 0% { margin-top: -26px; } 20% { margin-top: 8px; } 45% { margin-top: -3px; } 100% { margin-top: 0; } }
body.from-portal main, body.from-portal .pg-top { animation: none; }

/* Case study close */
.cs-close { position: fixed; top: 16px; right: 18px; z-index: 30; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px 9px 11px; border-radius: 999px; border: 1px solid rgba(237,231,221,.22);
  background: rgba(12,13,17,.85); backdrop-filter: blur(8px); color: var(--ink); font: 500 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.cs-close span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.1); font-size: 11px; }
.cs-close em { font-style: normal; } .cs-close:hover { border-color: var(--sun); background: rgba(30,26,20,.9); transform: translateY(-1px); }
.cs-close::after { content: "Esc"; margin-left: 2px; padding: 1px 5px; border: 1px solid rgba(237,231,221,.2); border-radius: 4px; font-size: 9px; color: var(--faint); }
body:has(.cs-close) .pg-top .snd-t { margin-right: 130px; }
@media (max-width: 560px) { .cs-close::after, .cs-close em { display: none; } .cs-close { padding: 9px; } body:has(.cs-close) .pg-top .snd-t { margin-right: 52px; } }

/* Folder hover, same feel as the portfolio's project cards: the card lifts, the shadow deepens and a round ↗ badge
   appears over the viewport. Nothing moves until you hover. */
.fold { transition: transform .5s cubic-bezier(.16,1,.3,1); }
.fold .f-body { transition: box-shadow .4s, border-color .3s; }
.f-view::before { content: "↗"; position: absolute; top: 12px; left: 12px; z-index: 3; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--f); color: #0b0b0d; font: 600 16px var(--sans); box-shadow: 0 6px 16px -8px rgba(0,0,0,.6); transform: scale(.6); opacity: 0; transition: .35s cubic-bezier(.16,1,.3,1); }
.fold:hover { transform: translateY(-6px); }
.fold:hover .f-body { box-shadow: 0 40px 60px -30px #000, 0 0 0 1px color-mix(in srgb, var(--f) 35%, transparent); }
.fold:hover .f-view::before { transform: none; opacity: 1; }
.fold:hover .f-view > svg, .fold:hover .f-view > img { transform: scale(1.04) translateY(-4px); }
.fold-wip .f-view::before { content: none; }

/* Now playing (case pages) */
.np { position: fixed; left: 16px; bottom: 16px; z-index: 30; display: inline-flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 8px 14px 8px 10px; border-radius: 999px;
  border: 1px solid rgba(237,231,221,.18); background: rgba(12,13,17,.85); backdrop-filter: blur(8px); font: 400 11px var(--mono); letter-spacing: .06em; color: var(--muted);
  opacity: 0; transform: translateY(8px); transition: opacity .6s, transform .6s; pointer-events: none; }
.np.on { opacity: 1; transform: none; } .np b { color: var(--ink); font-weight: 500; } .np span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np i { display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; } .np i::before, .np i::after { content: ""; width: 2px; height: 11px; background: var(--sun); animation: eq 1.1s ease-in-out infinite; } .np i::after { animation-delay: -.55s; }

/* ---------- 3D cockpit (cockpit3d.js) and its switcher ---------- */
.cockpit3d { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 6; pointer-events: none; }
html[data-cockpit="shuttle"] .deck { display: none; }
html[data-cockpit="vector"] .cockpit3d { display: none; }
html[data-cockpit="shuttle"] body:not(:has(.cs)) main.wrap { padding-bottom: 30vh; }
body:has(.cs) .cockpit3d, body:has(.cs) .hud { display: none; }
.cockpit-loading .cockpit3d { opacity: 0; } .cockpit3d { transition: opacity .6s; }
.ck-pick { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; }
.ck-pick button { padding: 5px 10px; border: 0; border-radius: 999px; background: none; color: var(--faint); font: 400 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; }
.ck-pick button:hover { color: var(--ink); } .ck-pick button[aria-pressed="true"] { background: rgba(233,192,138,.16); color: var(--sun); }

/* ---------- HUD (hud.js): side gutters only, wide screens only ---------- */
.hud { position: fixed; inset: 0; z-index: 7; pointer-events: none; font: 500 10px var(--mono); letter-spacing: .14em; color: #f2f2f2; text-shadow: 0 0 6px rgba(255,255,255,.35); display: none; }
@media (min-width: 1360px) { html:not([data-cockpit="vector"]) .hud { display: block; } }
.h-title { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); text-align: center; line-height: 1.6; } .h-title b { display: block; font-weight: 600; font-size: 11px; } .h-title span { color: #ffb35c; }
.h-left { position: absolute; left: 26px; top: 38vh; display: grid; gap: 22px; justify-items: center; }
.h-bars { display: flex; gap: 10px; align-items: flex-end; }
.hb { display: grid; justify-items: center; gap: 4px; } .hb i { position: relative; width: 16px; height: 86px; border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.05); }
.hb i::after { content: ""; position: absolute; left: 1px; right: 1px; bottom: 1px; height: calc(var(--h) - 2px); background: var(--c); box-shadow: 0 0 10px var(--c); }
.hb b { font-size: 11px; } .hb span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 8px; color: #cfcfcf; }
.h-radar { position: relative; width: 120px; } .h-radar svg { width: 120px; height: 120px; } .h-radar span { display: block; text-align: center; margin-top: 2px; font-size: 9px; }
.h-radar circle, .h-target circle, .h-target rect { fill: none; stroke: rgba(255,255,255,.55); stroke-width: 1; } .h-radar path { stroke: rgba(255,255,255,.18); fill: none; }
.h-radar #h-blips circle { fill: #ff5a4f; stroke: none; } .h-radar #h-blips circle.lit { fill: #ffd23c; filter: drop-shadow(0 0 4px #ffd23c); }
.h-radar .sweep { fill: rgba(255,255,255,.08); stroke: none; transform-origin: 60px 60px; animation: sweep 4s linear infinite; }
.h-right { position: absolute; right: 26px; top: 22vh; display: grid; grid-template-columns: 60px 60px; gap: 10px 8px; justify-items: center; }
.ho { position: relative; width: 60px; height: 60px; display: grid; place-items: center; align-content: center; } .ho svg { position: absolute; inset: 0; width: 100%; height: 100%; } .ho path { fill: rgba(0,0,0,.25); stroke: rgba(255,255,255,.6); stroke-width: 1.2; }
.ho span { position: relative; font-size: 8px; color: #cfcfcf; } .ho b { position: relative; font-size: 13px; color: #ff5a4f; text-shadow: 0 0 8px rgba(255,90,79,.6); }
.h-target { grid-column: 1 / -1; margin-top: 18px; display: grid; justify-items: center; gap: 4px; } .h-target svg { width: 120px; height: 120px; } .h-target span { font-size: 9px; color: #cfcfcf; } .h-target b { max-width: 150px; text-align: center; font-size: 10px; color: #ffd23c; }
.h-cross { position: absolute; left: 50%; top: 46%; width: 22px; height: 22px; margin: -11px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; } .h-cross i { position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; background: rgba(255,255,255,.7); border-radius: 50%; }
@media (max-width: 760px) { .ck-pick button { padding: 5px 7px; letter-spacing: .06em; } }
@media (prefers-reduced-motion: reduce) { .h-radar .sweep { animation: none; } }

/* ---------- The Design Lab station: first, two columns wide, picture left and story right ---------- */
.fold-wide { grid-column: span 2; }
.fold-wide .f-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: auto auto auto auto 1fr; column-gap: 28px; padding: 18px 18px 22px; }
.fold-wide .f-view { grid-column: 1; grid-row: 1 / span 5; height: auto; min-height: 300px; }
.fold-wide .f-top, .fold-wide h3, .fold-wide p, .fold-wide .f-tags, .fold-wide .f-acts { grid-column: 2; }
.fold-wide .f-top { margin-bottom: 0; align-self: start; }
.fold-wide h3 { margin-top: 26px; font-size: clamp(30px, 3.2vw, 44px); }
.fold-wide p { font-size: 16px; max-width: 42ch; }
.fold-wide .f-acts { align-self: end; margin-top: 20px; }
@media (max-width: 760px) {
  .fold-wide { grid-column: auto; }
  .fold-wide .f-body { display: block; }
  .fold-wide .f-view { min-height: 0; height: 200px; margin-top: 12px; }
  .fold-wide h3 { margin-top: 16px; font-size: 28px; }
}

/* Backdrop: the nebula skybox (3d-sources/alien-space-nebula), screened over the star field, behind the lava planet */
.nebula { inset: -12%; opacity: .5; mix-blend-mode: screen; animation: none; will-change: transform;
  background: url("/assets/outer/nebula-pano.jpg") 0 30% / auto 100% repeat-x, #000; }   /* bright core off to the side of the title */
@media (max-width: 760px) { .nebula { background-image: url("/assets/outer/nebula-pano-sm.jpg"); } }
body:has(.cs) .nebula { opacity: .35; }

/* ---------- Missions in 3D space (rim3d.js): fly past the cards as you scroll ---------- */
.flight { position: relative; margin: 0 calc(50% - 50vw); }
.flight-view { position: sticky; top: 0; height: 100vh; overflow: hidden; perspective: 900px; perspective-origin: 50% 36%; }
.flight-world { position: absolute; left: 50%; top: 36%; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; }
.flight .fly { position: absolute; left: 0; top: 0; width: 520px; transform-style: preserve-3d; transition: opacity .2s linear; }
.flight .fly.fold-wide { width: 820px; grid-column: auto; }
.flight .toy-slot.fly { width: 560px; }
.flight .fly:hover { transform: none; }   /* the 3D transform is set inline; the lift happens on the body instead */
.flight .fold.fly:hover .f-body { transform: translateY(-6px); transition: transform .45s cubic-bezier(.16,1,.3,1); }
.flight-hud { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); display: grid; gap: 4px; justify-items: end; font: 400 11px var(--mono); letter-spacing: .2em; color: var(--faint); z-index: 3; }
.flight-hud b { font: 500 26px var(--mono); letter-spacing: .02em; color: var(--ink); }
.flight-hud span { text-transform: uppercase; }
/* 3D credits: small and quiet, under the footer */
.pg-credits { margin: -40px auto 40px; max-width: 760px; padding: 0 16px; text-align: center; color: var(--faint); font: 400 10px/1.7 var(--mono); letter-spacing: .04em; opacity: .7; }
.pg-credits a { color: inherit; text-decoration: underline; text-decoration-color: rgba(255,255,255,.2); text-underline-offset: 2px; } .pg-credits a:hover { color: var(--muted); }
