/* VK7 Centenary Documents.

   Two typefaces. A monospace for everything amateur radio writes in columns
   (the wordmark, callsigns, dates, metadata, recognised text) and a serif for
   reading. Colours come off a valve-era receiver: a dark instrument panel at
   the top of the page, printed card below it, dial-glass teal for anything
   you can act on, and a dial-lamp amber used in exactly one place, marking
   search hits.

   Nothing loads from outside your server. No webfonts, no CDN, no tracking.
   The whole look is the token block below; change those values and the site
   changes with them. */

:root {
  /* Surfaces */
  --panel: #14262b;
  --panel-ink: #d9e2e1;
  --panel-dim: #93a5a6;
  --paper: #edefee;
  --card: #ffffff;

  /* Text */
  --ink: #15191b;
  --muted: #5f6b6d;
  --rule: #d3d8d7;
  --rule-strong: #b3bcbb;

  /* Accents */
  --accent: #145b63;
  --accent-deep: #0d3f45;
  --accent-soft: #e0ebec;
  --mark: #ffd66b;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 64ch;
  --gap: 1.75rem;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

.wrap { width: min(74rem, calc(100% - var(--pad) * 2)); margin-inline: auto; }

a { color: var(--accent); text-underline-offset: 0.16em; }
a:hover { color: var(--accent-deep); text-decoration-thickness: 2px; }

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

.skip { position: absolute; left: -9999px; background: var(--card); padding: 0.6rem 1rem; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; }

::selection { background: var(--mark); color: var(--ink); }

/* Masthead: the nameplate on the front of the set ---------------------- */

.masthead { background: var(--panel); color: var(--panel-ink); }
.masthead-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.1rem;
}
.wordmark {
  margin: 0;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.wordmark a { color: inherit; text-decoration: none; }
.wordmark a:hover { color: #fff; }
.masthead nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.masthead nav a {
  color: var(--panel-dim);
  text-decoration: none;
  padding-block: 0.15rem;
}
.masthead nav a:hover { color: #fff; }
.masthead nav a[aria-current] {
  color: var(--panel-ink);
  box-shadow: inset 0 -2px 0 var(--mark);
}
.masthead :focus-visible { outline-color: var(--mark); }

main { padding-block: clamp(2rem, 5vw, 3.5rem) 5rem; }

h1 {
  font-size: clamp(1.65rem, 1.1rem + 2vw, 2.5rem);
  line-height: 1.12;
  margin: 0 0 0.6rem;
  letter-spacing: -0.018em;
  font-weight: 600;
}
h2 { font-size: 1.2rem; margin: 0 0 0.9rem; font-weight: 600; letter-spacing: -0.005em; }
.lede { color: var(--muted); max-width: var(--measure); margin-top: 0; }

/* Home ----------------------------------------------------------------- */

.hero {
  max-width: 44rem;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}
.hero h1 { margin-bottom: 0.35rem; }
.tagline {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
  max-width: 36rem;
}
.searchbox { margin-bottom: 0.9rem; }
.scale {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  max-width: 34rem;
}

.split { display: grid; gap: 3rem; }
@media (min-width: 62rem) {
  .split { grid-template-columns: 15rem 1fr; gap: 4.5rem; }
}

/* Ledger rows: decades, collections ------------------------------------ */

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  border-top: 1px solid var(--rule-strong);
}
.rows li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}
.rows a { text-decoration: none; }
.rows a:hover { text-decoration: underline; }
.rows .count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}
.rows.big { font-size: 0.95rem; max-width: 34rem; }
.rows.big li { padding: 0.85rem 0; }

/* Cards ---------------------------------------------------------------- */

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
}
.card { display: flex; flex-direction: column; }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-thumb {
  display: block;
  background: var(--card);
  border: 1px solid var(--rule-strong);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  padding: 0.35rem;
}
/* An archive shows the whole item. A cropped QSL card is a lost QSL card. */
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.card-blank {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(135deg,
    var(--card), var(--card) 7px, var(--paper) 7px, var(--paper) 14px);
}
.card-link:hover .card-thumb { border-color: var(--accent); }
.card-title {
  display: block;
  margin-top: 0.65rem;
  font-size: 0.95rem;
  line-height: 1.35;
  overflow-wrap: break-word;
}
.card-link:hover .card-title { text-decoration: underline; }
.card-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
}

.empty { color: var(--muted); }

/* Pagination ----------------------------------------------------------- */

.pager {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-top: 3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule-strong);
  font-family: var(--mono);
  font-size: 0.8rem;
}
.pager .pos { color: var(--muted); }

/* Document page -------------------------------------------------------- */

.doc-head { max-width: var(--measure); margin-bottom: 2.25rem; }
.hidden-meta { display: none; }

.crumbs {
  font-family: var(--mono);
  font-size: 0.73rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 0.7rem;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

.doc-body { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 64rem) {
  .doc-body { grid-template-columns: 15rem 1fr; gap: 3.5rem; }
  .rail { position: sticky; top: 1.5rem; }
}

/* The rail reads like a catalogue slip. */
.rail dl {
  margin: 0 0 1.5rem;
  font-family: var(--mono);
  font-size: 0.79rem;
  line-height: 1.5;
  border-top: 1px solid var(--rule-strong);
}
.rail dt {
  color: var(--muted);
  padding-top: 0.55rem;
  font-size: 0.71rem;
  letter-spacing: 0.03em;
}
.rail dt:not(:first-of-type) { border-top: 1px solid var(--rule); }
.rail dd { margin: 0.12rem 0 0.7rem; overflow-wrap: break-word; }
.rail dd > div { margin-top: 0.2rem; }
.rail .provenance { font-family: var(--mono); font-size: 0.71rem; color: var(--muted); }
.rail code { word-break: break-all; }

.tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 0.08rem 0.4rem;
  margin: 0 0.2rem 0.25rem 0;
}

.download { margin: 0 0 1.25rem; }
.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  padding: 0.65rem 1.1rem;
  text-decoration: none;
}
.button:hover { background: var(--panel); color: #fff; }

.viewer {
  background: var(--card);
  border: 1px solid var(--rule-strong);
  margin-bottom: 2.5rem;
}
.viewer object { display: block; width: 100%; height: min(82vh, 48rem); border: 0; }
.viewer.photo { padding: 0.9rem; }
.viewer.photo img { display: block; width: 100%; height: auto; }
.viewer.media { padding: 1.35rem; }
.viewer.media audio, .viewer.media video { display: block; width: 100%; }
.viewer.media video { max-height: 70vh; background: var(--panel); }
.viewer.media .notice { margin: 0.9rem 0 0; }

.text-panel { max-width: 62rem; }
.notice {
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: var(--measure);
}
/* Monospace on purpose: pdftotext preserves column alignment, and a
   proportional face destroys the shape of a logbook table. */
pre.ocr {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 1.35rem;
  margin-top: 1rem;
  max-height: 46rem;
  overflow-y: auto;
}

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.25rem; }
.prose p { margin-block: 0 1rem; }

/* Footer --------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--rule-strong);
  font-family: var(--mono);
  font-size: 0.77rem;
  line-height: 1.7;
  color: var(--muted);
  padding-block: 2rem 3rem;
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); }

/* Search --------------------------------------------------------------- */

.searchbox {
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--card);
  --pagefind-ui-border: var(--rule-strong);
  --pagefind-ui-tag: var(--accent-soft);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 0;
  --pagefind-ui-font: var(--serif);
  --pagefind-ui-scale: 0.9;
}
.pagefind-ui__search-input { font-family: var(--serif); }
.pagefind-ui__result-title { font-family: var(--serif); font-weight: 600; }
.pagefind-ui__result-excerpt { font-family: var(--mono); font-size: 0.79rem; line-height: 1.55; }
.pagefind-ui mark { background: var(--mark); color: var(--ink); padding: 0 0.1em; }

/* Print: researchers print pages out ------------------------------------ */

@media print {
  .masthead, .footer, .pager, .searchbox, .skip, .download { display: none; }
  body { background: #fff; font-size: 11pt; }
  .doc-body { display: block; }
  .rail { margin-bottom: 1.5rem; }
  pre.ocr { max-height: none; overflow: visible; border-left-width: 1px; }
  a[href^="/"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #555; }
}
