/* Fonts: IBM Plex, SIL Open Font License 1.1 (see fonts/LICENSE-IBM-Plex.txt) */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Tokens. Dark is the default; theme.js sets data-theme="light" on request. */
:root {
  color-scheme: dark;
  --bg: #0d141b;
  --surface: #131e28;
  --ink: #eef2f5;
  --muted: #a9b6c2;
  --line: #26343f;
  --line-strong: #4d5d6b;
  --accent: #8fe3db;
  --accent-ink: #06201e;
  --node-line: #5fa7a3;

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --stroke: 1.5px;
  --gutter: clamp(20px, 5vw, 48px);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3ee;
  --surface: #fcfbf8;
  --ink: #14181d;
  --muted: #4f5760;
  --line: #d6d1c5;
  --line-strong: #8d8a80;
  --accent: #0a625c;
  --accent-ink: #ffffff;
  --node-line: #3d837e;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 76px;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { font-weight: 600; text-wrap: balance; }
p { text-wrap: pretty; }
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { width: min(1024px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.sprite { position: absolute; }
.skip {
  position: absolute; left: var(--gutter); top: -60px; z-index: 20;
  padding: 10px 14px; background: var(--ink); color: var(--bg); text-decoration: none;
}
.skip:focus { top: 8px; color: var(--bg); }

/* Buttons and links */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 22px;
  background: var(--accent); color: var(--accent-ink);
  border: var(--stroke) solid var(--accent); border-radius: 4px;
  font: 600 0.9375rem/1 var(--sans);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: transparent; color: var(--accent); }
.btn--ghost {
  min-height: 40px; padding: 0 14px;
  background: transparent; color: var(--ink);
  border-color: var(--line-strong);
  font-size: 0.875rem;
}
.btn--ghost:hover { color: var(--accent); border-color: var(--accent); }
.text-link { display: inline-block; padding-block: 10px; font-weight: 500; text-decoration-color: var(--accent); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.bar {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "brand actions" "nav nav";
  align-items: center;
  column-gap: 20px;
  padding-top: 10px;
}
.brand { grid-area: brand; padding-block: 9px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.nav { grid-area: nav; display: flex; gap: 4px 20px; flex-wrap: wrap; }
.nav a { padding-block: 11px; font-size: 0.9375rem; font-weight: 500; text-decoration: none; }
.bar-actions { grid-area: actions; display: flex; align-items: center; gap: 10px; }
@media (max-width: 379px) {
  .bar-cv { display: none; }
}
@media (min-width: 720px) {
  .bar {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav actions";
    column-gap: 40px;
    min-height: 60px; padding-top: 0;
  }
  .nav { justify-content: flex-end; gap: 4px 28px; }
}

/* Hero */
.hero { padding-block: clamp(40px, 7vw, 84px) clamp(40px, 6vw, 68px); }
.hero-grid { display: grid; gap: 40px; align-items: center; }
.hero h1 {
  font-size: clamp(2.5rem, 6.2vw, 4.25rem);
  line-height: 1;
  letter-spacing: -0.035em;
}
.hero-sub {
  margin-top: clamp(10px, 1.4vw, 16px);
  font-size: clamp(1.25rem, 2.3vw, 1.625rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--accent);
}
.lede { max-width: 27em; margin-top: 18px; font-size: clamp(1.0625rem, 1.4vw, 1.125rem); }
.hero-meta { margin-top: 12px; font-size: 0.9375rem; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; margin-top: 26px; }
.hero-fig figcaption { margin-bottom: 14px; font-size: 0.9375rem; font-weight: 600; }
@media (min-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr); gap: 56px; }
}

/* Sections */
.section > .wrap { padding-block: clamp(36px, 5.5vw, 60px); border-top: 1px solid var(--line); }
.section-title {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}
.section-title + .case, .section-title + .grid4 { margin-top: clamp(20px, 3vw, 30px); }
.section-note { margin-top: 8px; }

/* Icons and arrows */
.ic, .arrow {
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic { flex: none; width: 24px; height: 24px; color: var(--accent); }
.arrow { flex: none; width: 32px; height: 12px; color: var(--accent); }
.arrow--long { width: 56px; }

/* Flow diagrams */
.flow { display: flex; align-items: stretch; gap: 6px; }
.node {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; padding: 10px 14px;
  background: var(--bg);
  border: var(--stroke) solid var(--node-line);
  border-radius: 6px;
  font-size: 0.875rem; font-weight: 600; line-height: 1.25;
}
.link { flex: none; display: flex; align-items: center; justify-content: center; }

.flow--tiles .node {
  flex: 1 1 0; flex-direction: column; justify-content: center; gap: 8px;
  min-height: 92px; padding: 12px 6px;
  text-align: center;
}
.flow--pair .node { flex: 1 1 0; justify-content: center; min-height: 44px; }
.flow--text { gap: 4px; margin-block: 18px; }
.flow--text .node { flex: 0 1 auto; justify-content: center; padding: 9px 16px; }
.pairs { display: grid; gap: 16px; max-width: 34rem; margin-inline: auto; }

@media (max-width: 719px) {
  .flow--tiles { flex-direction: column; max-width: 22rem; }
  .flow--tiles .node {
    flex: none; flex-direction: row; justify-content: flex-start;
    min-height: 0; padding: 10px 14px;
    text-align: left;
  }
  .flow--tiles .link { height: 32px; justify-content: flex-start; padding-left: 10px; }
  .flow--tiles .arrow { rotate: 90deg; }
}
@media (max-width: 559px) {
  .flow--pair { flex-direction: column; }
  .flow--pair .node { flex: none; justify-content: flex-start; }
  .flow--pair .link { height: 32px; justify-content: flex-start; padding-left: 10px; }
  .flow--pair .arrow { width: 32px; rotate: 90deg; }
  .pairs { gap: 24px; margin-inline: 0; }
}
@media (max-width: 379px) {
  .flow--text .node { padding-inline: 10px; }
  .flow--text .arrow { width: 22px; }
}

/* Main projects */
.case {
  padding: clamp(20px, 3vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.case + .case { margin-top: 20px; }
.case h3 { font-size: clamp(1.25rem, 2.4vw, 1.5rem); line-height: 1.2; letter-spacing: -0.015em; }
.case-lead { margin-top: 6px; }
.case-meta { margin-top: 6px; font-size: 0.9375rem; color: var(--muted); }
.case .flow--tiles, .case .pairs { margin-top: 22px; }

/* More selected work */
.grid4 {
  display: grid; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden;
}
.cell { padding: clamp(20px, 3vw, 26px); background: var(--bg); }
.cell h3 { font-size: 1.1875rem; line-height: 1.25; letter-spacing: -0.01em; }
.cell p { margin-top: 4px; font-size: 0.9375rem; color: var(--muted); }
.motif { display: flex; align-items: center; gap: 4px; margin-top: 18px; }
.motif .box {
  display: grid; place-items: center;
  width: 46px; height: 36px;
  border: var(--stroke) solid var(--node-line); border-radius: 6px;
}
.motif .ic { width: 20px; height: 20px; }
.motif .arrow { width: 28px; }
@media (min-width: 720px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Experience */
.tl { --start: 2008; --end: 2027; margin-top: 24px; }
.tl-axis, .tl-track { display: none; }
.timeline { border-bottom: 1px solid var(--line); }
.tl-row { padding-block: 14px; border-top: 1px solid var(--line); }
.tl-row h3 { font-size: 1.0625rem; line-height: 1.3; letter-spacing: -0.005em; }
.tl-meta { margin-top: 2px; font-size: 0.875rem; color: var(--muted); }
.nw { white-space: nowrap; }
.tl-note { margin-top: 6px; font-size: 0.9375rem; color: var(--muted); }
.tl-foot { margin-top: 20px; font-size: 0.9375rem; color: var(--muted); }
@media (min-width: 720px) {
  .tl-axis, .tl-row { display: grid; grid-template-columns: minmax(0, 0.56fr) minmax(0, 1fr); column-gap: 24px; }
  .tl-row { padding-block: 0; }
  .tl-label { padding-block: 10px; }
  .tl-note { display: none; }
  .tl-years, .tl-track {
    position: relative; display: block;
    background-image: linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: calc(100% / 9.5) 100%;
  }
  .tl-years { height: 1.75rem; font: 400 0.75rem/1.75rem var(--mono); color: var(--muted); }
  .tl-years span {
    position: absolute;
    left: calc((var(--y) - var(--start)) / (var(--end) - var(--start)) * 100%);
    padding-left: 6px;
  }
  .tl-years span:nth-child(even) { display: none; }
  .tl-bar {
    position: absolute; top: 50%; height: 10px; translate: 0 -50%;
    left: calc((var(--from) - var(--start)) / (var(--end) - var(--start)) * 100%);
    width: calc((var(--to) - var(--from)) / (var(--end) - var(--start)) * 100%);
    background: var(--accent);
    border-radius: 2px;
  }
  .tl-bar--contract {
    background: repeating-linear-gradient(135deg, var(--accent) 0 2px, transparent 2px 6px);
    outline: var(--stroke) solid var(--accent); outline-offset: calc(var(--stroke) * -1);
  }
}

@media (min-width: 960px) {
  .tl-years span:nth-child(even) { display: block; }
}

/* Stack and AI share one band */
.band { display: grid; gap: 40px; }
.band .section-title { margin-bottom: 16px; }
.stack > div { padding-block: 5px; }
.stack dt, .stack dd { display: inline; }
.stack dt { font-weight: 600; }
.stack dt::after { content: " · "; font-weight: 400; color: var(--muted); }
@media (min-width: 820px) {
  .band { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .band > section:first-child { padding-right: 48px; }
  .band > section:last-child { padding-left: 48px; border-left: 1px solid var(--line-strong); }
}

/* Contact */
.contact { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 56px; }
.contact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 36px; }
.contact-note { flex-basis: 100%; color: var(--muted); }
@media (min-width: 720px) {
  .contact-actions { min-height: 56px; padding-left: 56px; border-left: 1px solid var(--line-strong); }
}

/* Footer */
.site-footer .wrap {
  padding-block: 22px;
  border-top: 1px solid var(--line);
  font: 400 0.8125rem/1.6 var(--mono);
  color: var(--muted);
}

/* Print: recruiters save pages as PDF */
@media print {
  :root, :root[data-theme="light"] {
    --bg: #fff; --surface: #fff; --ink: #000; --muted: #333;
    --line: #bbb; --line-strong: #777; --accent: #0a625c; --accent-ink: #fff; --node-line: #0a625c;
  }
  .site-header { position: static; }
  .nav, .bar-actions, .hero-actions, .skip { display: none; }
  .case, .cell, .tl-row { break-inside: avoid; }
  .tl-bar, .btn { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
