:root {
  --paper:    #FCFCFA;
  --card:     #F7F6F2;
  --ink:      #141413;
  --ink-soft: #6A6960;
  --rule:     #E6E4DC;
  --rule-2:   #D9D6CC;
  --accent:   #C15F3C;

  --serif: "Source Serif 4", Georgia, serif;
  --sans:  "Hanken Grotesk", system-ui, Arial, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, Menlo, monospace;

  --measure: 34rem;
  --wide:    56rem;
}

* { box-sizing: border-box; }

html { background: var(--paper); scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* ---------- Masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}
.masthead-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
  text-decoration: none;
}
.nav {
  display: flex;
  gap: 1.4rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--rule-2); }

/* ---------- Shells ---------- */

.wrap      { max-width: var(--measure); margin: 0 auto; padding: 0 1.5rem; }
.wrap-wide { max-width: var(--wide);    margin: 0 auto; padding: 0 1.5rem; }

.section { margin: 4.5rem 0; }

.section-label {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule);
}

.kicker {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1rem;
}

/* ---------- Home hero ---------- */

.hero { padding: 5rem 0 1rem; }
.hero-title {
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -0.022em;
  margin: 0 0 1.4rem;
  max-width: 20ch;
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 40ch;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}
.minihead {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.two-col p, .plain { margin: 0; color: var(--ink-soft); max-width: 46ch; }
.plain { max-width: 62ch; }

.institution-name { color: var(--accent); }

.more {
  font-family: var(--sans);
  font-size: 0.82rem;
  margin: 1.6rem 0 0;
}
.more a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--rule-2); padding-bottom: 1px; }
.more a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Note list ---------- */

.note-list { list-style: none; margin: 0; padding: 0; }
.note-row { border-bottom: 1px solid var(--rule); }
.note-row:first-child { border-top: 1px solid var(--rule); }

.note-link {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title meta" "excerpt meta";
  gap: 0.2rem 2rem;
  padding: 1.6rem 0;
  text-decoration: none;
}
.note-link:hover .note-row-title { color: var(--accent); }
.note-row-title {
  grid-area: title;
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: -0.014em;
  line-height: 1.25;
  transition: color 0.15s ease;
}
.note-row-excerpt {
  grid-area: excerpt;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.5;
  max-width: 52ch;
}
.note-row-meta {
  grid-area: meta;
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--ink-soft);
  white-space: nowrap;
  padding-top: 0.45rem;
}

/* ---------- Publications ---------- */

.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: pub;
}
.publication-group > summary {
  cursor: pointer;
  list-style: none;
}
.publication-group > summary::-webkit-details-marker { display: none; }
.publication-group > summary::after {
  content: "+";
  float: right;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
}
.publication-group[open] > summary::after { content: "−"; }
.publication-count {
  margin-left: 0.45rem;
  font-size: 0.9em;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-soft);
}
.pub {
  counter-increment: pub;
  position: relative;
  padding: 1.5rem 0 1.5rem 3.2rem;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 5rem;
}
.pub:first-child { border-top: 1px solid var(--rule); }
.pub::before {
  content: counter(pub);
  position: absolute;
  left: 0;
  top: 1.75rem;
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.pub:target { background: var(--card); }
.pub-title {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 0.35rem;
  max-width: 54ch;
}
.pub-meta {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
}
.pub-links {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pub-links a {
  font-family: var(--sans);
  font-size: 0.74rem;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.pub-links a:hover { color: var(--ink); border-color: var(--ink-soft); }
.pub-links .pub-note { color: var(--accent); border-color: var(--accent); }
.pub-links .pub-note:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Page and note headers ---------- */

.page-head { padding: 4rem 0 2.5rem; }
.page-title {
  font-size: clamp(2rem, 4vw, 2.9rem);
  font-weight: 400;
  letter-spacing: -0.022em;
  line-height: 1.12;
  margin: 0 0 0.9rem;
}
.standfirst {
  font-size: 1.08rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 52ch;
}
.note .standfirst { max-width: 64rem; }

.note { max-width: 68rem; margin: 0 auto; padding: 3.5rem 1.5rem 0; }
.note-title {
  font-size: clamp(2rem, 4.2vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.12;
  margin: 0 0 1rem;
}
.note-meta {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 1rem 0 0;
}
.note-meta a { color: var(--ink-soft); }

.note-figure {
  margin: 3rem 0;
  width: min(62rem, 92vw);
  margin-left: 50%;
  transform: translateX(-50%);
}
.note-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--rule);
}

/* ---------- Prose ---------- */

.prose { max-width: 64rem; }
.prose h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.014em;
  line-height: 1.22;
  margin: 3rem 0 0.8rem;
}
.prose h3 { font-size: 1.15rem; font-weight: 600; margin: 2.2rem 0 0.5rem; }
.prose p { margin: 0 0 1.2rem; }
.prose strong { font-weight: 600; }

.prose a {
  text-decoration: underline;
  text-decoration-color: var(--rule-2);
  text-underline-offset: 0.17em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.prose a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.prose blockquote {
  margin: 2rem 0;
  padding: 0 0 0 1.3rem;
  border-left: 2px solid var(--rule-2);
  color: var(--ink-soft);
}
.prose blockquote strong { color: var(--ink); }

.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

.prose ol, .prose ul { padding-left: 1.3rem; margin: 0 0 1.2rem; }
.prose li { margin-bottom: 0.45rem; }

.prose code, .prose pre {
  font-family: var(--mono);
  font-size: 0.8em;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.prose code { padding: 0.1em 0.35em; }
.prose pre { padding: 1em 1.2em; overflow-x: auto; }
.prose pre code { border: 0; padding: 0; background: none; }

/* Math is rendered at build time, so it needs styling but no script. */
.katex { font-size: 1em; color: var(--ink); }
.katex-display {
  margin: 1.7rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.4rem 0;
}

/* ---------- Footer ---------- */

.foot { margin-top: 6rem; border-top: 1px solid var(--rule); }
.foot-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.8rem 1.5rem 4rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.foot-inner p { margin: 0 0 0.3rem; }

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  body { font-size: 18px; }
  .masthead-inner { flex-direction: column; align-items: flex-start; gap: 0.7rem; }
  .nav { gap: 1.1rem; flex-wrap: wrap; }
  .hero { padding-top: 3rem; }
  .two-col { grid-template-columns: 1fr; gap: 1.6rem; }
  .note-link {
    grid-template-columns: 1fr;
    grid-template-areas: "title" "excerpt" "meta";
    gap: 0.35rem;
  }
  .note-row-meta { padding-top: 0.3rem; white-space: normal; }
  .note-figure { width: 100vw; }
  .pub { padding-left: 2.4rem; }
}


/* ---------- Home feed (card layout) ---------- */

.feed { padding-top: 3rem; }

.card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card-media {
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  margin-bottom: 1.1rem;
  aspect-ratio: 16 / 9;
}
.card-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.card:hover .card-media img { transform: scale(1.02); }

.card-topic {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}
.card-title {
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.016em;
  margin: 0 0 0.45rem;
  transition: color 0.15s ease;
}
.card:hover .card-title { color: var(--accent); }
.card-excerpt {
  color: var(--ink-soft);
  font-size: 0.97rem;
  line-height: 1.5;
  margin: 0 0 0.7rem;
}
.card-byline {
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--ink-soft);
  margin: 0;
}
.card-byline .dot { opacity: 0.5; margin: 0 0.15rem; }

/* Featured lead item: image left, text right on wide screens */
.card-feature {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 2.4rem;
  align-items: center;
  padding-bottom: 3rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--rule);
}
.card-feature .card-media { margin-bottom: 0; aspect-ratio: auto; }
.card-feature .card-media img { height: auto; object-fit: initial; }
.card-feature .card-title {
  font-size: clamp(1.6rem, 2.7vw, 2.15rem);
  line-height: 1.14;
  letter-spacing: -0.022em;
  margin-bottom: 0.7rem;
}
.card-feature .card-excerpt { font-size: 1.03rem; }
.card-feature--text-first { grid-template-columns: 1fr 1.35fr; }
.card-feature--text-first .card-body { grid-column: 1; }
.card-feature--text-first .card-media { grid-column: 2; grid-row: 1; }

/* Remaining items */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 2.6rem 2rem;
}

.feed-foot {
  margin: 5rem 0 0;
  padding-top: 1.8rem;
  border-top: 1px solid var(--rule);
}
.feed-foot .plain { font-size: 0.97rem; }
.feed-foot a { color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 0.17em; }
.feed-foot a:hover { color: var(--accent); }

@media (max-width: 780px) {
  .card-feature {
    grid-template-columns: 1fr;
    gap: 1.1rem;
    padding-bottom: 2.4rem;
    margin-bottom: 2.4rem;
  }
  .card-feature--text-first .card-body,
  .card-feature--text-first .card-media { grid-column: auto; grid-row: auto; }
  .card-grid { grid-template-columns: 1fr; gap: 2.2rem; }
}

/* Single note on the page: no trailing rule under the lead item */
.card-feature:last-child {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* ---------- Tag filter bar ---------- */

.tagbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: -0.6rem 0 1.8rem;
}
.tag {
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  padding: 0.24rem 0.7rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.tag:hover { color: var(--ink); border-color: var(--ink-soft); }
.tag.is-on {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}
.tag-n {
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
  margin-left: 0.15rem;
}

/* Tags shown on each publication */
.pub-tags {
  margin: 0 0 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.pub-tag {
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--card);
  border-radius: 4px;
  padding: 0.14rem 0.45rem;
}

.pub-empty {
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--ink-soft);
  padding: 1.5rem 0;
  margin: 0;
}

/* Hidden items must not keep their counter slot */
.pub[hidden] { display: none; }

/* ---------- Home intro block ---------- */

.intro {
  padding: 4rem 0 3.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.intro-role {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1.1rem;
}
.intro-research {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 0 0 1.6rem;
}
.intro-research p {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  line-height: 1.34;
  letter-spacing: -0.014em;
  margin: 0;
  max-width: 42ch;
}
.intro-research p + p {
  border-left: 1px solid var(--rule-2);
  padding-left: 2rem;
}
.intro-topic {
  display: block;
  font-family: var(--sans);
  font-size: 0.66em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.55rem;
}
.intro-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  margin: 0;
  font-family: var(--sans);
  font-size: 0.82rem;
}
.intro-links a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-2);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.intro-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.feed { padding-top: 1rem; }

@media (max-width: 720px) {
  .intro { padding: 2.5rem 0 2.2rem; }
  .intro-research { grid-template-columns: 1fr; gap: 1.4rem; }
  .intro-research p + p { border-left: 0; border-top: 1px solid var(--rule-2); padding: 1.4rem 0 0; }
}

/* ---------- Photographs ---------- */

/* A plate sits in the margin beside the passage it belongs to, the way a
   figure does in a printed monograph. It is evidence, not decoration:
   no shadow, no rounding, no hover effect, no lightbox. */
.plate {
  margin: 0.4rem 0 1.6rem;
}
.plate img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  /* A touch of desaturation so photographs from twenty different cameras
     sit together without one of them shouting. */
  filter: saturate(0.82) contrast(0.97);
}
.plate figcaption {
  font-family: var(--sans);
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--ink-soft);
  margin-top: 0.45rem;
}
.plate-when {
  display: block;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

@media (min-width: 62rem) {
  /* Float the plate into the gutter beside the text column. Floats stack and
     clear one another, so consecutive plates never collide. */
  .plate {
    float: right;
    clear: right;
    width: 15.5rem;
    margin: 0.3rem -19rem 1.8rem 0;
  }
}
