/* ---------- Tokens ---------- */
:root {
  --paper: #f3efe6;
  --paper-2: #ebe5d8;
  --ink: #1c1a16;
  --muted: #6d675b;
  --rule: #d6cebd;
  --accent: #b8431a;        /* survey-map vermilion */
  --accent-soft: #b8431a22;
  --sea: #e9e3d5;
  --land: #d9d0bd;
  --border: #f3efe6;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1280px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14130f;
    --paper-2: #1c1a15;
    --ink: #ece6d9;
    --muted: #9c9483;
    --rule: #34302760;
    --accent: #f0703c;
    --accent-soft: #f0703c26;
    --sea: #1a1814;
    --land: #2e2a22;
    --border: #14130f;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--ink); color: var(--paper); padding: 6px 10px; z-index: 10; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.kicker {
  font: 500 0.72rem/1.4 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.kicker a { color: var(--accent); text-decoration: none; }
.display {
  font-family: var(--serif);
  font-weight: 350;
  font-variation-settings: "opsz" 144;
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0;
}
.display em { font-style: italic; color: var(--accent); }

.button {
  display: inline-block;
  padding: 0.7em 1.1em;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font: 500 0.9rem/1 var(--sans);
  border: 1px solid var(--ink);
  border-radius: 999px;
  transition: background .2s, color .2s;
}
.button:hover { background: var(--accent); border-color: var(--accent); }
.button.ghost { background: transparent; color: var(--ink); }
.button.ghost:hover { color: var(--paper); background: var(--ink); border-color: var(--ink); }

/* ---------- Masthead ---------- */
.masthead {
  display: flex; flex-wrap: wrap; gap: 0.75rem 2rem;
  align-items: baseline; justify-content: space-between;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.wordmark { font: 600 1.05rem/1.2 var(--serif); text-decoration: none; }
.wordmark span { display: block; font: 400 0.72rem/1.4 var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.masthead nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.4rem; font-size: 0.92rem; }
.masthead nav a { text-decoration: none; color: var(--muted); }
.masthead nav a:hover { color: var(--ink); }
.masthead .nav-cv { color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: 2.5rem 4rem;
  align-items: end;
  padding-block: clamp(2.5rem, 8vw, 6rem) 3rem;
}
.hero .display { font-size: clamp(2.6rem, 6.4vw, 5.6rem); margin-bottom: 1.6rem; }
.lede { font: 350 1.22rem/1.55 var(--serif); color: var(--muted); max-width: 44ch; margin: 0 0 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.glance { margin: 0; border-top: 1px solid var(--ink); }
.glance div { padding: .85rem 0; border-bottom: 1px solid var(--rule); }
.glance dt { font: 500 .66rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.glance dd { margin: .2rem 0 0; font-size: .95rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- Focus areas (double as filters for the work grid) ---------- */
.areas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding-bottom: 3rem; }
.area {
  display: grid; align-content: start; gap: .5rem; text-align: left;
  padding: 1.2rem 1.2rem 1.4rem; cursor: pointer;
  background: transparent; color: var(--ink); font: inherit;
  border: 1px solid var(--rule); border-top: 3px solid var(--ink);
  transition: background .2s, border-color .2s;
}
.area:hover { background: var(--paper-2); }
.area[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.area-count { font: 500 .7rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.area-name { font: 400 1.55rem/1.1 var(--serif); letter-spacing: -.01em; }
.area-blurb { font-size: .9rem; line-height: 1.5; color: var(--muted); }
.area[aria-pressed="true"] .area-blurb { color: inherit; opacity: .75; }
.note { transition: opacity .3s; }
.note.dim { opacity: .18; }
.filter-status { font: 400 .8rem/1.4 var(--mono); color: var(--muted); margin: -1.4rem 0 2rem; min-height: 1.2em; }
.filter-status button { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }

/* ---------- Section heads ---------- */
.section-head { border-top: 1px solid var(--ink); padding-top: 1rem; margin-bottom: 2.2rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1.5rem; }
.section-head .kicker { margin: 0; }
.section-head h2 { font: 350 clamp(2rem, 4vw, 3rem)/1 var(--serif); letter-spacing: -.02em; margin: 0; }
.work, .pubs, .featured, .about { padding-block: 3rem; }

/* ---------- Field notes (editorial grid) ---------- */
.notes { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3rem 2rem; }
.note { grid-column: span 6; }
.note:nth-child(1) { grid-column: span 12; }
.note:nth-child(2) { grid-column: span 7; }
.note:nth-child(3) { grid-column: span 5; }
.note:nth-child(4), .note:nth-child(5), .note:nth-child(6) { grid-column: span 4; }
.note > a { text-decoration: none; display: block; }
.note figure { margin: 0 0 1rem; overflow: hidden; aspect-ratio: 4/3; background: var(--paper-2); }
.note img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); transition: filter .5s, transform .6s; }
.note a:hover img { filter: none; transform: scale(1.03); }
.note-meta { font: 500 .72rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 .5rem; }
.note-meta span { color: var(--accent); margin-right: .4rem; }
.note h3 { font: 400 1.5rem/1.15 var(--serif); letter-spacing: -.01em; margin: 0 0 .5rem; }
.note a:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.note-dek { margin: 0; color: var(--muted); font-size: .95rem; }
.tags { list-style: none; padding: 0; margin: .8rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.tags li { font: 400 .68rem/1 var(--mono); padding: .35em .6em; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted); }

/* The lead story: image left, text right, big headline */
@media (min-width: 800px) {
  .note:nth-child(1) > a { display: grid; grid-template-columns: 7fr 5fr; gap: 2rem; align-items: end; }
  .note:nth-child(1) figure { margin: 0; aspect-ratio: 16/10; }
  .note:nth-child(1) h3 { font-size: clamp(2rem, 3.4vw, 2.8rem); line-height: 1.05; }
  .note:nth-child(1) .note-dek { font: 350 1.15rem/1.5 var(--serif); }
}

/* ---------- Publications ---------- */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub-list li {
  display: grid; grid-template-columns: 5rem minmax(0, 1fr) 14rem; gap: 1.5rem;
  padding: 1.3rem 0; border-bottom: 1px solid var(--rule); align-items: baseline;
}
.pub-year { font: 500 .85rem/1 var(--mono); color: var(--accent); }
.pub-main { text-decoration: none; }
.pub-title { display: block; font: 400 1.3rem/1.25 var(--serif); }
.pub-main:hover .pub-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.pub-authors { display: block; margin-top: .35rem; font-size: .85rem; color: var(--muted); }
.pub-venue { font: 400 .75rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: right; }
.pub-list li.pub-group { grid-template-columns: 5rem minmax(0, 1fr); }
.pub-series { margin: 0; font: 500 .8rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.pub-blurb { margin: .4rem 0 .6rem; font-size: .9rem; color: var(--muted); max-width: 60ch; }
.pub-sublist { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--accent); }
.pub-list .pub-sublist li { grid-template-columns: minmax(0, 1fr) 14rem; padding: .9rem 0; }
.pub-list .pub-sublist li:last-child { border-bottom: 0; padding-bottom: 0; }

/* ---------- Featured (podcasts, talks) ---------- */
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.feature > a {
  display: grid; align-content: start; gap: .6rem; height: 100%;
  padding: 1.2rem 1.2rem 1.4rem; text-decoration: none;
  border: 1px solid var(--rule); border-top: 3px solid var(--ink);
  transition: background .2s;
}
.feature > a:hover { background: var(--paper-2); }
.feature-meta { font: 500 .72rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0; }
.feature-meta span { color: var(--accent); margin-right: .4rem; }
.feature h3 { font: 400 1.5rem/1.15 var(--serif); letter-spacing: -.01em; margin: 0; }
.feature a:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.feature-blurb { margin: 0; color: var(--muted); font-size: .95rem; }
.feature-link { margin: .4rem 0 0; font: 400 .75rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 3rem; align-items: start; }
.about-grid img { aspect-ratio: 4/5; object-fit: cover; width: 100%; filter: grayscale(1); }
.about-text p { font: 350 1.15rem/1.65 var(--serif); margin: 0 0 1.2rem; max-width: 60ch; }
.about-text p:first-child::first-letter { float: left; font-size: 4.2em; line-height: .85; padding: .06em .08em 0 0; color: var(--accent); font-weight: 400; }
.about-links { display: flex; flex-wrap: wrap; gap: .6rem; }

.colophon { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; padding-block: 2rem 3rem; border-top: 1px solid var(--rule); font-size: .85rem; color: var(--muted); }
.colophon p { margin: 0; }

/* ---------- Story page ---------- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 5; padding-top: env(safe-area-inset-top, 0px); }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); }

.story-head { padding-block: clamp(2.5rem, 7vw, 5rem) 2rem; }
.story-head .display { font-size: clamp(2.4rem, 6.2vw, 5.4rem); max-width: 18ch; }
.dek { font: 300 italic clamp(1.15rem, 2vw, 1.5rem)/1.45 var(--serif); color: var(--muted); max-width: 46ch; margin: 1.5rem 0 0; }
.story-hero { margin: 0 auto 3rem; }
.story-hero img { width: 100%; max-height: 72vh; object-fit: cover; border: 1px solid var(--rule); }

.story-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 4rem; padding-bottom: 4rem; }
.rail-inner { position: sticky; top: 2rem; }
.locator { width: 160px; margin-bottom: 1.2rem; }
.locator svg { width: 100%; height: auto; display: block; }
.locator .sphere { fill: var(--sea); stroke: var(--ink); stroke-width: 1; }
.locator .graticule { fill: none; stroke: var(--rule); stroke-width: .5; }
.locator .land { fill: var(--land); }
.locator .here { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
.locator .ring { fill: none; stroke: var(--accent); stroke-width: 1.2; }
.facts { margin: 0 0 1.4rem; font-size: .88rem; }
.facts dt { font: 500 .66rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: .9rem; }
.facts dd { margin: .15rem 0 0; }
.rail-links { display: grid; gap: .5rem; justify-items: start; }

.prose { max-width: 68ch; counter-reset: sec; }
.prose > p:first-child { font: 350 1.28rem/1.6 var(--serif); }
.prose > p:first-child::first-letter { float: left; font-size: 3.6em; line-height: .85; padding: .05em .1em 0 0; color: var(--accent); }
.prose p, .prose li { font-size: 1.02rem; }
.prose h2 { counter-increment: sec; font: 400 1.8rem/1.15 var(--serif); letter-spacing: -.01em; margin: 3rem 0 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.prose h2::before { content: "§ " counter(sec); display: block; font: 500 .7rem/1 var(--mono); letter-spacing: .1em; color: var(--accent); margin-bottom: .6rem; }
.prose h3 { font: 600 1.05rem/1.3 var(--sans); margin: 2rem 0 .5rem; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose code { font: .86em var(--mono); background: var(--paper-2); padding: .1em .35em; border-radius: 3px; }
.prose pre { background: var(--paper-2); padding: 1rem 1.2rem; overflow-x: auto; border-left: 3px solid var(--accent); }
.prose pre code { background: none; padding: 0; }
.prose img { margin: 1.5rem 0; border: 1px solid var(--rule); }
.prose blockquote { margin: 2rem 0; padding-left: 1.2rem; border-left: 3px solid var(--accent); font: 350 italic 1.3rem/1.45 var(--serif); }
.scroll-x { overflow-x: auto; margin: 1.5rem 0; }
.prose table { border-collapse: collapse; font-size: .88rem; min-width: 100%; }
.prose th, .prose td { text-align: left; padding: .5rem .8rem .5rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font: 500 .7rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.note-box { font-size: .88rem !important; color: var(--muted); border: 1px dashed var(--rule); padding: .8rem 1rem; }
.from-repo { margin-top: 3.5rem; padding-top: 1.2rem; border-top: 2px solid var(--ink); }
.from-repo > h2:first-of-type { margin-top: 1.5rem; }

.story-next { padding-block: 2rem 4rem; }
.story-next a { display: block; text-decoration: none; border-top: 1px solid var(--ink); padding-top: 1.2rem; }
.next-title { display: block; font: 350 clamp(1.6rem, 3.5vw, 2.6rem)/1.1 var(--serif); letter-spacing: -.02em; }
.story-next a:hover .next-title { color: var(--accent); }

/* ---------- Narrow screens ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .areas { grid-template-columns: minmax(0, 1fr); }
  .feature-list { grid-template-columns: minmax(0, 1fr); }
  .note, .note:nth-child(n) { grid-column: span 12; }
  .pub-list li, .pub-list li.pub-group, .pub-list .pub-sublist li { grid-template-columns: 1fr; gap: .4rem; }
  .pub-venue { text-align: left; }
  .about-grid { grid-template-columns: 1fr; }
  .about-grid img { max-width: 320px; }
  .story-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .rail-inner { position: static; display: grid; grid-template-columns: 110px 1fr; gap: 0 1.2rem; }
  .locator { width: 110px; grid-row: span 2; }
  .rail-links { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .rail-links { grid-auto-flow: row; }
}
