/* Catalogus. The site is a set bibliography with an evidence margin.
   References: Ziad Obermeyer (bio with a margin of sources), Kieran Healy (publications in
   citation style, small-cap actions), Bret Victor (year in the margin, no axis).
   One family: Spectral, with Spectral SC for true small capitals. One ink on cool white. */

@font-face { font-family: "Spectral"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/Spectral-400-latin.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: "Spectral"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/Spectral-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/Spectral-400i-latin.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: "Spectral"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/Spectral-400i-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/Spectral-600-latin.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: "Spectral"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/Spectral-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Spectral SC"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/SpectralSC-500-latin.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: "Spectral SC"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/SpectralSC-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: oklch(0.975 0.002 250);
  --ink: oklch(0.26 0.035 255);
  --ink-2: oklch(0.45 0.025 255);
  --rule: oklch(0.86 0.008 255);
  --accent: oklch(0.42 0.12 255);
  --accent-deep: oklch(0.32 0.11 255);

  --serif: "Spectral", "Iowan Old Style", Georgia, serif;
  --sc: "Spectral SC", "Spectral", Georgia, serif;

  --text: 1.1875rem;
  --small: 1rem;
  --wide: 62rem;
  --measure: 38rem;
  --margin: 17rem;
  --gutter: clamp(1.1rem, 0.6rem + 2.5vw, 3rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --mark: color-mix(in oklch, var(--accent) 7%, transparent);
  color-scheme: light dark;
}

/* Dark: blue-black ground, same hue as the ink, accent lifted to stay readable.
   Follows the system unless the visitor picked a theme (data-theme on <html>, set by the toggle). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(0.2 0.014 255);
    --ink: oklch(0.93 0.008 255);
    --ink-2: oklch(0.75 0.018 255);
    --rule: oklch(0.36 0.018 255);
    --accent: oklch(0.78 0.09 255);
    --accent-deep: oklch(0.88 0.06 255);
    --mark: color-mix(in oklch, var(--accent) 13%, transparent);
  }
}
:root[data-theme="dark"] {
  --bg: oklch(0.2 0.014 255);
  --ink: oklch(0.93 0.008 255);
  --ink-2: oklch(0.75 0.018 255);
  --rule: oklch(0.36 0.018 255);
  --accent: oklch(0.78 0.09 255);
  --accent-deep: oklch(0.88 0.06 255);
  --mark: color-mix(in oklch, var(--accent) 13%, transparent);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--text);
  line-height: 1.6;
  border-top: 3px solid var(--accent);
  text-rendering: optimizeLegibility;
  font-variant-numeric: oldstyle-nums proportional-nums;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  text-decoration-color: color-mix(in oklch, var(--accent) 35%, transparent);
}
a:hover { color: var(--accent-deep); text-decoration-color: currentColor; }
@media (prefers-reduced-motion: no-preference) {
  a { transition: color 160ms var(--ease-out), text-decoration-color 160ms var(--ease-out); }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 10;
  background: var(--ink); color: var(--bg); padding: 0.4rem 0.8rem;
}
.skip:focus { top: 0.6rem; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wide)); margin-inline: auto; }
.sc { font-family: var(--sc); font-weight: 500; letter-spacing: 0.03em; }

/* ---------- header ---------- */

.site-head .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.25rem 2rem; padding-block: 1.4rem 0.2rem;
}
.site-name { font-family: var(--sc); font-weight: 500; letter-spacing: 0.04em; color: var(--ink); text-decoration: none; font-size: 1.0625rem; padding-block: 0.6rem; }
.site-name:hover { color: var(--accent); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.35rem; align-items: baseline; }
.site-nav a { display: inline-block; padding-block: 0.6rem; text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; }
.site-nav .lang { display: inline-flex; align-items: baseline; gap: 0.3em; font-family: var(--sc); font-weight: 500; letter-spacing: 0.06em; color: var(--ink-2); }
.lang-icon { width: 0.9em; height: 0.9em; align-self: center; fill: none; stroke: currentColor; stroke-width: 1.1; }
.lang-cur { color: var(--ink); }
.lang-sep { color: var(--rule); }
.site-nav .lang a { color: var(--ink-2); padding-inline: 0.15em; }
.site-nav .lang a:hover { color: var(--accent); }

/* Theme toggle: moon in light, sun in dark. Hidden until the script runs. */
.site-nav .theme:not([hidden]) { display: inline-flex; align-self: center; margin-inline-start: -0.5rem; }
.theme-btn { display: inline-grid; place-items: center; inline-size: 1.75rem; block-size: 1.75rem; padding: 0; border: 0; border-radius: 2px; background: none; color: var(--ink-2); font: inherit; cursor: pointer; }
.theme-btn:hover { color: var(--accent); }
.theme-btn svg { width: 0.95em; height: 0.95em; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}

/* Mobile menu: the button shows only with JavaScript and below 640px. Without it the nav wraps. */
.menu-btn { display: none; }
.menu-icon { width: 0.95em; height: 0.95em; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; }
@media (max-width: 640px) {
  /* Name and button share one line: a smaller gap than the desktop 2rem. */
  .site-head.js .wrap { column-gap: 0.5rem; }
  .site-head.js .menu-btn:not([hidden]) {
    display: inline-flex; align-items: center; gap: 0.45em; min-block-size: 2.75rem; padding: 0;
    border: 0; background: none; font: inherit; font-family: var(--sc); font-weight: 500; letter-spacing: 0.06em;
    color: var(--ink-2); cursor: pointer;
  }
  .site-head.js .menu-btn:hover, .site-head.js .menu-btn:focus-visible, .site-head.js.open .menu-btn { color: var(--accent); }
  .site-head.js .site-nav { display: none; }
  .site-head.js.open .site-nav { display: block; flex-basis: 100%; border-top: 1px solid var(--rule); padding-block: 0.5rem 0.75rem; }
  /* Sections one per row, full-width tap rows; language and theme share the last row. */
  .site-head.js.open .site-nav ul { gap: 0; align-items: center; }
  .site-head.js.open .site-nav li:not(.lang):not(.theme) { flex-basis: 100%; }
  .site-head.js.open .site-nav li:not(.lang) > a { display: block; padding-block: 0.65rem; }
  .site-head.js.open .site-nav .lang { margin-top: 0.4rem; align-items: center; }
  .site-head.js.open .site-nav .lang a { display: inline-block; padding: 0.65rem 0.5em; }
  .site-head.js.open .site-nav .theme:not([hidden]) { margin-top: 0.4rem; margin-inline-start: 0.75rem; }
  .site-head.js.open .theme-btn { inline-size: 2.75rem; block-size: 2.75rem; }
}
/* Below 360px the word does not fit next to the name: icon only, the word stays as accessible name. */
@media (max-width: 359px) {
  .site-head.js .menu-btn:not([hidden]) { min-inline-size: 2.75rem; justify-content: flex-end; }
  .menu-btn span { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

main { padding-block: clamp(2.25rem, 1.8rem + 3vw, 4.5rem) clamp(3.5rem, 3rem + 4vw, 6rem); }

/* ---------- type ---------- */

p { margin: 0; text-wrap: pretty; }
p + p { margin-top: 0.9em; }
h1, h2 { margin: 0; text-wrap: balance; }
h1 { font-weight: 600; font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); line-height: 1.1; letter-spacing: -0.012em; max-width: 24ch; }
h2 { font-style: italic; font-weight: 400; font-size: 1.5rem; line-height: 1.25; margin: 3rem 0 1rem; }
.lead { font-size: 1.3125rem; line-height: 1.5; max-width: var(--measure); }
.quiet { color: var(--ink-2); font-size: var(--small); line-height: 1.5; max-width: var(--measure); }
cite { font-style: italic; }

/* ---------- identity block (home) ---------- */

.ident h1 { max-width: none; }
.roles { list-style: none; margin: 1.1rem 0 0; padding: 0; font-size: 1.125rem; line-height: 1.45; }
.roles li { color: var(--ink-2); }
.roles li:first-child { color: var(--ink); font-weight: 600; }

/* ---------- evidence rows: text left, sources in the margin ---------- */

.ev { margin-top: clamp(2.25rem, 1.8rem + 2vw, 3.25rem); }
.ev-row + .ev-row { margin-top: 1.1rem; }
.ev-row > p { max-width: var(--measure); }
.notes { list-style: none; margin: 0.45rem 0 0; padding: 0; font-size: var(--small); line-height: 1.4; color: var(--ink-2); }
.notes li + li { margin-top: 0.3rem; }
.notes a { color: var(--ink-2); text-decoration-color: var(--rule); }
.notes a:hover { color: var(--accent); }
.notes a cite { color: var(--ink); }
@media (min-width: 960px) {
  .ev-row { display: grid; grid-template-columns: minmax(0, var(--measure)) var(--margin); column-gap: 3.5rem; align-items: start; }
  .notes { margin-top: 0.3rem; padding-left: 0.9rem; border-left: 1px solid var(--rule); }
}

/* ---------- citation lists ---------- */

.cites { list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.cite-item { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); column-gap: 1rem; padding-block: 0.65rem; }
.yr { color: var(--ink-2); font-variant-numeric: lining-nums tabular-nums; font-size: 1.0625rem; padding-top: 0.08rem; }
.c-title { line-height: 1.4; }
.c-title a { color: var(--ink); text-decoration-color: var(--rule); }
.c-title a:hover { color: var(--accent); text-decoration-color: currentColor; }
.c-src { margin-top: 0.15rem; color: var(--ink-2); font-size: 1.0625rem; line-height: 1.45; }
.c-src cite { color: var(--ink); }
.c-auth { margin-top: 0.15rem; color: var(--ink-2); font-size: var(--small); line-height: 1.45; }
.c-auth b { color: var(--ink); font-weight: 600; }
.c-act { margin-top: 0.2rem; font-family: var(--sc); font-weight: 500; font-size: 0.95rem; letter-spacing: 0.05em; color: var(--ink-2); }
.c-act a { text-decoration: none; }
.c-act a:hover { text-decoration: underline; }
.c-act .first { color: var(--accent); }
.sep { padding-inline: 0.4em; color: var(--rule); }
@media (max-width: 520px) {
  .cite-item { grid-template-columns: 1fr; }
  .yr:empty { display: none; }
}

.sources { margin-top: 1rem; font-family: var(--sc); font-weight: 500; letter-spacing: 0.05em; font-size: 0.95rem; color: var(--ink-2); }
.sources a { text-decoration: none; }
.sources a:hover { text-decoration: underline; }

/* ---------- article and thesis pages ---------- */

.crumb { font-family: var(--sc); font-weight: 500; letter-spacing: 0.05em; font-size: 0.95rem; margin-bottom: 1.25rem; }
.crumb a { text-decoration: none; }
.paper h1 { font-size: clamp(1.65rem, 1.25rem + 1.6vw, 2.35rem); line-height: 1.2; max-width: 32ch; }
.paper .src { margin-top: 0.9rem; color: var(--ink-2); max-width: 44rem; }
.paper .src cite { color: var(--ink); }
.paper .c-auth { margin-top: 0.5rem; max-width: 44rem; }
.paper .c-act { margin-top: 0.6rem; }
.paper .ev { margin-top: 2.75rem; }
.paper .ev-row > div { max-width: var(--measure); }
.paper .ev-row h2 { margin-top: 0; }
.facts { margin: 0; font-size: var(--small); line-height: 1.4; color: var(--ink-2); }
.facts dt { font-family: var(--sc); font-weight: 500; letter-spacing: 0.05em; font-size: 0.9rem; color: var(--ink-2); }
.facts dd { margin: 0 0 0.75rem; color: var(--ink); }
@media (max-width: 959px) { .paper .facts { margin-top: 1.5rem; } }
@media (min-width: 960px) { .paper .facts { padding-left: 0.9rem; border-left: 1px solid var(--rule); } }

.citeblock { margin-top: 2.75rem; max-width: var(--measure); font-size: 1.0625rem; line-height: 1.5; }
.citeblock .sc { display: block; font-size: 0.9rem; color: var(--ink-2); margin-bottom: 0.3rem; letter-spacing: 0.05em; }

/* ---------- about page ---------- */

.topics { margin: 0.5rem 0 0; padding-left: 1.1rem; max-width: var(--measure); }
.topics li { margin: 0.3rem 0; }
.topics li::marker { color: var(--ink-2); }
.data { margin: 0; max-width: 46rem; }
.data > div { display: grid; grid-template-columns: 11rem minmax(0, 1fr); column-gap: 1.5rem; padding-block: 0.55rem; border-top: 1px solid var(--rule); }
.data > div:last-child { border-bottom: 1px solid var(--rule); }
.data dt { font-family: var(--sc); font-weight: 500; letter-spacing: 0.05em; font-size: 0.95rem; color: var(--ink-2); padding-top: 0.1rem; }
.data dd { margin: 0; }
@media (max-width: 560px) { .data > div { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */

.site-foot { border-top: 1px solid var(--rule); }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; padding-block: 1.5rem 2.5rem; font-size: var(--small); color: var(--ink-2); }
.site-foot .sc { color: var(--ink); }
.site-foot p + p { margin-top: 0; }

/* ---------- motion: three mechanisms, nothing decorative ----------
   1. The margin proves the paragraph: hovering a source lights the paragraph it supports,
      hovering the paragraph brings its sources forward (desktop grid only).
   2. Pages leaf instead of reload: cross-document view transitions, the head stays put.
   3. A citation row answers: year and title belong together.
   No scroll reveals, no load choreography. Reduced motion: states switch without transition. */

@media (min-width: 960px) {
  .ev-row > p { max-width: calc(var(--measure) + 1.2rem); margin-inline: -0.6rem; padding-inline: 0.6rem; border-radius: 2px; }
  .ev-row:has(> .notes a:focus-visible) > p { background-color: var(--mark); }
  .ev-row:has(> .notes a:focus-visible) > .notes { border-left-color: var(--accent); }
  @media (hover: hover) {
    .ev-row:has(> .notes a:hover) > p { background-color: var(--mark); }
    .ev-row:has(> .notes a:hover) > .notes,
    .ev-row:has(> p:hover) > .notes { border-left-color: var(--accent); }
    .ev-row:has(> p:hover) > .notes,
    .ev-row:has(> p:hover) > .notes a { color: var(--ink); }
  }
}

@view-transition { navigation: auto; }
.site-head { view-transition-name: site-head; }
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) { animation-duration: 180ms; animation-timing-function: var(--ease-out); }

.cite-item:hover .yr,
.cite-item:focus-within .yr { color: var(--ink); }
.cite-item:has(.c-title a:hover) .yr,
.cite-item:has(.c-title a:focus-visible) .yr { color: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  .ev-row > p { transition: background-color 160ms var(--ease-out); }
  .notes { transition: border-color 160ms var(--ease-out), color 160ms var(--ease-out); }
  .notes a { transition: color 160ms var(--ease-out), text-decoration-color 160ms var(--ease-out); }
  .yr { transition: color 160ms var(--ease-out); }
}
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* Touch: small-cap action links get a 24px+ hit area; inline padding does not move the line box. */
.c-act a, .crumb a, .sources a, .site-nav .lang a { padding-block: 0.25em; }
