/*
 * Callbooks.org: Edition Line (brand pack v1.0, callbooks-cmo work/M2-brand-pack).
 * A slate band on every page, one typeface (Libre Franklin, self-hosted in /static/fonts/),
 * paper and ink. Brass (--needle) marks the year or listing in view and nothing else.
 * No framework.
 */

:root {
  --paper: #f5f6f4;
  --paper-2: #e7ebeb;
  --ink: #1a2229;
  --ink-2: #4a5660;
  --hair: #c5cdd0;
  --band: #22374a;
  --band-ink: #f5f6f4;
  --band-ink-2: #c3ccd3;
  --accent: #28506e;
  --accent-ink: #ffffff;
  --needle: #8f5c00;
  --flag: #f6dd8c;
  --flag-ink: #1a2229;
  --sans: "Libre Franklin", "Franklin Gothic Medium", Arial, sans-serif;
  --radius: 4px;
  --measure: 46rem;
  --gutter: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11171c;
    --paper-2: #19222a;
    --ink: #e6eaec;
    --ink-2: #a3afb7;
    --hair: #2a3540;
    --band: #1b2c3a;
    --band-ink: #e6eaec;
    --band-ink-2: #a3afb7;
    --accent: #94bfe0;
    --accent-ink: #11171c;
    --needle: #e9b14e;
    --flag: #6a5212;
    --flag-ink: #fff1c9;
  }
}

:root[data-theme="dark"] {
  --paper: #11171c;
  --paper-2: #19222a;
  --ink: #e6eaec;
  --ink-2: #a3afb7;
  --hair: #2a3540;
  --band: #1b2c3a;
  --band-ink: #e6eaec;
  --band-ink-2: #a3afb7;
  --accent: #94bfe0;
  --accent-ink: #11171c;
  --needle: #e9b14e;
  --flag: #6a5212;
  --flag-ink: #fff1c9;
}

*, *::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: 400 1.0625rem/1.55 var(--sans);
  font-kerning: normal;
  font-variant-numeric: lining-nums;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main, .masthead-in, .searchbar, .colophon {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main { flex: 1; padding-block: 1.5rem 3rem; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 0.06em; }
a:hover { text-decoration-thickness: 0.12em; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3 { font-weight: 700; line-height: 1.2; margin: 0; }
h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.9em; }

mark {
  background: var(--flag);
  color: var(--flag-ink);
  padding: 0 0.1em;
  border-radius: 0.1em;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.9rem;
  z-index: 10;
}
.skip:focus { left: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- masthead: the slate band, full width, the logo in its dark version in both themes ---- */

.masthead {
  background: var(--band);
  color: var(--band-ink);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.masthead-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.25rem;
  padding-block: 0.95rem;
}

.brand { display: block; flex: none; line-height: 0; }
.brand img { display: block; height: 2.125rem; width: auto; }

.masthead nav { display: flex; align-items: baseline; gap: 1.1rem; font-size: 0.95rem; font-weight: 500; flex-wrap: wrap; justify-content: flex-end; }
.masthead nav a, .masthead button.linklike { color: var(--band-ink); }
.masthead .who { color: var(--band-ink-2); }
.masthead :focus-visible { outline-color: var(--band-ink); }
.who { color: var(--ink-2); overflow-wrap: anywhere; }
form.inline { display: inline; margin: 0; }

button.linklike {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* ---- search form ---- */

.find .field { display: flex; gap: 0.5rem; }

.find input.q {
  flex: 1;
  min-width: 0;
  font: 1.1rem/1.3 var(--sans);
  padding: 0.6rem 0.75rem;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}
.find input.q::placeholder { color: var(--ink-2); opacity: 0.8; }

button[type="submit"], .button {
  display: inline-block;
  font: 700 1rem/1.3 var(--sans);
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}
button[type="submit"]:hover, .button:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.searchbar { padding-block: 0.9rem 0; }
.find.compact input.q { font-size: 1rem; padding: 0.45rem 0.6rem; }
.find.compact button[type="submit"] { padding: 0.45rem 0.9rem; }

.narrow { margin-top: 0.5rem; font-size: 0.95rem; color: var(--ink-2); }
.narrow summary { cursor: pointer; width: fit-content; }
.narrow-fields { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; padding-top: 0.6rem; }
.narrow-fields label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; font-weight: 500; }
.narrow-fields input, .narrow-fields select {
  font: 1rem/1.3 var(--sans);
  padding: 0.35rem 0.5rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink-2);
  border-radius: var(--radius);
  min-width: 6rem;
}

/* ---- home ---- */

.hero { padding-block: 1.5rem 2rem; }
.hero h1 { font-size: clamp(2.1rem, 7vw, 3.375rem); line-height: 1.06; letter-spacing: -0.022em; max-width: 14em; margin-bottom: 0.75rem; }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 32em; margin-bottom: 1.5rem; }
.find.hero .find-label { display: block; font-size: 0.95rem; font-weight: 500; color: var(--ink-2); margin-bottom: 0.3rem; }
.find.hero input.q { font-size: 1.35rem; padding: 0.8rem 0.9rem; }
.find.hero button[type="submit"] { padding-inline: 1.5rem; font-size: 1.1rem; }
.try { margin: 0.9rem 0 0; color: var(--ink-2); }

.index-facts { margin-top: 2rem; }
.index-facts h2 { margin-bottom: 0.6rem; }

dl.leaders { margin: 0; max-width: 30rem; }
.leaders > div { display: flex; align-items: baseline; gap: 0.4rem; padding-block: 0.15rem; }
.leaders dt { display: flex; flex: 1; align-items: baseline; gap: 0.4rem; margin: 0; }
.leaders dt::after { content: ""; flex: 1; border-bottom: 2px dotted var(--hair); transform: translateY(-0.3em); }
.leaders dd { margin: 0; font-variant-numeric: tabular-nums lining-nums; font-weight: 700; }

/* ---- results ---- */

.results-head, .callhead, .viewer-head { margin-bottom: 1rem; }
.results-head h1 { font-size: 1.5rem; overflow-wrap: anywhere; }
.count { margin: 0.25rem 0 0; color: var(--ink-2); font-size: 0.95rem; }

/* A call-sign query's way to its call page: a filled button, the first thing under the heading. */
.callcard {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-block: 0 1.5rem;
  padding: 0.9rem 1.1rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent-ink);
  text-decoration: none;
  background: var(--accent);
}
.callcard:hover, .callcard:focus-visible { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.callcard .plate { color: inherit; }
.callcard-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.callcard-text strong { font-size: 1.1rem; font-weight: 700; }
.callcard-text span { font-size: 0.95rem; }
.callcard-go { font: 700 1.6rem/1 var(--sans); }

.search-all { margin: 0.35rem 0 0; font-size: 0.95rem; }

/* The call sign: the one loud thing on the page, in the heaviest weight. */
.plate {
  display: inline-block;
  font: 800 1.6rem/1 var(--sans);
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}
h1.plate { font-size: clamp(2.6rem, 12vw, 4.5rem); letter-spacing: -0.03em; line-height: 0.95; margin: 0.1rem 0 0.2rem; }

.edition { margin-top: 1.75rem; }
.edition-head {
  font-size: 1rem;
  font-weight: 700;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--hair);
  padding-block: 0.3rem;
  margin-bottom: 0.25rem;
}

ol.entries { list-style: none; margin: 0; padding: 0; }

.entry {
  display: grid;
  grid-template-columns: 6.25rem minmax(0, 1fr);
  gap: 0 0.9rem;
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--hair);
}
/* The listing in view: highlighted, with the brass needle down its edge. */
.entry:target { background: var(--flag); color: var(--flag-ink); box-shadow: inset 4px 0 0 var(--needle); }
.entry:target .meta { color: var(--flag-ink); }
.entry .call { font: 800 1.05rem/1.45 var(--sans); letter-spacing: -0.01em; }
.entry .call a { color: var(--ink); text-decoration: none; }
.entry .call a:hover { color: var(--accent); text-decoration: underline; }
.entry-body { min-width: 0; }
.entry .text { margin: 0; overflow-wrap: anywhere; }
.entry .meta, .license .meta { margin: 0.25rem 0 0; font-size: 0.88rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; align-items: baseline; }
.edition-name { font-weight: 500; }
.where { white-space: nowrap; }

.badge {
  display: inline-block;
  font-size: 0.8rem;
  line-height: 1.3;
  font-weight: 500;
  padding: 0 0.45rem;
  border: 1px solid var(--ink-2);
  border-radius: var(--radius);
  color: var(--ink);
}
.badge.fcc { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.badge.ocr { border-style: dashed; }

.ocr-head { margin-top: 2.25rem; font-size: 1.1rem; }

.note { color: var(--ink-2); }
.more { margin-top: 1.5rem; }

/* ---- the sign-in prompt where the free view ends ---- */

.gate {
  margin-block: 1.75rem;
  padding: 1rem 1.1rem;
  border: 0;
  border-top: 6px solid var(--band);
  border-radius: var(--radius);
  background: var(--paper-2);
  max-width: 34rem;
}
.gate p { margin-bottom: 0.6rem; }
.gate p:last-child { margin-bottom: 0; }
.gate-lead { font-weight: 700; font-size: 1.1rem; }

/* ---- call sign page ---- */

.callhead { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; }
.callhead .count { margin: 0.2rem 0 0; }

.timeline > h2, .fcc-section > h2 { border-bottom: 2px solid var(--ink); padding-bottom: 0.2rem; margin-bottom: 0.5rem; }
.fcc-section { margin-top: 2rem; }

.year { margin-top: 1rem; display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0 0.5rem; align-items: start; }
.year-label { font: 700 1.1rem/1.9 var(--sans); font-variant-numeric: tabular-nums lining-nums; padding-top: 0.55rem; position: sticky; top: 0; }
.year .entries { grid-column: 2; }
.year .entry { grid-template-columns: minmax(0, 1fr); }
.year .entry .call { display: none; }

.crop {
  display: block;
  position: relative;
  overflow: hidden;
  margin-top: 0.5rem;
  max-width: 32rem;
  border: 1px solid var(--hair);
  background: var(--paper-2);
}
.crop img { position: absolute; display: block; max-width: none; height: auto; }

.ocr-variants { margin-top: 2rem; }
.ocr-variants summary { cursor: pointer; font-weight: 700; }

.license { padding-block: 0.7rem; border-bottom: 1px solid var(--hair); }
.license .text { margin: 0; }
.events { list-style: none; margin: 0.5rem 0 0; padding: 0 0 0 0.9rem; border-left: 3px solid var(--hair); font-size: 0.95rem; }
.events li { padding-block: 0.1rem; }
.events time { font-size: 0.9rem; font-variant-numeric: tabular-nums lining-nums; margin-right: 0.6rem; }

/* ---- page viewer ---- */

.back { margin: 0 0 0.6rem; font-size: 0.95rem; }
.viewer-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; align-items: baseline; font-size: 0.95rem; }
/* The highlight toggle: a link without script, a button with it (app.js); both look the same. */
.toggle-hit {
  margin-left: auto;
  font: 700 0.9rem/1.3 var(--sans);
  padding: 0.25rem 0.7rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}
.toggle-hit:hover { background: var(--ink); color: var(--paper); }
.toggle-hit[aria-pressed="true"] { background: var(--paper-2); }
.toggle-hit[aria-pressed="true"]:hover { background: var(--ink); color: var(--paper); }
.sheet { position: relative; margin: 0.5rem 0 0; max-width: 100%; background: var(--paper-2); border: 1px solid var(--ink); }
.sheet img { display: block; width: 100%; height: auto; }
/* The listing in view on the scanned page: brass outline, highlight wash. */
.hit {
  position: absolute;
  display: block;
  border: 3px solid var(--needle);
  background: color-mix(in srgb, var(--flag) 45%, transparent);
  border-radius: 2px;
  box-shadow: 0 0 0 2px var(--paper);
  animation: arrive 0.9s ease-out 1;
}
.hit[hidden] { display: none; }
@keyframes arrive {
  from { box-shadow: 0 0 0 0 var(--needle); }
  to { box-shadow: 0 0 0 2px var(--paper); }
}

/* ---- prose pages and messages ---- */

.prose { max-width: 38rem; }
.prose h1 { margin-bottom: 0.8rem; }
.prose h2 { margin: 1.6rem 0 0.4rem; }

.message { max-width: 34rem; padding-block: 1.5rem; }
.message h1 { margin-bottom: 0.6rem; }
.message .actions { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; }
.message p { margin-bottom: 0.8rem; }

/* ---- sign-in, removal form, admin queue ---- */

.form { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; margin: 1.1rem 0; }
.form label { font-size: 0.95rem; font-weight: 500; color: var(--ink-2); margin-top: 0.5rem; }
.form input[type="email"], .form input[type="text"], .form input:not([type]), .form textarea {
  width: 100%;
  font: 1.05rem/1.3 var(--sans);
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}
.form textarea { resize: vertical; }
.form button[type="submit"] { margin-top: 0.8rem; }
.error { color: var(--ink); background: var(--paper-2); border-left: 4px solid var(--ink); padding: 0.5rem 0.8rem; margin: 0.6rem 0 0; font-weight: 700; }
.notice { background: var(--paper-2); border-left: 4px solid var(--accent); padding: 0.5rem 0.8rem; }
/* The honeypot: out of sight and out of the tab order, but present in the markup for bots. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.listing-box { border: 1px solid var(--hair); border-radius: var(--radius); background: var(--paper-2); padding: 0.7rem 0.9rem; margin: 0.6rem 0; width: 100%; }
.listing-box p { margin: 0 0 0.3rem; }
.listing-box p:last-child { margin-bottom: 0; }
.listing-box .meta, .request .meta, .legal .meta { color: var(--ink-2); font-size: 0.9rem; }

.admin { max-width: var(--measure); }
.admin h1 { margin-bottom: 0.4rem; }
.request { border-top: 2px solid var(--ink); padding-block: 1rem 0.4rem; }
.request h2 { font-size: 1.1rem; display: flex; flex-wrap: wrap; gap: 0.1rem 0.8rem; align-items: baseline; }
.request .text { margin: 0.3rem 0; overflow-wrap: anywhere; }
.request .reason { white-space: pre-wrap; color: var(--ink-2); }
.request-actions { display: flex; flex-wrap: wrap; gap: 0.2rem 1.5rem; align-items: flex-end; }
.form.row { flex-direction: row; align-items: flex-end; flex-wrap: wrap; gap: 0.5rem 0.8rem; margin: 0.6rem 0; }
.form.row label { display: flex; flex-direction: column; gap: 0.2rem; margin: 0; }
.form.row input { width: 9rem; }
.form.row button[type="submit"] { margin-top: 0; }
button[type="submit"].secondary { background: transparent; color: var(--ink); }
button[type="submit"].secondary:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.legal ul { padding-left: 1.3rem; margin: 0.4rem 0 0.8rem; }
.legal li { margin-bottom: 0.4rem; }

/* ---- colophon ---- */

.colophon {
  border-top: 2px solid var(--ink);
  padding-block: 1rem 2rem;
  font-size: 0.88rem;
  color: var(--ink-2);
}
.colophon p { margin: 0 0 0.4rem; }
.colophon a { margin-right: 1rem; color: var(--ink-2); }

/* ---- phones ---- */

@media (max-width: 34rem) {
  :root { --gutter: 1rem; }
  body { font-size: 1rem; }
  .entry { grid-template-columns: minmax(0, 1fr); }
  .entry .call { font-size: 1rem; margin-bottom: 0.1rem; }
  .year { grid-template-columns: minmax(0, 1fr); }
  .year-label { position: static; padding-top: 0; line-height: 1.5; }
  .year .entries { grid-column: 1; }
  .callcard { flex-wrap: wrap; gap: 0.4rem 0.75rem; }
  .callcard-text { order: 1; flex-basis: 100%; }
  .callcard-go { margin-left: auto; }
  .find .field { flex-direction: column; }
  .find.hero button[type="submit"] { width: 100%; }
  .masthead-in { flex-wrap: wrap; }
  .brand img { height: 1.875rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hit { animation: none; }
}

@media print {
  .masthead nav, .searchbar, .colophon, .gate, .skip, .back, .viewer-nav { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
