/* ==========================================================================
   Thanat Vijitrakanlikit — portfolio design system
   Editorial serif display · IBM Plex Sans Thai body · Plex Mono data labels
   Light "paper" and dark "instrument" themes are separate palettes.
   ========================================================================== */

/* ---------- Fonts (self-hosted, latin + thai subsets only) ---------- */
@font-face { font-family: "IBM Plex Sans Thai"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-thai-400-thai.woff2") format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "IBM Plex Sans Thai"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-thai-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Thai"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-thai-500-thai.woff2") format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "IBM Plex Sans Thai"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-thai-500-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Thai"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-thai-600-thai.woff2") format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "IBM Plex Sans Thai"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-thai-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Serif"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/instrument-serif-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Serif"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/instrument-serif-400-italic-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-mono-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-mono-500-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Metric-adjusted local fallbacks keep the font swap from shifting layout. */
@font-face { font-family: "Plex Fallback"; src: local("Helvetica Neue"), local("Arial"); size-adjust: 101%; ascent-override: 102%; descent-override: 28%; line-gap-override: 0%; }
@font-face { font-family: "Serif Fallback"; src: local("Times New Roman"), local("Georgia"); size-adjust: 92%; ascent-override: 95%; descent-override: 26%; line-gap-override: 0%; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* Light · "paper": warm neutral ground, ink text, deep teal accent */
  --bg: #f5f3ee;
  --bg-tint: #edeae2;
  --surface: #fdfcf9;
  --surface-2: #ebe8e0;
  --ink: #12171a;
  --ink-2: #3d464c;
  --muted: #56626a;
  --line: #d9d5cb;
  --line-strong: #bfbaae;
  --accent: #0a6c72;
  --accent-strong: #08565b;
  --accent-soft: #d8ebe9;
  --on-accent: #ffffff;
  --signal: #a63f1a;
  --signal-soft: #f3dfd5;
  --ok: #1c6b45;
  --ok-soft: #dcefe4;
  --warn: #7a5410;
  --warn-soft: #f4e8c9;
  --grid-dot: rgba(18, 23, 26, .16);
  --shadow: 0 1px 0 rgba(18, 23, 26, .04), 0 18px 40px -22px rgba(18, 23, 26, .28);
  --img-dim: 1;
  --header-bg: rgba(245, 243, 238, .84);

  /* Type */
  --font-sans: "IBM Plex Sans Thai", "Plex Fallback", "Sarabun", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Instrument Serif", "Serif Fallback", "Iowan Old Style", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-body: 1.0625rem;
  --fs-small: .9rem;
  --fs-label: .75rem;
  --fs-lead: clamp(1.1rem, 1rem + .45vw, 1.3rem);
  --fs-h3: clamp(1.4rem, 1.15rem + .9vw, 1.9rem);
  --fs-h2: clamp(2.1rem, 1.35rem + 2.9vw, 2.75rem);
  --fs-h1: clamp(2.7rem, 1.2rem + 4.2vw, 3.75rem);

  /* Space / layout */
  --gutter: clamp(1.25rem, .6rem + 3vw, 3rem);
  --max: 1240px;
  --section-y: clamp(4.5rem, 2.5rem + 7vw, 9rem);
  --radius: 14px;
  --radius-sm: 8px;
  --header-h: 64px;

  /* Motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: .18s;
}

/* Dark · "instrument": tinted near-black ground, luminous teal, amber signal.
   Depth comes from borders and surface steps rather than shadows. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a1012;
  --bg-tint: #0e171a;
  --surface: #111a1d;
  --surface-2: #172327;
  --ink: #e9efef;
  --ink-2: #b9c6c8;
  --muted: #93a4a7;
  --line: #22323a;
  --line-strong: #345059;
  --accent: #55cfc6;
  --accent-strong: #7fe0d8;
  --accent-soft: #123b3d;
  --on-accent: #06201f;
  --signal: #f2a36a;
  --signal-soft: #3a2517;
  --ok: #7fd6a4;
  --ok-soft: #14301f;
  --warn: #e8c46f;
  --warn-soft: #362b10;
  --grid-dot: rgba(233, 239, 239, .17);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .02), 0 24px 48px -24px rgba(0, 0, 0, .8);
  --img-dim: .92;
  --header-bg: rgba(10, 16, 18, .82);
}
/* Same dark palette for visitors whose system prefers dark and who have not chosen a theme (also covers no-JS). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a1012; --bg-tint: #0e171a; --surface: #111a1d; --surface-2: #172327;
    --ink: #e9efef; --ink-2: #b9c6c8; --muted: #93a4a7; --line: #22323a; --line-strong: #345059;
    --accent: #55cfc6; --accent-strong: #7fe0d8; --accent-soft: #123b3d; --on-accent: #06201f;
    --signal: #f2a36a; --signal-soft: #3a2517; --ok: #7fd6a4; --ok-soft: #14301f;
    --warn: #e8c46f; --warn-soft: #362b10; --grid-dot: rgba(233, 239, 239, .17);
    --shadow: 0 0 0 1px rgba(255, 255, 255, .02), 0 24px 48px -24px rgba(0, 0, 0, .8);
    --img-dim: .92; --header-bg: rgba(10, 16, 18, .82);
  }
}
/* Type never grows with the screen past the caps above, and the column stops at --max: extra width on large or ultrawide monitors becomes side margin. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1.25rem); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.8;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.nav-open { overflow: hidden; }
main { flex: 1 0 auto; }
img, svg, video { display: block; max-width: 100%; height: auto; }
img { filter: brightness(var(--img-dim)); }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
:root[data-theme="dark"] :focus-visible { outline-color: var(--accent-strong); }
[hidden] { display: none !important; }

.wrap { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }
.section { padding-block: var(--section-y); }
.section--tint { background: var(--bg-tint); border-block: 1px solid var(--line); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; z-index: 1000; left: 1rem; top: -4rem; padding: .7rem 1.1rem; border-radius: var(--radius-sm); background: var(--ink); color: var(--bg); font-weight: 600; transition: top var(--t-fast); }
.skip-link:focus { top: 1rem; }

/* ---------- Type ---------- */
.display, .h1, .h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.015em; line-height: 1.02; text-wrap: balance; }
.h1 { font-size: var(--fs-h1); line-height: .98; letter-spacing: -.025em; }
.h2 { font-size: var(--fs-h2); }
.h3 { font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-h3); line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; }
.h1 em, .h2 em { font-style: italic; color: var(--accent); }
.th { font-family: var(--font-sans); font-weight: 600; letter-spacing: 0; line-height: 1.2; }
.h2 .th, .card-body h3 .th { font-size: .8em; }
.notfound .h1 .th { font-size: .5em; display: block; }
.eyebrow, .label { font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500; letter-spacing: .09em; text-transform: uppercase; line-height: 1.5; }
.eyebrow { color: var(--accent); display: inline-flex; align-items: center; gap: .65rem; }
.eyebrow::before { content: ""; width: 1.6rem; height: 1px; background: currentColor; flex: none; }
.label { color: var(--muted); }
.lead { font-size: var(--fs-lead); line-height: 1.75; color: var(--ink-2); max-width: 62ch; text-wrap: pretty; }
.muted { color: var(--muted); }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.more { margin-top: 2rem; }
.mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }
.prose { max-width: 68ch; }
.prose > * + * { margin-top: 1.15em; }
.prose p { color: var(--ink-2); text-wrap: pretty; }
.prose strong { color: var(--ink); font-weight: 600; }
/* Thai is justified only where the browser can distribute space between
   characters (Chromium, Firefox); elsewhere it stays start-aligned so
   phrase spaces never open into wide gaps. */
@supports (text-justify: inter-character) {
  @media (min-width: 720px) {
    .prose p, .justify { text-align: justify; text-justify: inter-character; }
  }
}

.link { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .28em; transition: color var(--t-fast); }
.link:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
.link-arrow { display: inline-flex; align-items: center; gap: .55rem; min-height: 44px; font-weight: 500; color: var(--accent); }
.link-arrow svg { width: 1.05em; height: 1.05em; flex: none; transition: transform var(--t-fast) var(--ease); }
.link-arrow:hover svg { transform: translate(5px, -5px); }
.link-arrow span { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .3s var(--ease); padding-bottom: 2px; }
.link-arrow:hover span { background-size: 100% 1px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; min-height: 48px; padding: .7rem 1.35rem; border: 1px solid transparent; border-radius: 999px; font-weight: 500; font-size: 1rem; line-height: 1.2; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.btn svg { width: 1.05em; height: 1.05em; flex: none; transition: transform var(--t-fast) var(--ease); }
.btn:hover svg { transform: translate(5px, -5px); }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-strong); }
.btn--ghost { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn--ghost:hover { border-color: var(--ink); background: var(--surface); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); transition: border-color var(--t-fast), background var(--t-fast); }
.icon-btn:hover { border-color: var(--ink-2); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- Header / navigation ---------- */
.site-header { position: sticky; top: 0; z-index: 60; background: var(--header-bg); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); view-transition-name: site-header; }
.header-inner { min-height: var(--header-h); display: flex; align-items: center; gap: 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 600; letter-spacing: -.01em; min-height: 44px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: var(--bg); font-family: var(--font-mono); font-size: .8rem; font-weight: 500; letter-spacing: -.04em; }
.brand-name { font-size: .98rem; white-space: nowrap; }
.site-nav { margin-left: auto; }
.site-nav ul { display: flex; align-items: center; gap: .25rem; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .8rem; font-size: .93rem; font-weight: 500; color: var(--muted); border-radius: 999px; position: relative; transition: color var(--t-fast); }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current] { color: var(--ink); }
.site-nav a[aria-current]::after { content: ""; position: absolute; left: .8rem; right: .8rem; bottom: 6px; height: 2px; border-radius: 2px; background: var(--accent); }
.site-nav .nav-cta { border: 1px solid var(--line-strong); color: var(--ink); margin-left: .5rem; }
.site-nav .nav-cta:hover { border-color: var(--ink); background: var(--surface); }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.menu-toggle { display: none; }
.menu-lines, .menu-lines::before { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; transition: transform var(--t-fast) var(--ease); }
.menu-lines { position: relative; }
.menu-lines::before { content: ""; position: absolute; top: 6px; left: 0; }
.menu-lines { transform: translateY(-3px); }
.nav-open .menu-lines { transform: translateY(0) rotate(45deg); }
.nav-open .menu-lines::before { transform: translateY(-6px) rotate(-90deg); }
.reading-progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }

/* No-JS: the nav stays visible as a wrapped row below the brand.
   With JS it becomes a full-height sheet, positioned against the header (the header's
   backdrop-filter / view-transition-name make it the containing block for fixed children). */
@media (max-width: 1023.98px) {
  .header-inner { flex-wrap: wrap; row-gap: 0; padding-block: .4rem; }
  .site-nav { order: 3; flex: 1 0 100%; margin-left: 0; }
  .site-nav ul { flex-wrap: wrap; }
  .header-actions { margin-left: auto; }
  .js .menu-toggle { display: inline-grid; }
  .js .site-nav { position: absolute; left: 0; right: 0; top: 100%; height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); z-index: 55; background: var(--bg); padding: 1.5rem var(--gutter) 3rem; overflow-y: auto; visibility: hidden; opacity: 0; transform: translateY(-8px); transition: opacity var(--t-fast), transform var(--t-fast) var(--ease), visibility 0s linear var(--t-fast); }
  .js .nav-open .site-nav { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
  .js .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; border-top: 1px solid var(--line); }
  .js .site-nav li { border-bottom: 1px solid var(--line); }
  .js .site-nav a { min-height: 64px; padding: 0; font-family: var(--font-display); font-size: 2rem; font-weight: 400; color: var(--ink); border-radius: 0; }
  .js .site-nav a[aria-current]::after { left: 0; right: auto; width: 2rem; bottom: 12px; }
  .js .site-nav .nav-cta { border: 0; margin: 0; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-tint); padding-block: clamp(2.5rem, 5vw, 4rem) 2rem; margin-top: auto; }
.footer-grid { display: grid; gap: 2.25rem; }
.footer-name { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.1; }
.footer-sub { color: var(--muted); font-size: var(--fs-small); margin-top: .4rem; max-width: 40ch; }
.footer-col h2 { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: .6rem; }
.footer-col a { display: inline-flex; min-height: 36px; align-items: center; color: var(--ink-2); font-size: var(--fs-small); }
.footer-col a:hover { color: var(--accent); }
.footer-legal { grid-column: 1 / -1; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr; } }

/* ---------- Reveal (progressive: content is visible without JS) ---------- */
.js .reveal { opacity: 0; transform: translateY(32px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
.js [data-stagger] > .reveal:nth-child(2) { transition-delay: .07s; }
.js [data-stagger] > .reveal:nth-child(3) { transition-delay: .14s; }
.js [data-stagger] > .reveal:nth-child(4) { transition-delay: .21s; }
.js [data-stagger] > .reveal:nth-child(5) { transition-delay: .28s; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Status / tags ---------- */
.status { display: inline-flex; align-items: center; gap: .45rem; padding: .18rem .65rem; border-radius: 999px; font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; line-height: 1.6; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--built { color: var(--ok); background: var(--ok-soft); }
.status--concept { color: var(--warn); background: var(--warn-soft); }
.status--personal { color: var(--accent); background: var(--accent-soft); }
.flag { display: inline-flex; align-items: center; padding: .12rem .55rem; border-radius: 4px; background: var(--signal); color: var(--bg); font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500; letter-spacing: .07em; text-transform: uppercase; line-height: 1.6; vertical-align: middle; }
:root[data-theme="dark"] .flag { color: #1a0f08; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li { padding: .12rem .6rem; border: 1px solid var(--line-strong); border-radius: 4px; font-family: var(--font-mono); font-size: .76rem; color: var(--ink-2); line-height: 1.7; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: clip; padding-block: clamp(2.75rem, 1.5rem + 5vw, 6.5rem) clamp(3rem, 2rem + 4vw, 5.5rem); isolation: isolate; }
.hero-field { position: absolute; inset: 0; z-index: -1; pointer-events: none; --mx: 72%; --my: 30%; }
.hero-field::before, .hero-field::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1.4px); background-size: 26px 26px; }
.hero-field::before { opacity: .55; -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 92%); mask-image: linear-gradient(180deg, #000 0%, transparent 92%); }
.hero-field::after { display: none; background-image: radial-gradient(circle, var(--accent) 1.4px, transparent 1.9px); opacity: .85; -webkit-mask-image: radial-gradient(260px circle at var(--mx) var(--my), #000 0%, transparent 100%); mask-image: radial-gradient(260px circle at var(--mx) var(--my), #000 0%, transparent 100%); }
.hero-grid { display: grid; gap: clamp(2.5rem, 5vw, 4rem); align-items: end; }
.hero-copy > * + * { margin-top: 1.6rem; }
.hero .h1 { margin-top: 1.4rem; font-size: clamp(2.7rem, 1.2rem + 4.2vw, 3.75rem); }
.hero .lead { max-width: 56ch; }
.hero-note { display: flex; align-items: center; gap: .7rem; color: var(--ink-2); font-size: var(--fs-small); }
.hero-note::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .hero-note::before { animation: pulse 2.8s ease-in-out infinite; }
  @keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
  .js .hero-copy > * { animation: rise .8s var(--ease) both; }
  .js .hero-copy > :nth-child(2) { animation-delay: .06s; }
  .js .hero-copy > :nth-child(3) { animation-delay: .12s; }
  .js .hero-copy > :nth-child(4) { animation-delay: .18s; }
  .js .hero-copy > :nth-child(5) { animation-delay: .24s; }
  .js .flagship { animation: rise .9s .15s var(--ease) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(16px); } }
}
@media (min-width: 1024px) {
  .hero-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, .8fr); }
}

@media (hover: hover) and (pointer: fine) { .hero-field::after { display: block; } }
@media (max-width: 1023.98px) { .hero-field::before { -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 38%); mask-image: linear-gradient(180deg, #000 0%, transparent 38%); } }

/* Flagship card (hero) */
.flagship { position: relative; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.flagship-media { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.flagship-media img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.12); transition: transform 1.2s var(--ease); }
.flagship:hover .flagship-media img { transform: scale(1.15); }
.flagship-badge { position: absolute; left: 1.4rem; top: 1.4rem; }
.reticle { position: absolute; inset: .9rem; pointer-events: none; }
.reticle i { position: absolute; width: 18px; height: 18px; border: 0 solid rgba(255, 255, 255, .85); }
.reticle i:nth-child(1) { left: 0; top: 0; border-width: 1.5px 0 0 1.5px; }
.reticle i:nth-child(2) { right: 0; top: 0; border-width: 1.5px 1.5px 0 0; }
.reticle i:nth-child(3) { left: 0; bottom: 0; border-width: 0 0 1.5px 1.5px; }
.reticle i:nth-child(4) { right: 0; bottom: 0; border-width: 0 1.5px 1.5px 0; }
.flagship-body { padding: clamp(1.25rem, 1rem + 1vw, 1.75rem); display: grid; gap: .9rem; }
.flagship-body h2 { font-family: var(--font-display); font-size: clamp(2.2rem, 1.6rem + 1.6vw, 2.75rem); line-height: 1; font-weight: 400; }
.flagship-body p { color: var(--ink-2); font-size: var(--fs-small); line-height: 1.7; }
.stat-row { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; border-block: 1px solid var(--line); margin-block: .3rem; }
.stat-row div { padding: .8rem 1.2rem .8rem 0; margin-right: 1.2rem; border-right: 1px solid var(--line); }
.stat-row div:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.stat-row dt { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em; color: var(--muted); }
.stat-row dd { font-family: var(--font-display); font-size: clamp(1.7rem, 1.3rem + 1vw, 2.2rem); line-height: 1.1; }

/* Stat strip */
.strip { border-block: 1px solid var(--line); background: var(--surface); }
.strip-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
.strip-item { padding: 1.4rem 1.1rem 1.4rem 0; border-bottom: 1px solid var(--line); }
.strip-item:nth-child(even) { padding-left: 1.1rem; border-left: 1px solid var(--line); }
.strip-item:nth-last-child(-n+2) { border-bottom: 0; }
.strip-item strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 1.6rem + 2vw, 3.4rem); line-height: 1; }
.strip-item span { display: block; margin-top: .4rem; color: var(--muted); font-size: .84rem; line-height: 1.4; }
@media (min-width: 720px) {
  .strip-grid { grid-template-columns: repeat(4, 1fr); }
  .strip-item { border-bottom: 0; padding: 1.8rem 1.5rem; border-left: 1px solid var(--line); }
  .strip-item:first-child { border-left: 0; padding-left: 0; }
  .strip-item:nth-child(even) { padding-left: 1.5rem; }
}

/* ---------- Section heads ---------- */
.section-head { display: grid; gap: 1.25rem; margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.section-head .eyebrow { margin-bottom: 1rem; }
@media (min-width: 900px) { .section-head { grid-template-columns: 1.15fr .85fr; align-items: end; gap: 3rem; } }

/* ---------- Work index (home) ---------- */
.work-list { border-top: 1px solid var(--line-strong); }
.work-row { position: relative; display: grid; grid-template-columns: 5.5rem 1fr; gap: .4rem 1.25rem; padding: 1.4rem 0; border-bottom: 1px solid var(--line); transition: background var(--t-fast); }
.work-thumb { grid-column: 1; grid-row: 1 / span 2; width: 5.5rem; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); align-self: start; }
.work-thumb img { width: 100%; height: 100%; object-fit: cover; }
.work-num { display: none; color: var(--muted); font-size: .8rem; }
.work-main { grid-column: 2; }
.work-title { font-family: var(--font-display); font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.6rem); line-height: 1.1; }
.work-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.work-title .flag { margin-left: .6rem; transform: translateY(-.3em); }
.work-desc { color: var(--ink-2); font-size: var(--fs-small); margin-top: .35rem; max-width: 60ch; }
.work-meta { grid-column: 2; display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin-top: .4rem; }
.work-event { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.work-arrow { display: none; pointer-events: none; }
@media (min-width: 900px) {
  .work-row { grid-template-columns: 2.5rem 10rem minmax(0, 1fr) 14rem 2.5rem; align-items: center; gap: 1.5rem; padding-block: 1.6rem; isolation: isolate; }
  .work-row::before { content: ""; position: absolute; inset: 0 -.9rem; z-index: -1; background: var(--surface); border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity var(--t-fast); }
  .work-row:hover::before { opacity: 1; }
  .work-num { display: block; }
  .work-thumb { grid-column: 2; grid-row: auto; width: 10rem; align-self: center; }
  .work-main { grid-column: 3; }
  .work-meta { grid-column: 4; flex-direction: column; align-items: flex-start; margin-top: 0; gap: .5rem; }
  .work-arrow { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 1px solid var(--line-strong); border-radius: 50%; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease); }
  .work-arrow svg { width: 16px; height: 16px; }
  .work-row:hover .work-arrow { background: var(--accent); color: var(--on-accent); border-color: var(--accent); transform: rotate(-45deg); }
  .work-row:hover .work-thumb img { transform: scale(1.08); }
  .work-thumb img { transition: transform .6s var(--ease); }
}

/* ---------- Pipeline (dataset → device) ---------- */
.pipeline { display: grid; counter-reset: step; position: relative; }
.pipe-step { position: relative; padding: 0 0 2rem 3.25rem; }
.pipe-step:last-child { padding-bottom: 0; }
.pipe-step::before { counter-increment: step; content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 0; width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 1px solid var(--accent); display: grid; place-items: center; font-family: var(--font-mono); font-size: .72rem; color: var(--accent); background: var(--bg); z-index: 1; }
.section--tint .pipe-step::before { background: var(--bg-tint); }
.pipe-step::after { content: ""; position: absolute; left: 1.125rem; top: 2.25rem; bottom: 0; width: 1px; background: var(--line-strong); transform-origin: top; }
.pipe-step:last-child::after { display: none; }
.pipe-step h3 { font-family: var(--font-display); font-size: 1.7rem; font-weight: 400; line-height: 1.15; }
.pipe-step p { color: var(--ink-2); font-size: var(--fs-small); margin-top: .35rem; }
.pipe-step .label { display: block; margin-top: .7rem; color: var(--accent); text-transform: none; letter-spacing: .03em; }
.js .pipe-step.reveal::after { transform: scaleY(0); transition: transform .9s .25s var(--ease); }
.js .pipe-step.reveal.is-in::after { transform: scaleY(1); }
@media (min-width: 900px) {
  .pipeline { grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
  .pipeline--5 { grid-template-columns: repeat(5, 1fr); gap: 1.25rem; }
  .pipe-step { padding: 3.5rem 0 0 0; }
  .pipe-step::after { left: 2.25rem; right: -1.5rem; top: 1.125rem; bottom: auto; width: auto; height: 1px; transform-origin: left; }
  .js .pipe-step.reveal::after { transform: scaleX(0); }
  .js .pipe-step.reveal.is-in::after { transform: scaleX(1); }
}
.pipe-foot { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-small); max-width: 70ch; }

/* ---------- Cards ---------- */
.card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; transition: border-color var(--t-fast), box-shadow .35s var(--ease); --px: 50%; --py: 50%; }
.card::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .3s; background: radial-gradient(360px circle at var(--px) var(--py), color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%); }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.card:hover .card-media img { transform: scale(1.08); }
.card-media img[data-parallax] { transform: scale(1.2); }
.card:hover .card-media img[data-parallax] { transform: scale(1.26); }
.card-body { padding: clamp(1.25rem, 1rem + 1vw, 1.75rem); display: flex; flex-direction: column; gap: .8rem; flex: 1; position: relative; z-index: 2; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.card-body h3 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.9rem, 1.5rem + 1.2vw, 2.5rem); line-height: 1.08; }
.card-body p { color: var(--ink-2); font-size: var(--fs-small); line-height: 1.75; }
.card-body .tags { margin-top: auto; padding-top: .3rem; }
.card-links { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; position: relative; z-index: 4; }
.card .stretch::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.card-grid { display: grid; gap: clamp(1.25rem, 2.5vw, 2rem); }
@media (min-width: 720px) {
  .card-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card--wide { grid-column: 1 / -1; }
}
/* Wide cards go side-by-side only when there is room; below that the media keeps its 16:9 shape, so cover art is not cropped. */
@media (min-width: 1200px) {
  .card--wide { flex-direction: row; }
  .card--wide .card-media { flex: 1.15; aspect-ratio: auto; min-height: 320px; border-bottom: 0; border-right: 1px solid var(--line); }
  .card--wide .card-body { flex: 1; justify-content: center; }
}

/* Personal band on the home page */
.notice { display: inline-flex; align-items: center; gap: .6rem; padding: .35rem .85rem; border: 1px dashed var(--line-strong); border-radius: 999px; color: var(--muted); font-size: var(--fs-small); }

/* ---------- Toolbox ---------- */
.toolbox { border-top: 1px solid var(--line-strong); }
.toolbox > div { display: grid; gap: .6rem 2rem; padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.toolbox dt { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .09em; text-transform: uppercase; color: var(--accent); padding-top: .35rem; }
.toolbox dd { display: flex; flex-wrap: wrap; gap: .45rem .5rem; }
.skill-hint { font-family: var(--font-sans); color: var(--muted); text-transform: none; letter-spacing: .02em; margin-bottom: 1rem; }
.skill { position: relative; display: inline-block; }
.has-tips { overflow-x: clip; }   /* hidden bubbles near the right edge must not widen the page */
.skill-btn { padding: .3rem .95rem; border: 1px solid var(--line-strong); border-radius: 999px; font: inherit; font-size: var(--fs-small); color: var(--ink); background: var(--surface); cursor: help; min-height: 36px; transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast) var(--ease); }
.skill-btn:hover, .skill-btn[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); }
.skill-tip { position: absolute; z-index: 20; left: 0; top: calc(100% + .55rem); width: max-content; max-width: min(18rem, calc(100vw - 2 * var(--gutter))); padding: .7rem .9rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); color: var(--ink-2); font-size: var(--fs-small); line-height: 1.55; box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(-4px); translate: var(--tip-x, 0px) 0; pointer-events: none; transition: opacity var(--t-fast), transform var(--t-fast) var(--ease), visibility 0s linear var(--t-fast); }
.skill:hover .skill-tip, .skill:focus-within .skill-tip, .skill.is-open .skill-tip { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.skill.is-dismissed .skill-tip { opacity: 0; visibility: hidden; }   /* Escape hides it without moving focus or the pointer (WCAG 1.4.13) */
@media (prefers-reduced-motion: reduce) { .skill-btn, .skill-tip { transition: none; } .skill-btn:hover { transform: none; } }
@media (min-width: 800px) { .toolbox > div { grid-template-columns: 14rem 1fr; } }

/* ---------- CTA band ---------- */
.cta .h2 { max-width: 18ch; }
.cta .lead { margin-top: 1.5rem; }
.cta .btn-row { margin-top: 2rem; }

/* ---------- Page hero (inner pages) ---------- */
.page-hero { position: relative; overflow: clip; padding-block: clamp(3rem, 2rem + 4vw, 6rem) clamp(2.5rem, 4vw, 4rem); border-bottom: 1px solid var(--line); isolation: isolate; }
.page-hero .h1 { font-size: clamp(2.7rem, 1.2rem + 4.2vw, 3.75rem); margin-top: 1.25rem; max-width: 16ch; }
.page-hero .lead { margin-top: 1.5rem; }
.page-hero .btn-row { margin-top: 2rem; }
.page-hero + .section { padding-top: clamp(2.5rem, 1.5rem + 4vw, 5rem); }

/* ---------- Competition list ---------- */
.legend { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; margin-top: 2rem; color: var(--muted); font-size: var(--fs-small); }
.legend span { display: inline-flex; align-items: center; gap: .55rem; }
.comp-list { display: grid; gap: clamp(2.5rem, 5vw, 4.5rem); }
.comp { display: grid; gap: 1.5rem; padding-top: clamp(2rem, 4vw, 3.5rem); border-top: 1px solid var(--line-strong); scroll-margin-top: calc(var(--header-h) + 1rem); }
.comp-media { display: block; position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); aspect-ratio: 16 / 9; }
.comp-media img { width: 100%; height: 100%; object-fit: cover; }
.comp-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: 1rem; }
.comp-body h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.4rem, 1.5rem + 3.4vw, 2.75rem); line-height: 1; letter-spacing: -.02em; }
.comp-body h2 .th { font-size: .62em; }
.comp-body > p { margin-top: 1.1rem; color: var(--ink-2); max-width: 60ch; }
.facts { display: grid; grid-template-columns: 1fr 1fr; margin-top: 1.6rem; border-top: 1px solid var(--line); }
.facts div { padding: .85rem 1rem .85rem 0; border-bottom: 1px solid var(--line); }
.facts dt { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.facts dd { font-size: var(--fs-small); margin-top: .2rem; line-height: 1.55; }
.comp-body .tags { margin-top: 1.4rem; }
.comp-body .btn-row { margin-top: 1.5rem; gap: .25rem 1.75rem; }
@media (min-width: 960px) {
  .comp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 4vw, 4rem); align-items: start; }
  .comp--flagship .comp-body h2 { font-size: 2.75rem; }
}

/* ---------- Case study ---------- */
.case-hero { position: relative; overflow: clip; padding-block: clamp(3rem, 2rem + 4vw, 6rem) 0; isolation: isolate; }
.case-hero .h1 { font-size: clamp(3rem, 2rem + 3vw, 3.5rem); margin-top: 1.25rem; line-height: .92; }
.case-hero .h1 .th { font-size: .45em; display: block; margin-top: .4em; color: var(--ink-2); font-weight: 500; }
.case-hero .lead { margin-top: 1.75rem; }
.case-hero .btn-row { margin-top: 2rem; }
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 1.5rem; margin-top: clamp(2rem, 4vw, 3rem); border-top: 1px solid var(--line-strong); }
.meta-grid div { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.meta-grid dt { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.meta-grid dd { margin-top: .25rem; font-weight: 500; line-height: 1.5; }
@media (min-width: 800px) { .meta-grid { grid-template-columns: repeat(4, 1fr); } .meta-grid div { border-bottom: 0; } }
.case-media { margin-top: clamp(2rem, 4vw, 3.5rem); border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: #05090a; box-shadow: var(--shadow); }
.case-media video, .case-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.case-media figcaption { padding: .85rem 1.1rem; background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-small); }
.case-layout { display: grid; gap: 2.5rem; padding-block: var(--section-y); }
.toc { display: none; font-size: var(--fs-small); }
.toc h2 { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: .75rem; }
.toc ol { border-left: 1px solid var(--line); }
.toc a { display: block; padding: .32rem 0 .32rem 1rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); transition: color var(--t-fast), border-color var(--t-fast); }
.toc a:hover { color: var(--ink); }
.toc a[aria-current="true"] { color: var(--ink); border-left-color: var(--accent); font-weight: 500; }
.toc .glance { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); display: grid; gap: .9rem; }
.toc .glance dt { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.toc .glance dd { font-weight: 500; color: var(--ink); }
@media (min-width: 1024px) {
  .case-layout { grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(3rem, 6vw, 6rem); }
  .toc { display: block; position: sticky; top: calc(var(--header-h) + 1.5rem); align-self: start; }
}
.case-body > section + section { margin-top: clamp(3rem, 6vw, 5rem); }
.case-body section { scroll-margin-top: calc(var(--header-h) + 1.5rem); }
.case-body h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 1.4rem + 2.2vw, 2.75rem); line-height: 1.05; letter-spacing: -.015em; margin-bottom: 1.25rem; text-wrap: balance; }
.case-body h2 .num { display: block; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .09em; color: var(--accent); margin-bottom: .6rem; }
.case-body h3 { font-weight: 600; font-size: 1.15rem; margin-top: 2rem; }

/* Callouts, metrics, charts, diagrams */
.callout { display: grid; gap: .35rem; padding: 1.15rem 1.35rem; border: 1px solid var(--line-strong); border-left: 4px solid var(--signal); border-radius: var(--radius-sm); background: var(--surface); margin-top: 1.5rem; }
.callout strong { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .09em; text-transform: uppercase; color: var(--signal); font-weight: 500; }
.callout p { color: var(--ink-2); font-size: var(--fs-small); }
.metric-cards { display: grid; gap: 1rem; margin-block: 2rem; }
.metric { padding: 1.4rem 1.4rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metric strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: clamp(2.6rem, 2rem + 2vw, 3.6rem); line-height: 1; color: var(--accent); }
.metric span { display: block; margin-top: .55rem; color: var(--muted); font-size: .84rem; line-height: 1.5; }
@media (min-width: 720px) { .metric-cards { grid-template-columns: repeat(3, 1fr); } }
.chart { margin-block: 2rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.chart h3 { margin: 0 0 1.1rem; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.bars { display: grid; gap: .95rem; }
.bar { display: grid; grid-template-columns: 11rem 1fr 4.2rem; gap: .9rem; align-items: center; font-size: var(--fs-small); }
.bar-track { display: block; width: 100%; height: 12px; }
.bar-bg { fill: var(--surface-2); }
.bar-fill { fill: var(--muted); transform-box: fill-box; transform-origin: left center; }
.bar--top .bar-fill { fill: var(--accent); }
.bar b { font-family: var(--font-mono); font-weight: 500; text-align: right; }
.js .chart.reveal .bar-fill { transform: scaleX(0); transition: transform 1.1s .2s var(--ease); }
.js .chart.reveal.is-in .bar-fill { transform: scaleX(1); }
.chart .cap { margin-top: 1.1rem; color: var(--muted); font-size: .82rem; line-height: 1.6; }
@media (max-width: 620px) { .bar { grid-template-columns: 1fr 4.2rem; row-gap: .35rem; } .bar-track { grid-column: 1 / -1; grid-row: 2; } }
.tech-list { border-top: 1px solid var(--line); margin-block: 1.5rem; }
.tech-list div { display: grid; gap: .25rem 1.5rem; padding: .95rem 0; border-bottom: 1px solid var(--line); }
.tech-list dt { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding-top: .2rem; }
.tech-list dd { color: var(--ink-2); font-size: var(--fs-small); }
@media (min-width: 720px) { .tech-list div { grid-template-columns: 11rem 1fr; } }
.doc-list { display: grid; gap: .8rem; margin-top: 1.25rem; }
.doc { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); transition: border-color var(--t-fast); }
.doc:hover { border-color: var(--accent); }
.doc strong { display: block; font-weight: 500; }
.doc span { display: block; color: var(--muted); font-size: .84rem; margin-top: .1rem; }
.doc svg { width: 1.2rem; height: 1.2rem; flex: none; color: var(--accent); transition: transform var(--t-fast) var(--ease); }
.doc:hover svg { transform: translate(5px, -5px); }
.next-case { border-top: 1px solid var(--line-strong); }
.next-case a { display: grid; gap: 1rem; padding-block: clamp(2.5rem, 5vw, 4.5rem); align-items: end; }
.next-case .h2 { transition: color var(--t-fast); }
.next-arrow { width: 2.5rem; height: 2.5rem; color: var(--accent); transition: transform var(--t-fast) var(--ease); }
.next-case a:hover .next-arrow { transform: translateX(12px); }
.next-case a:hover .h2 { color: var(--accent); }
@media (min-width: 800px) { .next-case a { grid-template-columns: 1fr auto; } }

/* ---------- Personal projects ---------- */
.live-embed { border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: #12001c; box-shadow: var(--shadow); }
.embed-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .75rem 1.1rem; background: #0b1113; color: #c8d6d8; font-size: var(--fs-small); border-bottom: 1px solid #22323a; }
.embed-bar a { color: #7fe0d8; min-height: 32px; display: inline-flex; align-items: center; gap: .4rem; }
.embed-bar a:hover { text-decoration: underline; }
.live-embed.has-focus { outline: 3px solid var(--accent); outline-offset: 3px; }
.embed-bar svg { width: 1em; height: 1em; flex: none; }
.embed-bar a { white-space: nowrap; }
.live-embed iframe { display: block; width: 100%; height: min(760px, 82vh); border: 0; background: #170024; }
.tutorhub-embed, .tutorhub-embed iframe { background: #0b1425; }
.terminal { background: #0b1113; color: #cfe0e2; padding: 1.4rem; font-family: var(--font-mono); font-size: clamp(.82rem, .7rem + .4vw, 1rem); line-height: 2; min-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.terminal .bar-dots { display: flex; gap: .4rem; margin-bottom: 1.4rem; align-items: center; color: #7d9295; font-size: .74rem; }
.terminal .bar-dots i { width: 9px; height: 9px; border-radius: 50%; background: #34454a; }
.terminal .bar-dots span { margin-left: .5rem; }
.terminal b { color: #7fe0d8; font-weight: 500; }
.terminal em { color: #7d9295; font-style: normal; font-size: .85em; }
.card-media--terminal { aspect-ratio: auto; min-height: 240px; background: #0b1113; }

/* ---------- Deck links, cover captions, event photos, team list ---------- */
.deck-link { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .1rem .55rem; min-height: 44px; font-weight: 500; color: var(--accent); position: relative; z-index: 2; }
.deck-link svg { width: 1.05em; height: 1.05em; flex: none; transition: transform var(--t-fast) var(--ease); }
.deck-link:hover svg { transform: translate(5px, -5px); }
.deck-link > span:first-child { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .3s var(--ease); padding-bottom: 2px; }
.deck-link:hover > span:first-child { background-size: 100% 1px; }
.file-size { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em; color: var(--muted); font-weight: 400; }
.comp-cover { min-width: 0; }
.comp-cover .deck-cap { margin-top: .5rem; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
@media (min-width: 960px) {
  .comp-cover { position: sticky; top: calc(var(--header-h) + 1.5rem); }
  .comp:nth-child(even) .comp-cover { order: 2; }
}
.case-media figcaption .deck-link { margin-left: .75rem; min-height: 32px; }
.photo-grid { display: grid; gap: 1rem; margin-top: 1.5rem; }
@media (min-width: 720px) { .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.photo-grid figure { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-grid figcaption { padding: .8rem 1rem; color: var(--muted); font-size: .85rem; line-height: 1.6; }
.team-list { margin-top: 1.25rem; border-top: 1px solid var(--line); }
.team-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .1rem 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.team-list .label { align-self: center; }
.deck-note { margin-top: 1rem; color: var(--muted); font-size: var(--fs-small); max-width: 62ch; }

/* ---------- About ---------- */
.about-grid { display: grid; gap: clamp(2rem, 5vw, 5rem); }
@media (min-width: 900px) { .about-grid { grid-template-columns: 20rem minmax(0, 1fr); } .about-grid .side { position: sticky; top: calc(var(--header-h) + 1.5rem); align-self: start; } }
.side dl > div { padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.side dl > div:first-child { border-top: 1px solid var(--line-strong); }
.side dt { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .09em; text-transform: uppercase; color: var(--accent); margin-bottom: .35rem; }
.side dd { color: var(--ink-2); font-size: var(--fs-small); line-height: 1.7; }
.timeline { border-left: 1px solid var(--line-strong); margin-left: .5rem; }
.tl-item { position: relative; padding: 0 0 2.25rem 1.75rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: -5.5px; top: .6rem; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.tl-item time { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tl-item h3 { font-weight: 600; font-size: 1.15rem; line-height: 1.4; margin-top: .3rem; }
.tl-item p { color: var(--ink-2); font-size: var(--fs-small); margin-top: .35rem; max-width: 62ch; }
.block + .block { margin-top: clamp(3rem, 6vw, 5rem); }
.block > .h2 { margin: 1rem 0 2rem; font-size: clamp(2rem, 1.4rem + 2.2vw, 2.75rem); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: clamp(2.5rem, 5vw, 5rem); align-items: start; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 1.1fr .9fr; } }
.contact-list { border-top: 1px solid var(--line-strong); }
.contact-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; padding: .75rem 0; border-bottom: 1px solid var(--line); font-size: 1.1rem; transition: padding var(--t-fast) var(--ease), color var(--t-fast); }
a.contact-row:hover { padding-left: 1rem; color: var(--accent); }
a.contact-row:hover svg { transform: translate(4px, -4px); }
.contact-row .label { font-size: var(--fs-label); }
.contact-row svg { width: 1.15rem; height: 1.15rem; flex: none; transition: transform var(--t-fast) var(--ease); }
.copy-btn { min-height: 44px; padding: 0 1rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: var(--fs-small); font-weight: 500; color: var(--accent); transition: background var(--t-fast), border-color var(--t-fast); }
.copy-btn:hover { background: var(--surface); border-color: var(--accent); }
.copy-status { min-height: 1.6rem; margin-top: .75rem; color: var(--ok); font-size: var(--fs-small); }

/* ---------- 404 ---------- */
.notfound { min-height: 70vh; display: grid; align-items: center; padding-block: 5rem; }
.notfound .h1 { font-size: clamp(3.4rem, 1.5rem + 9vw, 9rem); margin: 1rem 0; }

/* ---------- Cross-document page transition (progressive enhancement) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: .14s ease both vt-out; }
  ::view-transition-new(root) { animation: .26s ease both vt-in; }
  @keyframes vt-out { to { opacity: 0; } }
  @keyframes vt-in { from { opacity: 0; } }
}

/* ---------- keyboardTrans widget ---------- */
.kt { padding: clamp(1.1rem, .8rem + 1.4vw, 2rem); gap: 1.1rem; }
.kt-grid { display: grid; gap: 1rem; }
@media (min-width: 800px) { .kt-grid { grid-template-columns: 1fr 1fr; gap: 1.25rem; } }
.kt-pane { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.kt-pane .label { color: var(--muted); }
.kt textarea, .kt-out { width: 100%; min-height: 9.5rem; padding: .9rem 1rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; font-size: 1.05rem; line-height: 1.7; }
.kt textarea { resize: vertical; }
.kt textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.kt-out { display: block; background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
.kt-out.is-empty::before { content: attr(data-placeholder); color: var(--muted); user-select: none; }
.kt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .75rem; }
.kt-bar .btn[disabled] { opacity: .5; cursor: not-allowed; }
.kt-live { display: inline-flex; align-items: center; gap: .5rem; margin-left: auto; font-size: var(--fs-small); color: var(--ink-2); cursor: pointer; min-height: 36px; }
.kt-live input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.kt-mode { color: var(--accent); text-transform: none; letter-spacing: .03em; margin: 0; }
.kt-mode:empty { display: none; }
.kt-status { font-size: var(--fs-small); color: var(--ok); }
.kt-examples { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.kt-examples .label { color: var(--muted); margin-right: .25rem; }
.kt-chip { padding: .3rem .8rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-family: var(--font-mono); font-size: .8rem; cursor: pointer; min-height: 36px; transition: border-color var(--t-fast), background var(--t-fast); }
.kt-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.kt-out.is-flash { animation: kt-flash .55s var(--ease); }
@keyframes kt-flash { from { background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); } }
.kt-note { color: var(--muted); font-size: var(--fs-small); margin: 0; max-width: 70ch; }

/* ---------- Lenis (from lenis.css; the iframe rule is left out so embedded demos stay interactive) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }

/* ---------- Motion strengthening ---------- */
/* Load-in for every inner-page hero (the home hero has its own): eyebrow, h1, lead, buttons rise in turn. */
@keyframes rise-lg { from { opacity: 0; transform: translateY(28px); } }
@media (prefers-reduced-motion: no-preference) {
  .js .page-hero .wrap:not(.contact-grid) > *, .js .case-hero .wrap > * { animation: rise-lg .9s var(--ease) both; }
  .js .page-hero .wrap:not(.contact-grid) > :nth-child(2), .js .case-hero .wrap > :nth-child(2) { animation-delay: .06s; }
  .js .page-hero .wrap:not(.contact-grid) > :nth-child(3), .js .case-hero .wrap > :nth-child(3) { animation-delay: .12s; }
  .js .page-hero .wrap:not(.contact-grid) > :nth-child(4), .js .case-hero .wrap > :nth-child(4) { animation-delay: .18s; }
  .js .page-hero .wrap:not(.contact-grid) > :nth-child(5), .js .case-hero .wrap > :nth-child(5) { animation-delay: .24s; }
  .js .page-hero .wrap:not(.contact-grid) > :nth-child(n+6), .js .case-hero .wrap > :nth-child(n+6) { animation-delay: .3s; }
}
/* Case-study slides: gentle parallax (a video would lose its controls off the edge, so only images) and a hover zoom on event photos. */
.case-media img[data-parallax] { transform: scale(1.1); }
.case-media figcaption { position: relative; z-index: 1; }
.photo-grid figure { position: relative; }
.photo-grid img { transition: transform .8s var(--ease); }
.photo-grid figure:hover img { transform: scale(1.04); }
.photo-grid figcaption { position: relative; z-index: 1; background: var(--surface); }
/* Step diagrams: each circle pops in as its step arrives. */
.js .pipe-step.reveal::before { opacity: 0; scale: .5; transition: opacity .4s .2s var(--ease), scale .55s .2s cubic-bezier(.34, 1.56, .64, 1); }
.js .pipe-step.reveal.is-in::before { opacity: 1; scale: 1; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .pipe-step.reveal::before { opacity: 1; scale: 1; transition: none; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .flagship-media img, .card-media img[data-parallax], .case-media img[data-parallax] { transform: none; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-nav, .site-footer, .btn-row, .hero-field, .live-embed, .toc, .reading-progress, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .section, .hero, .page-hero, .case-layout { padding-block: 1.5rem; }
  .card, .comp, .metric { break-inside: avoid; box-shadow: none; }
}
