/* Shared page styling for every HFKit page.
 *
 * Loaded before each page's own <style>, so a page can override anything here
 * at equal specificity simply by declaring it later. Tokens only: every colour,
 * space and size below is a --hf-* custom property from the theme package.
 *
 * What lives here is the vocabulary the pages share — page frame, headings,
 * cards, buttons, inputs, status tags, callouts, folds. Page-specific layout
 * stays on the page. */

*, *::before, *::after { box-sizing: border-box }
[hidden] { display: none !important }

html { -webkit-text-size-adjust: 100% }
body {
  margin: 0;
  background: var(--hf-surface-default);
  color: var(--hf-text-primary);
  font-family: var(--hf-font-family-sans);
  font-size: var(--hf-font-size-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--hf-accent-interactive) }
a:hover { color: var(--hf-accent-interactive-hover) }
:focus-visible {
  outline: var(--hf-focus-ring-width) solid var(--hf-focus-ring-color);
  outline-offset: var(--hf-focus-ring-offset);
}
code, .mono { font-family: var(--hf-font-family-mono); font-variant-numeric: tabular-nums }
.muted { color: var(--hf-text-muted) }
.small { font-size: var(--hf-font-size-sm) }
.xs { font-size: var(--hf-font-size-xs) }

/* --- page frame ---------------------------------------------------------- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: var(--hf-spacing-6);
}
.page-head { display: flex; flex-direction: column; gap: var(--hf-spacing-2) }
h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -.02em;
  line-height: 1.15;
  text-wrap: balance;
}
.lede { margin: 0; color: var(--hf-text-secondary); max-width: 70ch; text-wrap: pretty }
.kicker {
  font-family: var(--hf-font-family-mono);
  font-size: var(--hf-font-size-xs);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--hf-text-muted);
}
h2.label, .label {
  margin: 0 0 var(--hf-spacing-3);
  font-size: var(--hf-font-size-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--hf-text-muted);
  font-weight: var(--hf-font-weight-semibold);
}

/* --- cards --------------------------------------------------------------- */
.card {
  background: var(--hf-surface-raised);
  border: 1px solid var(--hf-border-subtle);
  border-radius: var(--hf-radius-md);
  padding: var(--hf-spacing-4);
  min-width: 0;
}
.card.sunken { background: var(--hf-surface-sunken) }
.card.accent { border-left: 4px solid var(--hf-accent-interactive) }

/* --- buttons ------------------------------------------------------------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--hf-spacing-2);
  padding: var(--hf-button-padding-y) var(--hf-button-padding-x);
  border-radius: var(--hf-button-radius);
  border: 1px solid var(--hf-button-border);
  background: var(--hf-button-background);
  color: var(--hf-button-foreground);
  font: inherit;
  font-size: var(--hf-font-size-sm);
  font-weight: var(--hf-font-weight-semibold);
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--hf-duration-fast) var(--hf-easing-standard),
              border-color var(--hf-duration-fast) var(--hf-easing-standard);
}
.btn:hover { background: var(--hf-button-background-hover); color: var(--hf-button-foreground) }
.btn:active { background: var(--hf-button-background-active) }
.btn:disabled { opacity: .5; cursor: default }
.btn.primary {
  background: var(--hf-accent-interactive);
  border-color: var(--hf-accent-interactive);
  color: var(--hf-accent-on-accent);
}
.btn.primary:hover { background: var(--hf-accent-interactive-hover); border-color: var(--hf-accent-interactive-hover); color: var(--hf-accent-on-accent) }
.btn.primary:active { background: var(--hf-accent-interactive-active) }
.btn.ghost { background: transparent; border-color: transparent; color: var(--hf-text-secondary) }
.btn.ghost:hover { background: var(--hf-surface-raised); color: var(--hf-text-primary) }
.btn.big { font-size: var(--hf-font-size-md); padding: var(--hf-spacing-3) var(--hf-spacing-5) }
.btn.small { font-size: var(--hf-font-size-xs); padding: 4px 10px }

/* --- form controls ------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0 }
.field > label, .field > .fl {
  font-size: var(--hf-font-size-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--hf-text-muted);
  font-weight: var(--hf-font-weight-semibold);
}
.field .val {
  font-family: var(--hf-font-family-mono);
  font-size: var(--hf-font-size-xs);
  color: var(--hf-text-secondary);
  font-variant-numeric: tabular-nums;
  text-transform: none;
  letter-spacing: 0;
}
.field .help { font-size: var(--hf-font-size-xs); color: var(--hf-text-muted) }
.input, select.input, input.input, textarea.input {
  width: 100%;
  background: var(--hf-surface-sunken);
  color: var(--hf-text-primary);
  border: 1px solid var(--hf-border-default);
  border-radius: var(--hf-radius-sm);
  padding: 7px 10px;
  font-family: inherit;
  font-size: var(--hf-font-size-sm);
  min-height: 36px;
}
.input::placeholder { color: var(--hf-text-muted) }
.input.mono { font-family: var(--hf-font-family-mono) }
input[type=range].range { width: 100%; accent-color: var(--hf-accent-interactive); margin: 6px 0 }

/* Segmented control: one pressed button, marked with fill and weight. */
.seg {
  display: inline-flex;
  border: 1px solid var(--hf-border-default);
  border-radius: var(--hf-radius-md);
  overflow: hidden;
  background: var(--hf-surface-raised);
}
.seg button {
  appearance: none; border: 0; cursor: pointer; font: inherit;
  font-size: var(--hf-font-size-sm); padding: 6px 14px;
  background: transparent; color: var(--hf-text-secondary);
}
.seg button + button { border-left: 1px solid var(--hf-border-default) }
.seg button:hover { color: var(--hf-text-primary) }
.seg button[aria-pressed=true] {
  background: var(--hf-accent-interactive);
  color: var(--hf-accent-on-accent);
  font-weight: var(--hf-font-weight-semibold);
}
.seg.small button { padding: 3px 10px; font-size: var(--hf-font-size-xs) }

/* Chips: removable tokens (frequencies, sites, antennas). */
.chips { display: flex; gap: var(--hf-spacing-2); flex-wrap: wrap; align-items: center }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 12px;
  border-radius: var(--hf-radius-full);
  border: 1px solid var(--hf-border-default);
  background: var(--hf-surface-sunken);
  font-size: var(--hf-font-size-sm);
  line-height: 1.3;
}
.chip.mono { font-family: var(--hf-font-family-mono); font-variant-numeric: tabular-nums }
.chip[aria-current=true], .chip.on {
  border-color: var(--hf-accent-interactive);
  background: var(--hf-accent-interactive);
  color: var(--hf-accent-on-accent);
}
.chip button { appearance: none; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0 }
.chip .x { font-size: 15px; line-height: 1; opacity: .65; padding: 0 2px }
.chip .x:hover { opacity: 1 }
.chip .sub { font-size: var(--hf-font-size-xs); opacity: .75 }

/* --- status -------------------------------------------------------------- */
.tag {
  display: inline-block;
  padding: 1px 9px;
  border-radius: var(--hf-radius-full);
  font-size: var(--hf-font-size-xs);
  font-weight: var(--hf-font-weight-semibold);
  line-height: 1.5;
  white-space: nowrap;
  background: var(--hf-surface-sunken);
  color: var(--hf-text-secondary);
  border: 1px solid var(--hf-border-subtle);
}
.tag.good   { background: var(--hf-status-good-fill);   color: var(--hf-status-good-on);   border-color: transparent }
.tag.fair   { background: var(--hf-status-fair-fill);   color: var(--hf-status-fair-on);   border-color: transparent }
.tag.poor   { background: var(--hf-status-poor-fill);   color: var(--hf-status-poor-on);   border-color: transparent }
.tag.closed { background: var(--hf-status-closed-fill); color: var(--hf-status-closed-on); border-color: transparent }
.tag.stale  { background: var(--hf-status-stale-fill);  color: var(--hf-status-stale-on);  border-color: transparent }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--hf-border-default); vertical-align: middle }
.dot.good { background: var(--hf-status-good-fill) }
.dot.fair { background: var(--hf-status-fair-fill) }
.dot.poor { background: var(--hf-status-poor-fill) }
.dot.closed { background: var(--hf-status-closed-fill) }

/* Callouts: a left rule in the status colour, never a filled box of text. */
.callout {
  border-left: 3px solid var(--hf-accent-interactive);
  background: var(--hf-surface-sunken);
  border-radius: var(--hf-radius-sm);
  padding: var(--hf-spacing-3) var(--hf-spacing-4);
  font-size: var(--hf-font-size-sm);
  color: var(--hf-text-secondary);
}
.callout b { color: var(--hf-text-primary) }
.callout.good { border-left-color: var(--hf-status-good-fill) }
.callout.fair { border-left-color: var(--hf-status-fair-fill) }
.callout.poor { border-left-color: var(--hf-status-poor-fill) }
.callout.closed { border-left-color: var(--hf-status-closed-fill) }
.callout.stale { border-left-color: var(--hf-status-stale-fill) }
.callout + .callout { margin-top: var(--hf-spacing-2) }

/* Stat tiles: a label, a big tabular number, a unit. */
.stats { display: grid; gap: var(--hf-spacing-3); grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) }
.stat { background: var(--hf-surface-sunken); border-radius: var(--hf-radius-sm); padding: var(--hf-spacing-3); display: flex; flex-direction: column; gap: 1px; min-width: 0 }
.stat .k { font-size: var(--hf-font-size-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--hf-text-muted) }
.stat .v { font-family: var(--hf-font-family-mono); font-size: var(--hf-font-size-xl); font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere }
.stat .u { font-size: var(--hf-font-size-xs); color: var(--hf-text-secondary) }

/* --- folds: depth on demand --------------------------------------------- */
details.more {
  background: var(--hf-surface-raised);
  border: 1px solid var(--hf-border-subtle);
  border-radius: var(--hf-radius-md);
  padding: var(--hf-spacing-3) var(--hf-spacing-4);
}
details.more + details.more { margin-top: var(--hf-spacing-3) }
details.more > summary {
  cursor: pointer;
  font-size: var(--hf-font-size-sm);
  font-weight: var(--hf-font-weight-semibold);
  color: var(--hf-text-secondary);
  list-style-position: outside;
}
details.more > summary:hover { color: var(--hf-text-primary) }
details.more > summary::marker { color: var(--hf-text-muted) }
details.more[open] > summary { margin-bottom: var(--hf-spacing-4) }
details.more .fine {
  color: var(--hf-text-muted);
  font-size: var(--hf-font-size-sm);
  display: flex; flex-direction: column; gap: var(--hf-spacing-3);
  max-width: 80ch;
}
details.more .fine b { color: var(--hf-text-secondary) }
/* An inline "learn more" that opens beneath a sentence rather than in a box. */
details.inline { display: inline }
details.inline > summary {
  display: inline; cursor: pointer; list-style: none;
  color: var(--hf-accent-interactive); font-size: var(--hf-font-size-xs);
  border-bottom: 1px dotted currentColor;
}
details.inline > summary::-webkit-details-marker { display: none }
details.inline > .fine { display: block; margin-top: var(--hf-spacing-2); color: var(--hf-text-secondary); font-size: var(--hf-font-size-sm); max-width: 70ch }

/* Jargon, glossed rather than removed. */
.gloss { border-bottom: 1px dotted var(--hf-text-muted); cursor: help; text-decoration: none }

/* --- lists and footers --------------------------------------------------- */
ul.plain { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: var(--hf-spacing-2); color: var(--hf-text-secondary) }
.site-footer {
  border-top: 1px solid var(--hf-border-subtle);
  padding-top: var(--hf-spacing-4);
  color: var(--hf-text-muted);
  font-size: var(--hf-font-size-xs);
  display: flex; flex-direction: column; gap: 6px;
  max-width: 90ch;
}
.site-footer strong { color: var(--hf-text-secondary) }

/* --- helpers ------------------------------------------------------------- */
.row { display: flex; gap: var(--hf-spacing-3); flex-wrap: wrap; align-items: center }
.row.between { justify-content: space-between }
.grid-2 { display: grid; gap: var(--hf-spacing-4); grid-template-columns: 1fr; align-items: start }
@media (min-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) } }
.grid-3 { display: grid; gap: var(--hf-spacing-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) }
.vis-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important }
}
