/* ==========================================================================
   Arbon Qorri — portfolio
   Hand-written CSS, no build step.

   Blocks, in order:
     tokens · base · shared pieces · reveal system (3D mode)
     chrome: bar · menu · HUD · loader · footer
     scene: hero · about · crafts · ai · work · path · contact

   Two page modes (class on <html>):
     .mode-static   editorial page in normal flow (default, no-JS, no-WebGL, reduced motion, ?static)
     .mode-3d       sections are scroll spacers; .stage--back / .stage--front are fixed overlays
   Every scene block has three parts: shared look, "static" layout, "3d" layout (landscape, then portrait).
   Edit one scene's block without touching the others.
   ========================================================================== */


/* ===== tokens ===== */

/* Registered so the theme can cross-fade in static mode (the engine tweens them itself in 3D mode). */
@property --sky-top    { syntax: '<color>'; inherits: true; initial-value: #dce6f5; }
@property --sky-bottom { syntax: '<color>'; inherits: true; initial-value: #f4efe6; }
@property --fg         { syntax: '<color>'; inherits: true; initial-value: #0e0e10; }
@property --fg-soft    { syntax: '<color>'; inherits: true; initial-value: rgba(14, 14, 16, .66); }
@property --line       { syntax: '<color>'; inherits: true; initial-value: rgba(14, 14, 16, .16); }
@property --panel      { syntax: '<color>'; inherits: true; initial-value: rgba(244, 239, 230, .72); }
@property --accent     { syntax: '<color>'; inherits: true; initial-value: #6c4cf1; }

:root {
  /* brand */
  --c-ink: #0e0e10;
  --c-cream: #f4efe6;
  --c-violet: #6c4cf1;
  --c-coral: #ff4d6d;
  --c-lime: #c6f432;
  --c-sky: #4cc9f0;
  --c-sun: #ffd23f;

  /* theme (the engine overwrites these seven at runtime; defaults per time of day below) */
  --sky-top: #dce6f5;
  --sky-bottom: #f4efe6;
  --fg: #0e0e10;
  --fg-soft: rgba(14, 14, 16, .66);
  --line: rgba(14, 14, 16, .16);
  --panel: rgba(244, 239, 230, .72);
  --accent: #6c4cf1;

  /* theme extras (CSS only, follow html[data-theme]) */
  --inv: #f4efe6;                 /* reads on top of --fg */
  --on-accent: #f4efe6;           /* reads on top of --accent */
  --slab: #0e0e10;                /* the dark contact slab */
  --slab-line: transparent;
  --media-bg: rgba(14, 14, 16, .06);
  --key-shadow: rgba(14, 14, 16, .28);

  /* type */
  --font-display: 'Space Grotesk', 'Helvetica Neue', Arial, system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* motion */
  --ease: cubic-bezier(.16, .84, .24, 1);        /* shared reveal easing: quick out, soft landing */
  --ease-inout: cubic-bezier(.7, 0, .2, 1);
  --t-fast: .3s;
  --t-med: .5s;
  --t-slow: .7s;

  /* layout */
  --gutter: clamp(20px, 3.2vw, 48px);
  --gap: clamp(14px, 1.7vw, 28px);
  --bar-h: 72px;
  --hud-h: 64px;
  --radius: 20px;
  --sec-pad: clamp(88px, 11vw, 176px);          /* air above each section in the static page */
}

html[data-theme='day'] {
  --sky-top: #dce6f5; --sky-bottom: #f4efe6;
  --fg: #0e0e10; --fg-soft: rgba(14, 14, 16, .66); --line: rgba(14, 14, 16, .16);
  --panel: rgba(244, 239, 230, .72); --accent: #6c4cf1;
}
html[data-theme='dusk'] {
  --sky-top: #b9a6f5; --sky-bottom: #ffd3b0;
  --fg: #0e0e10; --fg-soft: rgba(14, 14, 16, .7); --line: rgba(14, 14, 16, .2);
  --panel: rgba(255, 236, 222, .62); --accent: #6c4cf1;
  --media-bg: rgba(14, 14, 16, .08);
}
html[data-theme='night'] {
  --sky-top: #0a0a12; --sky-bottom: #1d1742;
  --fg: #f4efe6; --fg-soft: rgba(244, 239, 230, .68); --line: rgba(244, 239, 230, .2);
  --panel: rgba(24, 21, 52, .66); --accent: #c6f432;
  --inv: #0e0e10; --on-accent: #0e0e10;
  --slab: rgba(244, 239, 230, .06); --slab-line: rgba(244, 239, 230, .16);
  --media-bg: rgba(244, 239, 230, .07);
  --key-shadow: rgba(0, 0, 0, .55);
}

@media (orientation: portrait) {
  :root { --bar-h: 60px; --hud-h: 56px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  :root { --bar-h: 56px; --hud-h: 52px; }
}


/* ===== base ===== */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--sky-bottom);
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
html.mode-static {
  scroll-behavior: smooth;
  scroll-padding-top: var(--bar-h);
  transition: --sky-top .8s ease, --sky-bottom .8s ease, --fg .8s ease, --fg-soft .8s ease,
              --line .8s ease, --panel .8s ease, --accent .8s ease;
}
@media (prefers-reduced-motion: reduce) {
  html.mode-static { scroll-behavior: auto; transition: none; }
}

/* Moving between the home page and a project page (/work/<slug>/): browsers that support it cross-fade the two
   documents and carry the project's picture across (elements sharing a view-transition-name). Others just navigate. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* The sky: a fixed gradient behind everything (the canvas is transparent). */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  height: 100lvh;
  z-index: -1;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
  pointer-events: none;
}

h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg, picture { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

::selection { background: var(--c-lime); color: var(--c-ink); }

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

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed;
  left: var(--gutter); top: 12px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--fg); color: var(--inv);
  font: 500 14px/1 var(--font-body);
  transform: translateY(-200%);
}
.skip:focus-visible { transform: none; }

#scene { display: none; }
.mode-3d #scene {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}


/* ===== shared pieces ===== */

/* display type: big, tight */
.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: .92;
  text-wrap: balance;
}

/* mono labels: ( like this ) */
.label,
.kfmark {
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-soft);
}

/* keyframe diamond */
.kfmark { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.kfmark i,
.kfindex i,
.milestone__num i {
  display: inline-block;
  width: 7px; height: 7px;
  background: var(--accent);
  transform: rotate(45deg);
  flex: none;
}
.kfmark span { color: var(--fg); }

/* status line with a live dot */
.status {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.status__dot {
  position: relative;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22b455;
  flex: none;
}
.status__dot::after {
  content: '';
  position: absolute; inset: -5px;
  border-radius: 50%;
  border: 1px solid #22b455;
  opacity: 0;
  animation: status-ping 2.4s var(--ease) infinite;
}
@keyframes status-ping {
  0% { transform: scale(.4); opacity: .9; }
  70%, 100% { transform: scale(1.25); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .status__dot::after { animation: none; } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 500 15px/1 var(--font-body);
  letter-spacing: -.005em;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) ease, color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.btn:focus-visible { border-radius: 999px; }
.btn__arrow { display: inline-block; transition: transform var(--t-fast) var(--ease); }
.btn--solid { background: var(--fg); color: var(--inv); }
.btn--solid:hover { background: var(--accent); color: var(--on-accent); }
.btn--solid:hover .btn__arrow { transform: translateY(3px); }
.btn--ghost { border-color: var(--fg); }
.btn--ghost:hover { background: var(--fg); color: var(--inv); }
.btn--mail {
  min-height: 60px;
  padding: 0 28px;
  background: var(--c-lime); color: var(--c-ink);
  font: 600 clamp(16px, 1.5vw, 20px)/1 var(--font-display);
  letter-spacing: -.01em;
}
.btn--mail:hover { transform: translateY(-2px); }
.btn--mail:hover .btn__arrow { transform: translateX(4px); }
.btn:active { transform: translateY(1px) scale(.985); }

/* text links */
.link {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-weight: 500;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: 3px;
  transition: background-size var(--t-med) var(--ease);
}
.link:hover { background-size: 0 1px; background-position: 100% 100%; }

/* mono tag pills */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: 500 10.5px/1.2 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* a CSS keycap (logo mark, static hero art, contact slab) */
.keycap {
  --key: 64px;
  --cap: #f7f3ec;
  --cap-side: #d6cebf;
  --cap-fg: var(--c-ink);
  position: relative;
  isolation: isolate;
  display: inline-grid; place-items: center;
  width: var(--key); height: var(--key);
  padding-bottom: calc(var(--key) * .12);
  border-radius: calc(var(--key) * .2);
  background: var(--cap-side);
  color: var(--cap-fg);
  font: 700 calc(var(--key) * .4)/1 var(--font-display);
  letter-spacing: -.04em;
  box-shadow: 0 calc(var(--key) * .1) calc(var(--key) * .22) calc(var(--key) * -.06) var(--key-shadow);
  transform: translateY(var(--y, 0)) rotate(var(--r, 0deg));
  flex: none;
  user-select: none;
}
.keycap::before {
  content: '';
  position: absolute;
  inset: calc(var(--key) * .05) calc(var(--key) * .09) calc(var(--key) * .17);
  z-index: -1;
  border-radius: calc(var(--key) * .15);
  background: linear-gradient(165deg, color-mix(in srgb, var(--cap) 82%, #fff) 0%, var(--cap) 62%);
  box-shadow: inset 0 calc(var(--key) * -.02) calc(var(--key) * .05) rgba(14, 14, 16, .1);
}
.keycap--violet { --cap: #6c4cf1; --cap-side: #4b30c4; --cap-fg: #f4efe6; }
.keycap--ink    { --cap: #26262b; --cap-side: #0e0e10; --cap-fg: #f4efe6; }
.keycap--lime   { --cap: #c6f432; --cap-side: #97bd18; --cap-fg: #0e0e10; }
.keycap--mark   { --key: 40px; --cap: #26262b; --cap-side: #0e0e10; --cap-fg: #f4efe6; }
html[data-theme='night'] .keycap--mark { --cap: #7d60f5; --cap-side: #4b30c4; }
html[data-theme='night'] .keycap--ink { --cap: #34343c; --cap-side: #17171b; }

/* giant back-layer type (3D mode only, sits behind the canvas) */
.giant {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.05em;
  line-height: .84;
  white-space: nowrap;
  color: var(--fg);
  user-select: none;
}
.giant__ln { display: block; }
.giant__ln > span { display: block; }


/* ===== stages + reveal system ===== */

/* static mode: front stage is the page, back stage does not exist */
.mode-static .stage--back { display: none; }
.mode-static .stage--front {
  position: relative;
  max-width: 1480px;
  margin-inline: auto;
  padding: var(--sec-pad) var(--gutter) 0;
}
/* an in-page jump lands with the section's rule just under the bar, not a screen of air above it */
.mode-static section[data-scene]:not(#top) { scroll-margin-top: calc(28px - var(--sec-pad)); }
.mode-static .sec-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: var(--gap);
  row-gap: clamp(28px, 4.6vw, 72px);
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.mode-static .sec-head .display { grid-column: 1 / -1; }
.mode-static .sec-head .kfmark { justify-self: end; }

/* 3D mode: sections are tall scroll spacers; main and section must not create stacking contexts */
.mode-3d section[data-scene] {
  height: calc(var(--len) * 100vh);
  height: calc(var(--len) * 100lvh);
}
.mode-3d .stage {
  position: fixed;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
  padding: calc(var(--bar-h) + clamp(6px, 1.6vh, 18px)) var(--gutter) calc(var(--hud-h) + env(safe-area-inset-bottom, 0px) + clamp(14px, 3.2vh, 34px));
  transition: visibility 0s linear .5s;       /* lets the children finish their exit */
}
.mode-3d .stage.is-active { visibility: visible; transition-delay: 0s; }
.mode-3d .stage--back { z-index: 1; overflow: hidden; }
.mode-3d .stage--front {
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto minmax(0, 1fr) auto;
  column-gap: var(--gap);
}
.mode-3d .stage--front.is-active :is(a, button) { pointer-events: auto; }
.mode-3d .kfmark { display: none; }

/* beats: [data-show] is off until ui.js adds .is-on (stage active and local t inside the range) */
.mode-3d .stage [data-show] {
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity var(--t-fast) ease,
    transform var(--t-fast) ease,
    clip-path var(--t-fast) ease,
    visibility 0s linear var(--t-fast);
}
.mode-3d.is-loaded .stage [data-show].is-on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity var(--t-med) var(--ease) calc(var(--i, 0) * 70ms + 60ms),
    transform var(--t-slow) var(--ease) calc(var(--i, 0) * 70ms + 60ms),
    clip-path var(--t-slow) var(--ease) calc(var(--i, 0) * 70ms + 60ms),
    visibility 0s;
}
/* display headlines wipe open from the top edge instead of fading */
.mode-3d .stage .display[data-show] {
  clip-path: inset(-.1em -.1em 100% -.1em);
  transform: translate3d(0, .18em, 0);
}
.mode-3d.is-loaded .stage .display[data-show].is-on {
  clip-path: inset(-.1em -.1em -.3em -.1em);
}


/* ===== chrome: bar ===== */

.bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 6;
  height: var(--bar-h);
  padding-inline: var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  pointer-events: none;
  transition: color var(--t-med) ease;
}
.bar > * { pointer-events: auto; }
.bar__mark { justify-self: start; display: inline-flex; border-radius: 10px; }
.bar__mark .keycap { transition: transform var(--t-fast) var(--ease); }
.bar__mark:hover .keycap { transform: translateY(-2px) rotate(-4deg); }
.bar__mark:active .keycap { transform: translateY(2px); }

.bar__name {
  justify-self: center;
  font: 600 15px/1 var(--font-display);
  letter-spacing: -.01em;
  transition: opacity var(--t-fast) ease, transform var(--t-med) var(--ease);
}
.mode-static.is-scrolled .bar__name { opacity: 0; transform: translateY(-8px); }

.bar__links { display: none; }
html:not(.js) .bar__links {
  grid-column: 3; justify-self: end;
  display: flex; gap: 18px;
  font: 500 14px/1 var(--font-body);
}
html:not(.js) .bar__menu { display: none; }

.bar__menu {
  grid-column: 3; justify-self: end;
  display: inline-flex; align-items: center; gap: 12px;
  height: 40px;
  padding: 0 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font: 500 11px/1 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease;
}
.bar__menu:focus-visible { border-radius: 999px; }
.bar__menu:hover { background: var(--fg); color: var(--inv); border-color: var(--fg); }
.bar__menu-icon { position: relative; width: 16px; height: 10px; }
.bar__menu-icon i {
  position: absolute; left: 0; right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform var(--t-med) var(--ease);
}
.bar__menu-icon i:first-child { top: 1px; }
.bar__menu-icon i:last-child { bottom: 1px; }

.menu-open .bar { color: var(--c-cream); }
.menu-open .bar__name { opacity: 1; transform: none; }
.menu-open .bar__menu { background: transparent; border-color: rgba(244, 239, 230, .3); color: var(--c-cream); }
.menu-open .bar__menu:hover { background: var(--c-cream); color: var(--c-ink); border-color: var(--c-cream); }
.menu-open .bar__menu-icon i:first-child { transform: translateY(3.25px) rotate(45deg); }
.menu-open .bar__menu-icon i:last-child { transform: translateY(-3.25px) rotate(-45deg); }
.menu-open .bar :focus-visible { outline-color: var(--c-lime); }


/* ===== chrome: menu ===== */

.menu {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: var(--c-ink);
  color: var(--c-cream);
  visibility: hidden;
  clip-path: inset(0 0 100% 0);
  overscroll-behavior: contain;
  transition: clip-path .55s var(--ease-inout), visibility 0s linear .55s;
}
html:not(.js) .menu { display: none; }
.menu-open .menu {
  visibility: visible;
  clip-path: inset(0 0 0 0);
  transition: clip-path .65s var(--ease-inout), visibility 0s;
}
.menu :focus-visible { outline-color: var(--c-lime); }
.menu .label { color: rgba(244, 239, 230, .5); }

.menu__inner {
  height: 100%;
  max-width: 1480px;
  margin-inline: auto;
  padding: calc(var(--bar-h) + clamp(8px, 3vh, 40px)) var(--gutter) clamp(20px, 4vh, 44px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: clamp(10px, 2.4vh, 28px);
  overflow-y: auto;
}

.menu__list { align-self: center; display: grid; }
.menu__list li { border-top: 1px solid rgba(244, 239, 230, .14); }
.menu__list li:last-child { border-bottom: 1px solid rgba(244, 239, 230, .14); }
.menu__list a {
  display: grid;
  grid-template-columns: clamp(44px, 8vw, 120px) 1fr auto;
  align-items: baseline;
  padding: clamp(6px, 1.5vh, 16px) 0;
}
.menu__list a::after {
  content: '';
  align-self: center;
  width: clamp(10px, 1.4vw, 18px); height: clamp(10px, 1.4vw, 18px);
  margin-right: 6px;
  background: var(--c-lime);
  transform: rotate(45deg) scale(0);
  transition: transform var(--t-med) var(--ease);
}
.menu__list a:hover::after,
.menu__list a:focus-visible::after,
.menu__list a[aria-current='true']::after { transform: rotate(45deg) scale(1); }
.menu__num {
  font: 500 11px/1 var(--font-mono);
  letter-spacing: .12em;
  color: rgba(244, 239, 230, .5);
}
.menu__text {
  font: 600 clamp(40px, min(9.4vw, 12.5vh), 132px)/1 var(--font-display);
  letter-spacing: -.045em;
  transition: transform var(--t-med) var(--ease), color var(--t-fast) ease;
}
.menu__list a:hover .menu__text,
.menu__list a:focus-visible .menu__text { transform: translateX(clamp(8px, 1.4vw, 22px)); }
.menu__talk .menu__text { color: var(--c-lime); }

.menu__foot {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto;
  gap: 18px var(--gap);
  align-items: start;
}
.menu__col { display: grid; gap: 10px; }
.menu__ext { display: flex; flex-wrap: wrap; gap: 6px 22px; font: 500 15px/1.4 var(--font-body); }
.menu__ext a { border-bottom: 1px solid rgba(244, 239, 230, .3); transition: border-color var(--t-fast) ease, color var(--t-fast) ease; }
.menu__ext a:hover { color: var(--c-lime); border-color: var(--c-lime); }
.menu .themes { --fg: var(--c-cream); --fg-soft: rgba(244, 239, 230, .5); --accent: var(--c-lime); }

/* staggered entrance of the menu contents */
.menu__list li,
.menu__eyebrow,
.menu__foot {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity .2s ease, transform .2s ease;
}
.menu-open .menu__list li,
.menu-open .menu__eyebrow,
.menu-open .menu__foot {
  opacity: 1;
  transform: none;
  transition: opacity var(--t-med) var(--ease) calc(var(--i, 0) * 60ms + 220ms), transform var(--t-slow) var(--ease) calc(var(--i, 0) * 60ms + 220ms);
}

@media (max-width: 640px) {
  .menu__foot { grid-template-columns: 1fr 1fr; }
  .menu__col:first-child { grid-column: 1 / -1; }
}
@media (orientation: portrait) {
  .menu__text { font-size: clamp(40px, min(15.5vw, 9vh), 132px); }
  .menu__list a { padding: clamp(8px, 1.6vh, 18px) 0; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .menu__inner { grid-template-rows: 1fr auto; padding-top: calc(var(--bar-h) + 4px); }
  .menu__inner > nav { align-self: center; }
  .menu__eyebrow { display: none; }
  .menu__list { grid-template-columns: 1fr 1fr; column-gap: var(--gap); }
  .menu__list li:nth-last-child(2) { border-bottom: 1px solid rgba(244, 239, 230, .14); }
  .menu__list a { grid-template-columns: 36px 1fr auto; }
  .menu__text { font-size: clamp(32px, 13vh, 64px); }
}

/* time-of-day switch (HUD and menu) */
.themes {
  display: inline-flex; align-items: center; gap: 4px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-soft);
}
.themes button {
  position: relative;
  padding: 10px 6px;
  color: var(--fg-soft);
  letter-spacing: inherit;
  text-transform: inherit;
  transition: color var(--t-fast) ease;
}
.themes button::after {
  content: '';
  position: absolute; left: 6px; right: 6px; bottom: 4px;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--t-med) var(--ease);
}
.themes button:hover { color: var(--fg); }
.themes button[aria-pressed='true'] { color: var(--fg); }
.themes button[aria-pressed='true']::after { transform: scaleX(1); }


/* ===== chrome: HUD (timeline) ===== */

.hud { display: none; }
.mode-3d .hud {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 4;
  height: calc(var(--hud-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 var(--gutter) env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  column-gap: clamp(26px, 3vw, 44px);
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--sky-bottom) 55%, transparent));
  opacity: 0;
  transform: translate3d(0, 100%, 0);
  transition: opacity var(--t-med) ease .2s, transform var(--t-slow) var(--ease) .2s;
}
.mode-3d.is-loaded .hud { opacity: 1; transform: none; }

.hud__tc { display: flex; flex-direction: column; justify-content: center; gap: 5px; min-width: 76px; }
.hud__time {
  font: 500 13px/1 var(--font-mono);
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.hud__scene {
  font: 500 9.5px/1 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-soft);
}

.hud__track { position: relative; --rail: calc(var(--hud-h) * .64); }
.hud__line,
.hud__fill {
  position: absolute; left: 0; right: 0; top: var(--rail);
  height: 1px;
  background: var(--line);
}
.hud__fill {
  height: 1.5px; margin-top: -.25px;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.hud__head {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
}
.hud__head i {
  position: absolute; left: -.75px;
  top: calc(var(--rail) - 15px);
  width: 1.5px; height: 30px;
  background: var(--accent);
}
.hud__head i::before {
  content: '';
  position: absolute; left: -4.25px; top: -2px;
  border: 5px solid transparent;
  border-top: 7px solid var(--accent);
  border-bottom: 0;
}

.kf {
  position: absolute;
  left: calc(var(--x) * 100%);
  top: 0;
  height: 100%;
  min-width: 34px;
  padding: 0 6px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  color: var(--fg-soft);
  transition: color var(--t-fast) ease;
}
.kf__label {
  margin-top: calc(var(--rail) - 28px);
  font: 500 10px/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: transform var(--t-med) var(--ease);
}
.kf__gem {
  position: absolute; left: 50%; top: var(--rail);
  width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px;
  background: var(--sky-bottom);
  border: 1.5px solid var(--fg);
  transform: rotate(45deg);
  transition: transform var(--t-med) var(--ease), background-color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.kf:hover { color: var(--fg); }
.kf:hover .kf__gem { transform: rotate(45deg) scale(1.25); }
.kf.is-past .kf__gem { background: var(--fg); }
.kf[aria-current='true'] { color: var(--fg); }
.kf[aria-current='true'] .kf__gem { background: var(--accent); border-color: var(--accent); transform: rotate(45deg) scale(1.35); }
.kf[aria-current='true'] .kf__label { transform: translateY(-2px); }

.hud__themes { align-self: center; }
.hud__cycle { display: none; }

/* phones: timecode + track + small theme toggle */
@media (max-width: 760px) {
  .mode-3d .hud { column-gap: 22px; }
  .hud__themes { display: none; }
  .kf { min-width: 22px; padding: 0; }
  .kf__label {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%);
  }
  .hud__track { --rail: calc(var(--hud-h) * .5); }
  .hud__head i { top: calc(var(--rail) - 12px); height: 24px; }
  .hud__cycle {
    align-self: center;
    display: inline-flex; align-items: center; gap: 8px;
    height: 34px;
    padding: 0 12px 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font: 500 10px/1 var(--font-mono);
    letter-spacing: .12em;
    text-transform: uppercase;
  }
  .hud__cycle:focus-visible { border-radius: 999px; }
  .hud__cycle-icon {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--c-sun);
    box-shadow: 0 0 0 1.5px var(--fg);
    transition: background var(--t-med) ease, box-shadow var(--t-med) ease;
  }
  html[data-theme='dusk'] .hud__cycle-icon { background: linear-gradient(180deg, var(--c-coral) 50%, var(--c-violet) 50%); }
  html[data-theme='night'] .hud__cycle-icon { background: transparent; box-shadow: inset 4px -2px 0 0 var(--c-lime), 0 0 0 1.5px var(--fg); }
}


/* ===== chrome: loader ===== */

.loader { display: none; }
.mode-3d .loader {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: var(--gutter);
  background: var(--c-ink);
  color: var(--c-cream);
  clip-path: inset(0 0 0 0);
  transition: clip-path .8s var(--ease-inout), visibility 0s linear .8s;
}
.mode-3d.no-loader .loader { display: none; }
.mode-3d.is-loaded .loader { clip-path: inset(0 0 100% 0); visibility: hidden; pointer-events: none; }
.loader__line {
  align-self: center; justify-self: center;
  text-align: center;
  font: 500 11px/1.8 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.loader__count {
  justify-self: end;
  display: flex; align-items: flex-end; gap: 14px;
  font: 700 clamp(72px, 15vw, 220px)/.8 var(--font-display);
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}
.loader__label {
  padding-bottom: .1em;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: .14em;
  color: rgba(244, 239, 230, .5);
}
.loader__bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(244, 239, 230, .12);
}
.loader__bar i {
  display: block; height: 100%;
  background: var(--c-lime);
  transform-origin: 0 50%;
  transform: scaleX(0);
}


/* ===== chrome: footer ===== */

.footer {
  max-width: 1480px;
  margin-inline: auto;
  padding: clamp(28px, 4vw, 48px) var(--gutter) clamp(28px, 4vw, 44px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 10px var(--gap);
  font-size: 14px;
  color: var(--fg-soft);
}
.footer__name { font: 700 16px/1 var(--font-display); letter-spacing: -.01em; color: var(--fg); }
.footer__top { justify-self: end; color: var(--fg); }
@media (max-width: 760px) {
  .footer { grid-template-columns: 1fr auto; }
  .footer__copy { grid-column: 1 / -1; grid-row: 2; }
}

/* 3D mode: only the copyright line, pinned above the HUD during the last scene */
.mode-3d .footer {
  position: fixed;
  left: var(--gutter); right: var(--gutter);
  bottom: calc(var(--hud-h) + env(safe-area-inset-bottom, 0px) + 12px);
  z-index: 3;
  display: block;
  max-width: none;
  padding: 0;
  font: 500 10px/1.4 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--t-fast) ease, visibility 0s linear var(--t-fast);
}
.mode-3d .footer__name,
.mode-3d .footer__top { display: none; }
.mode-3d[data-scene='contact'] .footer { opacity: 1; visibility: visible; transition: opacity var(--t-med) ease .3s, visibility 0s; }
@media (max-width: 600px) {
  .mode-3d .footer__craft { display: none; }
}
@media (orientation: landscape) and (max-height: 520px), (orientation: portrait) and (max-height: 740px) {
  .mode-3d .footer { display: none; }
}


/* ==========================================================================
   ===== scene: hero =====
   ========================================================================== */

/* shared */
.hero__title .w { display: inline-block; vertical-align: top; }
.hero__title .w > span { display: inline-block; }
.lede {
  font-size: clamp(16px, 1.25vw, 19px);
  line-height: 1.5;
  text-wrap: pretty;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: clamp(16px, 2vw, 26px); }
.hero__name-big {
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: .32em;
  text-transform: uppercase;
}
.hero__name-roles {
  margin-top: 8px;
  font: 500 clamp(17px, 1.7vw, 26px)/1.2 var(--font-display);
  letter-spacing: -.02em;
}
.keys { display: grid; gap: calc(var(--key) * .12); width: max-content; }
.keys__row { display: flex; gap: calc(var(--key) * .1); }
.keys__row--2 { margin-left: calc(var(--key) * .5); }
.keys .keycap { --key: inherit; }

/* static */
.mode-static .hero {
  --hero-fs: clamp(60px, 12.9vw, 194px);
  min-height: min(100svh, 1000px);
  padding-top: calc(var(--bar-h) + clamp(12px, 3vh, 36px));
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto 1fr auto auto;
  column-gap: var(--gap);
  row-gap: clamp(24px, 3.4vw, 48px);
}
/* two lines: "I build" with the name keys beside it, then "the whole thing." across the full measure */
.mode-static .hero__title {
  grid-area: 2 / 1 / 3 / -1;
  align-self: center;
  font-size: var(--hero-fs);
  line-height: .86;
  letter-spacing: -.05em;
  text-wrap: wrap;
}
.mode-static .hero__keys {
  --key: clamp(40px, 6.5vw, 100px);
  grid-area: 2 / 5 / 3 / -1;
  align-self: center; justify-self: end;
  margin-right: clamp(0px, 1.2vw, 20px);
  transform: translateY(calc(var(--hero-fs) * -.7)) rotate(-5deg);
}
.mode-static .hero__copy { grid-area: 3 / 1 / 4 / 7; max-width: 520px; }
.mode-static .hero__name { grid-area: 3 / 8 / 4 / -1; align-self: end; justify-self: end; text-align: right; }
.mode-static .hero__index { grid-area: 4 / 1 / 5 / -1; }
.mode-static .hero__note,
.mode-static .scrollcue { display: none; }

/* static: the section index drawn as a timeline */
.kfindex {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: var(--gap);
  padding: 18px 0 4px;
  border-top: 1px solid var(--line);
}
.kfindex ol { display: flex; justify-content: space-between; gap: 8px; }
.kfindex a {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 0;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.kfindex i { transition: transform var(--t-med) var(--ease); }
.kfindex a:hover i { transform: rotate(135deg) scale(1.3); }
.kfindex small { font-size: inherit; color: var(--fg-soft); }

@media (max-width: 900px) {
  .mode-static .hero { --hero-fs: clamp(56px, 17.4vw, 150px); grid-template-rows: auto auto auto auto auto; min-height: 0; }
  .mode-static .hero__title { margin-top: clamp(8px, 4vw, 40px); }
  .mode-static .hero__keys {
    --key: clamp(44px, 12.6vw, 84px);
    grid-area: 3 / 1 / 4 / -1;
    align-self: start; justify-self: start;
    margin: 4px 0 8px 4px;
    transform: rotate(-4deg);
    transform-origin: 0 0;
  }
  .mode-static .hero__copy { grid-area: 4 / 1 / 5 / -1; }
  .mode-static .hero__name { grid-area: 5 / 1 / 6 / -1; justify-self: start; text-align: left; }
  .mode-static .hero__index { grid-area: 6 / 1 / 7 / -1; }
  .kfindex { grid-template-columns: 1fr; row-gap: 6px; }
  .kfindex ol { flex-wrap: wrap; justify-content: flex-start; gap: 4px 22px; }
  .kfindex small { display: none; }
}

/* 3d — landscape: headline bottom-left, copy bottom-right, note up-right of him, name bottom-centre */
.mode-3d .hero__keys,
.mode-3d .hero__index,
.mode-3d .hero__br { display: none; }
.mode-3d .hero__title {
  grid-area: 3 / 1 / 4 / 6;
  align-self: end;
  font-size: clamp(44px, min(7.6vw, 14vh), 148px);
  line-height: .88;
  letter-spacing: -.045em;
  text-wrap: wrap;
  max-width: 4.6em;
}
.mode-3d .hero__copy { grid-area: 3 / 10 / 4 / 13; align-self: end; }
.mode-3d .hero__copy .lede { font-size: clamp(14.5px, 1.18vw, 18px); }
.mode-3d .hero__name { grid-area: 3 / 3 / 4 / 11; align-self: end; justify-self: center; text-align: center; }
.mode-3d .hero__note {
  grid-area: 2 / 8 / 3 / 12;
  align-self: start; justify-self: center;
  margin-top: clamp(8px, 7vh, 80px);
}
.mode-3d .scrollcue { grid-area: 3 / 6 / 4 / 8; align-self: end; justify-self: center; }
@media (orientation: landscape) and (max-width: 1180px) {
  .mode-3d .hero__copy { grid-column: 9 / 13; }
}

/* 3d: the headline reveals word by word; the container itself only gates visibility */
.mode-3d .stage .hero__title[data-show] { clip-path: none; transform: none; }
.mode-3d.is-loaded .stage .hero__title[data-show].is-on { clip-path: none; }
.mode-3d .hero__title .w { overflow: hidden; padding: 0 .04em .14em; margin: 0 -.04em -.14em; }
.mode-3d .hero__title .w > span {
  transform: translate3d(0, 108%, 0);
  transition: transform var(--t-fast) ease;
}
.mode-3d.is-loaded .hero__title.is-on .w > span {
  transform: none;
  transition: transform var(--t-slow) var(--ease) calc(var(--i) * 70ms + 80ms);
}

/* the hand-drawn note */
.note {
  position: relative;
  width: max-content;
  font: italic 500 clamp(15px, 1.25vw, 19px)/1.25 var(--font-display);
  letter-spacing: -.01em;
  transform-origin: 0 100%;
}
.mode-3d .stage .note[data-show] { transform: rotate(-5deg) translate3d(0, 10px, 0); }
.mode-3d.is-loaded .stage .note[data-show].is-on { transform: rotate(-5deg); }
.note__text { display: block; }
.note__arrow {
  position: absolute;
  right: calc(100% + 6px); top: 58%;
  width: clamp(84px, 8.4vw, 132px);
  overflow: visible;
}
.note__scribble {
  position: absolute;
  left: -2px; top: 1.18em;
  width: 4.9em; height: 9px;
  overflow: visible;
}
.note__stroke {
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.note__scribble .note__stroke { stroke: var(--c-coral); stroke-width: 2.2; }
/* Drawn on with a clip sweep, not stroke-dash + pathLength: WebKit (every iOS browser) measures
   dashes in screen space under non-scaling-stroke, so only part of the arrow showed and no head. */
.note__arrow { clip-path: inset(0 0 100% 100%); transition: clip-path var(--t-fast) ease; }
.note__scribble { clip-path: inset(0 100% 0 0); transition: clip-path var(--t-fast) ease; }
.mode-3d.is-loaded .note.is-on .note__arrow { clip-path: inset(-12px); transition: clip-path .9s var(--ease-inout) .55s; }
.mode-3d.is-loaded .note.is-on .note__scribble { clip-path: inset(-12px); transition: clip-path .5s var(--ease-inout) .35s; }

/* scroll cue: gone for good after the first scroll (html.has-scrolled) */
.scrollcue {
  display: inline-flex; flex-direction: column; align-items: center; gap: 10px;
  font: 500 10px/1 var(--font-mono);
  letter-spacing: .24em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity var(--t-med) ease;
}
.scrollcue i {
  position: relative;
  width: 1px; height: clamp(26px, 5vh, 46px);
  background: var(--line);
  overflow: hidden;
}
.scrollcue i::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--fg);
  animation: cue-drop 1.9s var(--ease-inout) infinite;
}
@keyframes cue-drop {
  0% { transform: translateY(-101%); }
  55% { transform: translateY(0); }
  100% { transform: translateY(101%); }
}
.mode-3d.is-loaded .scrollcue { opacity: 1; transition-delay: 1.1s; }
.mode-3d.has-scrolled .scrollcue { opacity: 0; transition-delay: 0s; }

/* 3d — portrait: status + headline in the top band, copy + CTAs in the bottom band */
@media (orientation: portrait) {
  .mode-3d .hero { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .mode-3d .hero__title {
    grid-area: 2 / 1 / 3 / -1;
    align-self: start;
    margin-top: clamp(8px, 1.6vh, 18px);
    font-size: clamp(38px, min(14.2vw, 7.4vh), 96px);
    max-width: none;
    text-wrap: balance;
  }
  .mode-3d .hero__note {
    grid-area: 3 / 1 / 4 / -1;
    align-self: start; justify-self: end;
    margin-top: clamp(4px, 1.4vh, 14px);
    font-size: 14px;
  }
  /* arrow hangs below the text and curls down-left to the avatar's face */
  .mode-3d .hero__note .note__arrow { width: 68px; top: calc(100% + 4px); right: auto; left: -28px; }
  .mode-3d .hero__copy { grid-area: 4 / 1 / 5 / -1; }
  .mode-3d .hero__copy .lede { font-size: 15px; line-height: 1.45; max-width: 34em; }
  .mode-3d .hero__copy .cta-row { margin-top: 14px; gap: 8px; }
  .mode-3d .hero__copy .btn { min-height: 46px; padding: 0 18px; font-size: 14.5px; }
  .mode-3d .hero__name { grid-area: 4 / 1 / 5 / -1; }
  .mode-3d .hero__name-roles { font-size: clamp(17px, 4.6vw, 26px); }
  .mode-3d .scrollcue {
    grid-area: 3 / 1 / 4 / -1;
    align-self: center; justify-self: end;
    flex-direction: row;
    writing-mode: vertical-rl;
    margin-right: -6px;
  }
  .mode-3d .scrollcue i { width: 1px; height: 34px; }
}


/* 3d — short landscape (a phone on its side): headline and buttons only */
@media (orientation: landscape) and (max-height: 520px) {
  .mode-3d .hero__title { font-size: clamp(32px, min(6.4vw, 15vh), 72px); }
  .mode-3d .hero__copy .lede,
  .mode-3d .scrollcue { display: none; }
  .mode-3d .hero__copy .cta-row { flex-direction: column; align-items: stretch; gap: 8px; margin: 0; }
  .mode-3d .hero__copy .btn { min-height: 44px; padding: 0 16px; font-size: 14.5px; }
  .mode-3d .hero__note { margin-top: 0; font-size: 14px; }
  .mode-3d .hero__note .note__arrow { width: 64px; }
  .mode-3d .hero__name-roles { font-size: 17px; margin-top: 4px; }
}


/* ==========================================================================
   ===== scene: about =====
   ========================================================================== */

/* shared */
.about__body { font-size: clamp(16px, 1.25vw, 19px); line-height: 1.55; text-wrap: pretty; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 var(--gap); }
.stat {
  display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.stat dd {
  font: 700 clamp(40px, 5.4vw, 88px)/.9 var(--font-display);
  letter-spacing: -.02em;
}
.stat dt {
  font: 500 10.5px/1.45 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-soft);
}

/* static */
.mode-static .about {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: clamp(36px, 5vw, 80px);
}
.mode-static .about__head { grid-column: 1 / -1; }
.mode-static .about__title { font-size: clamp(34px, 6.1vw, 100px); max-width: 15.5em; }
.mode-static .about__body { grid-column: 7 / -1; font-size: clamp(17px, 1.55vw, 23px); line-height: 1.5; }
.mode-static .about__stats { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .mode-static .about__body { grid-column: 1 / -1; }
  .mode-static .about__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
  .mode-static .stat dd { font-size: clamp(48px, 13vw, 84px); }
}

/* 3d — landscape: avatar + desk fill the left ~55%; text column in the right ~38% */
.mode-3d .about { grid-template-rows: minmax(0, 1fr) auto auto auto minmax(0, 1.25fr); row-gap: clamp(14px, 2.6vh, 30px); }
.mode-3d .about__head { grid-area: 2 / 8 / 3 / 13; display: grid; gap: clamp(10px, 1.8vh, 18px); }
.mode-3d .about__title { font-size: clamp(25px, min(3.15vw, 5.6vh), 52px); line-height: .98; letter-spacing: -.035em; }
.mode-3d .about__body { grid-area: 3 / 8 / 4 / 13; font-size: clamp(14.5px, 1.12vw, 17px); max-width: 34em; }
.mode-3d .about__stats { grid-area: 4 / 8 / 5 / 13; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: clamp(12px, 2.2vh, 22px); margin-top: clamp(2px, 1vh, 10px); }
.about__hint { display: none; }
.mode-3d .about__hint {
  display: block; position: absolute; left: var(--gutter); bottom: calc(var(--hud-h) + env(safe-area-inset-bottom, 0px) + clamp(14px, 3.2vh, 34px));
}
.mode-3d.is-loaded .stage .about__hint.is-on { opacity: .55; }
.mode-3d .about__hint::before { content: "\2194\00a0\00a0"; }
.mode-3d #about.can-orbit { cursor: grab; touch-action: pan-y; }
.mode-3d #about.can-orbit.is-grabbing { cursor: grabbing; }
.mode-3d .stat { padding-top: 10px; gap: 6px; }
.mode-3d .stat dd { font-size: clamp(30px, min(3.5vw, 6.4vh), 56px); }
.mode-3d .stat dt { font-size: 10px; }
/* each stat rises in after the block turns on */
.mode-3d .stats .stat { opacity: 0; transform: translate3d(0, 14px, 0); transition: opacity var(--t-fast) ease, transform var(--t-fast) ease; }
.mode-3d.is-loaded .stats.is-on .stat {
  opacity: 1; transform: none;
  transition: opacity var(--t-med) var(--ease) calc(var(--i) * 90ms + 120ms), transform var(--t-slow) var(--ease) calc(var(--i) * 90ms + 120ms);
}
@media (orientation: landscape) and (max-height: 620px) {
  .mode-3d .about__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mode-3d .stat dt { font-size: 9px; letter-spacing: .08em; }
}

/* 3d — portrait: label + headline on top; body, then stats, take turns in the bottom band */
@media (orientation: portrait) {
  .mode-3d .about { grid-template-rows: auto minmax(0, 1fr) auto; row-gap: 0; }
  .mode-3d .about__head { grid-area: 1 / 1 / 2 / -1; gap: 10px; }
  .mode-3d .about__title { font-size: clamp(24px, min(6.7vw, 4vh), 52px); }
  .mode-3d .about__body { grid-area: 3 / 1 / 4 / -1; align-self: end; font-size: clamp(15px, 2.2vw, 19px); line-height: 1.48; }
  .mode-3d .about__stats { grid-area: 3 / 1 / 4 / -1; align-self: end; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px var(--gap); margin: 0; }
  .mode-3d .stat dd { font-size: clamp(32px, 9vw, 64px); }
  .mode-3d .stat dt { font-size: 10px; }
}
@media (orientation: portrait) and (min-width: 600px) {
  .mode-3d .about__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* 3d — short portrait (a phone with its browser bars showing): the bottom band is ~130px tall */
@media (orientation: portrait) and (max-height: 740px) {
  .mode-3d .about__body .opt { display: none; }
  .mode-3d .about__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 10px; }
  .mode-3d .stat dd { font-size: clamp(28px, 8.4vw, 56px); }
  .mode-3d .stat dt { font-size: 9px; letter-spacing: .08em; }
}


/* 3d — short landscape: body, then stats, take turns under the headline (same beats as portrait) */
@media (orientation: landscape) and (max-height: 520px) {
  .mode-3d .about { grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1fr); row-gap: 10px; }
  .mode-3d .about__head { gap: 8px; }
  .mode-3d .about__head .label { display: none; }
  .mode-3d .about__title { font-size: clamp(18px, 6.2vh, 30px); }
  .mode-3d .about__body { grid-area: 3 / 8 / 4 / 13; font-size: 15px; line-height: 1.45; }
  .mode-3d .about__body .opt { display: none; }
  .mode-3d .about__stats { grid-area: 3 / 8 / 4 / 13; align-self: start; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 8px; margin: 0; }
  .mode-3d .stat { padding-top: 8px; gap: 4px; }
  .mode-3d .stat dd { font-size: clamp(24px, 7.4vh, 30px); }
  .mode-3d .stat dt { font-size: 10px; letter-spacing: .1em; }
}


/* ==========================================================================
   ===== scene: crafts =====
   ========================================================================== */

/* shared */
.craft { --craft: var(--c-violet); --craft-fg: var(--c-cream); }
.craft--design { --craft: var(--c-lime); --craft-fg: var(--c-ink); }
.craft--motion { --craft: var(--c-coral); --craft-fg: var(--c-ink); }
.craft__num {
  display: flex; align-items: center; gap: 12px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: .12em;
  color: var(--fg-soft);
}
.craft__chip {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--craft); color: var(--craft-fg);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--craft) 68%, #000);
  transition: transform var(--t-med) var(--ease);
}
.craft__chip svg { width: 16px; height: 16px; }
.craft__title { font: 700 clamp(22px, 2.2vw, 34px)/1.04 var(--font-display); letter-spacing: -.03em; }
.craft__desc { color: var(--fg-soft); text-wrap: pretty; }

/* static */
.mode-static .crafts { display: grid; row-gap: clamp(36px, 5vw, 80px); }
.mode-static .crafts__title { font-size: clamp(44px, 9.2vw, 156px); line-height: .86; letter-spacing: -.05em; }
.mode-static .crafts__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.mode-static .craft {
  display: grid; align-content: start; gap: 14px;
  padding: clamp(18px, 2vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: transform var(--t-med) var(--ease), border-color var(--t-fast) ease;
}
.mode-static .craft:hover { transform: translateY(-4px); border-color: var(--fg); }
.mode-static .craft:hover .craft__chip { transform: rotate(-8deg) scale(1.08); }
.mode-static .craft__num { justify-content: space-between; flex-direction: row-reverse; margin-bottom: clamp(28px, 6vw, 96px); }
.mode-static .craft__chip { width: 44px; height: 44px; border-radius: 12px; }
.mode-static .craft__chip svg { width: 22px; height: 22px; }
.mode-static .craft__more > div { display: grid; gap: 18px; }
.mode-static .craft__desc { font-size: 15.5px; line-height: 1.55; }
@media (max-width: 900px) {
  .mode-static .crafts__list { grid-template-columns: 1fr; }
  .mode-static .craft__num { margin-bottom: 20px; }
}

/* 3d — back layer: the headline, huge, behind the avatar. Full strength first, then a ghost while the list talks. */
.mode-3d .stage--back:has(.crafts-giant) { display: grid; place-items: center; }
.crafts-giant { font-size: min(13.6vw, 31vh); text-align: center; }
.mode-3d .stage .crafts-giant[data-show] { transform: none; opacity: 1; }
.crafts-giant .giant__ln { overflow: hidden; padding: .02em .06em .16em; margin-bottom: -.16em; }
.crafts-giant .giant__ln > span {
  transform: translate3d(0, 112%, 0);
  opacity: .1;
  transition: transform var(--t-med) ease, opacity var(--t-slow) ease;
}
.mode-3d.is-loaded .crafts-giant.is-on .giant__ln > span {
  transform: none;
  transition: transform var(--t-slow) var(--ease) calc(var(--i) * 90ms), opacity var(--t-slow) ease;
}
.mode-3d.is-loaded .crafts-giant.is-on.is-current .giant__ln > span { opacity: 1; }

/* 3d — landscape: label top-left, the three crafts as a column in the right ~30% */
.mode-3d .crafts__head { grid-area: 1 / 1 / 2 / 7; margin-top: 6px; }
.mode-3d .crafts__title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mode-3d .crafts__list {
  grid-area: 2 / 9 / 3 / 13; align-self: center; justify-self: end;
  width: min(100%, 430px);
  padding: clamp(6px, 1.1vh, 12px) clamp(16px, 1.5vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.mode-3d .craft {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 14px;
  align-items: center;
  padding: clamp(10px, 1.8vh, 16px) 0;
  border-top: 1px solid var(--line);
  opacity: .42;
  transition: opacity var(--t-med) ease;
}
.mode-3d .craft:first-child { border-top-color: transparent; }
.mode-3d .craft::before {            /* the playhead mark on the current craft */
  content: '';
  position: absolute; left: 0; top: -1px;
  width: 100%; height: 1.5px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--t-slow) var(--ease);
}
.mode-3d .craft.is-current { opacity: 1; }
.mode-3d .craft.is-current::before { transform: scaleX(1); }
.mode-3d .craft.is-current .craft__chip { transform: rotate(-8deg) scale(1.1); }
.mode-3d .craft__num { grid-area: 1 / 1; font-size: 0; gap: 0; }        /* chip only; the number is implied */
.mode-3d .craft__title { grid-area: 1 / 2; font-size: clamp(19px, min(1.9vw, 3.6vh), 28px); }
.mode-3d .craft__more {
  grid-area: 2 / 2;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-slow) var(--ease);
}
.mode-3d .craft__more > div {
  min-height: 0; overflow: hidden;
  display: grid; gap: 12px;
  opacity: 0;
  transition: opacity var(--t-fast) ease;
}
.mode-3d .craft__more > div::before { content: ''; height: 0; }          /* top gap that collapses with the row */
.mode-3d .craft__more > div::after { content: ''; height: 2px; }
.mode-3d .craft.is-current .craft__more { grid-template-rows: 1fr; }
.mode-3d .craft.is-current .craft__more > div { opacity: 1; transition: opacity var(--t-med) ease .15s; }
.mode-3d .craft__desc { font-size: clamp(14px, 1.05vw, 15.5px); line-height: 1.5; }

/* 3d — portrait: headline in the top band (still the back layer), the current craft alone in the bottom band */
@media (orientation: portrait) {
  .mode-3d .stage--back:has(.crafts-giant) { place-items: start; padding-top: calc(var(--bar-h) + 34px); }
  .crafts-giant { font-size: min(14.6vw, 9vh); text-align: left; }
  .mode-3d.is-loaded .crafts-giant.is-on .giant__ln > span { opacity: 1; }
  .mode-3d .crafts__head { grid-area: 1 / 1 / 2 / -1; margin-top: 0; }
  .mode-3d .crafts__list {
    grid-area: 3 / 1 / 4 / -1; align-self: end; justify-self: stretch;
    width: auto; display: grid;
    padding: 0; border: 0; border-radius: 0; background: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .mode-3d .craft {
    grid-area: 1 / 1;
    align-self: end;
    padding: 12px 0 0;
    border-top: 1px solid var(--line) !important;
    opacity: 0; visibility: hidden;
    transform: translate3d(0, 14px, 0);
    transition: opacity var(--t-fast) ease, transform var(--t-fast) ease, visibility 0s linear var(--t-fast);
  }
  .mode-3d .craft.is-current {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity var(--t-med) var(--ease) .15s, transform var(--t-slow) var(--ease) .15s, visibility 0s;
  }
  .mode-3d .craft__title { font-size: clamp(22px, 6vw, 34px); }
  .mode-3d .craft__more { grid-area: 2 / 1 / 3 / 3; grid-template-rows: 1fr; }
  .mode-3d .craft__more > div { opacity: 1; }
  .mode-3d .craft__desc { font-size: clamp(15px, 2.1vw, 18px); line-height: 1.45; }
}


/* 3d — short landscape: a wider, tighter list; tags step aside */
@media (orientation: landscape) and (max-height: 520px) {
  .mode-3d .crafts__list { grid-area: 1 / 8 / 4 / 13; width: min(100%, 360px); padding-block: 2px; }
  .mode-3d .craft { padding: 8px 0; column-gap: 12px; }
  .mode-3d .craft__title { font-size: 18px; }
  .mode-3d .craft__more > div { gap: 0; }
  .mode-3d .craft__desc { font-size: 14px; line-height: 1.4; padding-top: 4px; }
  .mode-3d .craft .tags { display: none; }
}


/* 3d — short portrait: title and description only */
@media (orientation: portrait) and (max-height: 740px) {
  .mode-3d .craft .tags { display: none; }
}


/* ==========================================================================
   ===== scene: ai =====
   The section reuses the crafts layout (.crafts, .crafts__list, .craft); only the differences live here.
   ========================================================================== */

/* shared */
.craft--speed { --craft: var(--c-sun); --craft-fg: var(--c-ink); }
.craft--precision { --craft: var(--c-coral); --craft-fg: var(--c-ink); }
.craft--research { --craft: var(--c-sky); --craft-fg: var(--c-ink); }
.craft--security { --craft: var(--c-lime); --craft-fg: var(--c-ink); }
.craft--deploy { --craft: var(--c-violet); --craft-fg: var(--c-cream); }
.craft--agents { --craft: var(--fg); --craft-fg: var(--inv, var(--c-cream)); }
.craft__link { color: var(--fg); white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; }
.craft__link:hover { text-decoration-thickness: 2px; }
.boost__lead { color: var(--fg-soft); text-wrap: pretty; }

/* static: the lead under the headline, six cards in two rows */
.mode-static .boost__lead { grid-column: 1 / -1; max-width: 46ch; font-size: clamp(17px, 1.5vw, 22px); line-height: 1.4; }
.mode-static .boost__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mode-static .boost__list .craft__num { margin-bottom: clamp(20px, 3vw, 48px); }
.mode-static .boost__list .craft__title { font-size: clamp(20px, 1.7vw, 26px); }
@media (max-width: 900px) {
  .mode-static .boost__list { grid-template-columns: 1fr; }
}

/* 3d: the headline types itself out (js/scenes/ai.js fills .tw__on and .tw__off), so it does not slide in */
.mode-3d .ai-giant .giant__ln > span { transform: none; transition: opacity var(--t-slow) ease; }
.mode-3d.is-loaded .ai-giant.is-on .giant__ln > span { transition: opacity var(--t-slow) ease; }
.ai-giant .tw__on { position: relative; }
.ai-giant .tw__off { visibility: hidden; }
.ai-giant .tw--caret .tw__on::after {
  content: '';
  position: absolute; left: 100%; bottom: .12em;
  width: .07em; height: .74em; margin-left: .05em;
  background: var(--accent);
  animation: tw-caret .7s steps(1) infinite;
}
@keyframes tw-caret { 50% { opacity: 0; } }
#scene { transition: opacity .12s linear; }

/* 3d: the headline carries the message, so the lead is for screen readers only; six rows sit a little tighter */
.mode-3d .boost__lead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (orientation: landscape) {
  .mode-3d .boost__list .craft { padding-block: clamp(6px, 1.1vh, 10px); }
  .mode-3d .boost__list .craft__title { font-size: clamp(18px, min(1.6vw, 3.1vh), 24px); }
  .mode-3d .boost__list .craft__chip { width: 28px; height: 28px; }
}
@media (orientation: landscape) and (max-height: 760px) {
  .mode-3d .boost__list .tags { display: none; }
}


/* ==========================================================================
   ===== scene: work =====
   ========================================================================== */

/* shared */
.project__meta {
  display: flex; align-items: center; gap: 12px;
  font: 500 11px/1.3 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.project__num { color: var(--fg-soft); }
.project__tag {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: .08em;
}
.project__title { font-family: var(--font-display); letter-spacing: -.03em; line-height: 1.06; text-wrap: balance; }
.project__name { font-weight: 700; }
.project__kind { font-weight: 500; color: var(--fg-soft); }
.project__desc { color: var(--fg-soft); text-wrap: pretty; }
.project__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font: 500 11px/1.3 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
.project__visit,
.project__case {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--fg); color: var(--inv);
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) var(--ease);
}
.project__visit:focus-visible,
.project__case:focus-visible { border-radius: 999px; }
.project__visit span,
.project__case span { display: inline-block; transition: transform var(--t-fast) var(--ease); }
/* with a case study (a page under /work/), that is the main action and the live site steps back to an outline */
.project__case ~ .project__visit { position: relative; z-index: 1; padding: 8px 13px; border: 1px solid var(--line); background: transparent; color: var(--fg); }
.project__case ~ .project__visit:hover { border-color: var(--fg); }
.project__state { display: inline-flex; align-items: center; gap: 8px; padding: 9px 0; color: var(--fg-soft); }
.project__state svg { width: 13px; height: 13px; flex: none; }

/* static: the nine projects as an editorial grid */
.mode-static .work { display: grid; row-gap: clamp(36px, 5vw, 80px); }
.mode-static .work__title { grid-column: 1; font-size: clamp(44px, 9.2vw, 156px); line-height: .86; letter-spacing: -.05em; }
.mode-static .work__head .work__title { grid-column: 1 / 2; }
.mode-static .work__counter,
.mode-static .work__pips { display: none; }
.mode-static .projects {
  --stagger: clamp(0px, 7vw, 120px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(44px, 6vw, 96px) var(--gap);
  padding-bottom: 8px;
}
.mode-static .project { position: relative; display: grid; align-content: start; gap: 18px; }
.mode-static .project:nth-child(even) { transform: translateY(var(--stagger)); }
.mode-static .project--wide { grid-column: 1 / -1; margin-top: var(--stagger); }
.mode-static .project__media {
  aspect-ratio: 5 / 4;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--media-bg);
}
.mode-static .project__media picture { width: 100%; height: 100%; }
.mode-static .project__media img,
.mode-static .project__media video {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .9s var(--ease);
}
.mode-static .project:hover .project__media img,
.mode-static .project:hover .project__media video { transform: scale(1.035); }
.mode-static .project__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
}
.mode-static .project__meta { grid-area: 1 / 1; }
.mode-static .project__foot { grid-area: 1 / 2; }
.mode-static .project__title { grid-area: 2 / 1 / 3 / -1; font-size: clamp(24px, 2.7vw, 42px); margin-top: 2px; }
.mode-static .project__desc { grid-area: 3 / 1 / 4 / -1; max-width: 56ch; font-size: clamp(15px, 1.1vw, 16.5px); }
.mode-static .project__visit::after,
.mode-static .project__case::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }   /* whole card clicks through */
.mode-static .project__case ~ .project__visit::after { content: none; }                                        /* ... to the case study when there is one */
.mode-static .project:hover .project__visit,
.mode-static .project:hover .project__case { background: var(--accent); color: var(--on-accent); }
.mode-static .project:hover .project__case ~ .project__visit { background: transparent; color: var(--fg); }
.mode-static .project:hover .project__visit span { transform: translate(2px, -2px); }
.mode-static .project:hover .project__case span { transform: translateX(3px); }
.mode-static .project:hover .project__case ~ .project__visit span { transform: none; }
@media (min-width: 720px) {
  .mode-static .project--wide .project__media { aspect-ratio: 7 / 3; }
}
@media (max-width: 719px) {
  .mode-static .projects { grid-template-columns: 1fr; --stagger: 0px; }
}

/* 3d — back layer: the running project number, outlined, behind avatar and card */
.work-giant {
  position: absolute;
  left: calc(var(--gutter) - .04em); top: 54%;
  font-size: min(52vh, 33vw);
  line-height: .74;
  letter-spacing: -.06em;
  font-variant-numeric: tabular-nums;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--fg);
  transform: translate3d(0, -50%, 0);
}
.mode-3d .stage .work-giant[data-show] { transform: translate3d(0, -46%, 0); }
.mode-3d.is-loaded .stage .work-giant[data-show].is-on { opacity: .3; transform: translate3d(0, -50%, 0); }
.work-giant > span { display: block; }
.work-giant > span.tick-a { animation: work-tick-a .6s var(--ease) both; }
.work-giant > span.tick-b { animation: work-tick-b .6s var(--ease) both; }
@keyframes work-tick-a { from { transform: translate3d(0, 9%, 0); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes work-tick-b { from { transform: translate3d(0, 9%, 0); opacity: 0; } to { transform: none; opacity: 1; } }

/* 3d — landscape: headline top-left, caption panel in the right ~28%, the 3D card owns the centre */
.mode-3d .work__head { grid-area: 1 / 1 / 2 / 6; display: grid; justify-items: start; gap: clamp(8px, 1.4vh, 14px); margin-top: 6px; }
.mode-3d .work__title { font-size: clamp(26px, min(3.3vw, 6vh), 56px); }
.mode-3d .work__panel {
  grid-area: 2 / 9 / 3 / 13;
  align-self: center; justify-self: end;
  width: min(100%, max(250px, 25.5vw));
  display: grid;
  gap: clamp(12px, 2vh, 20px);
}
.work__counter {
  display: flex; align-items: baseline; gap: 8px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: .12em;
  color: var(--fg-soft);
  font-variant-numeric: tabular-nums;
}
.work__counter span:first-child { font: 700 clamp(30px, 3vw, 46px)/.9 var(--font-display); letter-spacing: -.04em; color: var(--fg); }
.mode-3d .projects { display: grid; }
.mode-3d .project {
  grid-area: 1 / 1;
  align-self: start;
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.mode-3d .project.is-current { opacity: 1; visibility: visible; transition: opacity .2s ease .12s, visibility 0s; }
.mode-3d .project__media { display: none; }
.mode-3d .project__body { display: grid; gap: clamp(10px, 1.6vh, 14px); justify-items: start; }
.mode-3d .project__body > * { opacity: 0; transform: translate3d(0, 14px, 0); transition: opacity .2s ease, transform .2s ease; }
.mode-3d .project.is-current .project__body > * {
  opacity: 1; transform: none;
  transition: opacity var(--t-med) var(--ease) calc(var(--j, 0) * 55ms + 140ms), transform var(--t-slow) var(--ease) calc(var(--j, 0) * 55ms + 140ms);
}
.mode-3d .project__body > :nth-child(2) { --j: 1; }
.mode-3d .project__body > :nth-child(3) { --j: 2; }
.mode-3d .project__body > :nth-child(4) { --j: 3; }
.mode-3d .project__num { display: none; }
.mode-3d .project__title { font-size: clamp(22px, min(2.15vw, 4.4vh), 34px); }
.mode-3d .project__kind { display: block; margin-top: 4px; font-size: .62em; letter-spacing: -.015em; }
.mode-3d .project__desc { font-size: clamp(14px, 1.05vw, 15.5px); line-height: 1.5; }
.mode-3d .project__visit:hover,
.mode-3d .project__case:hover { background: var(--accent); color: var(--on-accent); }
.mode-3d .project__case ~ .project__visit:hover { background: transparent; color: var(--fg); }
.mode-3d .project__visit:hover span { transform: translate(2px, -2px); }
.mode-3d .project__case:hover span { transform: translateX(3px); }

.work__pips { display: flex; gap: 2px; margin-left: -6px; }
.work__pips button { position: relative; width: 22px; height: 24px; }
.work__pips button::before {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border: 1.5px solid var(--fg);
  transform: rotate(45deg);
  transition: transform var(--t-med) var(--ease), background-color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.work__pips button:hover::before { transform: rotate(45deg) scale(1.3); }
.work__pips button[aria-current='true']::before { background: var(--accent); border-color: var(--accent); transform: rotate(45deg) scale(1.35); }

/* 3d — portrait: headline on top, caption in the bottom band under the card */
@media (orientation: portrait) {
  .work-giant { left: auto; right: calc(var(--gutter) - .02em); top: calc(var(--bar-h) + clamp(88px, 13.5vh, 150px)); font-size: min(30vw, 16vh); transform: none; }
  .mode-3d .stage .work-giant[data-show] { transform: translate3d(0, 6%, 0); }
  .mode-3d.is-loaded .stage .work-giant[data-show].is-on { transform: none; }
  .mode-3d .work__head { grid-area: 1 / 1 / 2 / -1; margin-top: 0; gap: 8px; }
  .mode-3d .work__title { font-size: clamp(28px, min(8vw, 4.6vh), 60px); }
  .mode-3d .work__panel {
    grid-area: 3 / 1 / 4 / -1;
    align-self: end; justify-self: stretch;
    width: auto;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px 12px;
  }
  .mode-3d .projects { grid-area: 2 / 1 / 3 / -1; }
  .mode-3d .project { align-self: end; }
  .mode-3d .project__body { gap: 8px; }
  .mode-3d .work__counter { grid-area: 1 / 1; }
  .mode-3d .work__counter span:first-child { font-size: 26px; }
  .mode-3d .work__pips { grid-area: 1 / 2; margin: 0 -7px 0 0; }
  .mode-3d .work__pips button { width: 20px; }
  .mode-3d .project__meta { display: none; }
  .mode-3d .project__title { font-size: clamp(20px, 5.6vw, 32px); }
  .mode-3d .project__kind { display: inline; margin: 0; font-size: .7em; }
  .mode-3d .project__desc {
    font-size: clamp(15px, 2.1vw, 18px); line-height: 1.42;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  }
  .mode-3d .project__visit { padding: 8px 13px; }
  .mode-3d .project__state { padding: 4px 0; }
}


/* 3d — landscape under 780px tall: the Contra link moves up beside the label, clear of his head */
@media (orientation: landscape) and (max-height: 780px) {
  .mode-3d .work__head { grid-template-columns: auto minmax(0, 1fr); column-gap: 22px; align-items: baseline; }
  .mode-3d .work__head .label { grid-area: 1 / 1; }
  .mode-3d .work__title { grid-area: 2 / 1 / 3 / -1; }
}

/* 3d — short landscape: number, name, three lines, link */
@media (orientation: landscape) and (max-height: 520px) {
  .mode-3d .work__title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }   /* no room above his head: the label carries it */
  .mode-3d .project__meta { display: none; }
  .mode-3d .work__panel { grid-area: 1 / 9 / 4 / 13; gap: 8px; width: min(100%, max(230px, 27vw)); }
  .mode-3d .work__counter span:first-child { font-size: 24px; }
  .mode-3d .project__body { gap: 8px; }
  .mode-3d .project__title { font-size: 20px; }
  .mode-3d .project__desc {
    font-size: 14px; line-height: 1.4;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  }
  .mode-3d .project__visit { padding: 8px 13px; }
  .mode-3d .project__state { padding: 4px 0; }
  .mode-3d .work__pips button { width: 19px; height: 20px; }
}


/* 3d — short portrait: status / visit link takes the pips' place beside the counter, two lines of copy */
@media (orientation: portrait) and (max-height: 740px) {
  .mode-3d .work__panel { position: relative; }
  .mode-3d .work__pips { display: none; }
  .mode-3d .project__foot { position: absolute; top: -3px; right: 0; }
  .mode-3d .project__desc { -webkit-line-clamp: 2; line-clamp: 2; }
}


/* ==========================================================================
   ===== scene: path =====
   ========================================================================== */

/* shared */
.milestone__num {
  display: flex; align-items: center; gap: 10px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: .12em;
  color: var(--fg);
}
.milestone__num span { color: var(--fg-soft); }
.milestone__role { font: 700 clamp(24px, 2.6vw, 40px)/1.02 var(--font-display); letter-spacing: -.035em; }
.milestone__org { font: 500 11px/1.4 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
html[data-theme='dusk'] .milestone__org { color: var(--fg); }
.milestone__desc { color: var(--fg-soft); text-wrap: pretty; }

/* static */
.mode-static .path { display: grid; row-gap: clamp(36px, 5vw, 80px); }
.mode-static .path__title { font-size: clamp(44px, 9.2vw, 156px); line-height: .86; letter-spacing: -.05em; }
.mode-static .path__list { position: relative; }
.mode-static .milestone {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto auto 1fr;
  column-gap: var(--gap);
  align-items: start;
  padding: clamp(22px, 2.8vw, 40px) 0;
  border-top: 1px solid var(--line);
}
.mode-static .milestone:last-child { border-bottom: 1px solid var(--line); }
.mode-static .milestone__num { grid-area: 1 / 1 / 4 / 3; padding-top: .7em; }
.mode-static .milestone__role { grid-area: 1 / 3 / 2 / 8; }
.mode-static .milestone__org { grid-area: 2 / 3 / 3 / 8; margin-top: 12px; }
.mode-static .milestone__desc { grid-area: 1 / 8 / 4 / -1; max-width: 46ch; font-size: clamp(15px, 1.2vw, 17.5px); padding-top: .35em; }
@media (max-width: 900px) {
  .mode-static .milestone { grid-template-columns: 1fr; grid-template-rows: none; row-gap: 10px; }
  .mode-static .milestone__num,
  .mode-static .milestone__role,
  .mode-static .milestone__org,
  .mode-static .milestone__desc { grid-area: auto; margin: 0; padding: 0; }
  .mode-static .milestone__desc { margin-top: 6px; }
}

/* 3d — landscape: headline top-left, one milestone card at a time in the right ~34% */
.mode-3d .path__head { grid-area: 1 / 1 / 2 / 7; display: grid; gap: clamp(8px, 1.4vh, 14px); margin-top: 6px; }
.mode-3d .path__title { font-size: clamp(26px, min(3.3vw, 6vh), 56px); }
.mode-3d .path__list { grid-area: 2 / 9 / 3 / 13; align-self: center; justify-self: end; width: min(100%, 430px); display: grid; }
.mode-3d .milestone {
  grid-area: 1 / 1;
  align-self: center;
  display: grid; gap: clamp(10px, 1.6vh, 14px);
  padding: clamp(18px, 1.8vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.mode-3d .stage .milestone[data-show] { transform: translate3d(28px, 0, 0); }
.mode-3d.is-loaded .stage .milestone[data-show].is-on { transform: none; }
.mode-3d .milestone__role { font-size: clamp(22px, min(2.2vw, 4.6vh), 34px); margin-top: clamp(6px, 1.6vh, 18px); }
.mode-3d .milestone__desc { font-size: clamp(14px, 1.05vw, 15.5px); line-height: 1.5; }

/* 3d — portrait */
@media (orientation: portrait) {
  .mode-3d .path__head { grid-area: 1 / 1 / 2 / -1; margin-top: 0; gap: 8px; }
  .mode-3d .path__title { font-size: clamp(28px, min(8vw, 4.6vh), 60px); }
  .mode-3d .path__list { grid-area: 3 / 1 / 4 / -1; align-self: end; justify-self: stretch; width: auto; }
  .mode-3d .milestone { align-self: end; gap: 8px; padding: 14px 16px 16px; border-radius: 16px; }
  .mode-3d .stage .milestone[data-show] { transform: translate3d(0, 18px, 0); }
  .mode-3d .milestone__role { font-size: clamp(21px, 5.8vw, 32px); margin-top: 2px; }
  .mode-3d .milestone__desc { font-size: clamp(15px, 2.1vw, 18px); line-height: 1.42; }
}


/* 3d — short landscape */
@media (orientation: landscape) and (max-height: 520px) {
  .mode-3d .path__head { gap: 6px; }
  .mode-3d .path__title { font-size: clamp(20px, 7vh, 30px); }
  .mode-3d .path__list { grid-area: 1 / 8 / 4 / 13; width: min(100%, 340px); }
  .mode-3d .milestone { gap: 8px; padding: 14px 16px 16px; border-radius: 16px; }
  .mode-3d .milestone__role { font-size: 20px; margin-top: 2px; }
  .mode-3d .milestone__desc { font-size: 14px; line-height: 1.4; }
}


/* 3d — short portrait: a tighter card, organisation up beside the count */
@media (orientation: portrait) and (max-height: 740px) {
  .mode-3d .milestone { grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; padding: 12px 14px 14px; }
  .mode-3d .milestone__num { grid-area: 1 / 1; }
  .mode-3d .milestone__org { grid-area: 1 / 2; justify-self: end; text-align: right; }
  .mode-3d .milestone__role { grid-area: 2 / 1 / 3 / -1; }
  .mode-3d .milestone__desc {
    grid-area: 3 / 1 / 4 / -1;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
  }
}


/* ==========================================================================
   ===== scene: contact =====
   ========================================================================== */

/* shared */
.contact__body { text-wrap: pretty; }
.contact__links { display: flex; flex-wrap: wrap; gap: 8px 26px; font-size: 15px; }

/* static: a dark slab that closes the page */
.mode-static .contact { padding-bottom: clamp(20px, 3vw, 40px); }
.mode-static .contact__panel {
  --fg: var(--c-cream);
  --fg-soft: rgba(244, 239, 230, .64);
  --accent: var(--c-lime);
  position: relative;
  overflow: hidden;
  display: grid;
  gap: clamp(40px, 8vw, 140px);
  padding: clamp(24px, 5vw, 80px);
  border: 1px solid var(--slab-line);
  border-radius: clamp(22px, 3vw, 44px);
  background: var(--slab);
  color: var(--c-cream);
}
.mode-static .contact__panel::after {            /* the enter key from the last shot */
  content: '↵';
  position: absolute;
  right: clamp(18px, 5vw, 80px); top: clamp(18px, 4.4vw, 70px);
  display: grid; place-items: center;
  width: clamp(56px, 9.6vw, 152px); aspect-ratio: 1;
  padding-bottom: .16em;
  border-radius: 20%;
  background: linear-gradient(165deg, #d8f86a 0%, var(--c-lime) 60%);
  box-shadow: 0 clamp(6px, 1vw, 16px) 0 #97bd18;
  color: var(--c-ink);
  font: 700 clamp(26px, 4.6vw, 72px)/1 var(--font-display);
  transform: rotate(8deg);
}
.mode-static .contact__head { display: grid; gap: clamp(20px, 3vw, 44px); }
.mode-static .contact__title { font-size: clamp(46px, 10.4vw, 176px); line-height: .86; letter-spacing: -.05em; max-width: 6.4em; }
.mode-static .contact__foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 22px var(--gap);
}
.mode-static .contact__body { grid-area: 1 / 1 / 3 / 2; max-width: 30em; font-size: clamp(17px, 1.55vw, 23px); line-height: 1.45; color: var(--fg-soft); }
.mode-static .contact__actions { grid-area: 1 / 2; justify-self: end; }
.mode-static .contact__links { grid-area: 2 / 2; justify-self: end; }
@media (max-width: 760px) {
  .mode-static .contact__foot { grid-template-columns: 1fr; }
  .mode-static .contact__body,
  .mode-static .contact__actions,
  .mode-static .contact__links { grid-area: auto; justify-self: start; }
  .mode-static .contact__title { max-width: none; padding-top: clamp(64px, 20vw, 120px); }
  .mode-static .btn--mail { min-height: 56px; padding: 0 22px; }
}

/* 3d — back layer: a giant "Say hi." behind the avatar on the right */
.contact-giant {
  position: absolute;
  right: calc(var(--gutter) + 1vw); top: 17%;
  font-size: min(13vw, 28vh);
  color: var(--accent);
}
.mode-3d .stage .contact-giant[data-show] { transform: none; opacity: 1; }
.contact-giant .giant__ln { overflow: hidden; padding: .02em .06em .12em; }
.contact-giant .giant__ln > span { transform: translate3d(0, 112%, 0); transition: transform var(--t-med) ease; }
.mode-3d.is-loaded .contact-giant.is-on .giant__ln > span { transform: none; transition: transform var(--t-slow) var(--ease) .1s; }

/* 3d — landscape: avatar on the right ~40%; label, headline, body, email and links on the left ~50% */
.mode-3d .contact__panel { grid-area: 2 / 1 / 3 / 7; align-self: center; display: grid; gap: clamp(18px, 3.4vh, 36px); margin-bottom: 4vh; }
.mode-3d .contact__head { display: grid; gap: clamp(10px, 2vh, 20px); }
.mode-3d .contact__title { font-size: clamp(40px, min(6.5vw, 13vh), 124px); line-height: .88; letter-spacing: -.045em; max-width: 6.2em; }
.mode-3d .contact__foot { display: grid; justify-items: start; gap: clamp(14px, 2.4vh, 24px); }
.mode-3d .contact__body { max-width: 26em; font-size: clamp(15px, 1.25vw, 19px); line-height: 1.5; }

/* 3d — portrait */
@media (orientation: portrait) {
  .contact-giant { right: auto; left: var(--gutter); top: 27%; font-size: min(25vw, 12vh); }
  .mode-3d .contact { grid-template-rows: minmax(0, 1fr); }
  .mode-3d .contact__panel { grid-area: 1 / 1 / 2 / -1; align-self: stretch; grid-template-rows: auto minmax(0, 1fr) auto; gap: 0; margin: 0 0 16px; }
  .mode-3d .contact__head { grid-row: 1; gap: 10px; }
  .mode-3d .contact__title { font-size: clamp(36px, min(11.4vw, 6.6vh), 92px); max-width: none; }
  .mode-3d .contact__foot { grid-row: 3; gap: 12px; }
  .mode-3d .contact__body { font-size: clamp(15px, 2.2vw, 19px); line-height: 1.45; }
  .mode-3d .btn--mail { min-height: 52px; padding: 0 22px; font-size: 16px; }
  .mode-3d .contact__links { font-size: 14.5px; }
}


/* 3d — short landscape: the headline runs in two lines so everything fits between bar and HUD */
@media (orientation: landscape) and (max-height: 520px) {
  .mode-3d .contact__panel { grid-area: 1 / 1 / 4 / 8; gap: 12px; margin: 0; }
  .mode-3d .contact__head { gap: 8px; }
  .mode-3d .contact__title { font-size: clamp(28px, 11.5vh, 52px); max-width: none; }
  .mode-3d .contact__foot { gap: 10px; }
  .mode-3d .contact__body { font-size: 15px; line-height: 1.4; max-width: 30em; }
  .mode-3d .btn--mail { min-height: 46px; padding: 0 20px; font-size: 16px; }
  .mode-3d .contact__links { font-size: 14.5px; }
}


/* 3d — short portrait */
@media (orientation: portrait) and (max-height: 740px) {
  .mode-3d .contact__panel { margin-bottom: 0; }
  .mode-3d .btn--mail { min-height: 48px; }
}


/* ===== print ===== */
@media print {
  .bar, .menu, .hud, .loader, #scene, .skip { display: none !important; }
  body::before { display: none; }
}
