/* Declassified UAP
   A reading room for government records: white paper, dusk-blue ink, one
   dark band where the photographs live. Newsreader carries the documents and
   headings; Schibsted Grotesk carries the interface and the catalog data. */

:root {
  --paper: #ffffff;
  --paper-2: #f3f4f7;      /* panels, the frequent-words band */
  --table: #eceef3;        /* the "reading table" behind a document */
  --ink: #161b2e;          /* text: the dusk sky of the FD-302 prints */
  --ink-2: #434a60;
  --ink-3: #5c6378;        /* meta text; 5.7:1 on white */
  --rule: #d9dce4;
  --rule-strong: #b6bccb;
  --dusk: #10162b;         /* hero band + footer */
  --dusk-2: #1a2240;
  --on-dusk: #f1f3f8;
  --on-dusk-2: #aab2c7;    /* 8:1 on --dusk */
  --link: #1e46a8;
  --link-hover: #12317a;
  --action: #2c52c4;       /* the one filled button colour */
  --mark: #ffe58a;
  --focus: #2f6bff;
  --focus-on-dark: #9bbcff;

  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --wrap: 1240px;
  --section: clamp(40px, 5.5vw, 72px);
  --radius: 3px;

  /* Legacy names: pipeline/lib/helpers.php writes these into inline styles
     (word clouds, the empty-OCR note). Mapped onto the new palette. */
  --cyan: var(--ink);
  --pink: var(--ink-2);
  --text: var(--ink-3);
  --muted: var(--ink-3);

  color-scheme: light;
}

/* ---------------------------------------------------------------- base -- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Short pages keep the footer at the bottom of the window. */
  min-height: 100vh; display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; }
body.modal-open { overflow: hidden; }
img, video, iframe { max-width: 100%; }
img { display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; }
p { margin: 0; }
a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }
::selection { background: #cfdcff; }
mark { background: var(--mark); color: inherit; padding: 0 1px; }
code { font-family: var(--mono); font-size: 0.88em; }

.wrap { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.page-narrow { max-width: calc(760px + 2 * var(--gutter)); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; color: #fff; }

/* Small reusable type */
.label { display: block; font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.01em; }
.kicker { font-size: 14px; font-weight: 600; color: var(--ink-3); margin-bottom: 8px; }
.count { color: var(--ink-3); font-size: 0.86em; font-variant-numeric: tabular-nums; }
.section-title { font-family: var(--serif); font-size: clamp(1.45rem, 1.2rem + 0.8vw, 1.85rem); font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; }
.section-note { font-size: 15px; color: var(--ink-3); margin-top: 6px; max-width: 70ch; }
.lede { font-family: var(--serif); font-size: clamp(1.1rem, 1rem + 0.35vw, 1.3rem); line-height: 1.55; color: var(--ink-2); max-width: 62ch; margin-top: 14px; }
.prose { font-family: var(--serif); font-size: 18px; line-height: 1.62; max-width: 70ch; }
.prose p + p { margin-top: 0.8em; }
mark.todo { background: var(--mark); font-family: var(--sans); font-weight: 700; padding: 1px 5px; }

.btn {
  display: inline-flex; align-items: center; min-height: 40px;
  padding: 8px 14px; border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); font-family: var(--sans); font-size: 15px; font-weight: 600;
  text-decoration: none; line-height: 1.2;
}
.btn:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }

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

.site-header { background: #fff; border-bottom: 1px solid var(--rule); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 64px; }
.wordmark {
  font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: -0.015em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  font-variation-settings: 'opsz' 36;
}
.wordmark:hover { color: var(--ink); text-decoration: none; }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  display: block; padding: 8px 10px; color: var(--ink-2); font-size: 15px; font-weight: 500;
  text-decoration: none; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
.site-nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }

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

.site-footer { background: var(--dusk); color: var(--on-dusk-2); padding: 44px 0 56px; margin-top: var(--section); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 40px; }
.footer-name { font-family: var(--serif); font-size: 21px; color: var(--on-dusk); margin-bottom: 8px; font-weight: 500; }
.footer-about p:not(.footer-name) { font-size: 15px; line-height: 1.6; max-width: 58ch; }
.site-footer a { color: var(--on-dusk); }
.site-footer a:hover { color: #fff; }
.site-footer :focus-visible { outline-color: var(--focus-on-dark); }
.footer-nav { display: grid; grid-template-columns: repeat(2, max-content); gap: 10px 40px; align-content: start; }
.footer-nav a { text-decoration: none; font-size: 15px; }
.footer-nav a:hover { text-decoration: underline; }

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

.hero { background: var(--dusk); color: var(--on-dusk); }
.hero :focus-visible { outline-color: var(--focus-on-dark); }
.hero-inner {
  /* Text column lines up with the header's wordmark; the plate runs wider. */
  padding: clamp(32px, 4.5vw, 64px) var(--gutter) clamp(32px, 4vw, 56px);
  padding-left: max(var(--gutter), calc((100% - var(--wrap)) / 2));
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: clamp(28px, 4vw, 64px); align-items: center;
}
.hero h1 {
  font-family: var(--serif); font-weight: 450; font-size: clamp(2rem, 1.35rem + 1.75vw, 2.85rem);
  line-height: 1.08; letter-spacing: -0.018em; color: #fff; max-width: 17ch;
  font-variation-settings: 'opsz' 60;
}
.hero-dek { margin-top: 18px; font-size: 17px; line-height: 1.55; color: var(--on-dusk-2); max-width: 46ch; }
.hero-search { margin-top: 28px; }
.hero-search label { display: block; font-size: 14px; font-weight: 600; color: var(--on-dusk); margin-bottom: 8px; }
.search-row { display: flex; max-width: 560px; }
.search-row input {
  flex: 1 1 auto; min-width: 0; height: 52px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius) 0 0 var(--radius);
  background: #fff; color: var(--ink); font-size: 17px;
}
.search-row input::placeholder { color: #737a8e; }
.search-row button {
  flex: 0 0 auto; height: 52px; padding: 0 22px; border: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--action); color: #fff; font-size: 16px; font-weight: 600;
}
.search-row button:hover { background: #2446ad; }
.hero-try { margin-top: 14px; font-size: 14px; color: var(--on-dusk-2); display: flex; flex-wrap: wrap; gap: 4px 14px; max-width: 560px; }
.hero-try span { color: var(--on-dusk-2); }
.hero-try a { color: var(--on-dusk); text-decoration-color: rgba(241, 243, 248, 0.4); }
.hero-try a:hover { color: #fff; text-decoration-color: #fff; }

/* The plate: nine registered prints, cross-faded */
.plate { margin: 0; }
.plate-frames {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: #0c1124; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.plate-frame { position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s ease-in-out; }
.plate-frame img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.plate-frame.is-current { opacity: 1; z-index: 2; }
.plate-frame.is-prev { opacity: 1; z-index: 1; transition: none; }
.plate-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; }
.plate-toggle {
  min-height: 34px; padding: 4px 14px; border: 1px solid rgba(241, 243, 248, 0.35); border-radius: var(--radius);
  background: transparent; color: var(--on-dusk); font-size: 14px; font-weight: 600; min-width: 72px;
}
.plate-toggle:hover { border-color: var(--on-dusk); }
.plate-label { font-size: 13px; color: var(--on-dusk-2); }
.plate-ticks { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.plate-ticks button {
  width: 32px; height: 32px; padding: 0; border: 1px solid rgba(241, 243, 248, 0.2); border-radius: 2px;
  background: transparent; color: var(--on-dusk-2); font-size: 13px; font-variant-numeric: tabular-nums;
}
.plate-ticks button:hover { border-color: var(--on-dusk-2); color: var(--on-dusk); }
.plate-ticks button[aria-current="true"] { background: var(--on-dusk); border-color: var(--on-dusk); color: var(--dusk); font-weight: 700; }
.plate figcaption { margin-top: 14px; font-size: 14.5px; line-height: 1.55; color: var(--on-dusk-2); max-width: 74ch; }
.plate figcaption p + p { margin-top: 6px; }
.plate figcaption strong { color: var(--on-dusk); font-weight: 600; }
.plate figcaption a { color: var(--on-dusk); }
.plate figcaption a:hover { color: #fff; }
.plate figcaption .plate-credit { font-size: 13px; }

/* Arriving with a search in the URL: the hero shrinks to its search box. */
html.is-filtered .hero-inner { grid-template-columns: minmax(0, 1fr); padding-block: 22px 26px; }
html.is-filtered .hero h1 { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem); max-width: none; }
html.is-filtered .hero-dek,
html.is-filtered .hero-try,
html.is-filtered .plate { display: none; }
html.is-filtered .hero-search { margin-top: 14px; }

/* --------------------------------------------------- ways in + notable -- */

.ways { border-bottom: 1px solid var(--rule); }
.ways-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-top: 36px; padding-bottom: 36px; }
.way { padding: 0 24px; border-left: 1px solid var(--rule); }
.way:first-child { padding-left: 0; border-left: 0; }
.way h2 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 8px; letter-spacing: -0.01em; }
.way h2 a { color: var(--ink); text-decoration: none; }
.way h2 a:hover { text-decoration: underline; }
.way p { font-size: 15px; color: var(--ink-2); line-height: 1.5; }
.way ul { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.way li + li { margin-top: 6px; }
.way li .count { display: block; font-size: 13px; }

.notable { padding: var(--section) 0 0; }
.notable-grid {
  list-style: none; margin: 24px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 32px;
}
.notable-grid a { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; color: var(--ink); text-decoration: none; }
.notable-grid img { width: 88px; height: 66px; object-fit: cover; background: var(--paper-2); }
.notable-grid img.is-missing { visibility: hidden; }
.notable-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notable-title {
  font-family: var(--serif); font-size: 16.5px; line-height: 1.3; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notable-grid a:hover .notable-title { text-decoration: underline; text-underline-offset: 0.18em; }
.notable-meta { font-size: 13px; color: var(--ink-3); }

/* ------------------------------------------------------ records browser -- */

.browser { padding: var(--section) 0 0; scroll-margin-top: 8px; }
.browser-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 18px; }
.results-count { font-size: 15px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.filters-toggle { display: none; }
.browser-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; margin-top: 22px; align-items: start; }

.filters {
  position: sticky; top: 16px; background: var(--paper-2); padding: 18px; border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 16px;
}
.filter label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.filter select {
  width: 100%; height: 40px; padding: 0 32px 0 10px; border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23434a60' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 11px center;
  appearance: none; -webkit-appearance: none; font-size: 15px; color: var(--ink);
}
.filter-active { border-top: 1px solid var(--rule-strong); padding-top: 14px; }
.filter-active p { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; overflow-wrap: anywhere; }
.filter-active button, .timeline-clear {
  background: none; border: 0; padding: 0; color: var(--link); font-size: 14px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 0.18em;
}
.filters-more { font-size: 14px; }

.views { display: flex; flex-wrap: wrap; gap: 6px; }
.views button, .density-btn, .dualpane-toggles button {
  min-height: 38px; padding: 6px 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink-2); font-size: 14px; font-weight: 500;
}
.views button:hover, .density-btn:hover, .dualpane-toggles button:hover { border-color: var(--ink-2); color: var(--ink); }
.views button[aria-pressed="true"], .density-btn[aria-pressed="true"], .dualpane-toggles button[aria-pressed="true"] {
  background: var(--ink); border-color: var(--ink); color: #fff;
}
.views .n { color: var(--ink-3); margin-left: 2px; }
.views button[aria-pressed="true"] .n { color: rgba(255, 255, 255, 0.72); }

/* Incident-year timeline */
.timeline-shell { margin-top: 20px; }
.timeline-shell[hidden] { display: none; }
.timeline-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.timeline-title { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.timeline-status { font-size: 13px; color: var(--ink-3); }
.timeline-clear { margin-left: auto; font-size: 13px; visibility: hidden; }
.timeline-shell.has-filter .timeline-clear { visibility: visible; }
.timeline-scroll { overflow-x: auto; scrollbar-width: thin; }
.timeline-bars { display: flex; align-items: flex-end; gap: 2px; height: 56px; border-bottom: 1px solid var(--rule-strong); }
.timeline-bar {
  flex: 1 1 0; min-width: 4px; height: var(--h, 3px); padding: 0; border: 0;
  background: #99a1b6; border-radius: 1px 1px 0 0;
}
.timeline-bar:hover:not([disabled]) { background: var(--ink-2); }
.timeline-bar[aria-pressed="true"] { background: var(--link); }
.timeline-bar.is-dim { opacity: 0.35; }
.timeline-bar[disabled] { background: var(--rule); cursor: default; }
.timeline-labels { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Map */
.map-panel { margin-top: 20px; scroll-margin-top: 12px; }
.map-panel[hidden] { display: none; }
#map { height: clamp(320px, 54vh, 580px); border: 1px solid var(--rule); background: var(--paper-2); }
.map-note { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.map-error { padding: 24px; color: var(--ink-2); }
.popup-sub { font-size: 12px; color: var(--ink-3); }
.mapboxgl-popup-content { font-family: var(--sans); font-size: 13px; color: var(--ink); }

.results-banner { margin-top: 18px; padding: 12px 14px; background: var(--paper-2); font-size: 15px; color: var(--ink-2); border-radius: var(--radius); }
.results-banner[hidden] { display: none; }
.density { display: flex; align-items: center; gap: 6px; margin-top: 16px; }
.density[hidden] { display: none; }
.density-label { font-size: 13px; color: var(--ink-3); margin-right: 4px; }
.density-btn { min-height: 32px; padding: 3px 10px; font-size: 13px; }

/* Record rows: a finding aid. Shared by the browser, topic, case and related lists. */
.rec-list { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.rec-list[hidden] { display: none; }
.rec { border-bottom: 1px solid var(--rule); }
.rec-link {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 170px 170px; gap: 4px 20px;
  grid-template-areas: "thumb main meta when";
  padding: 16px 6px 16px 0; color: var(--ink); text-decoration: none; align-items: start;
}
.rec-thumb { grid-area: thumb; }
.rec-main { grid-area: main; }
.rec-meta { grid-area: meta; }
.rec-when { grid-area: when; }
.rec-link:hover { background: #f7f8fa; color: var(--ink); text-decoration: none; }
.rec-link:hover .rec-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.rec-thumb { width: 96px; height: 72px; background: var(--paper-2); overflow: hidden; position: relative; }
.rec-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rec-thumb img.is-missing { visibility: hidden; }
.rec-thumb.is-video::after {
  content: ''; position: absolute; left: 6px; bottom: 6px; width: 0; height: 0;
  border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.7));
}
.rec-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rec-code { font-size: 12.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.rec-title { font-family: var(--serif); font-size: 18.5px; line-height: 1.3; font-weight: 500; overflow-wrap: anywhere; }
.rec-snippet { font-size: 14px; line-height: 1.5; color: var(--ink-2); margin-top: 4px; overflow-wrap: anywhere; }
.rec-snippet-src { color: var(--ink-3); font-weight: 600; }
.rec-flag { font-size: 13px; color: var(--ink-3); }
.rec-meta { display: flex; flex-direction: column; font-size: 14px; color: var(--ink-2); line-height: 1.4; padding-top: 2px; }
.rec-format { color: var(--ink-3); }
.rec-when { font-size: 14px; color: var(--ink-2); line-height: 1.4; padding-top: 2px; overflow-wrap: anywhere; }
.rec-list .empty, .results-grid .empty { padding: 32px 0; color: var(--ink-2); font-size: 16px; list-style: none; }
.rec-list-compact .rec-link { grid-template-columns: 72px minmax(0, 1fr) 160px 160px; padding-block: 12px; }
.rec-list-compact .rec-thumb { width: 72px; height: 54px; }
.rec-list-compact .rec-title { font-size: 16.5px; }

/* Image grids */
.results-grid { display: none; }
.results-grid.is-active {
  display: grid; grid-template-columns: repeat(var(--grid-cols, 6), minmax(0, 1fr));
  gap: 22px 16px; margin-top: 18px;
}
.tile {
  display: flex; flex-direction: column; gap: 8px; padding: 0; border: 0; background: none;
  text-align: left; color: var(--ink); text-decoration: none; min-width: 0;
}
.tile:hover { color: var(--ink); text-decoration: none; }
.tile-media { position: relative; aspect-ratio: 4 / 3; background: var(--paper-2); overflow: hidden; }
.tile-media img { width: 100%; height: 100%; object-fit: cover; }
.tile-media img.is-missing { visibility: hidden; }
.tile-media.is-video::after {
  content: ''; position: absolute; left: 8px; bottom: 8px; border-style: solid;
  border-width: 7px 0 7px 12px; border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.7));
}
.tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-kicker { font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.02em; overflow-wrap: anywhere; }
.tile-title {
  font-family: var(--serif); font-size: 15px; line-height: 1.3; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tile:hover .tile-title { text-decoration: underline; text-underline-offset: 0.18em; }
.tile-sub { font-size: 12.5px; color: var(--ink-3); }

/* Pager */
.pager { margin-top: 24px; }
.pager nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pager button {
  min-width: 40px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums;
}
.pager button:hover:not(:disabled) { border-color: var(--ink); }
.pager button[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager-of { margin-left: auto; font-size: 14px; color: var(--ink-3); }
.pager .pager-more { width: 100%; font-weight: 600; }
.pager-done { font-size: 14px; color: var(--ink-3); }

/* Frequent words */
.words { margin-top: var(--section); padding: var(--section) 0; background: var(--paper-2); }
.words + .site-footer, .words ~ .site-footer { margin-top: 0; }
.wordcloud ul { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; }
.wordcloud a { font-family: var(--serif); color: var(--ink-3); text-decoration: none; line-height: 1.2; }
.wordcloud a[data-weight="2"] { color: var(--ink-2); }
.wordcloud a[data-weight="3"] { color: var(--ink); font-weight: 500; }
.wordcloud a:hover { color: var(--link); text-decoration: underline; }

body.has-active-filter .ways,
body.has-active-filter .notable,
body.has-active-filter .words { display: none; }
body.has-active-filter .browser { padding-top: 32px; }

/* Modals */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 30, 0.86); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-shell { position: relative; background: #fff; width: min(1100px, 100%); max-height: 100%; overflow: auto; padding: 16px; border-radius: var(--radius); }
.modal-close {
  display: block; margin: 0 0 12px auto; min-height: 36px; padding: 4px 14px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: #fff; font-size: 14px; font-weight: 600;
}
.modal-shell img, .modal-shell video { width: 100%; max-height: 70vh; object-fit: contain; background: #0c1124; }
.im-caption, .vm-caption { margin-top: 12px; }
.modal-title { font-family: var(--serif); font-size: 18px; line-height: 1.35; }
.modal-sub { font-size: 14px; color: var(--ink-3); margin-top: 2px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.modal-actions a {
  padding: 8px 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius);
  font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none;
}
.modal-actions a:hover { border-color: var(--ink); }
.modal-actions a.is-primary { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ------------------------------------------------------------- record -- */

.record-head { padding: 26px 0 32px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; font-size: 14px; color: var(--ink-3); }
.crumbs li + li::before { content: '/'; margin: 0 9px; color: var(--rule-strong); }
.crumbs a { color: var(--ink-2); }
.record-code { margin: 26px 0 6px; font-size: 14.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.03em; font-variant-numeric: tabular-nums; }
.crumbs + .record-title { margin-top: 26px; }
.record-title {
  font-family: var(--serif); font-size: clamp(1.85rem, 1.35rem + 1.7vw, 2.75rem); line-height: 1.12;
  letter-spacing: -0.015em; max-width: 30ch; overflow-wrap: anywhere; font-variation-settings: 'opsz' 60;
}
.catalog {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin: 26px 0 0;
  border-top: 1px solid var(--rule-strong);
}
.catalog > div { padding: 11px 18px 11px 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.catalog dt { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.catalog dd { margin: 2px 0 0; font-size: 15.5px; overflow-wrap: anywhere; }
.catalog-wide { grid-column: 1 / -1; }
.case-note { margin-top: 18px; font-size: 15.5px; color: var(--ink-2); }
.record-desc { margin-top: 26px; }
.record-desc .label { margin-bottom: 6px; }
.record-note { margin-top: 16px; padding: 10px 14px; background: var(--paper-2); font-size: 15px; color: var(--ink-2); max-width: 82ch; border-radius: var(--radius); }
.record-note .label { display: inline; margin-right: 6px; color: var(--ink); }

.viewer { background: var(--table); padding: 28px 0 32px; }
.viewer-title { font-family: var(--serif); font-size: 22px; margin-bottom: 8px; }
.viewer-note { font-size: 14px; color: var(--ink-3); margin-bottom: 14px; }
.viewer-missing { font-size: 16px; padding: 24px; background: #fff; }

.dualpane { background: #fff; border: 1px solid var(--rule-strong); }
.dualpane-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.dualpane-meta { font-size: 14px; color: var(--ink-2); margin-right: auto; }
.dualpane-search-badge { margin-left: 8px; color: var(--ink); font-weight: 600; }
.dualpane-search input {
  width: min(320px, 100%); height: 38px; padding: 0 10px; border: 1px solid var(--rule-strong);
  border-radius: var(--radius); font-size: 15px; background: #fff;
}
.dualpane-toggles { display: flex; gap: 4px; }
.dualpane-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: clamp(480px, 78vh, 980px); }
.dualpane[data-view="text"] .dualpane-body { grid-template-columns: minmax(0, 1fr); }
.dualpane[data-view="text"] .dualpane-pdf { display: none; }
.dualpane[data-view="text"] .dualpane-text { border-right: 0; }
.dualpane[data-view="pdf"] .dualpane-body { grid-template-columns: minmax(0, 1fr); }
.dualpane[data-view="pdf"] .dualpane-text { display: none; }
.doc-text {
  font-family: var(--serif); font-size: 17px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
  color: var(--ink);
}
.dualpane-text { overflow: auto; padding: 20px 28px 40px; border-right: 1px solid var(--rule); }
.dualpane[data-view="split"] .doc-text { font-size: 15.5px; }
.ocr-page {
  display: block; white-space: normal; font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink-3);
  margin: 26px 0 8px; padding-top: 12px; border-top: 1px solid var(--rule); scroll-margin-top: 12px;
}
.doc-text > .ocr-page:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.ocr-page.jump-target { background: var(--mark); transition: background 0.6s; }
mark.search-hit { background: var(--mark); }
mark.search-hit.first { outline: 2px solid #d7a800; }
.dualpane-pdf { background: #52565e; min-height: 0; }
.dualpane-pdf iframe { width: 100%; height: 100%; border: 0; display: block; }
.dualpane-foot { padding: 8px 12px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-3); }
.pdf-only iframe { display: block; width: 100%; height: clamp(480px, 80vh, 1000px); border: 1px solid var(--rule-strong); background: #52565e; }

.media-video { background: #000; }
.media-video video { display: block; width: 100%; max-height: 76vh; margin: 0 auto; background: #000; }
.media-audio { background: #fff; padding: 16px; border: 1px solid var(--rule-strong); }
.media-audio audio { width: 100%; display: block; }
.transcript { margin-top: 20px; background: #fff; border: 1px solid var(--rule-strong); padding: 20px 24px; }
.transcript .dualpane-text { border: 0; padding: 0; max-height: 70vh; }
.media-image { margin: 0; background: #fff; border: 1px solid var(--rule-strong); padding: 16px; }
.media-image img { margin: 0 auto; max-height: 78vh; width: auto; }
.media-image figcaption { margin-top: 10px; font-size: 13px; color: var(--ink-3); text-align: center; }
.exif { margin-top: 20px; background: #fff; border: 1px solid var(--rule-strong); padding: 20px 24px; }
.exif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 24px; margin: 0; }
.exif-grid > div { padding: 8px 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.exif-grid dt { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.exif-grid dd { margin: 2px 0 0; font-size: 14.5px; overflow-wrap: anywhere; }
.record-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.prior { padding: 36px 0 0; }
.prior .prose { margin-top: 10px; }
.prior p:last-child { margin-top: 14px; }

.record-lower { padding: var(--section) 0 0; }
.record-lower-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.record-lower-grid > :only-child { grid-column: 1 / -1; max-width: 860px; }
.summary { border: 1px dashed #9fa7ba; background: #fafbfc; padding: 22px 26px 26px; border-radius: var(--radius); }
.summary-provenance { font-size: 14px; color: var(--ink-3); margin: 6px 0 16px; max-width: 70ch; line-height: 1.5; }
.summary .prose { font-size: 17px; }
.topwords .record-wordcloud { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-top: 14px; }
.record-wordcloud a { color: var(--ink-2) !important; font-family: var(--serif); text-decoration: none; line-height: 1.25; }
.record-wordcloud a:hover { color: var(--link) !important; text-decoration: underline; }

.related { padding: var(--section) 0 0; }
.related-group { margin-top: 26px; }
.related-group h3 { font-size: 16px; font-weight: 600; }
.related-group .section-note { margin-top: 2px; font-size: 14px; }
.related-group .rec-list { margin-top: 10px; }

.prevnext { margin-top: var(--section); border-top: 1px solid var(--rule); }
.prevnext-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding-top: 20px; padding-bottom: 4px; }
.prevnext a { display: block; color: var(--ink); text-decoration: none; max-width: 52ch; }
.prevnext-next { justify-self: end; text-align: right; }
.prevnext .label { margin-bottom: 4px; }
.prevnext-title {
  font-family: var(--serif); font-size: 17px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.prevnext a:hover .prevnext-title { text-decoration: underline; text-underline-offset: 0.18em; }

/* ------------------------------------------------------- list + text pages -- */

.page-head { padding-top: 30px; padding-bottom: 26px; }
.page-head .crumbs { margin-bottom: 24px; }
.page-head h1, .prose-page h1, .notfound h1 {
  font-family: var(--serif); font-size: clamp(2rem, 1.55rem + 1.5vw, 2.85rem); line-height: 1.1;
  letter-spacing: -0.015em; font-variation-settings: 'opsz' 60;
}
.page-facts { margin-top: 12px; font-size: 15px; color: var(--ink-3); max-width: 75ch; }
.page-list .rec-list { margin-top: 0; }
.siblings { margin-top: 24px; }
.siblings .label { margin-bottom: 8px; }
.term-list { list-style: none; margin: 0; padding: 0; columns: 3 220px; column-gap: 32px; }
.term-list li { break-inside: avoid; font-size: 16px; padding: 3px 0; }
.term-list-wide { columns: 2 320px; margin-top: 16px; }
.topic-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 36px 40px; padding-top: 8px; }
.topic-group .term-list { columns: 1; margin-top: 12px; }
.topic-group { border-top: 1px solid var(--rule-strong); padding-top: 14px; }
.topic-group .section-title { font-size: 1.35rem; }

.release-list { list-style: none; margin: 0; padding: 0; }
.release { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 32px; padding: 26px 0; border-top: 1px solid var(--rule-strong); scroll-margin-top: 12px; }
.release:target { background: linear-gradient(var(--paper-2), var(--paper-2)) no-repeat; background-size: 100% 100%; }
.release-head h2 { font-family: var(--serif); font-size: 28px; letter-spacing: -0.01em; }
.release-date { font-size: 15.5px; color: var(--ink); margin-top: 4px; }
.release-total { font-size: 15px; color: var(--ink-2); margin-top: 2px; }
.release-debuts { font-size: 14px; color: var(--ink-3); margin-top: 8px; }
.release-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.release-cols .label { margin-bottom: 8px; }
.tally { list-style: none; margin: 0; padding: 0; }
.tally li { display: flex; gap: 12px; font-size: 15px; padding: 3px 0; border-bottom: 1px solid var(--rule); }
.tally-n { flex: 0 0 3ch; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.case-files { padding-top: var(--section); scroll-margin-top: 12px; }

.prose-page { padding-top: 40px; }
.prose-page .lede { margin-top: 16px; }
.prose-page .page-facts { margin-top: 10px; }
.prose-page h2 { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; margin: 38px 0 10px; letter-spacing: -0.005em; }
.prose-page p, .prose-page li { font-family: var(--serif); font-size: 18px; line-height: 1.62; max-width: 68ch; }
.prose-page p + p { margin-top: 0.8em; }
.prose-page ul { padding-left: 1.2em; margin: 0; }
.prose-page li + li { margin-top: 8px; }
.prose-page code { background: var(--paper-2); padding: 1px 5px; border-radius: 2px; }
.code-line { margin: 10px 0 12px; }
.code-line code { display: inline-block; padding: 8px 12px; font-size: 15px; overflow-wrap: anywhere; }
.data-table { width: 100%; border-collapse: collapse; margin: 6px 0 18px; }
.data-table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-3); padding: 0 12px 8px 0; border-bottom: 1px solid var(--rule-strong); }
.data-table td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top; font-size: 15.5px; line-height: 1.5; }
.data-table td:first-child { font-weight: 600; overflow-wrap: anywhere; width: 42%; }
.cite-example { margin: 16px 0; padding: 16px 20px; background: var(--paper-2); border-radius: var(--radius); }
.cite-example p { font-size: 16.5px; overflow-wrap: anywhere; }

.notfound { padding-top: 64px; padding-bottom: 24px; }
.notfound .kicker { margin-bottom: 10px; }
.notfound .lede { margin-bottom: 28px; }
.notfound-search label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.notfound-search input { border-color: var(--rule-strong); }
.notfound > p:last-child { margin-top: 18px; font-size: 16px; }

/* ---------------------------------------------------------- responsive -- */

@media (max-width: 1180px) {
  .rec-link, .rec-list-compact .rec-link {
    grid-template-columns: 96px minmax(0, 1fr) 170px;
    grid-template-areas: "thumb main meta" "thumb main when";
    grid-template-rows: auto 1fr;
  }
  .rec-list-compact .rec-link { grid-template-columns: 72px minmax(0, 1fr) 160px; }
  .notable-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { max-width: 22ch; }
  .ways-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 0; }
  .way:nth-child(odd) { padding-left: 0; border-left: 0; }
  .browser-layout { grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 14px; }
  .filters-toggle {
    display: inline-flex; align-items: center; min-height: 38px; margin-left: auto; padding: 6px 14px;
    border: 1px solid var(--rule-strong); border-radius: var(--radius); background: #fff; font-size: 14px; font-weight: 600;
  }
  .filters-toggle[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
  .filters { display: none; position: static; margin-bottom: 18px; }
  .filters.is-open { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
  .filters.is-open .filter-active, .filters.is-open .filters-more { grid-column: 1 / -1; }
  .notable-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-lower-grid { grid-template-columns: minmax(0, 1fr); }
  .release { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

@media (max-width: 760px) {
  .site-header-inner { flex-wrap: wrap; gap: 0; padding-top: 12px; }
  .wordmark { font-size: 22px; }
  .site-nav {
    width: calc(100% + 2 * var(--gutter)); margin: 4px calc(-1 * var(--gutter)) 0; padding: 0 calc(var(--gutter) - 7px);
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { white-space: nowrap; padding: 10px 7px 9px; font-size: 14.5px; }
  .nav-long { display: none; }
  .hero-dek { font-size: 16px; }
  .search-row input { height: 50px; font-size: 16px; }
  .search-row button { height: 50px; padding: 0 16px; }
  .plate-frames { aspect-ratio: 4 / 3; }
  .plate-label { flex-basis: 100%; order: -1; margin-bottom: -2px; }
  .plate-ticks { flex: 1 1 auto; justify-content: space-between; gap: 3px; }
  .plate-ticks li { flex: 1 1 0; }
  .plate-ticks button { width: 100%; height: 36px; }
  .plate-controls { gap: 8px; }

  .rec-link, .rec-list-compact .rec-link {
    grid-template-columns: 72px minmax(0, 1fr); gap: 3px 14px; padding: 14px 0;
    grid-template-areas: "thumb main" "thumb meta" "thumb when";
    grid-template-rows: auto auto 1fr;
  }
  .rec-thumb, .rec-list-compact .rec-thumb { width: 72px; height: 54px; }
  .rec-meta, .rec-when { padding-top: 0; font-size: 13.5px; }
  .rec-meta { flex-direction: row; flex-wrap: wrap; }
  .rec-format::before { content: ', '; }
  .rec-title { font-size: 17px; }

  .results-grid.is-active { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .views { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; scrollbar-width: none; }
  .views::-webkit-scrollbar { display: none; }
  .views button { flex: 0 0 auto; white-space: nowrap; }
  .timeline-track { min-width: 520px; }
  .filters.is-open { grid-template-columns: minmax(0, 1fr); }

  .catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog > div { padding-right: 12px; }
  .dualpane-toolbar { gap: 8px; }
  .dualpane-meta { flex-basis: 100%; }
  .dualpane-search { flex: 1 1 100%; }
  .dualpane-search input { width: 100%; }
  .dualpane-toggles button[data-view-set="split"] { display: none; }
  .dualpane-body { height: auto; grid-template-columns: minmax(0, 1fr); }
  .dualpane-text { max-height: 75vh; border-right: 0; padding: 16px 16px 28px; }
  .dualpane[data-view="split"] .dualpane-pdf, .dualpane[data-view="pdf"] .dualpane-pdf { height: 75vh; }
  .doc-text { font-size: 16.5px; }
  .summary { padding: 18px; }
  .prevnext-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .prevnext-next { justify-self: start; text-align: left; }
  .release-cols { gap: 20px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .data-table td:first-child { width: 46%; }
}

@media (max-width: 520px) {
  .ways-grid { gap: 24px 0; padding-top: 28px; padding-bottom: 28px; }
  .way { padding: 0 0 0 16px; }
  .way h2 { font-size: 20px; }
  .way p, .way ul { font-size: 14.5px; }
  .notable-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  /* Phones get the first eight; every record is in the list below. */
  .notable-grid li:nth-child(n + 9) { display: none; }
  .term-list { columns: 1; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table td { padding: 2px 0; border: 0; }
  .data-table td:first-child { width: 100%; padding-top: 12px; }
  .data-table tr { border-bottom: 1px solid var(--rule); padding-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .plate-frame { transition: none; }
  .ocr-page.jump-target { transition: none; }
}

@media print {
  .site-header, .site-footer, .hero, .ways, .notable, .words, .filters, .views, .timeline-shell,
  .record-actions, .prevnext, .dualpane-toolbar, .dualpane-pdf { display: none !important; }
  .dualpane-body { display: block; height: auto; }
  .dualpane-text { overflow: visible; max-height: none; }
}
