:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1d21;
  --muted: #5d6170;
  --border: #e4e2dc;
  --accent: #b5452b;        /* salt-crystal rust */
  --accent-soft: #f6e7e2;
  --gpu: #2f6f5e;
  --gpu-soft: #e2efea;
  --ai: #3d5a99;
  --ai-soft: #e4e9f5;
  --filter: #8a5a12;
  --filter-soft: #f5ecdc;
  --hash: #7a3f8f;
  --hash-soft: #f1e6f5;
  --radius: 10px;
  --max: 1080px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131417;
    --surface: #1b1d21;
    --text: #e9e8e4;
    --muted: #a0a3ad;
    --border: #2c2f35;
    --accent: #e0775c;
    --accent-soft: #3a231d;
    --gpu: #6cc3a8;
    --gpu-soft: #1c2f29;
    --ai: #8fa9e6;
    --ai-soft: #1f2638;
    --filter: #e0b268;
    --filter-soft: #33291a;
    --hash: #c99be0;
    --hash-soft: #2e2236;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; display: block; }
nav.main { display: flex; gap: 22px; font-size: 15px; }
nav.main a { color: var(--muted); }
nav.main a[aria-current="page"], nav.main a:hover { color: var(--text); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { padding-top: 88px; padding-bottom: 64px; }
.eyebrow {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 14px;
}
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 20px; max-width: 18ch;
}
.hero p.lede { font-size: 1.2rem; color: var(--muted); max-width: 62ch; margin: 0 0 28px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px;
  font-weight: 600; font-size: 15px; border: 1px solid var(--border);
  color: var(--text); background: var(--surface);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }

/* ---------- Sections ---------- */
section { padding: 56px 0; border-top: 1px solid var(--border); }
section h2 { font-size: 1.75rem; letter-spacing: -0.015em; margin: 0 0 8px; }
section .sub { color: var(--muted); margin: 0 0 32px; max-width: 70ch; }

/* ---------- Research-area tiles (home) ---------- */
.areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 18px; }
.area {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; color: var(--text);
  border-top: 4px solid var(--tone);
}
.area:hover { text-decoration: none; border-color: var(--tone); }
.area h3 { margin: 0 0 8px; font-size: 1.2rem; }
.area p { margin: 0 0 16px; color: var(--muted); font-size: 15.5px; }
.area .names { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }

.tone-gpu    { --tone: var(--gpu);    --tone-soft: var(--gpu-soft); }
.tone-ai     { --tone: var(--ai);     --tone-soft: var(--ai-soft); }
.tone-filter { --tone: var(--filter); --tone-soft: var(--filter-soft); }
.tone-hash   { --tone: var(--hash);   --tone-soft: var(--hash-soft); }

.chip {
  font-family: var(--mono); font-size: 12.5px; padding: 3px 9px; border-radius: 999px;
  background: var(--tone-soft, var(--accent-soft)); color: var(--tone, var(--accent));
}

/* ---------- Project groups ---------- */
.group-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.group-head .dot { width: 12px; height: 12px; border-radius: 3px; background: var(--tone); flex: none; transform: translateY(-2px); }

.toc { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.toc a {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14.5px;
}
.toc a:hover { border-color: var(--tone); text-decoration: none; }

.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr)); gap: 18px; }
.project {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 22px 18px; display: flex; flex-direction: column;
}
.project h3 { margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; }
.project .tagline { margin: 2px 0 12px; color: var(--tone); font-weight: 600; font-size: 14.5px; }
.project p { margin: 0 0 14px; font-size: 15.5px; color: var(--muted); }
.project ul.highlights { margin: 0 0 16px; padding-left: 18px; font-size: 15px; }
.project ul.highlights li { margin-bottom: 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.links { margin-top: auto; display: flex; flex-wrap: wrap; gap: 16px; font-size: 14.5px; font-weight: 600; padding-top: 12px; border-top: 1px solid var(--border); }

.todo {
  font-family: var(--mono); font-size: 12.5px; color: var(--accent);
  background: var(--accent-soft); padding: 8px 10px; border-radius: 6px; margin-bottom: 14px;
}

/* ---------- People ---------- */
.people { list-style: none; margin: 0; padding: 0; max-width: 720px; }
.people li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.people li:first-child { border-top: 1px solid var(--border); }
.people a { font-weight: 600; color: var(--text); min-width: 170px; }
.people a:hover { color: var(--accent); text-decoration: none; }
.people .role { color: var(--muted); font-size: 15px; }
.people-sub { font-size: 13px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 32px 0 10px; }

/* ---------- Footer ---------- */
footer.site { border-top: 1px solid var(--border); padding: 32px 0 48px; color: var(--muted); font-size: 14.5px; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  nav.main { gap: 14px; }
  .hero { padding-top: 56px; padding-bottom: 40px; }
  .projects, .areas { grid-template-columns: 1fr; }
}

/* ---------- Project detail pages ---------- */
.detail-hero { padding-top: 56px; padding-bottom: 32px; }
.detail-hero h1 { margin-bottom: 8px; }
.detail-hero .lede { color: var(--tone); font-weight: 600; margin-bottom: 16px; }
.crumbs { font-size: 14.5px; color: var(--muted); margin: 0 0 14px; }
.crumbs a { color: var(--muted); }

.detail {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px;
  padding-top: 32px; padding-bottom: 64px; border-top: 1px solid var(--border);
}
.prose h2 { font-size: 1.35rem; margin: 36px 0 12px; letter-spacing: -0.01em; }
.prose h2:first-child, .prose .todo + h2 { margin-top: 0; }
.prose p { margin: 0 0 14px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 14px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--tone); border-radius: 8px; padding: 14px 16px; }
.feature h3 { margin: 0 0 4px; font-size: 1rem; }
.feature p { margin: 0; font-size: 15px; color: var(--muted); }

pre {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.55; margin: 0;
}
code { font-family: var(--mono); font-size: 0.9em; }
pre code { font-size: inherit; }

.side { display: flex; flex-direction: column; gap: 18px; }
.side-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; position: sticky; top: 84px; }
.side-box + .side-box { position: static; }
.side-box h3 { margin: 0 0 10px; font-size: 13px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.side-box ul { list-style: none; margin: 0; padding: 0; }
.side-links li { padding: 6px 0; font-weight: 600; font-size: 15px; }
.related li { padding: 8px 0; border-top: 1px solid var(--border); font-size: 15px; }
.related li:first-child { border-top: 0; padding-top: 0; }
.related a { font-weight: 600; display: block; }
.related span { color: var(--muted); font-size: 14px; }

.project h3 a { color: inherit; }
.soon {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.03em;
  padding: 2px 8px; border-radius: 999px; vertical-align: 3px; margin-left: 6px;
  background: var(--tone-soft, var(--accent-soft)); color: var(--tone, var(--accent));
}

@media (max-width: 820px) {
  .detail { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .side-box { position: static; }
}
