:root {
  --bg: #f4f1ea;
  --surface: #fbfaf6;
  --ink: #1b1d1a;
  --muted: #5e625b;
  --line: #d9d4c7;
  --grid: rgba(27, 29, 26, .045);
  --accent: #0f7a5c;
  --accent-ink: #ffffff;
  --mark: #e4f0e9;
  --serif: "Fraunces", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121412; --surface: #191c19; --ink: #e8e6df; --muted: #9a9e96;
    --line: #2c302b; --grid: rgba(232, 230, 223, .04);
    --accent: #4fd1a5; --accent-ink: #0b1a14; --mark: #1a2a23;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121412; --surface: #191c19; --ink: #e8e6df; --muted: #9a9e96;
  --line: #2c302b; --grid: rgba(232, 230, 223, .04);
  --accent: #4fd1a5; --accent-ink: #0b1a14; --mark: #1a2a23;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.mono { font-family: var(--mono); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--ink); color: var(--bg); padding: .5rem 1rem; z-index: 10; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; font: 500 1rem var(--mono); }
.brand svg { width: 22px; height: 22px; color: var(--accent); }
.brand b { color: var(--accent); font-weight: 500; }
nav { display: flex; align-items: center; gap: clamp(.6rem, 2vw, 1.6rem); font-size: .9rem; }
nav a { text-decoration: none; color: var(--muted); }
nav a:hover { color: var(--ink); }
.lang {
  font: 500 .75rem var(--mono); letter-spacing: .05em;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: .3rem .55rem; border-radius: 4px; cursor: pointer;
}
.lang:hover { border-color: var(--accent); }
@media (max-width: 560px) { nav a:not(:last-of-type) { display: none; } }

main { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }

/* hero */
.hero { padding: clamp(4rem, 12vw, 8.5rem) 0 clamp(3rem, 7vw, 5rem); border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--accent); font-size: .85rem; margin-bottom: 1.4rem; }
h1 {
  font: 400 clamp(2.4rem, 6.4vw, 4.6rem)/1.04 var(--serif);
  letter-spacing: -.025em; max-width: 15ch;
}
h1 em { font-style: italic; color: var(--accent); }
h1 span, h1 em { display: block; }
.lede { margin-top: 1.6rem; max-width: 58ch; color: var(--muted); font-size: 1.125rem; }
.cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.btn {
  display: inline-block; text-decoration: none; font-weight: 500; font-size: .95rem;
  padding: .7rem 1.15rem; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  transition: transform .15s ease;
  overflow-wrap: anywhere;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }

.readout {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: clamp(3rem, 7vw, 4.5rem) 0 0; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface);
}
.readout div { padding: 1rem 1.2rem; }
.readout div + div { border-left: 1px solid var(--line); }
.readout dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.readout dd { margin: .25rem 0 0; font-size: clamp(1.4rem, 3.5vw, 2rem); color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout div + div { border-left: 0; }
  .readout div:nth-child(even) { border-left: 1px solid var(--line); }
  .readout div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* blocks */
.block { padding: clamp(3.5rem, 9vw, 6rem) 0; border-bottom: 1px solid var(--line); scroll-margin-top: 60px; }
.block-head { display: grid; gap: .6rem; max-width: 62ch; margin-bottom: 2.5rem; }
.idx { font-size: .8rem; color: var(--accent); }
h2 { font: 400 clamp(1.8rem, 4vw, 2.6rem)/1.1 var(--serif); letter-spacing: -.02em; }
.block-head p:last-child { color: var(--muted); }

/* specimen cards */
.specimens { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.spec {
  position: relative; display: flex; flex-direction: column; gap: .6rem;
  padding: 1.3rem 1.3rem 1.2rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .2s ease, transform .2s ease;
}
.spec:hover { border-color: var(--accent); transform: translateY(-2px); }
.spec.feature { grid-column: 1 / -1; background: var(--mark); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); padding: 1.8rem; }
.spec.feature h3 { font: 400 clamp(1.5rem, 3vw, 2rem)/1.15 var(--serif); }
.spec.feature p:not(.tag) { max-width: 64ch; }
.tag { font-size: .74rem; color: var(--accent); letter-spacing: .03em; }
.spec h3 { font-size: 1.12rem; }
.spec p:not(.tag) { color: var(--muted); font-size: .97rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin: auto 0 0; padding: .5rem 0 0; }
.chips li { font-size: .72rem; padding: .18rem .5rem; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: var(--bg); }

/* lab */
.lab { display: grid; gap: 1rem; }
.exp {
  display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 1.4rem; align-items: start;
  padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.exp-n { font-size: .8rem; color: var(--accent); padding-top: .2rem; }
.exp h3 { font: 600 1.25rem var(--sans); margin-bottom: .4rem; }
.exp p { color: var(--muted); max-width: 70ch; }
.exp .chips { margin-top: .4rem; }
.exp-link { font-size: .8rem; color: var(--muted); text-decoration: none; white-space: nowrap; padding-top: .2rem; }
a.exp-link:hover { color: var(--accent); }
@media (max-width: 640px) {
  .exp { grid-template-columns: 1fr; gap: .6rem; }
}

.exp.side { margin-top: 1rem; grid-template-columns: 9rem 1fr; border-style: dashed; }
@media (max-width: 640px) { .exp.side { grid-template-columns: 1fr; } }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.timeline li {
  position: relative; display: grid; grid-template-columns: 8.5rem 1fr; gap: 1.2rem;
  padding: 0 0 1.6rem 1.6rem;
}
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: .45rem;
  width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.timeline li:first-child::before { background: var(--accent); }
.when { font-size: .82rem; color: var(--accent); padding-top: .15rem; }
.timeline h3 { font-size: 1.05rem; }
.timeline p:not(.when) { color: var(--muted); font-size: .97rem; margin-top: .2rem; }
@media (max-width: 560px) { .timeline li { grid-template-columns: 1fr; gap: .2rem; } }

.creds { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 2.5rem; }
.creds > div { padding: 1.2rem 1.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.creds h3 { font-size: .78rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: .5rem; }
.creds ul { margin: 0; padding-left: 1.1rem; }
.creds li, .creds p { font-size: .95rem; }
.creds li + li { margin-top: .3rem; }

/* stack */
.stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); border-top: 1px solid var(--line); }
.stack div { padding: 1.3rem 1.2rem 1.3rem 0; border-bottom: 1px solid var(--line); }
.stack h3 { font-size: .78rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: .5rem; }
.stack p { color: var(--ink); font-size: .97rem; }

/* contact */
.contact { border-bottom: 0; text-align: left; }
.contact h2 { max-width: 20ch; margin: .6rem 0 .8rem; }
.contact > p:not(.idx) { color: var(--muted); }

.foot {
  max-width: 1120px; margin: 0 auto; padding: 1.6rem clamp(16px, 4vw, 48px) 2.4rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem;
  font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
