:root {
  --paper: #ffffff;
  --paper-alt: #f1f3f5;
  --ink: #1b2430;
  --muted: #4f5b67;
  --rule: #d5dae0;
  --control: #6b7785;   /* form/button borders: 3:1 against paper */
  --link: #1f4fbf;
  --focus: #1f4fbf;
  --stamp: #a3122a;
  --on-ink: #ffffff;
  --measure: 70ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12171d;
    --paper-alt: #1c242d;
    --ink: #e6eaee;
    --muted: #a7b1bc;
    --rule: #2f3944;
    --control: #7d8996;
    --link: #8db4ff;
    --focus: #8db4ff;
    --stamp: #ff8a9a;
    --on-ink: #12171d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--link); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
#app:focus, h1:focus, h2:focus { outline: none; }

.wrap { max-width: 64rem; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

.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: 16px; top: -100px; z-index: 10;
  background: var(--ink); color: var(--on-ink); padding: 10px 16px; font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* Header and footer */
.site-header { padding: 40px 0 28px; border-bottom: 2px solid var(--ink); margin-bottom: 32px; }
.brand {
  color: var(--ink); text-decoration: none;
  font-size: clamp(2rem, 5.5vw, 3rem); font-weight: 800; line-height: 1; letter-spacing: -.03em;
}
.brand:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.tagline { margin: 12px 0 0; max-width: 52ch; color: var(--muted); font-size: 1.125rem; }

.site-footer { margin-top: 64px; padding: 20px 0 40px; border-top: 1px solid var(--rule); color: var(--muted); font-size: .9375rem; }
.site-footer p { margin: 0; max-width: var(--measure); }

/* Search and filters */
.finder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 16rem) auto; gap: 12px 16px; align-items: end; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; min-height: 48px; padding: 10px 14px;
  font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--control); border-radius: 6px;
}
.field input::placeholder { color: var(--muted); opacity: 1; }
.field input:focus-visible, .field select:focus-visible { outline-offset: 0; border-color: var(--focus); }

.results-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 32px 0 0; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.results-head p { margin: 0; }
.results-head h2 { margin: 0; font-size: 1.125rem; font-weight: 700; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: 6px;
  font: inherit; font-size: .9375rem; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer;
  background: var(--ink); color: var(--on-ink); border: 2px solid var(--ink);
}
.btn:hover { text-decoration: underline; }
.btn.secondary { background: var(--paper); color: var(--ink); border-color: var(--control); }
.btn.secondary:hover { border-color: var(--ink); }
.btn.plain { background: none; border-color: transparent; color: var(--link); text-decoration: underline; padding-inline: 8px; }

/* Record list: a register of releases, each with a stamp in the margin */
.records { list-style: none; margin: 0; padding: 0; }
.record {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); grid-template-areas: "stamp body";
  gap: 0 28px; padding: 28px 0; border-bottom: 1px solid var(--rule);
}
.record-body { grid-area: body; max-width: var(--measure); }
.record .stamp { grid-area: stamp; align-self: start; }
.record h3 { margin: 0 0 4px; font-size: 1.3125rem; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
.record h3 a { color: var(--ink); text-decoration: none; }
.record h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.agency { margin: 0 0 8px; color: var(--muted); font-size: .9375rem; }
.summary {
  margin: 0 0 12px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
.empty { padding: 32px 0; max-width: var(--measure); }
.empty p { margin: 0 0 12px; }

.stamp {
  display: block; width: 100%; padding: 8px 6px 7px;
  color: var(--stamp); border: 3px double var(--stamp); border-radius: 4px;
  text-align: center; text-transform: uppercase; letter-spacing: .05em;
  font-size: .75rem; font-weight: 800; line-height: 1.25;
  transform: rotate(-3deg);
}
.stamp-n { display: block; font-size: 2rem; line-height: 1; letter-spacing: -.02em; }
.stamp-date { display: block; margin-top: 6px; padding-top: 5px; border-top: 1px solid currentColor; letter-spacing: .02em; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tag {
  display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px;
  border-radius: 4px; background: var(--paper-alt); color: var(--ink);
  font-size: .875rem; text-decoration: none; border: 1px solid transparent;
}
.tag:hover { border-color: var(--control); text-decoration: underline; }

/* Record detail */
.back { display: inline-block; margin-bottom: 24px; font-weight: 600; }
.detail h1 {
  margin: 0 0 16px; max-width: 30ch;
  font-size: clamp(1.75rem, 4.5vw, 2.625rem); line-height: 1.15; font-weight: 800; letter-spacing: -.025em;
}
.detail-top { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: 28px; align-items: start; }
.detail-summary { max-width: var(--measure); margin: 0 0 20px; font-size: 1.125rem; }
.points { max-width: var(--measure); margin: 0 0 24px; padding-left: 1.25em; }
.points li { margin-bottom: 8px; padding-left: 4px; }
.points li::marker { color: var(--muted); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0 0 20px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

.files-head { margin: 48px 0 0; padding-bottom: 12px; border-bottom: 2px solid var(--ink); font-size: 1.375rem; font-weight: 800; letter-spacing: -.01em; }
.files { list-style: none; margin: 0; padding: 0; }
.file { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.file-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.file-head h3 { flex: 1 1 20rem; display: flex; align-items: baseline; gap: 10px; margin: 0; font-size: 1.0625rem; font-weight: 600; overflow-wrap: anywhere; }
.ftype {
  flex: none; min-width: 3.25rem; padding: 1px 6px; border: 1px solid var(--control); border-radius: 3px;
  color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-align: center;
}
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.no-preview { align-self: center; color: var(--muted); font-size: .875rem; margin-right: 4px; }
.viewer-slot:not(:empty) { margin-top: 16px; }
.viewer { display: block; width: 100%; height: 85vh; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper-alt); }
img.viewer { height: auto; }

@media (max-width: 720px) {
  .finder { grid-template-columns: 1fr; }
  .finder .btn { justify-self: start; }
  .record { grid-template-columns: 1fr; grid-template-areas: "body" "stamp"; padding: 24px 0; }
  .record .stamp { display: flex; align-items: baseline; justify-content: center; gap: 8px; width: auto; justify-self: start; margin-top: 16px; padding: 6px 12px; transform: rotate(-2deg); }
  .record .stamp-n { display: inline; font-size: 1.25rem; }
  .record .stamp-date { display: inline; margin: 0; padding: 0 0 0 8px; border-top: 0; border-left: 1px solid currentColor; }
  .detail-top { grid-template-columns: 1fr; }
  .detail-top .stamp { display: none; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 10px; }
  .viewer { height: 75vh; }
}

@media (forced-colors: active) {
  .btn, .tag { border: 1px solid ButtonText; }
  .stamp { border-color: CanvasText; color: CanvasText; }
}

@media print {
  .skip-link, .finder, .file-actions, .viewer-slot { display: none; }
  .stamp { transform: none; }
}
