/* ==========================================================================
   Portfolio stylesheet. Hand-written, no build step.
   Sections: fonts · tokens · base · masthead · intro · now · sections ·
   system diagram · projects · experience · colophon · contact ·
   fallback pages · motion · print
   ========================================================================== */

/* --- Fonts: self-hosted, SIL Open Font License (see fonts/OFL-*.txt) ------
   Two type sets. The default is Hanken Grotesk + JetBrains Mono. The
   editorial set, Newsreader + IBM Plex Mono, is kept for comparison: press
   "f" or add ?type=editorial (see theme.js). A browser only downloads the
   fonts of the set in use.
   ------------------------------------------------------------------------ */
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-grotesk-roman.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-grotesk-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-roman.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-roman.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

/* --- Tokens ------------------------------------------------------------- */
:root {
  --paper: #f3f0e8;
  --paper-2: #ebe7dc;
  --ink: #1b1a17;
  --ink-2: #3a3731;
  --muted: #6b675e;
  --rule: #d6d0c2;
  --accent: #007800;                /* #2bc017 darkened to pass 4.5:1 for text */
  --accent-2: var(--accent);       /* underlines, borders, in-progress dots */
  --accent-wash: color-mix(in srgb, var(--accent) 9%, transparent);
  --highlight: #2bc017;             /* text selection: the bright green, with dark text */
  --highlight-ink: #1b1a17;
  --ok: #2f7a4b;
  --contact-bg: #1b1a17;
  --contact-ink: #f3f0e8;
  --contact-muted: #a39d8f;
  --contact-accent: var(--accent);
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain: var(--grain-light);

  --sans: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Newsreader", ui-serif, "Iowan Old Style", Georgia, serif;
  --text: var(--sans);              /* body and headlines */
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-size: 1.0625rem;
  --display-weight: 400;            /* large headlines */
  --diagram-names: 15px;            /* source list in the diagram */
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14130f;
    --paper-2: #1d1b16;
    --ink: #ece6d8;
    --ink-2: #cfc8b8;
    --muted: #9d9686;
    --rule: #2f2c25;
    --accent: #70ef50;
    --highlight: var(--accent);
    --highlight-ink: var(--paper);
    --ok: #6cc08f;
    --contact-bg: #1d1b16;
    --contact-ink: #ece6d8;
    --contact-muted: #9d9686;
    --grain: var(--grain-dark);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14130f;
  --paper-2: #1d1b16;
  --ink: #ece6d8;
  --ink-2: #cfc8b8;
  --muted: #9d9686;
  --rule: #2f2c25;
  --accent: #70ef50;
  --highlight: var(--accent);
  --highlight-ink: var(--paper);
  --ok: #6cc08f;
  --contact-bg: #1d1b16;
  --contact-ink: #ece6d8;
  --contact-muted: #9d9686;
  --grain: none;
  color-scheme: dark;
}

/* Editorial type set, kept for comparison. */
:root[data-type="editorial"] {
  --text: var(--serif);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-size: 1.125rem;
  --display-weight: 350;
  --diagram-names: 17px;
}

/* --- Palettes ------------------------------------------------------------
   Hidden themes, switched by theme.js (press "t", or click the dot after the
   name). Each palette has a light and a dark scheme; theme.js sets
   data-scheme from the OS setting or the "m" key.

   How the light schemes were derived: luminance roles flip, hues stay.
   - Dark scheme: the darkest color is the page, the bright one is the accent,
     the mid-tones become rules and the contact block.
   - Light scheme: the darkest colors become text, the mid-tones become the
     accent, and the bright color moves to marks (selection, dots), where it
     doesn't need text contrast. Backgrounds are near-white tints of the
     palette's own hue, so the page still reads as that palette.
   - The dark anchor color reappears as the contact block in light schemes.
   Every text pairing below meets WCAG AA; body text meets AAA.
   ------------------------------------------------------------------------ */

/* Lichen (#171B25 #2A464D #D7C824 #4C7455 #8E872A), light */
:root[data-palette="lichen"][data-scheme="light"] {
  --paper: #f6f5e6;
  --paper-2: #ebe9d0;
  --ink: #171b25;
  --ink-2: #2a464d;
  --muted: #586a5b;
  --rule: #d6d4ba;
  --accent: #4c7455;
  --accent-2: #8e872a;
  --ok: #4c7455;
  --highlight: #d7c824;
  --highlight-ink: #171b25;
  --contact-bg: #171b25;
  --contact-ink: #efeed9;
  --contact-muted: #92a495;
  --contact-accent: #d7c824;
  --grain: var(--grain-light);
  color-scheme: light;
}

:root[data-palette="lichen"][data-scheme="dark"] {
  --paper: #171b25;
  --paper-2: #14252e;
  --ink: #efeed9;
  --ink-2: #c3d3c5;
  --muted: #849987;
  --rule: #2a464d;
  --accent: #d7c824;
  --accent-2: #8e872a;
  --ok: #567e5f;
  --highlight: #d7c824;
  --highlight-ink: #171b25;
  --contact-bg: #2a464d;
  --contact-ink: #efeed9;
  --contact-muted: #a2b8a5;
  --contact-accent: #d7c824;
  --grain: var(--grain-dark);
  color-scheme: dark;
}

/* Aurora (#1E2450 #4A298F #0D2E35 #126137 #24BD51), light */
:root[data-palette="aurora"][data-scheme="light"] {
  --paper: #f5f5fe;
  --paper-2: #e7e8fb;
  --ink: #1e2450;
  --ink-2: #0d2e35;
  --muted: #636382;
  --rule: #d2d2e8;
  --accent: #4a298f;
  --accent-2: #126137;
  --ok: #126137;
  --highlight: #24bd51;
  --highlight-ink: #1e2450;
  --contact-bg: #1e2450;
  --contact-ink: #eeeffc;
  --contact-muted: #a1a1c3;
  --contact-accent: #24bd51;
  --grain: var(--grain-light);
  color-scheme: light;
}

:root[data-palette="aurora"][data-scheme="dark"] {
  --paper: #1e2450;
  --paper-2: #0d2e35;
  --ink: #eeeffc;
  --ink-2: #cfcdea;
  --muted: #a1a1c3;
  --rule: #543c95;
  --accent: #24bd51;
  --accent-2: #8066d1;
  --ok: #24bd51;
  --highlight: #4a298f;
  --highlight-ink: #eeeffc;
  --contact-bg: #4a298f;
  --contact-ink: #eeeffc;
  --contact-muted: #bdb9dc;
  --contact-accent: #24bd51;
  --grain: var(--grain-dark);
  color-scheme: dark;
}

/* Dusk (#1B2035 #45263F #852D49 #CE3845 #237098), light */
:root[data-palette="dusk"][data-scheme="light"] {
  --paper: #fbf3f7;
  --paper-2: #f4e4ee;
  --ink: #1b2035;
  --ink-2: #45263f;
  --muted: #745e71;
  --rule: #e0ced9;
  --accent: #852d49;
  --accent-2: #ce3845;
  --ok: #237098;
  --highlight: #ce3845;
  --highlight-ink: #ffffff;
  --contact-bg: #1b2035;
  --contact-ink: #f8ebeb;
  --contact-muted: #aa98a7;
  --contact-accent: #ce3845;
  --grain: var(--grain-light);
  color-scheme: light;
}

:root[data-palette="dusk"][data-scheme="dark"] {
  --paper: #1b2035;
  --paper-2: #332137;
  --ink: #f8ebeb;
  --ink-2: #dec8d6;
  --muted: #ad96aa;
  --rule: #50314a;
  --accent: #ee575f;
  --accent-2: #2e79a1;
  --ok: #2e79a1;
  --highlight: #ce3845;
  --highlight-ink: #ffffff;
  --contact-bg: #852d49;
  --contact-ink: #f8ebeb;
  --contact-muted: #dbbac3;
  --contact-accent: #ff7277;
  --grain: var(--grain-dark);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper) var(--grain);
  color: var(--ink);
  font-family: var(--text);
  font-size: var(--text-size);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3 { font-weight: 400; text-wrap: balance; }
p { text-wrap: pretty; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s, text-decoration-thickness 0.15s;
}
a:hover { color: var(--accent); text-decoration-thickness: 2px; }

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

.wrap { width: min(calc(100% - 2 * var(--gutter)), var(--maxw)); margin-inline: auto; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; padding: 8px 12px; background: var(--ink); color: var(--paper); }

/* Small uppercase mono text used for labels, metadata and navigation. */
.label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }

.inline-list { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; list-style: none; }
.inline-list a { text-decoration: none; }
.inline-list a:hover { text-decoration: underline; text-decoration-color: var(--accent); }

/* Content you still have to write. Remove the class once it's real. */
.todo {
  background: repeating-linear-gradient(-45deg, var(--accent-wash) 0 6px, transparent 6px 12px);
  outline: 1px dashed var(--accent);
  outline-offset: 2px;
}

/* Status dots: live (pulsing), building, off */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; vertical-align: 0.1em; margin-right: 0.5em; }
.dot.live { color: var(--ok); animation: pulse 2.4s ease-out infinite; }
.dot.wip { color: var(--accent-2); }
.dot.off { color: var(--muted); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

/* --- Masthead ----------------------------------------------------------- */
.masthead { border-bottom: 1px solid var(--ink); }
.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 32px;
  padding-block: 20px 14px;
}
.wordmark { font-size: 1.3rem; font-weight: 500; letter-spacing: -0.01em; text-decoration: none; }
.wordmark .stop { color: var(--accent); }
.masthead nav ul { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0; padding: 0; list-style: none; }
.masthead nav a { text-decoration: none; }
/* Language link: set apart from the section links by a hairline. */
.masthead .lang { padding-left: 20px; border-left: 1px solid var(--rule); }
.masthead a.lang, .masthead .lang a { text-decoration: none; }
.masthead a.lang:hover, .masthead .lang a:hover { color: var(--accent); }
.masthead nav { margin-left: auto; }
/* Phones: the language link sits next to the name, the sections get their own row. */
@media (max-width: 640px) {
  .masthead a.lang { order: 2; margin-left: auto; padding-left: 0; border-left: 0; }
  .masthead nav { order: 3; flex-basis: 100%; margin-left: 0; }
}
.masthead nav a:hover { color: var(--accent); }

/* --- Intro -------------------------------------------------------------- */
.intro { padding-block: clamp(48px, 9vw, 120px) clamp(48px, 7vw, 88px); }
.intro h1 {
  max-width: 21ch;
  margin: 0 0 clamp(36px, 6vw, 64px);
  font-size: clamp(2.5rem, 6.4vw, 5.6rem);
  font-weight: var(--display-weight);
  line-height: 1;
  letter-spacing: -0.028em;
}
.intro h1 em { color: var(--accent); }

.intro-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px 24px; }
.intro-body { grid-column: 1 / span 7; }
.intro-side { grid-column: 9 / -1; }

.role { margin: 0 0 14px; color: var(--accent); }
.bio { margin: 0 0 28px; font-size: clamp(1.2rem, 1.7vw, 1.42rem); line-height: 1.45; }

.facts { margin: 0 0 24px; border-top: 1px solid var(--ink); }
.facts div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.facts dt { padding-top: 0.25em; color: var(--muted); }
.facts dd { margin: 0; font-size: 1rem; }

/* --- Now ---------------------------------------------------------------- */
.now { border-block: 1px solid var(--rule); background: var(--paper-2); }
.now .wrap { display: grid; grid-template-columns: 7.5rem 1fr; gap: 8px 24px; padding-block: 18px; align-items: baseline; }
.now p { margin: 0; max-width: 62em; }

/* --- Sections ----------------------------------------------------------- */
.section { padding-block: clamp(64px, 9vw, 112px) 0; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding-bottom: 14px;
  margin-bottom: clamp(28px, 4vw, 44px);
  border-bottom: 1px solid var(--ink);
}
.section-head h2 { margin: 0; font-size: clamp(2.1rem, 4.2vw, 3.2rem); font-weight: var(--display-weight); line-height: 1; letter-spacing: -0.022em; }
.section-head h2 .num { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.08em; color: var(--accent); vertical-align: super; margin-right: 0.6em; }

.lede-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
.lede { grid-column: 1 / span 7; margin: 0; font-size: clamp(1.2rem, 1.7vw, 1.4rem); line-height: 1.45; }
.aside { grid-column: 9 / -1; margin: 0; padding-left: 16px; border-left: 1px solid var(--rule); color: var(--muted); font-size: 1rem; }

/* --- System diagram ----------------------------------------------------- */
.system { margin: clamp(36px, 5vw, 56px) 0 clamp(24px, 4vw, 40px); }
.system .scroller { overflow-x: auto; padding: clamp(16px, 3vw, 32px); border: 1px solid var(--rule); background: var(--paper-2); }
.system svg { display: block; width: 100%; height: auto; }
.system .dg-wide { min-width: 640px; }
.system .dg-narrow { display: none; }
@media (max-width: 640px) {
  .system .dg-wide { display: none; }
  .system .dg-narrow { display: block; max-width: 420px; margin-inline: auto; }
  .system .dg-narrow .dg-title { font-size: 21px; }
  .system .dg-narrow .dg-srcnames { font-size: 15px; }
  .system .dg-narrow .dg-sub, .system .dg-narrow .dg-elabel { font-size: 10px; }
}
.system figcaption { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 12px; color: var(--muted); }
.system figcaption p { margin: 0; font-family: var(--text); text-transform: none; letter-spacing: 0; font-size: 0.95rem; max-width: 60em; }
.legend-line { display: inline-block; width: 28px; border-top: 1.5px solid var(--ink-2); vertical-align: middle; margin-right: 8px; }
.legend-line.opt { border-top-style: dashed; }

.dg-box { fill: var(--paper); stroke: var(--ink); stroke-width: 1; transition: stroke 0.2s, stroke-width 0.2s; }
.dg-sheet { fill: var(--paper-2); stroke: var(--ink-2); stroke-width: 1; }
.dg-src { fill: none; stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 4; }
.dg-title { font-family: var(--text); font-size: 25px; fill: var(--ink); transition: fill 0.2s; }
.dg-title.it { font-style: italic; }
.dg-srcnames { font-family: var(--text); font-size: var(--diagram-names); fill: var(--ink-2); }
.dg-sub, .dg-elabel { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; fill: var(--muted); }
.dg-edge { fill: none; stroke: var(--ink-2); stroke-width: 1.25; }
.dg-edge.opt { stroke-dasharray: 5 5; }
.dg-head { fill: var(--ink-2); }

/* Highlight a node while its project is hovered or focused, and in role views. */
.dg-node.is-hot .dg-box,
.work:has(#p-ask:is(:hover, :focus-within)) [data-node="ask"] .dg-box,
.work:has(#p-warehouse:is(:hover, :focus-within)) [data-node="warehouse"] .dg-box,
.work:has(#p-radar:is(:hover, :focus-within)) [data-node="radar"] .dg-box,
.work:has(#p-deps:is(:hover, :focus-within)) [data-node="deps"] .dg-box,
[data-view="ai"] [data-profiles~="ai"] .dg-box,
[data-view="data"] [data-profiles~="data"] .dg-box,
[data-view="python"] [data-profiles~="python"] .dg-box,
[data-view="typescript"] [data-profiles~="typescript"] .dg-box,
[data-view="elixir"] [data-profiles~="elixir"] .dg-box { stroke: var(--accent); stroke-width: 2; }

.work:has(#p-ask:is(:hover, :focus-within)) [data-node="ask"] .dg-title,
.work:has(#p-warehouse:is(:hover, :focus-within)) [data-node="warehouse"] .dg-title,
.work:has(#p-radar:is(:hover, :focus-within)) [data-node="radar"] .dg-title,
.work:has(#p-deps:is(:hover, :focus-within)) [data-node="deps"] .dg-title,
[data-view="ai"] [data-profiles~="ai"] .dg-title,
[data-view="data"] [data-profiles~="data"] .dg-title,
[data-view="python"] [data-profiles~="python"] .dg-title,
[data-view="typescript"] [data-profiles~="typescript"] .dg-title,
[data-view="elixir"] [data-profiles~="elixir"] .dg-title { fill: var(--accent); }

/* --- Projects ----------------------------------------------------------- */
.projects { margin: 0; padding: 0; list-style: none; counter-reset: project; }
.project {
  counter-increment: project;
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 5fr) minmax(0, 7fr);
  gap: 8px 32px;
  padding: clamp(28px, 4vw, 40px) 0;
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.25s;
}
.project::before {
  content: counter(project, decimal-leading-zero);
  padding-top: 0.9em;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}
.project:hover { background: linear-gradient(to right, var(--accent-wash), transparent 70%); }

.project h3 { margin: 0; font-size: clamp(2rem, 3.4vw, 2.75rem); line-height: 1.05; letter-spacing: -0.022em; }
.project:hover h3 { color: var(--accent); }
.tagline { margin: 6px 0 16px; font-size: 1.2rem; font-style: italic; color: var(--ink-2); }
.p-meta { display: flex; flex-direction: column; gap: 6px; }

.summary { margin: 0 0 20px; font-size: 1.18rem; }
.decision { margin: 0 0 20px; padding-left: 16px; border-left: 2px solid var(--accent-2); }
.decision p { margin: 4px 0 0; }
.stack { margin: 0 0 16px; color: var(--muted); }
.stack li + li::before { content: "·"; margin-right: 20px; margin-left: -12px; }
.stack.inline-list { gap: 4px 12px; }
.stack.inline-list li + li::before { margin: 0 12px 0 0; }

.p-links a::after { content: " ↗"; }

/* --- Experience --------------------------------------------------------- */
.jobs { margin: 0; padding: 0; list-style: none; }
.job {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 5fr) minmax(0, 7fr);
  gap: 4px 32px;
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
}
.job .years { grid-column: 2; grid-row: 1; margin: 0; color: var(--muted); }
.job .what { grid-column: 2; grid-row: 2; }
.job h3 { margin: 0; font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.01em; }
.job .company { margin: 2px 0 0; font-style: italic; color: var(--muted); }
.job .impact { grid-column: 3; grid-row: 1 / span 2; margin: 0; align-self: start; }
.after-list { margin: 20px 0 0; padding-left: calc(3.5rem + 32px); }
@media (max-width: 820px) { .after-list { padding-left: 0; } }

/* --- Colophon ----------------------------------------------------------- */
.colophon-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
.colophon-text { grid-column: 1 / span 7; }
.colophon-text p { margin: 0 0 1em; }
.colophon-grid .facts { grid-column: 9 / -1; align-self: start; }

/* --- Contact ------------------------------------------------------------ */
.contact {
  margin-top: clamp(72px, 10vw, 128px);
  padding-block: clamp(56px, 8vw, 96px) 28px;
  background: var(--contact-bg);
  color: var(--contact-ink);
}
.contact a { text-decoration-color: var(--contact-accent); }
.contact .statement {
  max-width: 20ch;
  margin: 14px 0 28px;
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: var(--display-weight);
  line-height: 1.02;
  letter-spacing: -0.025em;
}
.contact .email { display: inline-block; font-size: clamp(1.3rem, 2.4vw, 1.9rem); text-decoration-thickness: 2px; }
.contact .label { color: var(--contact-muted); }
.contact .inline-list { margin-top: 24px; }
.footline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: clamp(56px, 8vw, 96px);
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--contact-ink) 20%, transparent);
}

/* --- Fallback pages (demos/<slug>/) and 404 ----------------------------- */
.page-head { padding-block: clamp(40px, 7vw, 88px) clamp(28px, 4vw, 48px); }
.crumb { margin: 0 0 20px; color: var(--muted); }
.crumb a { text-decoration: none; }
.page-head h1 { margin: 0; font-size: clamp(3rem, 8vw, 6rem); font-weight: var(--display-weight); line-height: 0.95; letter-spacing: -0.03em; }
.page-head .tagline { font-size: clamp(1.3rem, 2.2vw, 1.7rem); margin: 10px 0 0; }
/* Second language on the bilingual 404 page. */
.page-alt { margin-top: clamp(28px, 4vw, 44px); padding-top: clamp(20px, 3vw, 28px); border-top: 1px solid var(--rule); color: var(--ink-2); }
.page-alt .alt-title { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); font-weight: var(--display-weight); line-height: 1; letter-spacing: -0.025em; }

.status-band { border-block: 1px solid var(--rule); background: var(--paper-2); }
.status-band .wrap { display: grid; grid-template-columns: 12rem 1fr; gap: 8px 24px; padding-block: 18px; align-items: baseline; }
.status-band p { margin: 0; max-width: 60em; }

.demo-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 40px 24px; padding-top: clamp(40px, 6vw, 72px); }
.demo-main { grid-column: 1 / span 8; }
.demo-side { grid-column: 10 / -1; }
.demo-main h2, .demo-side h2 { margin: 0 0 12px; }
.demo-main section + section { margin-top: 48px; }

.media { margin: 0; }
.media video, .media img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); background: var(--paper-2); }
.media .placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--muted);
  background: var(--paper-2);
  color: var(--muted);
  text-align: center;
  padding: 16px;
}
.media figcaption { margin-top: 12px; font-size: 1rem; color: var(--ink-2); }
.media figcaption .label { display: block; color: var(--muted); margin-bottom: 2px; }

.page-foot { margin-top: clamp(64px, 9vw, 112px); padding-block: 20px 32px; border-top: 1px solid var(--ink); }
.page-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; color: var(--muted); }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 820px) {
  .intro-body, .intro-side, .lede, .aside, .colophon-text, .colophon-grid .facts, .demo-main, .demo-side { grid-column: 1 / -1; }
  .aside { padding-left: 0; padding-top: 14px; border-left: 0; border-top: 1px solid var(--rule); }
  .project, .job { grid-template-columns: 2.25rem minmax(0, 1fr); gap: 4px 12px; }
  .project > .p-body { grid-column: 2; margin-top: 16px; }
  .job { grid-template-columns: minmax(0, 1fr); }
  .job .years, .job .what, .job .impact { grid-column: 1; grid-row: auto; }
  .job .impact { margin-top: 10px; }
  .now .wrap, .status-band .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .facts div { grid-template-columns: 6.5rem 1fr; }
}

/* --- Motion ------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  @supports (animation-timeline: view()) {
    .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
  }

  ::view-transition-group(*) { animation-duration: 0.4s; animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dot.live { animation: none; }
}
#p-ask { view-transition-name: p-ask; }
#p-warehouse { view-transition-name: p-warehouse; }
#p-radar { view-transition-name: p-radar; }
#p-deps { view-transition-name: p-deps; }

/* --- Theme toast (theme.js) ------------------------------------------- */
.theme-toast {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.theme-toast.is-on { opacity: 1; transform: none; }
.theme-toast .sw { display: flex; gap: 3px; }
.theme-toast .sw i { width: 10px; height: 10px; outline: 1px solid color-mix(in srgb, var(--paper) 35%, transparent); }
@media print { .theme-toast { display: none; } }

/* --- Print: the page doubles as a one-page summary ---------------------- */
@media print {
  :root, :root[data-palette][data-scheme] {
    --paper: #fff; --paper-2: #fff; --ink: #111; --ink-2: #333; --muted: #555; --rule: #ccc;
    --accent: #111; --accent-2: #555; --grain: none; --contact-bg: #fff; --contact-ink: #111; --contact-muted: #555;
    color-scheme: light;
  }
  body { font-size: 11pt; }
  .masthead nav, .skip, .system, .now { display: none; }
  .intro { padding-block: 12pt; }
  .intro h1 { font-size: 26pt; }
  .section { padding-top: 18pt; }
  .project, .job { break-inside: avoid; padding-block: 10pt; }
  .contact { margin-top: 18pt; padding-block: 12pt; }
  .reveal { animation: none !important; }
}
