/* ---------- tokens ---------- */
:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-2: #f2f3ef;
  --text: #16191d;
  --muted: #59616b;
  --faint: #868e97;
  --border: #e4e5df;
  --accent: #0d7a69;
  --accent-ink: #0a5d51;
  --accent-soft: #e2f1ed;
  --on-accent: #ffffff;
  --warn: #8f5a00;
  --warn-soft: #fbefd8;
  --info: #2a5db0;
  --info-soft: #e7eefa;
  --inhib: #c2412d;
  --edge: #a3aab1;
  --node-off: #ffffff;
  --node-stroke: #cfd3cc;
  --shadow: 0 1px 2px rgba(20, 24, 28, .04), 0 4px 16px rgba(20, 24, 28, .05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013;
    --surface: #15181c;
    --surface-2: #1b1f24;
    --text: #e8eaed;
    --muted: #a3abb4;
    --faint: #757d86;
    --border: #272c32;
    --accent: #3cc4aa;
    --accent-ink: #7fdcc9;
    --accent-soft: #132e29;
    --on-accent: #0b1513;
    --warn: #f0b75e;
    --warn-soft: #33270f;
    --info: #8eb0f0;
    --info-soft: #18233a;
    --inhib: #f07a66;
    --edge: #59616b;
    --node-off: #15181c;
    --node-stroke: #3a4048;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1013;
  --surface: #15181c;
  --surface-2: #1b1f24;
  --text: #e8eaed;
  --muted: #a3abb4;
  --faint: #757d86;
  --border: #272c32;
  --accent: #3cc4aa;
  --accent-ink: #7fdcc9;
  --accent-soft: #132e29;
  --on-accent: #0b1513;
  --warn: #f0b75e;
  --warn-soft: #33270f;
  --info: #8eb0f0;
  --info-soft: #18233a;
  --inhib: #f07a66;
  --edge: #59616b;
  --node-off: #15181c;
  --node-stroke: #3a4048;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
p { margin: 0 0 .9em; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.45rem; font-weight: 700; margin-bottom: 1.4rem; }
h3 { font-size: 1.02rem; font-weight: 600; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.muted { color: var(--muted); }

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 28px; } }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--surface); padding: 8px 12px; border-radius: 6px;
}
.skip:focus { left: 8px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { font-weight: 700; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav nav::-webkit-scrollbar { display: none; }
.nav-links { display: flex; gap: 4px; justify-content: flex-end; }
.nav-links a {
  display: block; padding: 6px 10px; border-radius: 6px;
  color: var(--muted); font-size: .9rem; font-weight: 500; white-space: nowrap;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.theme-btn {
  flex: none; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  cursor: pointer; font-size: .9rem;
}
.theme-btn:hover { color: var(--text); }
@media (max-width: 720px) {
  .brand { display: none; }
  .nav-links { justify-content: flex-start; }
}

/* ---------- hero ---------- */
.hero { padding: 64px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 32px; align-items: center; }
@media (min-width: 860px) { .hero-grid { grid-template-columns: 1.35fr 1fr; gap: 48px; } }
.eyebrow {
  color: var(--accent-ink); font-weight: 600; font-size: .85rem;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: .6rem;
}
h1 { font-size: clamp(2.1rem, 5.5vw, 3rem); font-weight: 700; letter-spacing: -.025em; margin-bottom: 1rem; }
.lede { font-size: 1.1rem; color: var(--text); max-width: 38em; }
.where { color: var(--muted); font-size: .95rem; }
.where i { color: var(--faint); margin-right: 4px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 18px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: .93rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: border-color .15s, transform .15s;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }

.socials { display: flex; gap: 6px; flex-wrap: wrap; }
.socials a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px;
  color: var(--muted); font-size: 1.2rem;
}
.socials a:hover { color: var(--accent-ink); background: var(--surface-2); text-decoration: none; }

/* portrait: 4:5 photo on desktop, round headshot above the name on phones */
.hero-photo { margin: 0; }
.hero-photo img {
  display: block; width: 100%; max-width: 340px; height: auto; aspect-ratio: 4 / 5;
  object-fit: cover; margin: 0 0 0 auto; border-radius: 18px;
  background: var(--surface-2); box-shadow: var(--shadow);
}
@media (max-width: 859px) {
  .hero-photo { order: -1; }
  .hero-photo img {
    width: 112px; height: 112px; aspect-ratio: 1; margin: 0;
    border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border);
  }
  .hero-grid { gap: 20px; }
}

/* GRN figure (About section) */
.about-side { display: flex; flex-direction: column; gap: 28px; align-self: start; }
.grn-fig { margin: 0; }
.grn-fig svg { width: 100%; max-width: 340px; height: auto; display: block; margin: 0 auto; }
.e-act { stroke: var(--edge); stroke-width: 1.6; }
.e-inh { stroke: var(--inhib); stroke-width: 1.6; opacity: .8; }
.mk-act { fill: var(--edge); }
.mk-inh { fill: var(--inhib); opacity: .8; }
.gn rect {
  fill: var(--node-off); stroke: var(--node-stroke); stroke-width: 1.4;
  animation: node-on 8s var(--d) infinite;
}
.gn text {
  font: 600 10.5px "Inter", system-ui, sans-serif; text-anchor: middle; dominant-baseline: middle;
  fill: var(--muted); animation: label-on 8s var(--d) infinite;
}
@keyframes node-on {
  0%, 6%    { fill: var(--node-off); stroke: var(--node-stroke); }
  12%, 44%  { fill: var(--accent);   stroke: var(--accent); }
  50%, 100% { fill: var(--node-off); stroke: var(--node-stroke); }
}
@keyframes label-on {
  0%, 6%    { fill: var(--muted); }
  12%, 44%  { fill: var(--on-accent); }
  50%, 100% { fill: var(--muted); }
}
@media (prefers-reduced-motion: reduce) {
  .gn rect, .gn text { animation: none; }
}
.grn-fig figcaption {
  text-align: center; color: var(--faint); font-size: .8rem; margin-top: 8px;
}
.legend { display: flex; justify-content: center; gap: 14px; margin-top: 2px; }
.lg-act { color: var(--muted); }
.lg-inh { color: var(--inhib); }

/* ---------- sections ---------- */
.section { padding: 56px 0; border-top: 1px solid var(--border); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 1.4rem; }
.section-head h2 { margin-bottom: 0; }
.see-all { font-size: .9rem; font-weight: 500; }
.see-all i { font-size: .75em; margin-left: 3px; }
.h2-gap { margin-top: 2.4rem; }

/* about */
.about-grid { display: grid; grid-template-columns: 1fr; gap: 28px; }
@media (min-width: 860px) { .about-grid { grid-template-columns: 1.6fr 1fr; gap: 40px; } }
.prose p { color: var(--text); }
.now h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-bottom: 12px; }
.now li { padding: 10px 0; border-top: 1px solid var(--border); }
.now li:first-child { border-top: 0; padding-top: 0; }
.now strong { display: block; font-weight: 600; font-size: .95rem; line-height: 1.35; }
.now span { color: var(--muted); font-size: .87rem; }
.toolbox { margin-top: 28px; }
.toolbox h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-bottom: 10px; }

/* tags & badges */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font-size: .82rem; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); padding: 2px 10px; border-radius: 999px;
}
.tags.small li { font-size: .76rem; padding: 1px 8px; }
.badge {
  display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; vertical-align: 1px;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border);
}
.badge-ok  { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.badge-rev { color: var(--info); background: var(--info-soft); border-color: transparent; }
.badge-dev { color: var(--warn); background: var(--warn-soft); border-color: transparent; }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; box-shadow: var(--shadow);
}
.cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .cards-3 { grid-template-columns: repeat(3, 1fr); } }

.project { display: flex; flex-direction: column; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-head h3 { font-size: 1.05rem; }
.project .meta { color: var(--faint); font-size: .84rem; margin: 4px 0 10px; }
.project > p:not(.meta):not(.links-note) { font-size: .94rem; color: var(--muted); }
.project .tags { margin-top: auto; padding-top: 4px; }
.links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: .88rem; font-weight: 500; }
.links i { margin-right: 4px; font-size: .9em; }
.links-note { font-size: .84rem; color: var(--faint); margin: 14px 0 0; }

.site { display: flex; flex-direction: column; color: inherit; transition: border-color .15s, transform .15s; }
.site:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.site-icon { color: var(--accent); font-size: 1.3rem; margin-bottom: 12px; }
.site h3 { margin-bottom: 6px; }
.site p { color: var(--muted); font-size: .92rem; }
.site .url { margin-top: auto; font-size: .8rem; color: var(--accent-ink); overflow-wrap: anywhere; }

/* publications */
.pubs li { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 18px 0; border-top: 1px solid var(--border); }
.pubs li:first-child { border-top: 0; padding-top: 0; }
.pub-year { color: var(--faint); font-weight: 600; font-size: .9rem; padding-top: 2px; }
.pub-title { font-weight: 600; margin-bottom: 4px; line-height: 1.45; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent-ink); }
.pub-authors { color: var(--muted); font-size: .92rem; margin-bottom: 4px; }
.pub-authors strong { color: var(--text); font-weight: 600; }
.pub-venue { color: var(--muted); font-size: .88rem; margin: 0; }
@media (max-width: 520px) {
  .pubs li { grid-template-columns: 1fr; gap: 2px; }
}

/* talks */
.timeline li { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.when { color: var(--faint); font-weight: 600; font-size: .88rem; padding-top: 2px; }
.what { margin-bottom: 2px; font-weight: 500; line-height: 1.45; }
.kind {
  display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent-ink); margin-right: 6px;
}
.venue { color: var(--muted); font-size: .9rem; margin: 0; }
.small-note { font-size: .88rem; margin-top: 14px; }
@media (max-width: 520px) {
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

/* experience */
.two-col { display: grid; grid-template-columns: 1fr; gap: 40px; }
@media (min-width: 800px) { .two-col { grid-template-columns: 1fr 1fr; gap: 56px; } }
.entries li { padding: 12px 0; border-top: 1px solid var(--border); }
.entries li:first-child { border-top: 0; padding-top: 0; }
.e-title { font-weight: 600; margin: 0; line-height: 1.4; }
.e-org { color: var(--muted); font-size: .92rem; margin: 2px 0 0; }
.e-when { color: var(--faint); font-size: .85rem; margin: 2px 0 0; }
.plain li { padding: 8px 0; color: var(--muted); border-top: 1px solid var(--border); }
.plain li:first-child { border-top: 0; padding-top: 0; }
.plain strong { color: var(--text); font-weight: 600; }

/* contact & footer */
.contact p { color: var(--muted); max-width: 40em; }
.footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--faint); font-size: .85rem; }
.footer p { margin: 0; }
