/* jamescurd.dev: Exploded View */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo.woff2") format("woff2");
  font-weight: 400 900;
  font-stretch: 100% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("../fonts/martian-mono.woff2") format("woff2");
  font-weight: 400 500;
  font-stretch: 87.5% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Archivo Fallback";
  src: local("Arial");
  size-adjust: 104%;
  ascent-override: 88%;
  descent-override: 21%;
}

:root {
  --paper: #eef0f3;
  --paper-2: #e3e7ee;
  --ink: #0a1230;
  --ink-2: #3f4a69;
  --navy: #0e1f4d;
  --navy-2: #16295f;
  --navy-hi: #1d3a8f;
  --ice: #dce4f5;
  --ice-2: #a9b6d6;
  --line-paper: #cdd3df;
  --line-navy: #2b3d74;

  --font: "Archivo", "Archivo Fallback", system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(16px, 4.2vw, 64px);
  --gl: max(var(--gutter), env(safe-area-inset-left));
  --gr: max(var(--gutter), env(safe-area-inset-right));
  --section: clamp(6rem, 16vh, 12rem);
  --radius-sheet: clamp(20px, 3vw, 40px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* section-scoped colour roles */
  --fg: var(--ink);
  --fg-2: var(--ink-2);
  --line: var(--line-paper);
  --em: var(--navy-hi);
}

[data-theme="navy"] {
  --fg: var(--paper);
  --fg-2: var(--ice-2);
  --line: var(--line-navy);
  --em: var(--ice);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
  scrollbar-color: var(--navy-hi) var(--paper-2);
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: clip; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.55;
  font-stretch: 100%;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

::selection { background: var(--navy-hi); color: var(--paper); }
[data-theme="navy"] ::selection { background: var(--ice); color: var(--navy); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--navy-hi); border-radius: 10px; border: 2px solid var(--paper-2); }

h1, h2, h3, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
img, svg, canvas { display: block; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--em);
  outline-offset: 4px;
  border-radius: 6px;
}

.skip {
  position: fixed;
  left: var(--gl);
  top: 12px;
  z-index: 100;
  padding: 0.7rem 1rem;
  background: var(--navy);
  color: var(--paper);
  border-radius: 10px;
  transform: translateY(-160%);
  transition: transform 0.3s var(--ease-out);
}
.skip:focus-visible { transform: none; }

/* ---------- icons ---------- */
.i {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- stage layers ---------- */
.stage, .scene, .annot {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.stage { z-index: 0; display: none; }
.scene { z-index: 1; width: 100%; height: 100%; opacity: 0; transition: opacity 0.6s ease; }
.annot { z-index: 2; opacity: 0; display: none; }
.stage__sheet {
  position: absolute;
  inset: 0;
  background: var(--navy);
  clip-path: inset(100% 0 0 0);
  will-change: clip-path;
}

.js .stage { display: block; }
.webgl .scene { opacity: 1; }
.webgl .annot { display: block; }
.scene.is-swapping { opacity: 0; transition-duration: 0.18s; }

main, .bar, .progress, .toast { position: relative; z-index: 3; }

/* annotations (technical-drawing callouts) */
.annot__lines { position: absolute; inset: 0; overflow: visible; }
.annot__lines line { stroke: var(--ice-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.annot__lines circle { fill: var(--navy); stroke: var(--ice); stroke-width: 1.25; }
.annot__lines .is-dim { opacity: 0.35; }
.tag {
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-stretch: 87.5%;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  color: var(--ice);
  white-space: nowrap;
  transform: translate3d(-200vw, 0, 0);
  transition: opacity 0.35s ease, color 0.35s ease;
}
.tag b { display: block; font-weight: 400; color: var(--ice-2); }
.tag__s { display: none; }
.annot--compact .tag { font-size: 0.625rem; }
.annot--compact .tag__l, .annot--compact .tag b { display: none; }
.annot--compact .tag__s { display: inline; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.tag.is-dim { opacity: 0.62; }
.tag.is-dim b { color: var(--ice); }

/* ---------- progress ---------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 60;
  pointer-events: none;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--navy-hi);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.progress.on-navy span { background: var(--ice); }

/* ---------- header bar ---------- */
.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: max(14px, env(safe-area-inset-top)) var(--gr) 14px var(--gl);
  color: var(--fg);
  font-size: 0.875rem;
  transition: color 0.4s ease, background-color 0.4s ease, transform 0.5s var(--ease-out), box-shadow 0.4s ease;
}
.bar.is-solid { background: var(--paper); box-shadow: 0 1px 0 var(--line-paper); }
.bar.is-solid[data-theme="navy"] { background: var(--navy); box-shadow: 0 1px 0 var(--line-navy); }
.bar.is-hidden { transform: translateY(-110%); }
.bar:focus-within { transform: none; }
.bar__mark { display: inline-flex; border-radius: 9px; }
.bar__mark svg { width: 34px; height: 34px; }
.mark-cap { fill: var(--navy-hi); transition: fill 0.4s ease; }
.mark-top { fill: #2a4aa6; transition: fill 0.4s ease; }
.mark-j { fill: none; stroke: var(--paper); stroke-width: 2.4; stroke-linecap: round; transition: stroke 0.4s ease; }
.bar[data-theme="navy"] .mark-cap { fill: var(--ice); }
.bar[data-theme="navy"] .mark-top { fill: #f4f6fa; }
.bar[data-theme="navy"] .mark-j { stroke: var(--navy); }
.bar__where {
  display: flex;
  align-items: center;
  gap: 0.6em;
  color: var(--fg-2);
  transition: color 0.4s ease;
}
.bar__dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.clock { font-variant-numeric: tabular-nums; color: var(--fg); }
.bar__mail {
  margin-left: auto;
  font-weight: 600;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.45s var(--ease-out);
  padding-bottom: 2px;
}
.bar__mail:hover { background-size: 100% 1px; }

/* ---------- keycap buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.cap {
  --cap-bg: var(--navy-hi);
  --cap-fg: var(--paper);
  --cap-edge: rgba(4, 10, 32, 0.45);
  --cap-top: rgba(255, 255, 255, 0.16);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  min-height: 54px;
  padding: 0 1.35rem 4px;
  border: 0;
  border-radius: 14px;
  background: var(--cap-bg);
  color: var(--cap-fg);
  font-weight: 600;
  font-size: 1rem;
  font-stretch: 105%;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    inset 0 -4px 0 var(--cap-edge),
    inset 0 1px 0 var(--cap-top),
    0 10px 18px -12px rgba(0, 0, 0, 0.35);
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0);
  transition: box-shadow 0.18s ease, transform 0.18s var(--ease-out), background-color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}
.cap:hover { --cap-bg: #2445a3; }
.cap:active, .cap.is-pressed {
  transform: translate3d(var(--mx, 0px), calc(var(--my, 0px) + 3px), 0);
  box-shadow:
    inset 0 -1px 0 var(--cap-edge),
    inset 0 1px 0 var(--cap-top),
    0 4px 8px -6px rgba(0, 0, 0, 0.3);
}
.cap--ghost {
  --cap-bg: var(--paper);
  --cap-fg: var(--ink);
  --cap-edge: rgba(10, 18, 48, 0.16);
  --cap-top: rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 0 0 1px var(--line-paper),
    inset 0 -4px 0 var(--cap-edge),
    0 10px 18px -14px rgba(0, 0, 0, 0.22);
}
.cap--ghost:hover { --cap-bg: #f7f8fa; }
.cap--ghost:active, .cap--ghost.is-pressed {
  box-shadow: inset 0 0 0 1px var(--line-paper), inset 0 -1px 0 var(--cap-edge);
}
.cap--light {
  --cap-bg: var(--paper);
  --cap-fg: var(--navy);
  --cap-edge: rgba(14, 31, 77, 0.28);
  --cap-top: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 -4px 0 var(--cap-edge), inset 0 1px 0 var(--cap-top), 0 12px 22px -14px rgba(0, 0, 0, 0.6);
}
.cap--light:hover { --cap-bg: #ffffff; }
.cap--ghost-light {
  --cap-bg: var(--navy-2);
  --cap-fg: var(--paper);
  --cap-edge: rgba(0, 0, 0, 0.35);
  --cap-top: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--line-navy), inset 0 -4px 0 var(--cap-edge), inset 0 1px 0 var(--cap-top);
}
.cap--ghost-light:hover { --cap-bg: #1b3070; }
.cap .i--done { display: none; }
.copy.is-done .i--copy { display: none; }
.copy.is-done .i--done { display: block; }

/* ---------- layout primitives ---------- */
section {
  position: relative;
  padding-left: var(--gl);
  padding-right: var(--gr);
}
.no-js section[data-theme="navy"], .no-webgl section[data-theme="navy"] { color: var(--fg); }
/* No-JS: sections paint their own grounds */
.no-js section[data-theme="navy"] {
  background: var(--navy);
  border-radius: var(--radius-sheet);
}

/* ---------- hero ---------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding-top: calc(88px + env(safe-area-inset-top));
  padding-bottom: 96px;
}
.hero__copy { max-width: min(46rem, 56vw); }
.hero__name {
  font-size: clamp(2.6rem, min(9.6vw, 16svh), 7rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-left: -0.04em;
}
.hero__tag {
  margin-top: 0.55em;
  font-size: clamp(1.45rem, min(3.3vw, 6svh), 2.75rem);
  font-weight: 600;
  font-stretch: 110%;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.hero__tag em { font-style: normal; color: var(--navy-hi); }
.hero__role {
  margin-top: 1.25rem;
  max-width: 34rem;
  color: var(--ink-2);
  text-wrap: pretty;
}
.hero .actions { margin-top: 2rem; }
.hero__cue {
  position: absolute;
  left: var(--gl);
  bottom: max(28px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.hero__cue-line {
  position: relative;
  width: 44px;
  height: 1px;
  background: var(--line-paper);
  overflow: hidden;
}
.hero__cue-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--navy-hi);
  transform: translateX(-100%);
  animation: cue 2.4s var(--ease-out) 1.6s 3 both;
}
@keyframes cue {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

.poster { width: min(46vw, 620px); height: auto; }
.poster--hero { position: absolute; right: var(--gr); top: 50%; transform: translateY(-50%); }
.poster--work { width: min(80vw, 520px); margin: 3rem auto 0; }
.no-js .hero noscript, .no-js .work noscript { display: contents; }
.js noscript { display: none; }
.no-js .clock, .no-js .bar__dot { display: none; }
/* posters flow in a grid when the page is not scroll-pinned (no JS, or no WebGL with motion reduced) */
.no-js .work, .no-webgl:not(.motion) .work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 34rem);
  align-items: center;
  gap: 3rem;
}
.no-js .work .poster--work, .no-webgl:not(.motion) .work .poster--work { order: -1; margin: 0 auto; }
.poster--reduced { display: none; }
/* no WebGL, motion on: posters sit exactly where the model would, so nothing reflows */
.poster--contact { display: none; }
.no-webgl .poster--contact { display: block; position: absolute; right: var(--gr); top: 44%; transform: translateY(-50%); width: min(34vw, 460px); }
.no-webgl.motion .poster--work { position: absolute; left: var(--gl); top: 50%; transform: translateY(-50%); width: min(38vw, 500px); margin: 0; }
.poster { pointer-events: none; }

/* ---------- statement ---------- */
.statement { padding-top: var(--section); padding-bottom: var(--section); }
.statement__text {
  max-width: min(21ch, 58vw);
  font-size: clamp(1.75rem, min(4.3vw, 7.4svh), 4rem);
  font-weight: 600;
  font-stretch: 108%;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-wrap: pretty;
}
.statement__text .w { transition: none; }

.motion .statement { height: 240vh; padding-top: 0; padding-bottom: 0; }
.motion .statement__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  align-items: center;
}

/* ---------- work (exploded view) ---------- */
.work {
  color: var(--fg);
  padding-top: var(--section);
  padding-bottom: var(--section);
}
.js .work { color: var(--fg); }
.work__col { max-width: 34rem; margin-left: auto; }
.work__title {
  font-size: clamp(2.25rem, min(5.2vw, 9svh), 4.5rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 0.95;
  letter-spacing: -0.035em;
}
.work__intro { margin-top: 1rem; color: var(--fg-2); max-width: 26rem; }
.layers { margin-top: clamp(2rem, 5vh, 3.5rem); display: grid; gap: 2.5rem; }
.layer__name {
  font-size: clamp(2.5rem, min(6vw, 10svh), 5.25rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--paper);
}
.layer__lede {
  margin-top: 0.8rem;
  font-size: clamp(1.2rem, 1.6vw, 1.5rem);
  font-weight: 600;
  font-stretch: 108%;
  letter-spacing: -0.015em;
  color: var(--ice);
}
.layer__body { margin-top: 0.6rem; color: var(--fg-2); max-width: 30rem; text-wrap: pretty; }
.rail { display: none; }

/* scrolly mode: pinned, one layer at a time */
.motion .work { height: 460vh; padding-top: 0; padding-bottom: 0; }
.motion .work__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 48px;
}
.motion .work__col { width: min(34rem, 38vw); margin-right: 0; }
.motion.ready .layers { position: relative; display: block; min-height: 15.5rem; }
.motion.ready .layer {
  position: absolute;
  inset: 0 0 auto 0;
  pointer-events: none;
}
.motion.ready .layer > * {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition: opacity 0.5s ease, transform 0.7s var(--ease-out), filter 0.6s ease;
}
.motion.ready .layer.is-active { pointer-events: auto; }
.motion.ready .layer.is-active > * { opacity: 1; transform: none; filter: none; }
.motion.ready .layer.is-active > :nth-child(2) { transition-delay: 0.06s; }
.motion.ready .layer.is-active > :nth-child(3) { transition-delay: 0.12s; }
.motion.ready .rail {
  display: grid;
  grid-template-columns: repeat(3, auto) 1fr;
  align-items: center;
  gap: 0 1.25rem;
  margin-top: 2.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg-2);
}
.rail__step { transition: color 0.3s ease; }
.rail__step.is-on { color: var(--paper); }
.rail__track { position: relative; height: 1px; background: var(--line-navy); }
.rail__fill { position: absolute; inset: 0; background: var(--ice); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- principles ---------- */
.principles { padding-top: var(--section); padding-bottom: var(--section); }
.principles__title {
  font-size: clamp(2.25rem, min(5.2vw, 9svh), 4.5rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 0.95;
  letter-spacing: -0.035em;
  max-width: 60%;
}
.rows { margin-top: clamp(2.5rem, 6vh, 4.5rem); max-width: min(56rem, 60vw); }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1rem 2.5rem;
  padding: 1.75rem 0 1.9rem;
  border-top: 1px solid var(--line-paper);
}
.row:last-child { border-bottom: 1px solid var(--line-paper); }
.row__head {
  font-size: clamp(1.5rem, 2.6vw, 2.25rem);
  font-weight: 700;
  font-stretch: 112%;
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.row__body { color: var(--ink-2); max-width: 32rem; padding-top: 0.2rem; text-wrap: pretty; }

/* ---------- contact ---------- */
.contact {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  color: var(--fg);
  padding-top: calc(var(--section) * 0.8);
}
.contact:focus { outline: none; }
.contact__copy { align-self: center; max-width: min(54rem, 60vw); }
.contact__title {
  font-size: clamp(2.6rem, min(8.2vw, 15svh), 6.5rem);
  font-weight: 800;
  font-stretch: 122%;
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin-left: -0.04em;
}
.contact__lede {
  margin-top: 0.8rem;
  font-size: clamp(1.25rem, 2.2vw, 1.875rem);
  font-weight: 600;
  font-stretch: 108%;
  letter-spacing: -0.02em;
  color: var(--ice);
}
.email-xl {
  display: inline-block;
  margin-top: clamp(1.75rem, 5vh, 3rem);
  font-size: clamp(1.35rem, min(4.6vw, 8svh), 3.75rem);
  font-weight: 700;
  font-stretch: 108%;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--paper);
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--ice-2);
  transition: text-decoration-color 0.3s ease, text-underline-offset 0.4s var(--ease-out);
}
.email-xl:hover { text-decoration-color: var(--paper); text-underline-offset: 0.26em; }
.contact .actions { margin-top: 2rem; }
.contact__meta { margin-top: 1.5rem; color: var(--fg-2); font-size: 0.9375rem; }

.key-hit {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 4;
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 24px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.key-hit[hidden] { display: none; }
.key-hit:focus-visible { outline: 2px solid var(--ice); outline-offset: 6px; }
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 2.5rem 0 max(1.75rem, env(safe-area-inset-bottom));
  margin-top: 3rem;
  border-top: 1px solid var(--line-navy);
  font-size: 0.875rem;
  color: var(--fg-2);
}
.foot__egg {
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: var(--fg-2);
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
}
.foot__egg span { color: var(--paper); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-navy); text-underline-offset: 0.25em; }
.foot__egg:hover span { text-decoration-color: var(--ice); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.2rem;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.9375rem;
  font-weight: 600;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, 140%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s var(--ease-out), opacity 0.3s ease;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.toast.on-navy { background: var(--paper); color: var(--navy); }
.toast:empty { display: none; }

/* ---------- mini game ---------- */
.game {
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: var(--navy);
  color: var(--paper);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.5);
  overflow: auto;
  overscroll-behavior: contain;
}
.game::backdrop { background: rgba(10, 18, 48, 0.6); backdrop-filter: blur(6px); }
.game[open] { animation: game-in 0.5s var(--ease-out); }
@keyframes game-in { from { opacity: 0; transform: translateY(24px) scale(0.98); } }
.game__panel { padding: clamp(20px, 4vw, 36px); display: grid; gap: 1rem; }
.game__panel:focus { outline: none; }
.game__head { display: flex; align-items: center; justify-content: space-between; }
.game__title { font-size: 2rem; font-weight: 800; font-stretch: 125%; letter-spacing: -0.035em; line-height: 1; }
.game__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-navy);
  border-radius: 12px;
  background: var(--navy-2);
  cursor: pointer;
}
.game__close:hover { border-color: var(--ice-2); }
.game__rules { color: var(--ice-2); }
.game__hud { display: flex; gap: 2rem; font-variant-numeric: tabular-nums; }
.game__hud p { display: grid; }
.game__k { font-size: 0.8125rem; color: var(--ice-2); }
.game__score, .game__time, .game__best { font-size: 1.5rem; font-weight: 700; font-stretch: 110%; }
.game__clock { height: 3px; background: var(--line-navy); border-radius: 3px; overflow: hidden; }
.game__clock span { display: block; height: 100%; background: var(--ice); transform-origin: 0 50%; }
.game__word {
  min-height: 1.2em;
  font-size: clamp(2.5rem, 9vw, 4.5rem);
  font-weight: 800;
  font-stretch: 120%;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: #7d8dbd;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.game__word .ok { color: var(--paper); }
.game__word .next { color: var(--ice-2); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.12em; }
.game__word.is-miss { animation: miss 0.3s ease; }
@keyframes miss { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.game__end { text-align: center; display: grid; gap: 0.4rem; }
.game__verdict { font-size: 1.35rem; font-weight: 700; font-stretch: 108%; }
.game__pitch { color: var(--ice-2); }
.game__pitch a { color: var(--paper); font-weight: 600; }
.game__start { justify-self: center; }
.game .cap--primary { --cap-bg: var(--paper); --cap-fg: var(--navy); --cap-edge: rgba(14, 31, 77, 0.3); }
.game .cap--primary:hover { --cap-bg: #fff; }

.kb { display: grid; gap: 6px; margin-top: 0.5rem; user-select: none; }
.kb__row { display: flex; justify-content: center; gap: 6px; }
.kb__key {
  flex: 0 1 52px;
  min-width: 0;
  height: clamp(40px, 7.5vw, 52px);
  border: 0;
  border-radius: 9px;
  background: var(--navy-2);
  color: var(--ice);
  font-weight: 700;
  font-size: clamp(0.8rem, 2.4vw, 1rem);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px var(--line-navy);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.2s ease, color 0.2s ease;
}
.kb__key.is-hot { background: var(--ice); color: var(--navy); }
.kb__key.is-down { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.35), inset 0 0 0 1px var(--line-navy); }

html.over-key, html.over-key body { cursor: pointer; }

/* hero intro: CSS only, so first paint never waits on scripts */
@keyframes name-in {
  from { clip-path: inset(0 0 100% 0); transform: translateY(0.3em); }
  to { clip-path: inset(-20% -5% -30% -5%); transform: none; }
}
@keyframes rise { from { opacity: 0.001; transform: translateY(18px); } }
.motion .hero__name { animation: name-in 1.1s var(--ease-out) 0.05s both; }
.motion .hero__tag { animation: rise 0.9s var(--ease-out) 0.25s both; }
.motion .hero__role { animation: rise 0.9s var(--ease-out) 0.35s both; }
.motion .hero .actions { animation: rise 0.9s var(--ease-out) 0.45s both; }
.motion .hero__cue { animation: rise 0.9s var(--ease-out) 0.7s both; }

/* ---------- JS-driven grounds ---------- */
.js section[data-theme="navy"] { background: none; }

/* ---------- tall layouts: phones, portrait tablets, unfolded foldables ---------- */
@media (max-aspect-ratio: 23/20) {
  .hero { align-content: end; padding-top: 46svh; padding-bottom: 88px; }
  .hero__copy { max-width: 40rem; }
  .hero__name { font-size: clamp(2.6rem, min(15vw, 11svh), 6rem); }
  .no-js .poster--hero { position: static; transform: none; width: min(70vw, 360px); margin: 0 auto 2rem; order: -1; }
  .no-webgl .poster--hero { top: calc(64px + env(safe-area-inset-top)); left: 50%; right: auto; transform: translateX(-50%); width: auto; height: calc(46svh - 84px); }
  .no-webgl.motion .poster--work { top: 64px; left: 50%; transform: translateX(-50%); width: auto; height: 42svh; }
  .no-webgl .poster--contact { top: 64px; left: 50%; right: auto; transform: translateX(-50%); width: auto; height: calc(54svh - 96px); }
  .motion .statement__pin { align-items: flex-start; padding-top: 16svh; }
  .no-js .hero { padding-top: 96px; }

  .motion .work__pin { align-items: flex-end; padding-bottom: max(32px, env(safe-area-inset-bottom)); }
  .motion .work__col { width: 100%; max-width: 40rem; margin: 0; }
  .motion .work__title {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .motion .work__intro { display: none; }
  .motion .layers { margin-top: 0; min-height: 11.5rem; }
  .motion .layer__name { font-size: clamp(2.4rem, 11vw, 4rem); }
  .motion .layer__lede { margin-top: 0.5rem; font-size: 1.125rem; }
  .motion .rail { margin-top: 1.25rem; }

  .statement__text { max-width: 21ch; }
  .principles__title { max-width: none; }
  .rows { max-width: none; }

  .contact { padding-top: 54svh; }
  .contact__copy { max-width: none; align-self: end; }
  .no-js .contact { padding-top: var(--section); }
  .no-js .contact__copy { align-self: center; }
  .no-js .work, .no-webgl:not(.motion) .work { grid-template-columns: 1fr; }
  .webgl .poster--reduced { display: block; width: min(64vw, 340px); margin: 0 auto 2.5rem; }
}

@media (max-width: 899px) {
  .bar__mail { font-size: 0; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; background: none; }
  .bar__mail::before {
    content: "";
    width: 22px;
    height: 22px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5.5' width='18' height='13' rx='2.5'/%3E%3Cpath d='m4 7.5 8 5.5 8-5.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5.5' width='18' height='13' rx='2.5'/%3E%3Cpath d='m4 7.5 8 5.5 8-5.5'/%3E%3C/svg%3E") center / contain no-repeat;
  }
}
@media (max-width: 699px) {
  .row { grid-template-columns: 1fr; gap: 0.6rem; padding: 1.4rem 0 1.5rem; }
}
/* portrait tablets and unfolded foldables: use the width */
@media (max-aspect-ratio: 23/20) and (min-width: 700px) {
  .statement__text { max-width: 22ch; font-size: clamp(2.25rem, min(6.2vw, 6.4svh), 3.75rem); }
  .motion .statement__pin { align-items: flex-start; padding-top: 18svh; }
  .motion .work__col { max-width: 44rem; }
  .motion .layer__body { max-width: 36rem; }
  .rows { margin-top: 3rem; }
}

@media (max-width: 520px) {
  .hero__name { font-stretch: 108%; }
  .actions { gap: 10px; }
  .hero .cap--primary { flex: 1 1 100%; justify-content: center; }
  .hero .copy { flex: 1 1 100%; justify-content: center; }
  .contact .cap { flex: 1 1 100%; justify-content: center; }
  .foot { flex-direction: column; align-items: flex-start; }
  .game__hud { gap: 1.25rem; }
}

@media (max-width: 380px) {
  .bar__where { font-size: 0.8125rem; }
  .kb__row { gap: 4px; }
  .kb { gap: 4px; }
}

/* short landscape phones */
@media (max-height: 520px) and (min-aspect-ratio: 23/20) {
  .hero { padding-top: 72px; padding-bottom: 48px; }
  .hero .actions { margin-top: 1.25rem; }
  .hero__role { margin-top: 0.75rem; }
  .hero__cue { display: none; }
  .motion .work__pin { padding-top: 60px; padding-bottom: 16px; }
  .motion .work__intro, .motion.ready .rail { display: none; }
  .motion .work__title { font-size: clamp(1.5rem, 8svh, 2.25rem); }
  .motion .layers { margin-top: 0.5rem; min-height: 11rem; }
  .motion .layer__name { font-size: clamp(1.9rem, 11svh, 3rem); }
  .motion .layer__lede { margin-top: 0.35rem; font-size: 1rem; }
  .motion .layer__body { margin-top: 0.3rem; font-size: 0.875rem; line-height: 1.45; }
}

/* dual-screen foldables spanning a hinge */
@media (horizontal-viewport-segments: 2) {
  .hero__copy, .contact__copy { max-width: calc(env(viewport-segment-left 1 0, 50vw) - var(--gl) - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .motion.ready .layer > * { transition-duration: 0.01ms; filter: none; transform: none; }
  .scene { transition-duration: 0.2s; }
}

@media print {
  .stage, .scene, .annot, .bar, .progress, .toast, .key-hit, .hero__cue { display: none !important; }
  section { break-inside: avoid; }
}
