/* Layout: a sticky identity rail on the left, a single reading column on the right.
   Sections are numbered-free; eyebrows use a mono "log tag" style from the subject's world. */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #e9edf3;
  --fg: #121a24;
  --muted: #5a6677;
  --line: #d9dfe8;
  --accent: #0f5fb4;
  --accent-ink: #0a4486;
  --accent-soft: #e2edfa;
  --gold: #a9771a;
  --gold-soft: #f6ecd4;
  --on-accent: #ffffff;
  --icon-sun: none;
  --icon-moon: block;
  --shadow: 0 1px 2px rgba(18, 26, 36, .06), 0 8px 24px -12px rgba(18, 26, 36, .18);

  --font-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --measure: 68ch;
  --rail: 300px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1218; --surface: #141b24; --surface-2: #1b2430; --fg: #e7ecf3; --muted: #9aa8ba;
    --line: #273342; --accent: #6aaaf2; --accent-ink: #9cc6f7; --accent-soft: #152b47;
    --gold: #e0b45a; --gold-soft: #2e2512; --on-accent: #0d1218; --icon-sun: block; --icon-moon: none;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1218; --surface: #141b24; --surface-2: #1b2430; --fg: #e7ecf3; --muted: #9aa8ba;
  --line: #273342; --accent: #6aaaf2; --accent-ink: #9cc6f7; --accent-soft: #152b47;
  --gold: #e0b45a; --gold-soft: #2e2512; --on-accent: #0d1218; --icon-sun: block; --icon-moon: none;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .15em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.12; letter-spacing: -.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
strong { font-weight: 600; }

/* Skip link */
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: .5rem .75rem; border-radius: 4px; z-index: 50; }
.skip:focus { left: 16px; }

/* Frame */
.frame {
  max-width: 1240px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 4rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 4rem;
}
@media (min-width: 1000px) {
  .frame { grid-template-columns: var(--rail) minmax(0, 1fr); }
}

/* Rail */
.rail {
  padding-block: 2rem 1rem;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 1000px) {
  .rail {
    position: sticky; top: 0; align-self: start;
    height: 100vh; height: 100dvh;
    padding-block: 3.25rem 2rem;
    border-bottom: 0;
    display: flex; flex-direction: column; gap: 2rem;
    overflow: auto;
  }
}
.rail-head { display: grid; gap: .65rem; }
.rail-name {
  font-size: clamp(1.9rem, 2.3vw, 2.3rem);
  font-weight: 700;
  font-variation-settings: "opsz" 96, "wdth" 100;
}
.rail-role { font-size: 1rem; line-height: 1.45; color: var(--fg); }
.rail-role span { display: block; color: var(--muted); }
.rail-loc { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .04em; color: var(--muted); display: flex; align-items: center; gap: .5rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); display: inline-block; }

.rail-nav { display: none; }
@media (min-width: 1000px) {
  .rail-nav { display: grid; gap: .1rem; }
  .rail-nav a {
    display: grid; grid-template-columns: 1.4rem 1fr; align-items: center; gap: .6rem;
    padding: .35rem 0; color: var(--muted); font-size: .92rem; transition: color .15s;
  }
  .rail-nav a::before { content: ""; height: 1px; width: 1rem; background: var(--line); transition: width .2s, background .2s; }
  .rail-nav a:hover, .rail-nav a.active { color: var(--fg); text-decoration: none; }
  .rail-nav a.active::before { width: 1.4rem; background: var(--accent); }
}

.rail-links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
@media (min-width: 1000px) { .rail-links { margin-top: auto; } }
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--fg); font-size: .86rem; line-height: 1;
  transition: border-color .15s, background .15s;
  cursor: pointer; font-family: inherit;
}
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chip.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }

.theme-toggle { margin-left: auto; }
.theme-toggle .sun { display: var(--icon-sun); }
.theme-toggle .moon { display: var(--icon-moon); }

/* Main column */
.main { min-width: 0; padding-block: 2.5rem 0; display: grid; gap: 4.5rem; }
@media (min-width: 1000px) { .main { padding-block: 3.25rem 0; } }

.eyebrow {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); display: flex; align-items: center; gap: .75rem; margin-bottom: 1.1rem;
}
.eyebrow::after { content: ""; flex: 1; height: 1px; background: var(--line); }
section > h2 { font-size: clamp(1.45rem, 2.2vw, 1.8rem); font-weight: 600; margin-bottom: 1.4rem; }

/* Hero */
.hero { position: relative; display: grid; gap: 1.6rem; }
.hero-art {
  position: relative; height: 180px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow);
}
.hero-art canvas { width: 100%; height: 100%; display: block; }
.hero-art .hud {
  position: absolute; inset: 0; pointer-events: none;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; color: var(--muted);
}
.hero-art .hud span { position: absolute; padding: .25rem .45rem; background: color-mix(in srgb, var(--surface) 80%, transparent); border-radius: 3px; }
.hud .tl { top: 10px; left: 12px; } .hud .tr { top: 10px; right: 12px; } .hud .bl { bottom: 10px; left: 12px; } .hud .br { bottom: 10px; right: 12px; }
.hud .rec { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #d64545; margin-right: .4rem; vertical-align: 1px; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 600; max-width: 22ch; font-variation-settings: "opsz" 96; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: 1.12rem; line-height: 1.65; color: var(--muted); max-width: var(--measure); }
.hero-facts { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; font-size: .92rem; color: var(--muted); }
.hero-facts li { display: flex; align-items: center; gap: .5rem; }
.hero-facts li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Prose */
.prose { max-width: var(--measure); display: grid; gap: 1rem; }
.prose p { line-height: 1.7; }
.tags { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .5rem; }
.tag { font-family: var(--font-mono); font-size: .76rem; padding: .3rem .6rem; border-radius: 4px; background: var(--surface-2); color: var(--fg); }

/* Timeline entries (experience, education, research) */
.entries { display: grid; gap: 2rem; }
.entry { display: grid; grid-template-columns: 1fr; gap: .35rem 2rem; }
@media (min-width: 720px) { .entry { grid-template-columns: 150px minmax(0, 1fr); } }
.entry .when { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); letter-spacing: .02em; padding-top: .25rem; font-variant-numeric: tabular-nums; }
.entry h3 { font-size: 1.12rem; font-weight: 600; }
.entry .org { color: var(--muted); font-size: .95rem; margin-top: .15rem; }
.entry .org a { color: inherit; }
.entry ul { margin-top: .7rem; display: grid; gap: .45rem; max-width: var(--measure); }
.entry li { padding-left: 1.1rem; position: relative; line-height: 1.55; }
.entry li::before { content: ""; position: absolute; left: 0; top: .7em; width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.entry .meta { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); margin-top: .35rem; }
.badge {
  display: inline-block; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .22rem .5rem; border-radius: 4px; background: var(--accent-soft); color: var(--accent-ink); vertical-align: middle; margin-left: .4rem;
}
.badge.gold { background: var(--gold-soft); color: var(--gold); }

/* Now card */
.now {
  display: grid; gap: 1rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); box-shadow: var(--shadow); max-width: 760px;
}
.now h3 { font-size: 1.25rem; font-weight: 600; }
.now p { line-height: 1.65; }
.now .cta { display: flex; gap: .6rem; flex-wrap: wrap; }

/* Awards */
.awards { display: grid; gap: 0; max-width: 820px; border-top: 1px solid var(--line); }
.award { display: grid; grid-template-columns: 1fr; gap: .15rem 1.5rem; padding: .95rem 0; border-bottom: 1px solid var(--line); }
@media (min-width: 720px) { .award { grid-template-columns: 110px minmax(0, 1fr); } }
.award .when { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: .15rem; }
.award .what { font-weight: 600; }
.award .who { color: var(--muted); font-size: .95rem; }

/* Publications */
.pub-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.pub-controls button {
  font: inherit; font-size: .86rem; padding: .45rem .85rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.pub-controls button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pub-group { display: grid; gap: 1rem; }
.pub-group + .pub-group { margin-top: 2.25rem; }
.pub-group h3 { font-size: .8rem; font-family: var(--font-mono); font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pub { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: .25rem .75rem; max-width: 820px; }
.pub .num { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); padding-top: .2rem; font-variant-numeric: tabular-nums; }
.pub .title { font-weight: 600; line-height: 1.4; }
.pub .authors { color: var(--muted); font-size: .92rem; line-height: 1.5; }
.pub .authors b { color: var(--fg); font-weight: 600; }
.pub .venue { font-size: .92rem; line-height: 1.5; }
.pub .venue i { font-style: italic; }
.pub .links { display: flex; gap: .75rem; font-size: .84rem; font-family: var(--font-mono); margin-top: .1rem; }

/* Talks */
.talks { display: grid; gap: 0; max-width: 860px; border-top: 1px solid var(--line); }
.talk { display: grid; grid-template-columns: 1fr; gap: .1rem 1.5rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
@media (min-width: 720px) { .talk { grid-template-columns: 110px minmax(0, 1fr); } }
.talk .when { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: .15rem; }
.talk .where { color: var(--muted); font-size: .92rem; }

/* Two-column facts (teaching, service, skills) */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 2rem 3rem; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fact h3 { font-size: 1rem; font-weight: 600; margin-bottom: .6rem; }
.fact ul { display: grid; gap: .4rem; }
.fact li { line-height: 1.5; font-size: .96rem; }
.fact li .sub { color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr; gap: .9rem; }
.kv div { display: grid; gap: .25rem; }
.kv dt { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kv dd { margin: 0; line-height: 1.55; }
.mentees { columns: 1; column-gap: 2rem; }
@media (min-width: 560px) { .mentees { columns: 2; } }
.mentees li { break-inside: avoid; }

/* Contact */
.contact { display: grid; gap: 1.25rem; max-width: 760px; }
.contact .email {
  font-family: var(--font-display); font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 600; letter-spacing: -.01em;
  word-break: break-all;
}
.contact .row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.toast { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); min-height: 1.2em; }

footer { grid-column: 1 / -1; border-top: 1px solid var(--line); margin-top: 4rem; padding-top: 1.25rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; font-size: .84rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
