/* ==========================================================================
   Engineering Portfolio — main stylesheet
   Themes: graphite (default) · cyanotype (blueprint)
   ========================================================================== */

@view-transition { navigation: auto; }

@property --cs { syntax: '<length>'; inherits: true; initial-value: 12px; }

:root {
  /* surfaces */
  --bg: #080A0D;
  --bg-2: #0C0F13;
  --panel: #11151A;
  /* ink */
  --ink: #E8ECF0;
  --ink-2: #A6B0BB;
  --ink-3: #7F8995;
  /* lines */
  --line: rgba(176, 196, 216, .11);
  --line-2: rgba(176, 196, 216, .22);
  /* signal */
  --accent: #FF5B1F;
  --accent-ink: #0A0A0A;
  --cyan: #8CC4E6;
  /* drafting grid */
  --grid-minor: rgba(140, 196, 230, .032);
  --grid-major: rgba(140, 196, 230, .065);
  /* 3D model (read by WebGL) */
  --model-line: #7FB6D8;
  --model-bright: #E8ECF0;
  --model-accent: #FF5B1F;

  --font-body: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-serif: 'Instrument Serif', 'Times New Roman', serif;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);

  --gutter: clamp(20px, 4vw, 56px);
  --maxw: 1440px;
  --header-h: 68px;

  --z-alt: 20;
  --z-preview: 30;
  --z-menu: 35;
  --z-header: 40;
  --z-toast: 90;
  --z-skip: 100;

  color-scheme: dark;
}

/* Prussian blue + warm paper-white, like a real cyanotype print.
   Less saturated than pure royal blue so light text doesn't vibrate. */
:root[data-theme="cyanotype"] {
  --bg: #102A44;
  --bg-2: #132F4B;
  --panel: #183754;
  --ink: #ECE8DF;
  --ink-2: #BCC5CE;
  --ink-3: #93A5B8;
  --line: rgba(225, 232, 240, .14);
  --line-2: rgba(225, 232, 240, .26);
  --accent: #F2834B;
  --accent-ink: #10202F;
  --cyan: #CFDCE8;
  --grid-minor: rgba(225, 232, 240, .045);
  --grid-major: rgba(225, 232, 240, .09);
  --model-line: #BFD2E4;
  --model-bright: #ECE8DF;
  --model-accent: #F2834B;
}
/* thin weights look spindly on a mid-tone ground; give display type a little body */
:root[data-theme="cyanotype"] :is(.hero__title, .sec__title, .cs-title, .contact__big, .about__lead, .next__title, .stat b, .cs-specs b, .work__metric b, .menu__link) { font-weight: 360; }
:root[data-theme="cyanotype"] body { -webkit-font-smoothing: auto; }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 160px 160px, 160px 160px, 32px 32px, 32px 32px;
  background-position: center top;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  transition: background-color .6s var(--ease-io), color .6s var(--ease-io);
}

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

.t-mono {
  font-family: var(--font-mono);
  font-size: .75rem;
  line-height: 1.5;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 400;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; left: 16px; top: -64px; z-index: var(--z-skip);
  background: var(--accent); color: var(--accent-ink);
  padding: 12px 16px; font-weight: 600; transition: top .2s;
}
.skip:focus { top: 16px; }

.i { width: 18px; height: 18px; flex: none; }

/* corner registration marks (drafting frame) */
.corners {
  --cm: var(--line-2);
  background-image:
    linear-gradient(var(--cm), var(--cm)), linear-gradient(var(--cm), var(--cm)),
    linear-gradient(var(--cm), var(--cm)), linear-gradient(var(--cm), var(--cm)),
    linear-gradient(var(--cm), var(--cm)), linear-gradient(var(--cm), var(--cm)),
    linear-gradient(var(--cm), var(--cm)), linear-gradient(var(--cm), var(--cm));
  background-repeat: no-repeat;
  background-size:
    var(--cs) 1px, 1px var(--cs), var(--cs) 1px, 1px var(--cs),
    var(--cs) 1px, 1px var(--cs), var(--cs) 1px, 1px var(--cs);
  background-position: 0 0, 0 0, 100% 0, 100% 0, 0 100%, 0 100%, 100% 100%, 100% 100%;
  transition: --cs .5s var(--ease-out);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 0 22px;
  font-size: .9375rem; font-weight: 500; letter-spacing: .01em;
  border: 1px solid transparent;
  transition: background-color .25s, color .25s, border-color .25s, transform .2s var(--ease-out);
  touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn .i { transition: transform .45s var(--ease-out); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--ink); }
.btn--primary:hover .i { transform: translateY(3px); }
.btn--ghost { border-color: var(--line-2); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--ghost:hover .i { transform: translate(2px, -2px); }

/* ---------- header ---------- */
.hdr {
  position: fixed; inset: 0 0 auto; z-index: var(--z-header);
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: transform .55s var(--ease-out), background-color .35s, border-color .35s;
}
.hdr.is-scrolled, .menu-open .hdr {
  background: color-mix(in srgb, var(--bg) 97%, transparent);
  border-color: var(--line);
}
.hdr.is-hidden { transform: translateY(-100%); }
.hdr__in { height: 100%; display: flex; align-items: center; gap: 20px; }

.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 500; font-size: 1rem; letter-spacing: .005em; }
.brand__mark { width: 30px; height: 30px; color: var(--ink); }
.brand__mark .orbit { transform-origin: 16px 16px; transition: transform 1.2s var(--ease-out); }
.brand:hover .brand__mark .orbit { transform: rotate(180deg); }

.nav { margin-left: auto; display: flex; gap: 2px; }
.nav a { position: relative; padding: 12px 12px; font-size: .9375rem; color: var(--ink-2); transition: color .2s; }
.nav a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 8px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: right;
  transition: transform .45s var(--ease-out);
}
.nav a:hover, .nav a[aria-current="true"] { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="true"]::after { transform: scaleX(1); transform-origin: left; }

.mode {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2);
  transition: border-color .25s, color .25s;
}
.mode:hover { border-color: var(--ink-2); color: var(--ink); }
.mode__dot { position: relative; width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--ink-2); overflow: hidden; }
.mode__dot::after { content: ""; position: absolute; inset: 0; background: var(--accent); transform: translateX(-50%); transition: transform .5s var(--ease-out); }
:root[data-theme="cyanotype"] .mode__dot::after { transform: translateX(50%); }

.menu-btn { display: none; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px 0 12px; }
.menu-btn__bars { position: relative; width: 22px; height: 10px; }
.menu-btn__bars::before, .menu-btn__bars::after {
  content: ""; position: absolute; left: 0; right: 0; height: 1px; background: currentColor;
  transition: transform .45s var(--ease-out), top .45s var(--ease-out);
}
.menu-btn__bars::before { top: 0; }
.menu-btn__bars::after { top: 9px; }
.menu-btn[aria-expanded="true"] .menu-btn__bars::before { top: 5px; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn__bars::after { top: 5px; transform: rotate(-45deg); }

@media (max-width: 880px) {
  .nav { display: none; }
  .menu-btn { display: inline-flex; }
  .mode { margin-left: auto; }
}
@media (max-width: 480px) {
  .mode__label { display: none; }
  .mode { padding: 0; width: 40px; justify-content: center; }
  .brand__name { font-size: .9375rem; }
}

/* ---------- mobile menu ---------- */
.menu {
  position: fixed; inset: 0; z-index: var(--z-menu);
  background: var(--bg);
  padding: calc(var(--header-h) + 32px) var(--gutter) max(32px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  opacity: 0; transition: opacity .35s var(--ease-out);
  overflow-y: auto;
}
.menu[hidden] { display: none; }
.menu.is-open { opacity: 1; }
.menu__link {
  display: flex; align-items: baseline; gap: 18px;
  font-size: clamp(2.2rem, 10vw, 3.4rem); font-weight: 300; line-height: 1.15; letter-spacing: -.02em;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  opacity: 0; transform: translateY(20px);
  transition: opacity .6s var(--ease-out), transform .7s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 60ms + 80ms);
}
.menu__link .t-mono { color: var(--accent); }
.menu.is-open .menu__link { opacity: 1; transform: none; }
.menu__foot { color: var(--ink-3); display: grid; gap: 6px; }

/* ---------- altimeter (scroll gauge) ---------- */
.alt {
  position: fixed; right: 20px; top: 50%; z-index: var(--z-alt);
  height: 42vh; width: 72px; transform: translateY(-50%);
  pointer-events: none; color: var(--ink-3);
  opacity: 0; transition: opacity .6s;
}
.alt.is-on { opacity: 1; }
.alt__scale {
  position: absolute; right: 0; top: 0; bottom: 0; width: 16px;
  background:
    repeating-linear-gradient(to bottom, var(--line-2) 0 1px, transparent 1px 42px) right / 16px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 8.4px) right / 8px 100% no-repeat;
}
.alt__marker {
  position: absolute; right: 0; top: 0; display: flex; align-items: center; gap: 8px;
  transform: translateY(calc(var(--p, 0) * 42vh - 50%));
  will-change: transform;
}
.alt__marker::after { content: ""; width: 24px; height: 1px; background: var(--accent); }
.alt__label { color: var(--ink-2); white-space: nowrap; }
@media (max-width: 1640px) { .alt { right: 14px; width: 40px; } .alt__label { display: none; } }
@media (max-width: 1280px) { .alt { display: none; } }

/* ---------- hero ---------- */
.hero {
  position: relative; isolation: isolate;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-top: calc(var(--header-h) + 24px);
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 22%, transparent 52%),
    radial-gradient(120% 90% at 70% 40%, transparent 55%, color-mix(in srgb, var(--bg) 80%, transparent) 100%);
}
.hero__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2;
  opacity: 0; transition: opacity 1.4s var(--ease-out);
}
.hero.is-3d .hero__canvas { opacity: 1; }
.hero__fallback {
  position: absolute; z-index: -2; color: var(--cyan);
  right: 2%; top: 46%; width: min(60vw, 900px); transform: translateY(-50%);
  opacity: 0; transition: opacity 1s;
}
.hero--static .hero__fallback { opacity: .75; }
@media (max-width: 880px) {
  .hero__fallback { right: 50%; top: 30%; width: 108vw; transform: translate(50%, -50%); }
}
@media (max-width: 760px) and (orientation: portrait) {
  /* reserve a band above the headline for the model */
  .hero { padding-top: calc(var(--header-h) + 16px); }
  .hero__hud { min-height: 66vw; padding-bottom: 0; }
  .hero__fallback { top: calc(var(--header-h) + 33vw); width: 100vw; }
}

/* HUD sits in normal flow at the top of the hero; margin-bottom:auto lets the
   headline push it up instead of sliding underneath it on short viewports. */
.hero__hud {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
  margin-bottom: auto; padding-bottom: 40px; pointer-events: none;
}
.hud { color: var(--ink-3); }
.hud b { font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hud--tr { text-align: right; }
.hud--tl::before {
  content: ""; display: block; width: 40px; height: 1px; background: var(--accent); margin-bottom: 12px;
}
@media (max-width: 640px) { .hud--tl { display: none; } .hud--tr { text-align: left; } }

/* crosshair (fine pointers only) */
.xhair { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .4s; }
.hero:hover .xhair.is-live { opacity: 1; }
.xhair i { position: absolute; background: var(--line); }
.xhair .xh { left: 0; right: 0; height: 1px; top: 0; transform: translateY(var(--y, 0)); }
.xhair .yh { top: 0; bottom: 0; width: 1px; left: 0; transform: translateX(var(--x, 0)); }
.xhair .xr {
  position: absolute; left: 0; top: 0; color: var(--ink-3);
  transform: translate(calc(var(--x, 0) + 14px), calc(var(--y, 0) + 12px));
  font-variant-numeric: tabular-nums;
}
@media (hover: none), (pointer: coarse) { .xhair { display: none; } }

/* 3D callouts */
.callouts { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .9s var(--ease-out); }
.callouts.is-on { opacity: 1; }
.callouts svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.callouts polyline { fill: none; stroke: var(--ink-3); stroke-width: 1; }
.callouts circle { fill: var(--bg); stroke: var(--accent); stroke-width: 1.25; }
.co { position: absolute; left: 0; top: 0; white-space: nowrap; color: var(--ink-2); will-change: transform; }
.co small { display: block; color: var(--ink-3); }
@media (max-width: 960px) { .callouts { display: none; } }

.hero__content { position: relative; padding-bottom: clamp(32px, 5vw, 56px); }
.eyebrow { color: var(--ink-3); display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.eyebrow::before { content: ""; width: 7px; height: 7px; background: var(--accent); }

.hero__title {
  font-size: clamp(2.6rem, 7.2vw, 6.6rem);
  line-height: .98; letter-spacing: -.03em; font-weight: 300;
  font-stretch: 100%;
  max-width: 13ch;
}
.hero__title em, .serif-em {
  font-family: var(--font-serif); font-style: italic; font-weight: 400;
  letter-spacing: -.01em; color: var(--accent);
  padding-right: .06em;
}
.ln { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.ln > span { display: inline-block; }

.hero__lead {
  margin-top: 28px; max-width: 46ch;
  font-size: clamp(1.05rem, 1.35vw, 1.2rem); line-height: 1.55; color: var(--ink-2);
}
.hero__cta { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 12px; }

.specs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-2);
}
.specs > div { padding: 18px 20px 22px 0; }
.specs > div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.specs dt { color: var(--ink-3); margin-bottom: 6px; }
.specs dd { font-size: .9375rem; color: var(--ink); }
.specs .dot::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #3DDC97; margin-right: 8px; vertical-align: 1px;
  box-shadow: 0 0 0 3px rgba(61, 220, 151, .18);
}
@media (max-width: 880px) {
  .specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .specs > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .specs > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

.cue {
  position: absolute; right: var(--gutter); bottom: calc(clamp(32px, 5vw, 56px) + 96px);
  display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--ink-3);
  writing-mode: vertical-rl; min-width: 44px;
}
.cue i { position: relative; width: 1px; height: 64px; background: var(--line-2); overflow: hidden; }
.cue i::after {
  content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 40%;
  background: var(--accent); animation: cue 2.2s var(--ease-io) infinite;
}
@keyframes cue { from { transform: translateY(-100%); } to { transform: translateY(260%); } }
@media (max-width: 880px) { .cue { display: none; } }

/* intro choreography (only when JS is running) */
.js .hero .ln > span, .js .cs-hero .ln > span { transform: translateY(108%); transition: transform 1.2s var(--ease-out); transition-delay: calc(var(--i, 0) * 90ms + 120ms); }
.js [data-intro] { opacity: 0; transform: translateY(16px); transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out); transition-delay: calc(var(--i, 0) * 90ms + 420ms); }
.js .hud, .js .cue { opacity: 0; transition: opacity 1.2s 1s; }
.is-loaded .hero .ln > span, .is-loaded .cs-hero .ln > span { transform: none; }
.is-loaded [data-intro] { opacity: 1; transform: none; }
.is-loaded .hud, .is-loaded .cue { opacity: 1; }

/* ---------- sections ---------- */
.sec { position: relative; padding-top: clamp(96px, 13vw, 176px); }
.sec__hd {
  display: grid; grid-template-columns: 140px minmax(0, 1fr) auto;
  align-items: end; gap: 16px 24px; margin-bottom: clamp(40px, 6vw, 72px);
}
.sec__idx { color: var(--accent); padding-bottom: .6em; }
.sec__title { font-size: clamp(2.2rem, 5vw, 4.2rem); line-height: 1; letter-spacing: -.025em; }
.sec__note { color: var(--ink-3); padding-bottom: .6em; text-align: right; }
.rule { grid-column: 1 / -1; height: 1px; background: var(--line-2); transform-origin: left; }
@media (max-width: 720px) {
  .sec__hd { grid-template-columns: 1fr; }
  .sec__idx, .sec__note { padding-bottom: 0; text-align: left; }
  .sec__note { order: 3; }
}

/* reveal system */
.js [data-reveal] {
  opacity: 0; transform: translateY(28px);
  transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal="line"] { opacity: 1; transform: scaleX(0); transition: transform 1.5s var(--ease-io); }
.js [data-reveal="line"].is-in { transform: scaleX(1); }
.js [data-reveal="fade"] { transform: none; }
.reveal-all [data-reveal] { opacity: 1 !important; transform: none !important; }

/* ---------- figures (generated line drawings) ---------- */
.fig { width: 100%; height: 100%; color: var(--ink); overflow: visible; }
.fig path { stroke: currentColor; stroke-width: var(--sw, 1.4); vector-effect: none; }
.fig .sub { stroke: var(--cyan); opacity: .7; }
.fig .acc { stroke: var(--accent); }
.fig .fill { fill: var(--accent); stroke: none; }
.fig .cl { stroke: var(--ink-3); stroke-dasharray: 22 5 3 5; opacity: .8; }
.fig text { fill: var(--ink-3); stroke: none; font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .06em; }
.fig text.hi { fill: var(--ink-2); }
.js .fig .d { stroke-dasharray: 1 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.8s var(--ease-io); transition-delay: calc(var(--k, 0) * 45ms); }
.js .fig .cl, .js .fig text, .js .fig .fill { opacity: 0; transition: opacity .8s var(--ease-out) 1s; }
.js .is-in .fig .d, .js .is-active .fig .d, .js .hero--static .fig .d { stroke-dashoffset: 0; }
.js .is-in .fig text, .js .is-active .fig text, .js .hero--static .fig text, .js .is-in .fig .fill, .js .is-active .fig .fill { opacity: 1; }
.js .is-in .fig .cl, .js .is-active .fig .cl, .js .hero--static .fig .cl { opacity: .8; }

/* ---------- work list ---------- */
.work { border-top: 1px solid var(--line-2); }
.work__row { border-bottom: 1px solid var(--line-2); }
.work__link {
  position: relative; isolation: isolate;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 140px 150px 64px 28px;
  grid-template-areas: "dwg main disc metric year arrow";
  align-items: center; gap: 24px;
  padding: 34px 0;
}
.work__link::before {
  content: ""; position: absolute; inset: 0 calc(var(--gutter) * -.5); z-index: -1;
  background: var(--panel);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform .55s var(--ease-out);
}
.work__link:hover::before, .work__link:focus-visible::before { transform: scaleY(1); }
.work__dwg { grid-area: dwg; color: var(--ink-3); transition: color .3s; }
.work__link:hover .work__dwg { color: var(--accent); }
.work__main { grid-area: main; min-width: 0; }
.work__title {
  display: block; font-size: clamp(1.35rem, 2.2vw, 1.95rem); font-weight: 400; line-height: 1.15; letter-spacing: -.012em;
  transition: transform .55s var(--ease-out);
}
.work__link:hover .work__title { transform: translateX(10px); }
.work__sum { display: block; margin-top: 8px; color: var(--ink-2); font-size: .9375rem; line-height: 1.5; max-width: 58ch; }
.work__disc { grid-area: disc; color: var(--ink-2); }
.work__metric { grid-area: metric; display: grid; }
.work__metric b { font-size: 1.85rem; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.work__metric b small { font-size: .9rem; color: var(--ink-2); margin-left: 4px; letter-spacing: 0; }
.work__metric .t-mono { color: var(--ink-3); margin-top: 6px; }
.work__year { grid-area: year; color: var(--ink-3); }
.work__arrow { grid-area: arrow; color: var(--ink-3); transition: color .3s, transform .45s var(--ease-out); }
.work__link:hover .work__arrow { color: var(--accent); transform: translate(3px, -3px); }
.work__fig { grid-area: fig; display: none; }

@media (max-width: 1100px) {
  .work__link { grid-template-columns: 100px minmax(0, 1fr) 140px 56px 28px; grid-template-areas: "dwg main metric year arrow"; }
  .work__disc { display: none; }
}
@media (max-width: 760px) {
  .work__link {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "dwg year arrow" "fig fig fig" "main main main" "metric metric metric";
    gap: 16px; padding: 28px 0 32px;
  }
  .work__link::before { display: none; }
  .work__fig {
    display: block; aspect-ratio: 16 / 10; padding: 6% 8%;
    background: var(--bg-2); border: 1px solid var(--line);
    --sw: 2.2;
  }
  .work__fig .fig text { display: none; }
  .work__metric { grid-template-columns: auto 1fr; align-items: baseline; gap: 12px; }
}

.preview {
  position: fixed; left: 0; top: 0; z-index: var(--z-preview);
  width: 400px; aspect-ratio: 16 / 10; pointer-events: none;
  transform: translate3d(var(--x, -999px), var(--y, -999px), 0);
  will-change: transform;
}
.preview__in {
  position: absolute; inset: 0; background: var(--bg-2); border: 1px solid var(--line-2);
  opacity: 0; transform: scale(.92); transition: opacity .35s var(--ease-out), transform .5s var(--ease-out);
}
.preview.is-on .preview__in { opacity: 1; transform: none; }
.preview__item { position: absolute; inset: 0; padding: 8% 10%; opacity: 0; transition: opacity .4s; --sw: 1.9; }
.preview__item.is-active { opacity: 1; }
.preview__item .fig text { display: none; }
.preview__tag { position: absolute; left: 12px; bottom: 10px; color: var(--ink-3); }
@media (hover: none), (pointer: coarse), (max-width: 760px) { .preview { display: none; } }

/* ---------- about ---------- */
/* statement on the left, bio + figures on the right */
.about { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 7vw, 112px); align-items: start; }
.about__lead {
  font-size: clamp(1.7rem, 3.2vw, 2.75rem); font-weight: 300; line-height: 1.18; letter-spacing: -.02em; max-width: 18ch;
  position: sticky; top: calc(var(--header-h) + 40px);
}
.about__body { display: grid; gap: 18px; color: var(--ink-2); max-width: 62ch; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 56px; border-top: 1px solid var(--line-2); }
.stat { padding: 22px 16px 0 0; }
.stat + .stat { padding-left: 16px; border-left: 1px solid var(--line); }
.stat b { display: block; font-size: clamp(2rem, 3.6vw, 3.1rem); font-weight: 300; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .t-mono { display: block; margin-top: 10px; color: var(--ink-3); }
@media (max-width: 880px) {
  .about { grid-template-columns: 1fr; gap: 28px; }
  .about__lead { position: static; max-width: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
}

/* ---------- capabilities ---------- */
.caps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cap {
  position: relative; padding: 28px 24px 32px; border: 1px solid var(--line);
  --cm: var(--line-2);
  transition: border-color .4s, background-color .4s, --cs .5s var(--ease-out);
}
.cap:hover { --cs: 22px; --cm: var(--accent); background-color: color-mix(in srgb, var(--panel) 60%, transparent); }
.cap__code { color: var(--accent); }
.cap__title { margin: 40px 0 20px; font-size: 1.4rem; font-weight: 400; letter-spacing: -.01em; }
.cap li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .9375rem; line-height: 1.45; }
.cap li::before { content: ""; flex: none; width: 8px; height: 1px; margin-top: .72em; background: var(--ink-3); }
@media (max-width: 1100px) { .caps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .caps { grid-template-columns: 1fr; } }

/* ---------- experience ---------- */
.exp { border-top: 1px solid var(--line-2); }
.exp__row {
  display: grid; grid-template-columns: 180px minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--line);
}
.exp__period { color: var(--ink-3); padding-top: .35em; }
.exp__role { font-size: 1.25rem; font-weight: 400; letter-spacing: -.01em; line-height: 1.3; }
.exp__org { display: block; color: var(--ink-2); font-size: .9375rem; margin-top: 4px; }
.exp__note { color: var(--ink-2); font-size: .9375rem; line-height: 1.55; padding-top: .2em; }
@media (max-width: 760px) { .exp__row { grid-template-columns: 1fr; gap: 8px; } }

/* ---------- contact ---------- */
.contact { padding-bottom: clamp(96px, 12vw, 160px); }
.contact__big { font-size: clamp(2.6rem, 8vw, 7.4rem); line-height: .98; letter-spacing: -.035em; max-width: 12ch; }
.contact__row { margin-top: clamp(40px, 6vw, 72px); display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.mail {
  position: relative; display: inline-flex; align-items: center; gap: 16px;
  font-size: clamp(1.25rem, 3vw, 2.25rem); font-weight: 300; letter-spacing: -.015em;
  padding-bottom: 10px; min-height: 48px;
  overflow-wrap: anywhere;
}
.mail::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line-2); }
.mail::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--accent); z-index: 1;
  transform: scaleX(0); transform-origin: right; transition: transform .6s var(--ease-out);
}
.mail:hover::before { transform: scaleX(1); transform-origin: left; }
.mail .i { width: 28px; height: 28px; color: var(--ink-3); transition: transform .5s var(--ease-out), color .3s; }
.mail:hover .i { transform: translate(4px, -4px); color: var(--accent); }
.copy { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-2); color: var(--ink-2); transition: border-color .25s, color .25s; }
.copy:hover { border-color: var(--ink-2); color: var(--ink); }
.links { margin-top: 48px; display: flex; flex-wrap: wrap; gap: 8px 32px; }
.links a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink-2); transition: color .25s; }
.links a:hover { color: var(--ink); }
.links a .i { width: 14px; height: 14px; transition: transform .4s var(--ease-out); }
.links a:hover .i { transform: translate(2px, -2px); }

/* contact: intro left, form right */
.contact__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(48px, 7vw, 112px); align-items: start; }
.contact__grid .contact__big { font-size: clamp(2.6rem, 5.6vw, 5.4rem); max-width: 10ch; }
@media (max-width: 960px) { .contact__grid { grid-template-columns: 1fr; } }

/* ---------- contact form ---------- */
:root { --danger: #FF8A7A; --ok: #5FE0A8; }
:root[data-theme="cyanotype"] { --danger: #FFB3A6; --ok: #8EEBC2; }
.form { position: relative; padding: clamp(24px, 3.4vw, 40px); border: 1px solid var(--line); background-color: color-mix(in srgb, var(--bg-2) 96%, transparent); }
.form__head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--ink-3); padding-bottom: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.form__head span:first-child { color: var(--accent); }
.field { display: grid; gap: 4px; padding-top: 20px; }
.field label { color: var(--ink-3); transition: color .25s; }
.field:focus-within label { color: var(--ink); }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 1.0625rem; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0;
  padding: 10px 0 12px; min-height: 48px;
  transition: border-color .25s, box-shadow .25s;
}
.field textarea { resize: vertical; min-height: 132px; line-height: 1.55; }
.field input:hover, .field textarea:hover { border-bottom-color: var(--ink-3); }
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 0 var(--accent); }
.field [aria-invalid="true"] { border-bottom-color: var(--danger); box-shadow: 0 1px 0 0 var(--danger); }
.field__err { min-height: 1.4em; font-size: .875rem; line-height: 1.4; color: var(--danger); }
.field__err:empty { min-height: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 32px; }
.form__foot .btn[disabled] { opacity: .55; cursor: progress; }
.form__foot .btn:hover .i { transform: translateX(3px); }
.form__status { flex: 1 1 220px; font-size: .9375rem; line-height: 1.5; color: var(--ink-2); }
.form__status[data-kind="error"] { color: var(--danger); }
.form__status[data-kind="ok"] { color: var(--ok); }
.form__status[data-kind="ok"]::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 10px; vertical-align: 1px; }

/* ---------- footer title block ---------- */
.ftr { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
.tblock {
  display: grid; grid-template-columns: 2.2fr repeat(5, 1fr);
  border: 1px solid var(--line-2);
}
.tb { padding: 14px 16px 16px; display: grid; gap: 4px; min-width: 0; }
.tb + .tb { border-left: 1px solid var(--line-2); }
.tb .t-mono { color: var(--ink-3); }
.tb b { font-weight: 400; font-size: .9375rem; overflow-wrap: anywhere; }
.ftr__bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 18px; color: var(--ink-3); }
.ftr__bar a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: -12px; transition: color .25s; }
.ftr__bar a:hover { color: var(--ink); }
@media (max-width: 900px) {
  .tblock { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tb:first-child { grid-column: 1 / -1; }
  .tb { border-top: 1px solid var(--line-2); }
  .tb:first-child { border-top: 0; }
  .tb:nth-child(2), .tb:nth-child(5) { border-left: 0; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: var(--z-toast);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--panel); border: 1px solid var(--line-2); color: var(--ink);
  padding: 12px 18px; transition: opacity .3s, transform .45s var(--ease-out);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Case study
   ========================================================================== */
.cs-hero { padding-top: calc(var(--header-h) + clamp(48px, 8vw, 112px)); }
.crumbs { display: flex; flex-wrap: wrap; gap: 10px; color: var(--ink-3); }
.crumbs a { transition: color .2s; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--accent); }
.cs-disc { margin-top: clamp(40px, 6vw, 72px); color: var(--ink-2); display: flex; align-items: center; gap: 12px; }
.cs-disc::before { content: ""; width: 7px; height: 7px; background: var(--accent); }
.cs-title { margin-top: 20px; font-size: clamp(2.5rem, 6.4vw, 6rem); line-height: 1; letter-spacing: -.03em; max-width: 15ch; }
.cs-sum { margin-top: 28px; max-width: 52ch; font-size: clamp(1.1rem, 1.7vw, 1.4rem); line-height: 1.5; color: var(--ink-2); font-weight: 300; }
.cs-meta { margin-top: clamp(48px, 6vw, 80px); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line); }
.cs-meta > div { padding: 18px 16px 20px 0; min-width: 0; }
.cs-meta > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.cs-meta dt { color: var(--ink-3); margin-bottom: 6px; }
.cs-meta dd { font-size: .9375rem; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .cs-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-meta > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .cs-meta > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .cs-meta > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

.plate { margin-top: clamp(48px, 7vw, 96px); }
.plate__frame {
  position: relative; aspect-ratio: 16 / 9; background-color: color-mix(in srgb, var(--bg-2) 70%, transparent);
  border: 1px solid var(--line); padding: clamp(16px, 4vw, 56px) clamp(16px, 6vw, 96px);
}
.plate__frame.is-img { padding: 0; }
.plate__zoom { position: absolute; inset: 0; display: block; cursor: zoom-in; }
.plate__frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.plate__frame img.cover { object-fit: cover; }
.plate__hint {
  position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--ink-2);
  opacity: 0; transition: opacity .3s;
}
.plate__hint .i { width: 12px; height: 12px; }
.plate__zoom:hover .plate__hint, .plate__zoom:focus-visible .plate__hint { opacity: 1; }
@media (hover: none) { .plate__hint { opacity: 1; } }

/* PDF document card */
.doc__card {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 28px;
  padding: 20px; border: 1px solid var(--line-2);
  transition: border-color .3s, background-color .3s;
}
.doc__card:hover { border-color: var(--ink-3); background-color: color-mix(in srgb, var(--panel) 60%, transparent); }
.doc__thumb {
  position: relative; aspect-ratio: 3 / 4; display: grid; place-items: center; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-3);
}
.doc__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.doc__thumb svg { width: 46%; }
.doc__meta { color: var(--accent); }
.doc__title { display: block; margin-top: 8px; font-size: 1.25rem; font-weight: 400; line-height: 1.3; letter-spacing: -.01em; }
.doc__desc { display: block; margin-top: 6px; color: var(--ink-2); font-size: .9375rem; line-height: 1.5; }
.doc__cta { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); white-space: nowrap; transition: color .3s; }
.doc__cta .i { width: 14px; height: 14px; transition: transform .4s var(--ease-out); }
.doc__card:hover .doc__cta { color: var(--accent); }
.doc__card:hover .doc__cta .i { transform: translate(2px, -2px); }
@media (max-width: 640px) {
  .doc__card { grid-template-columns: 64px minmax(0, 1fr); gap: 16px; }
  .doc__cta { grid-column: 2; }
}

/* image gallery */
.gallery__grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 12px; }
.gallery__item { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); cursor: zoom-in; }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease-out); }
.gallery__item img.contain { object-fit: contain; }
.gallery__item:hover img { transform: scale(1.03); }
.gallery__cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 10px; color: var(--ink);
  background: linear-gradient(transparent, color-mix(in srgb, var(--bg) 88%, transparent));
}
@media (max-width: 640px) { .gallery__grid { grid-template-columns: 1fr; } }
.plate__cap { display: flex; justify-content: space-between; gap: 24px; margin-top: 12px; color: var(--ink-3); }
.plate__cap span:last-child { text-align: right; text-transform: none; letter-spacing: .02em; }
@media (max-width: 640px) {
  .plate__frame { aspect-ratio: 4 / 3; --sw: 2; }
  .plate__cap { flex-direction: column; gap: 4px; }
  .plate__cap span:last-child { text-align: left; }
}

.ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); text-align: center; }
.ph svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ph svg path { stroke: var(--line-2); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.ph span { position: relative; background: var(--bg-2); padding: 6px 12px; }

.cs-specs { margin-top: clamp(56px, 8vw, 112px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-2); }
.cs-specs > div { padding: 22px 16px 0 0; }
.cs-specs > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.cs-specs b { display: flex; align-items: baseline; gap: 6px; font-size: clamp(2.2rem, 4.4vw, 3.8rem); font-weight: 300; line-height: 1; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.cs-specs b small { font-size: .32em; letter-spacing: .02em; color: var(--ink-2); }
.cs-specs .t-mono { display: block; margin-top: 10px; color: var(--ink-3); }
@media (max-width: 760px) {
  .cs-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
  .cs-specs > div:nth-child(3) { padding-left: 0; border-left: 0; }
}

.cs-body { margin-top: clamp(72px, 10vw, 140px); display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(32px, 7vw, 112px); }
.toc { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; }
.toc p { color: var(--ink-3); margin-bottom: 16px; }
.toc a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; color: var(--ink-3); font-size: .9375rem; transition: color .3s; }
.toc a::before { content: ""; width: 12px; height: 1px; background: currentColor; transition: width .45s var(--ease-out), background-color .3s; }
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--ink); }
.toc a.is-active::before { width: 28px; background: var(--accent); }
.cs-sec { padding-bottom: clamp(56px, 8vw, 104px); }
.cs-sec h2 { display: flex; align-items: baseline; gap: 20px; font-size: clamp(1.7rem, 2.8vw, 2.4rem); line-height: 1.1; letter-spacing: -.02em; font-weight: 300; margin-bottom: 24px; }
.cs-sec h2 .t-mono { color: var(--accent); flex: none; }
.cs-sec p { color: var(--ink-2); max-width: 66ch; }
.cs-sec p + p { margin-top: 18px; }
.cs-sec ul { margin-top: 24px; max-width: 66ch; border-top: 1px solid var(--line); }
.cs-sec li { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-size: .9375rem; }
.cs-sec li .t-mono { color: var(--ink-3); padding-top: .2em; }
.cs-sec .plate { margin-top: 40px; }
.cs-sec .plate__frame { aspect-ratio: 16 / 10; }
@media (max-width: 960px) { .cs-body { grid-template-columns: 1fr; } .toc { display: none; } }

.next { margin-top: clamp(40px, 6vw, 80px); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.next a {
  position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); align-items: center; gap: 40px;
  padding-block: clamp(48px, 7vw, 96px);
}
.next a::before {
  content: ""; position: absolute; inset: 0 calc(var(--gutter) * -1); z-index: -1; background: var(--panel);
  transform: scaleY(0); transform-origin: bottom; transition: transform .6s var(--ease-out);
}
.next a:hover::before { transform: scaleY(1); }
.next .t-mono { color: var(--ink-3); }
.next__title { margin-top: 16px; font-size: clamp(2rem, 5vw, 4.4rem); font-weight: 300; line-height: 1; letter-spacing: -.03em; transition: transform .6s var(--ease-out); }
.next a:hover .next__title { transform: translateX(12px); }
.next__fig { aspect-ratio: 16 / 10; --sw: 1.8; }
.next__fig .fig text { display: none; }
@media (max-width: 760px) { .next a { grid-template-columns: 1fr; } .next__fig { display: none; } }

/* ---------- page transitions ---------- */
::view-transition-old(root) { animation: .32s var(--ease-io) both vt-out; }
::view-transition-new(root) { animation: .55s var(--ease-out) both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; transition-delay: 0ms !important;
  }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}
