@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400;500;600&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;1,6..72,400&display=swap");

:root {
  color-scheme: light;
  --bg: #faf8f4;
  --panel: #ffffff;
  --deep: #faf8f4;
  --line: #e5e0d5;
  --grid: #eae5dc;
  --axis: #8a8f99;
  --ink: #1c1f26;
  --muted: #5a6270;
  --prussian: #1d4e89;
  --terracotta: #b8432e;
  --ochre: #b57c1e;
  --sage: #2a6f63;
  --plum: #6b4c8a;
  --clay: #815f50;
  --on-accent: #ffffff;
  --shadow: 0 2px 9px #382c1810;
  --serif: Newsreader, "Iowan Old Style", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1c1f26;
  --panel: #23272e;
  --deep: #1e2229;
  --line: #3e444d;
  --grid: #333942;
  --axis: #808793;
  --ink: #eee9e0;
  --muted: #bdc2ca;
  --prussian: #9cbbdc;
  --terracotta: #e8a295;
  --ochre: #dbb470;
  --sage: #9ec6b7;
  --plum: #c5aedb;
  --clay: #cdb4a3;
  --on-accent: #1c1f26;
  --shadow: 0 2px 9px #0002;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1.5rem; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 16px/1.6 var(--sans); }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: .25em; }
a:hover { color: var(--prussian); }
:focus-visible { outline: 2px solid var(--prussian); outline-offset: 4px; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.08; font-weight: 500; }
h2 { font-size: clamp(2rem, 4.6vw, 3.2rem); letter-spacing: -.038em; }
h3 { font-size: 1.55rem; }
p { color: var(--muted); }
.wrap { width: min(1180px, calc(100% - 72px)); margin: 0 auto; }
.skip { position: absolute; z-index: 10; top: 0; left: 1rem; background: var(--panel); padding: .6rem; transform: translateY(-120%); }
.skip:focus { transform: none; }
.masthead { border-bottom: 1px solid var(--line); }
.mast-row, .mast-row nav { display: flex; align-items: center; gap: clamp(.65rem, 3vw, 2rem); }
.mast-row { justify-content: space-between; min-height: 66px; flex-wrap: wrap; padding-block: .6rem; }
.masthead a { text-decoration: none; }
.masthead nav { flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.36rem; white-space: nowrap; }
.masthead { background: var(--panel); }
.masthead nav { margin-left: auto; }
#theme-toggle { min-width: 5.5rem; }
.hero { padding-top: clamp(3.1rem, 7vw, 6.1rem); }
.eyebrow { color: var(--muted); font: 500 .76rem/1.5 var(--sans); letter-spacing: .13em; }
.hero h1 { font-size: clamp(2.8rem, 7.2vw, 6.5rem); line-height: 1; letter-spacing: -.052em; margin: 1rem 0 1.15rem; }
.hero h1 em { color: var(--prussian); font-weight: 400; }
.subtitle { font-size: clamp(1.04rem, 1.7vw, 1.24rem); max-width: 44rem; }
.hero-equation { margin: 1.35rem 0 1.55rem; color: var(--prussian); width: fit-content; max-width: 100%; overflow-x: auto; padding: .3rem 0 .3rem .85rem; border-left: 1px solid var(--terracotta); }
math { font-size: 1.12em; }
.actions, .filters, .pagination { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; }
button, .button, input, select { font: inherit; color: var(--ink); border: 1px solid var(--line); background: var(--panel); border-radius: 4px; }
button, .button { cursor: pointer; padding: .57rem .84rem; font-size: .86rem; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
button:hover:not(:disabled), .button:hover { color: var(--prussian); border-color: var(--prussian); }
button:disabled { opacity: .46; cursor: default; }
button.primary, .button.primary { color: var(--on-accent); background: var(--prussian); border-color: var(--prussian); font-weight: 720; }
button.primary:hover, .button.primary:hover { background: color-mix(in srgb, var(--prussian), var(--ink) 14%); color: var(--on-accent); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 3rem; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); box-shadow: var(--shadow); }
.stats div { display: flex; flex-direction: column-reverse; justify-content: flex-end; padding: .83rem 1.2rem; }
.stats div + div { border-left: 1px solid var(--line); }
.stats dd { font: 1.87rem/1.3 var(--serif); color: var(--ink); }
.stats dt { color: var(--muted); font-size: .77rem; }
.block { padding-top: clamp(3.6rem, 7vw, 6rem); }
.section-head { display: flex; justify-content: space-between; gap: .8rem 1.4rem; flex-wrap: wrap; align-items: baseline; margin-bottom: 1.25rem; }
.section-head p { font-size: .94rem; max-width: 37rem; }
.lab, .surface, .gallery-card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; min-height: 55px; background: none; color: var(--muted);
}
.tabs button[aria-selected="true"] { color: var(--prussian); border-color: var(--prussian); background: var(--deep); }
.tabs button:focus-visible { outline-offset: -4px; }
.lab-inner { display: grid; grid-template-columns: 218px minmax(0, 1fr); }
.lab-controls { padding: 1.15rem; border-right: 1px solid var(--line); }
.lab-controls h3 { font-size: 1.2rem; margin-bottom: .6rem; }
.lab-controls .actions { margin-top: 1rem; }
.field { display: block; margin-bottom: .75rem; font-size: .83rem; }
.field span { display: flex; justify-content: space-between; gap: .5rem; }
output { font-variant-numeric: tabular-nums; color: var(--prussian); }
input[type="range"] { width: 100%; accent-color: var(--prussian); margin: .6rem 0 .1rem; display: block; }
select { padding: .46rem; }
.field select { display: block; width: 100%; margin-top: .45rem; }
.lab-display { min-width: 0; padding: .95rem; }
.plots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.plots figure { min-width: 0; background: var(--deep); border: 1px solid var(--line); border-radius: 4px; }
.plots figcaption { font: 500 1rem/1.2 var(--serif); padding: .72rem .8rem .15rem; color: var(--ink); }
canvas { width: 100%; height: auto; display: block; }
.measurements { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: .72rem; }
.measurements div { background: transparent; border-top: 1px solid var(--line); padding: .35rem .65rem; }
.measurements meter { width: 100%; min-width: 5.4rem; height: .45rem; display: block; accent-color: var(--ochre); }
.measurements dt { font-size: .7rem; color: var(--muted); }
.measurements dd { font: 1.1rem/1.35 var(--serif); color: var(--terracotta); }
.lab-source { padding: .85rem 1.15rem; border-top: 1px solid var(--line); }
#lab-equation { color: var(--prussian); overflow-x: auto; padding-bottom: .22rem; }
#lab-note, .noscript { font-size: .84rem; }
.noscript { padding: .8rem; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.gallery-card { overflow: hidden; }
.gallery-plates { display: grid; gap: 1rem; max-width: 960px; margin-inline: auto; }
.gallery-card figcaption { display: flex; align-items: baseline; gap: .4rem 1.2rem; flex-wrap: wrap; }
.gallery-card img, .gallery-card canvas { width: 100%; aspect-ratio: 960/440; height: auto; display: block; background: #faf8f4; }
.gallery-card figcaption { padding: 1rem; border-top: 1px solid var(--line); }
.gallery-card p, .surface p { font-size: .88rem; margin-top: .5rem; }
.surface { padding: 1.15rem; }
.publication-cards article { display: flex; flex-direction: column; align-items: flex-start; }
.publication-cards .eyebrow { margin: 0 0 .7rem; font-size: .69rem; }
.publication-cards .actions { padding-top: 1.15rem; margin-top: auto; }
.text-link, .companion a { font-size: .84rem; }
.companion { margin-top: .9rem; padding: .8rem 1rem; display: flex; flex-wrap: wrap; gap: .55rem 1.3rem; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
.filters button[aria-pressed="true"] { border-color: var(--prussian); color: var(--prussian); }
.map { padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; list-style: none; }
.map > li { padding: .9rem; border: 1px solid var(--line); background: var(--panel); border-radius: 4px; position: relative; }
.map > li:not(:last-child)::after { content: "›"; position: absolute; left: 100%; top: 1rem; width: .75rem; text-align: center; color: var(--prussian); }
.map h3 { margin-bottom: .35rem; font-size: 1.28rem; }
.map article { padding-block: .65rem; border-top: 1px solid var(--line); margin-top: .65rem; }
.map li.empty { opacity: .55; }
.map article p { font-size: .83rem; margin: .38rem 0; }
.map article a { font-size: .75rem; }
.badge { color: var(--status, var(--muted)); font: 500 .76rem/1.3 var(--sans); display: inline-block; }
.badge[data-status="0"] { --status: var(--sage); }
.badge[data-status="1"] { --status: var(--prussian); }
.badge[data-status="2"] { --status: var(--ochre); }
.badge[data-status="3"] { --status: var(--terracotta); }
.badge[data-status="4"] { --status: var(--plum); }
.search-row { display: grid; grid-template-columns: 2fr 1fr; gap: .75rem; }
.search-row label { font-size: .81rem; color: var(--muted); min-width: 0; }
.search-row input, .search-row select { display: block; margin-top: .3rem; width: 100%; padding: .6rem .65rem; }
#result-count { font: .86rem/1.4 var(--sans); margin: 1rem 0 .5rem; }
#results { list-style: none; margin: 0; padding: 0; }
#results li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, auto); gap: .6rem; padding: .43rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
#results a { font: .79rem/1.5 var(--mono); color: var(--prussian); }
#results span { font-size: .78rem; color: var(--muted); }
.pagination { justify-content: space-between; margin-top: .8rem; color: var(--muted); font-size: .85rem; }
footer { margin-top: 4rem; padding-block: 2rem; border-top: 1px solid var(--line); background: var(--deep); }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
footer pre { font-size: .79rem; white-space: pre-wrap; overflow-wrap: anywhere; }
footer p, footer a { font-size: .86rem; }
#copy-note { color: var(--sage); margin-left: .5rem; font-size: .82rem; }

@media (max-width: 960px) {
  .lab-inner { grid-template-columns: 180px minmax(0, 1fr); }
  .stats div { padding-inline: .65rem; }
  .map { grid-template-columns: 1fr; gap: .5rem; }
  .map > li:not(:last-child)::after { display: none; }
}
@media (max-width: 720px) {
  .wrap { width: calc(100% - 32px); }
  .masthead nav { order: 1; margin-left: 0; width: 100%; }
  #theme-toggle { margin-left: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div + div { border-left: 0; }
  .stats div:nth-child(even) { border-left: 1px solid var(--line); }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stats div:last-child { grid-column: 1/-1; }
  .lab-inner { grid-template-columns: 1fr; }
  .lab-controls { border-right: 0; border-bottom: 1px solid var(--line); }
  #controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 0 .8rem; }
  .cards, .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 510px) {
  .plots, .search-row, #results li { grid-template-columns: 1fr; }
  .tabs button { padding: .35rem; font-size: .72rem; line-height: 1.3; }
  #results li { gap: .1rem; }
}
