/* ─────────────────────────────────────────────────────────────
   Fonts — self-hosted (no Google Fonts requests, GDPR-friendly)
   Inter and Newsreader, SIL Open Font License
   ───────────────────────────────────────────────────────────── */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/newsreader-latin-opsz-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/newsreader-latin-ext-opsz-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url("../fonts/newsreader-latin-opsz-italic.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url("../fonts/newsreader-latin-ext-opsz-italic.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* ─────────────────────────────────────────────────────────────
   Tokens
   ───────────────────────────────────────────────────────────── */
:root {
  --bg: #fbfaf7;
  --fg: #1a1a18;
  --muted: #6e6c66;
  --faint: #a19e96;
  --rule: #e6e3dc;
  --tint: #f2f0ea;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --narrow: 640px;
  --wide: 1080px;
  --gutter: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --fg: #ecebe7; --muted: #9a9892; --faint: #6b6964;
    --rule: #2a2927; --tint: #1c1c1a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121211; --fg: #ecebe7; --muted: #9a9892; --faint: #6b6964;
  --rule: #2a2927; --tint: #1c1c1a; color-scheme: dark;
}

/* ─────────────────────────────────────────────────────────────
   Base
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15.5px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}
img { display: block; max-width: 100%; height: auto; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { margin: 0; font-weight: 400; }
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color .15s ease, color .15s ease;
}
a:hover { text-decoration-color: currentColor; }
::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 2px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

.shell { width: 100%; max-width: calc(var(--narrow) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.shell.wide { max-width: calc(var(--wide) + 2 * var(--gutter)); }
main { min-height: 60vh; }
.measure { max-width: var(--narrow); margin-left: auto; margin-right: auto; }

/* ─────────────────────────────────────────────────────────────
   Header / footer
   ───────────────────────────────────────────────────────────── */
.site-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem;
  padding-top: 44px; padding-bottom: 72px;
}
.site-name { font-weight: 500; text-decoration: none; letter-spacing: -0.005em; }
.site-nav { display: flex; gap: 1.35rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--fg); }

.site-footer {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 120px; padding-top: 24px; padding-bottom: 48px;
  color: var(--faint); font-size: .8125rem;
  position: relative;
}
.site-footer::before {
  content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter);
  border-top: 1px solid var(--rule);
}
.site-footer .footer-links { display: flex; gap: 1.25rem; }
.site-footer a, .theme-toggle { color: var(--faint); text-decoration: none; }
.site-footer a:hover, .theme-toggle:hover { color: var(--fg); }

/* ─────────────────────────────────────────────────────────────
   Shared pieces
   ───────────────────────────────────────────────────────────── */
.page-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 8px;
}
.page-head h1, .journal-head h1 {
  font-family: var(--serif); font-size: 2.1rem; line-height: 1.15; letter-spacing: -0.01em;
}
.label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 56px 0 14px;
  font-family: var(--sans); font-size: .75rem; font-weight: 500;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.label-link { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .8125rem; text-decoration: none; color: var(--faint); }
.label-link:hover { color: var(--fg); }
.kicker {
  margin: 0; font-size: .6875rem; font-weight: 500; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.kicker a { text-decoration: none; }
.dek { color: var(--muted); }
.chip {
  display: inline-block; padding: 2px 10px;
  border: 1px solid var(--rule); border-radius: 999px;
  font-size: .75rem; line-height: 1.6; color: var(--muted);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.chip:hover { color: var(--fg); border-color: var(--faint); }

/* Year-in-the-gutter rows (News, CV, journal list) */
.rows .row {
  display: grid; grid-template-columns: 7.5rem 1fr; gap: 1.25rem;
  padding: 7px 0;
}
.rows .when { color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows p { margin: 0; }

/* ─────────────────────────────────────────────────────────────
   About
   ───────────────────────────────────────────────────────────── */
.portrait { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin-bottom: 28px; filter: grayscale(.15); }
.lede {
  font-family: var(--serif); font-size: 1.5rem; line-height: 1.4; letter-spacing: -0.005em;
  margin-bottom: 1.1em;
}
.lede em { font-style: italic; }
.intro p:not(.lede) { color: var(--muted); }
.intro p:not(.lede) a { color: var(--fg); }
.inline-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin-top: 1.6rem; font-size: .875rem; }

/* ─────────────────────────────────────────────────────────────
   CV
   ───────────────────────────────────────────────────────────── */
.cv-section .row { padding: 10px 0; }
.cv-section .what { font-weight: 500; }
.cv-section .where { font-weight: 400; color: var(--muted); }
.cv-section .where::before { content: "— "; color: var(--faint); }
.cv-section .note { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.cv-section .note p { margin: 0; }
.cv-section .compact .row { padding: 5px 0; }
.cv-section .compact .what { font-weight: 400; }

/* ─────────────────────────────────────────────────────────────
   Papers
   ───────────────────────────────────────────────────────────── */
.papers { counter-reset: none; }
.paper { padding: 16px 0 18px; border-top: 1px solid var(--rule); }
.paper:first-child { border-top: 0; padding-top: 4px; }
.paper p { margin: 0; }
.paper-title { font-weight: 500; line-height: 1.45; }
.paper-title a { text-decoration-color: var(--rule); }
.paper-authors { color: var(--muted); font-size: .9rem; margin-top: 3px !important; }
.paper-authors b { color: var(--fg); font-weight: 500; }
.paper-venue { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1rem; }
.paper-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.paper-links:empty { display: none; }
.paper-links .chip[aria-expanded="true"] { color: var(--fg); border-color: var(--faint); }
.paper-abstract { color: var(--muted); font-size: .9rem; margin-top: 10px !important; }
.bibtex {
  margin: 10px 0 0; padding: 12px 14px; overflow-x: auto;
  background: var(--tint); border-radius: 6px;
  font: .78rem/1.55 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--muted);
}

/* ─────────────────────────────────────────────────────────────
   Journal index
   ───────────────────────────────────────────────────────────── */
.journal-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  padding-bottom: 20px; margin-bottom: 40px; border-bottom: 1px solid var(--rule);
}
.journal-head .dek { margin: 6px 0 0; }
.filters { display: flex; gap: 1.1rem; font-size: .875rem; }
.filters button { color: var(--faint); padding-bottom: 2px; border-bottom: 1px solid transparent; }
.filters button:hover { color: var(--fg); }
.filters button[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--fg); }

.entry { text-decoration: none; display: block; }
.entry[hidden] { display: none; }
.entry img { width: 100%; object-fit: cover; background: var(--tint); transition: opacity .25s ease; }
.entry:hover img { opacity: .9; }
.entry:hover h2, .entry:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

.feature {
  display: grid; grid-template-columns: 1.55fr 1fr; gap: 36px; align-items: end;
  margin-bottom: 72px;
}
.feature img { aspect-ratio: 3 / 2; }
.feature h2 { font-family: var(--serif); font-size: 2.15rem; line-height: 1.12; letter-spacing: -0.012em; margin: 10px 0 12px; }
.feature .dek { font-family: var(--serif); font-size: 1.15rem; line-height: 1.45; margin: 0; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 56px 28px; }
.card img { aspect-ratio: 4 / 5; margin-bottom: 14px; }
.card h3 { font-family: var(--serif); font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.005em; margin: 6px 0 6px; }
.card .dek { font-size: .9rem; line-height: 1.5; margin: 0; }
.empty { color: var(--muted); }

/* ─────────────────────────────────────────────────────────────
   Journal entry
   ───────────────────────────────────────────────────────────── */
.post-head { margin-bottom: 40px; }
.post-head h1 {
  font-family: var(--serif); font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.06; letter-spacing: -0.018em; margin: 14px 0 14px;
}
.post-head .dek { font-family: var(--serif); font-style: italic; font-size: 1.3rem; line-height: 1.4; margin: 0; }
.cover { margin: 0 0 56px; }
.cover img { width: 100%; max-height: 78vh; object-fit: cover; }

.prose { font-family: var(--serif); font-size: 1.2rem; line-height: 1.62; }
.prose p { margin: 0 0 1.1em; }
.prose h2 { font-family: var(--serif); font-size: 1.55rem; line-height: 1.25; margin: 1.8em 0 .6em; }
.prose h3 { font-family: var(--sans); font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin: 2em 0 .6em; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1.1em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose blockquote {
  margin: 1.8em 0; padding: 0; border: 0;
  font-size: 1.55rem; line-height: 1.35; font-style: italic; letter-spacing: -0.005em;
}
.prose blockquote p { margin: 0; }
.prose hr { border: 0; text-align: center; margin: 2.4em 0; }
.prose hr::after { content: "· · ·"; color: var(--faint); letter-spacing: .4em; }
.prose code { font: .85em ui-monospace, Menlo, monospace; background: var(--tint); padding: .1em .3em; border-radius: 4px; }
.prose > p:first-child::first-letter {
  float: left; font-size: 3.6em; line-height: .85; padding: .06em .08em 0 0; font-weight: 400;
}

/* Figures: text width by default, .wide and .full break out of the column */
.figure, .gallery { margin: 2.2em 0; }
.prose .wide { width: min(var(--wide), 100vw - 2 * var(--gutter)); margin-left: 50%; transform: translateX(-50%); }
.prose .full { width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.prose img { width: 100%; }
figcaption {
  margin-top: 10px; font-family: var(--sans); font-size: .8rem; line-height: 1.5; color: var(--muted);
}
.prose .wide figcaption, .prose .full figcaption { max-width: var(--narrow); margin-left: auto; margin-right: auto; }
.prose .full figcaption { padding: 0 var(--gutter); }
.gallery-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 8px; align-items: start; }
.gallery-grid img { aspect-ratio: 4 / 5; object-fit: cover; }

.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--rule);
}
.post-nav a { text-decoration: none; font-family: var(--serif); font-size: 1.15rem; line-height: 1.3; }
.post-nav a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.post-nav .kicker { display: block; margin-bottom: 6px; font-family: var(--sans); }
.post-nav .next { text-align: right; }

/* ─────────────────────────────────────────────────────────────
   Small screens
   ───────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 44px 20px; }
  .feature { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .site-header { flex-direction: column; gap: .5rem; padding-top: 32px; padding-bottom: 52px; }
  .rows .row { grid-template-columns: 1fr; gap: 0; }
  .lede { font-size: 1.3rem; }
  .grid { grid-template-columns: 1fr; }
  .card img { aspect-ratio: 3 / 2; }
  .feature h2 { font-size: 1.75rem; }
  .prose { font-size: 1.12rem; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
}

/* ─────────────────────────────────────────────────────────────
   Print (the CV page prints cleanly)
   ───────────────────────────────────────────────────────────── */
@media print {
  :root { --bg: #fff; --fg: #000; --muted: #444; --faint: #777; --rule: #ddd; }
  .site-nav, .site-footer, .chip { display: none !important; }
  .site-header { padding: 0 0 24px; }
  .label { margin-top: 24px; }
  a { text-decoration: none; }
}
