/* Monochrome, paper-like. No accent color: hierarchy comes from type and gray tones. */
:root {
  --bg: #f8f7f4;
  --ink: #1c1c1a;
  --ink-2: #55534e;
  --ink-3: #8a877f;
  --rule: #e3e0d9;
  --chip: #eeece6;
  --bar: rgba(248, 247, 244, 0.82);
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --max: 880px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --ink: #e8e6e1;
    --ink-2: #aeaba4;
    --ink-3: #7c7972;
    --rule: #2c2b29;
    --chip: #222120;
    --bar: rgba(22, 22, 21, 0.82);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15.5px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  /* Continuous line set just below the descenders, so it never breaks around p, g, q, @ */
  text-decoration-skip-ink: none;
  text-underline-offset: .32em;
  transition: text-decoration-color .2s;
}
a:hover { text-decoration-color: currentColor; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bar);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-family: var(--serif); font-size: 1.15rem; text-decoration: none; letter-spacing: .01em; }
.nav { display: flex; gap: 22px; font-size: .88rem; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--ink-3); text-decoration: none; white-space: nowrap; transition: color .2s; }
.nav a:hover, .nav a.active { color: var(--ink); }

/* Layout */
.page { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

.hero { padding: 88px 0 56px; border-top: 0; }
h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 3.2rem); line-height: 1.1; letter-spacing: -.015em;
  margin: 0;
}
.role { margin: 12px 0 20px; color: var(--ink-2); font-size: 1rem; }
.links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; font-size: .92rem; }

section { padding: 40px 0; border-top: 1px solid var(--rule); }
h2 {
  font-family: var(--serif); font-weight: 500;
  font-size: 1.45rem; letter-spacing: -.005em;
  margin: 0 0 20px;
}
p { margin: 0 0 14px; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.topics { font-size: .86rem; color: var(--ink-3); }
.topics i { font-style: normal; margin: 0 .6em; }


/* Date rows (news): text left, date right, matching Education / Experience */
.rows { list-style: none; padding: 0; margin: 0; }
.rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 6px 0; }
.rows time { font-family: var(--mono); font-size: .78rem; color: var(--ink-3); white-space: nowrap; }
.rows small { color: var(--ink-2); font-size: .88rem; }

/* Education / Experience: one line per stint, organization | role | date */
.rows li.entry { display: grid; grid-template-columns: 11rem 1fr auto; gap: 16px; }
.entry .org { font-weight: 500; }
.entry .what { color: var(--ink-2); }

/* Publications */
.note { font-size: .82rem; color: var(--ink-3); margin-bottom: 18px; }
.pubs { list-style: none; padding: 0; margin: 0; }
.pubs > li { padding: 14px 0; }
.pub-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.pub-head .venue { line-height: calc(1.12rem * 1.4); }
.pubs > li + li { border-top: 1px dashed var(--rule); }
.venue { font-family: var(--mono); font-size: .78rem; color: var(--ink-3); white-space: nowrap; }
.pub-title { font-family: var(--serif); font-size: 1.12rem; line-height: 1.4; margin: 0 0 4px; }
.authors { color: var(--ink-2); font-size: .9rem; margin: 0 0 6px; }
.authors b { color: var(--ink); font-weight: 600; }
.pub-links { display: flex; gap: 16px; font-size: .84rem; margin: 0; }

.pub-toggle {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  text-align: left; cursor: pointer;
  text-decoration: underline; text-decoration-color: transparent; text-decoration-skip-ink: none; text-underline-offset: .32em;
  transition: text-decoration-color .2s;
}
.pub-toggle:hover, .pub-toggle[aria-expanded="true"] { text-decoration-color: var(--rule); }
.pub-toggle:focus-visible { outline: 1px solid var(--ink-3); outline-offset: 2px; }
.tldr { color: var(--ink-2); font-size: .9rem; margin: 2px 0 8px; padding-left: 14px; border-left: 1px solid var(--rule); }

footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  border-top: 1px solid var(--rule); padding: 28px 0 48px;
  font-size: .8rem; color: var(--ink-3);
}

@media (max-width: 600px) {
  .brand { display: none; }
  .topbar-inner { justify-content: flex-start; }
  .hero { padding: 56px 0 40px; }
  .rows li.entry { grid-template-columns: 1fr auto; row-gap: 0; padding: 8px 0; }
  .entry .what { grid-column: 1 / -1; grid-row: 2; }
}

/* Phones: spread the five links across the bar and scale them so all of them fit */
@media (max-width: 430px) {
  .nav { flex: 1; justify-content: space-between; gap: 12px; font-size: min(.84rem, 3.4vw); }
}
