/* --------------------------------------------------------------------------
   YSF DASHBOARD — project layer.

   Loaded AFTER assets/brand.css (vendored, never edited) and BEFORE the page
   markup. Drives three things:

     1. The slot override.  The pack's GUIDE §2 documents `--brand-accent` as
        the single point of variation, but the vendored brand.css does not
        alias every accent role to it (the shadow tokens are literal).  This
        file performs the aliasing so changing `--brand-accent` cascades to
        every accent role.  Currently set to phosphor cyan to match the morse
        trainer at 4e9kkz-morse.duckdns.org — same callsign, same operator,
        same family.

     2. Density override.  The pack's spacing scale (2/4/8/12/16/24/32/40/48/64)
        is ~50% too loose for a single 1080p ham-shack monitor.  Re-scaled to
        75% for cards, sections, and headers, but the typography, radius,
        shadow, and motion scales are unchanged.

     3. Project-level components the pack does not ship.  Specifically:
          - .activity-table  molecule (Last Heard, Linked Gateways)
          - .connect-panel   the endpoint panel
          - .on-air          active-transmission callout
          - .system-strip    one-row operator telemetry
          - .stat            label/value pair inside the system strip
          - .tag--ok/warn/err/info  status variants
          - [data-fresh]     row-level "new since last refresh" affordance
          - .icon            inline-SVG sizing + currentColor stroke contract
        All of these resolve only through pack tokens — no raw hex, no
        arbitrary px outside the pack's scale, no border-radius > 0 except
        2px (inputs) and 9999px (pills).

   Hierarchy contract (2026-11-04): the page is weighted by what a visitor
   came for, not by what the server knows.

     endpoint / live callsign   --text-xl (32px)   ← the reason to be here
     identity                    --text-lg (24px)
     operator telemetry          --text-sm (14px)  ← demoted to one strip
     labels / chrome             --text-xs (12px)

   a11y: respects prefers-reduced-motion and forced-colors throughout.
   -------------------------------------------------------------------------- */

/* ----- fonts (self-hosted, no Google Fonts CSP widening) ----------------- */

/* JetBrains Mono only.  The pack rule is "mono for chrome, sans for prose";
   every string on this dashboard is chrome (labels, values, callsigns), so
   the Inter webfont was shipped, downloaded, and never used — 48 KB of dead
   weight on every page load.  Prose would reintroduce it. */

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-var.woff2") format("woff2");
}

/* ----- slot override: cyan, 11.4:1 on canvas (AAA) ----------------------- */

:root {
  color-scheme: dark;
  --brand-accent: #00d9e8;       /* override the accent (slot §2 of the pack) */
  --accent: var(--brand-accent); /* the pack's own --accent literal */
  --accent-hover: var(--brand-accent);
  --accent-subtle: #002a2e;     /* was the pack's lime #1a1f00 — slot mismatch */
  --shadow-hard: 4px 4px 0 var(--brand-accent);
  --shadow-hard-hover: 8px 8px 0 var(--brand-accent);
  --shadow-pressed: 2px 2px 0 var(--brand-accent);

  /* Contrast fixes (2026-11-04):
       --text-subtle #7a7a7a on --canvas-raised #141414 = 4.29:1, which
       fails WCAG AA (4.5:1) for normal text and was carrying the 12px
       time column, the card meta, the stat sub-labels, the connect
       labels and every empty state.  #8f8f8f = 5.70:1.
       --border-hairline on --canvas-raised = 1.12:1 — the table row
       rules were effectively invisible.  --border-rule #2e2e2e reads
       as a rule without shouting; the column header rule stays on
       --border-strong. */
  --text-subtle: #8f8f8f;
  --border-rule: #2e2e2e;
}

/* ----- density override (75% of pack defaults) --------------------------- *
 * Only the spacing scale is shrunk. Typography, color, radius, shadow, and
 * motion stay at the pack's defaults so visual rhythm is preserved.
 * -------------------------------------------------------------------------- */

:root {
  --space-1: 3px;
  --space-2: 6px;
  --space-3: 9px;
  --space-4: 12px;
  --space-6: 18px;
  --space-8: 24px;
  --space-10: 28px;
  --space-12: 32px;
  --space-16: 48px;
}

/* The pack's components declare `display`, which beats the UA's [hidden]
   rule. We toggle [hidden] on nodes that carry pack classes (loading state,
   ON AIR callout), so restore hiding once, here, instead of per element. */
[hidden] {
  display: none !important;
}

/* ----- body + layout shell ---------------------------------------------- */

body {
  margin: 0;
  background: var(--canvas-base);
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: var(--leading-normal);
}

/* Flex column, not grid areas: a hidden band (ON AIR while the channel is
   quiet) must collapse completely — grid-template-areas would leave an empty
   row behind and pay the row-gap for it.  margin-block-start:auto on the
   footer parks it at the bottom of the viewport. */
.app {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  max-inline-size: 1280px;
  margin: 0 auto;
  min-block-size: 100dvh;
}

@media (min-width: 768px) {
  .app {
    gap: var(--space-6);
    padding: var(--space-6);
  }
}

.app__header    { order: 1; }
.app__connect   { order: 2; }
.app__onair     { order: 3; }
.app__activity  { order: 4; }
.app__system    { order: 5; }
.app__footer    { order: 6; }

/* ----- skip link -------------------------------------------------------- */

.skip-link {
  position: absolute;
  inset-inline-start: var(--space-2);
  inset-block-start: calc(-1 * var(--space-16));
  z-index: var(--z-nav);
  padding-block: var(--space-3);
  padding-inline: var(--space-4);
  border-radius: var(--radius-none);
  background: var(--accent);
  color: var(--text-inverse);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-decoration: none;
}

.skip-link:focus {
  inset-block-start: var(--space-2);
}

/* ----- site header (callsign + tagline + LIVE) --------------------------- *
 * Borderless bar with a rule under it.  The old version wrapped the header
 * in a card, which made nine separate boxes on the page and gave the
 * identity no more weight than a stat tile.
 * -------------------------------------------------------------------------- */

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block-end: var(--space-3);
  border-block-end: 1px solid var(--border-hairline);
  flex-wrap: wrap;
}

.app-header__id {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-inline-size: 0;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin: 0;
  /* allow the wordmark to shrink below its content width on narrow
     viewports.  Default min-width: auto on a flex item pins the
     intrinsic content width, which on a 375 px phone was wider than
     the available column and forced the whole grid wider. */
  min-width: 0;
}

.app-header__brand > svg.brand-mark {
  /* the brand mark stays at 24 px; only the wordmark span shrinks/wraps */
  flex-shrink: 0;
}

.app-header__tagline {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.app-header__status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.app-header__refresh {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-subtle);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 479px) {
  .app-header__brand { font-size: var(--text-md); }
}

/* brand mark — a 24x24 tile + a "Y" stroke + accent underline.
   Uses pack's --accent token, mirrors the morse mark. */
.brand-mark {
  display: block;
  /* --mark-size never existed in the pack; the token is --brand-mark-size.
     The old rule therefore resolved to an invalid var() and the flex
     shorthand fell back to flex: 0 1 auto, letting the mark shrink. */
  inline-size: var(--brand-mark-size);
  block-size: var(--brand-mark-size);
  flex: 0 0 var(--brand-mark-size);
}

.brand-mark .mark-tile {
  fill: var(--canvas-base);
  stroke: var(--accent);
}

.brand-mark .mark-letter {
  fill: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: var(--weight-bold);
  text-anchor: middle;
  dominant-baseline: central;
}

.brand-mark .mark-underline {
  fill: var(--accent);
}

/* ----- tag variants (status semantics the pack defines but doesn't expose) */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding-block: 2px;
  padding-inline: var(--space-2);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  line-height: var(--leading-none);
  white-space: nowrap;
}

.tag--ok {
  color: var(--status-ok-fg);
  background: var(--status-ok-bg);
  border-color: var(--status-ok-fg);
}

.tag--warn {
  color: var(--status-warn-fg);
  background: var(--status-warn-bg);
  border-color: var(--status-warn-fg);
}

.tag--err {
  color: var(--status-err-fg);
  background: var(--status-err-bg);
  border-color: var(--status-err-fg);
}

.tag--info {
  color: var(--status-info-fg);
  background: var(--status-info-bg);
  border-color: var(--status-info-fg);
}

.tag--accent {
  color: var(--text-inverse);
  background: var(--accent);
  border-color: var(--accent);
}

/* Forced-colors mode: status colors collapse to one Highlight fill, so the
   tag variants become visually identical.  Add a left-border bar (a
   non-color cue) so OK / WARN / ERR / INFO remain distinguishable in
   Windows High Contrast.  The :before marker is hidden by default to keep
   sighted users unaffected. */
@media (forced-colors: active) {
  .tag { forced-color-adjust: none; }
  .tag--ok,
  .tag--warn,
  .tag--err,
  .tag--info {
    border-inline-start-width: 4px;
  }
}

/* ----- spinner (polling-alive) ------------------------------------------- */

.spinner {
  display: inline-block;
  inline-size: 12px;
  block-size: 12px;
  border: 1.5px solid var(--border-strong);
  border-block-start-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 3s;
  }
}

/* ----- connect panel (the "how do I connect" surface) ------------------- *
 * The old connect bar was four equal grey fragments spread with
 * space-between: the endpoint a visitor came for had the same weight as
 * "MODE C4FM" and sat in the middle of the strip.  Here the endpoint is
 * the headline (accent, 32px), COPY sits next to it, and the constants
 * drop to a metadata row.
 * -------------------------------------------------------------------------- */

.connect-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--canvas-raised);
  border: 1px solid var(--border-hairline);
  border-inline-start: 3px solid var(--accent);
}

.connect-panel__main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.connect-panel__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.connect-panel__value {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--accent);
  letter-spacing: var(--tracking-wide);
  font-variant-numeric: tabular-nums;
  /* a long host on a 320 px phone must break rather than push the page */
  overflow-wrap: anywhere;
}

.connect-panel__copy {
  margin-inline-start: auto;
  min-block-size: 36px;
}

.connect-panel__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  list-style: none;
  margin: 0;
  padding: 0;
}

.connect-panel__item {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.connect-panel__key {
  color: var(--text-subtle);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.connect-panel__val {
  color: var(--text-muted);
}

/* ----- ON AIR (only rendered while a station holds the channel) --------- */

.on-air {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--status-err-bg);
  border: 1px solid var(--status-err-fg);
  border-inline-start-width: 4px;
}

.on-air__head {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.on-air__dot {
  inline-size: 8px;
  block-size: 8px;
  background: var(--status-err-fg);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
  flex: 0 0 8px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

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

.on-air__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--status-err-fg);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

/* The callsign is the single most important string on the page while the
   channel is busy — it outranks the endpoint and the wordmark. */
.on-air__callsign {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-wide);
}

.on-air__callsign a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--status-err-fg);
  text-underline-offset: 3px;
}

.on-air__callsign a:hover,
.on-air__callsign a:focus-visible {
  color: var(--status-err-fg);
}

.on-air__meta {
  margin-inline-start: auto;
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.on-air__field {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.on-air__key {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

.on-air__val {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

/* ----- activity: last heard (primary) + linked gateways (live rail) ----- */

.app__activity {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

@media (min-width: 900px) {
  .app__activity {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: var(--space-6);
    align-items: start;
  }
}

/* Stacked order on narrow screens: live data first, history second.
   LAST_HEARD_FIRST flips it (see index.php). */
@media (max-width: 899px) {
  .card--rail { order: -1; }
  .app--lh-first .card--table { order: -1; }
  .app--lh-first .card--rail { order: 0; }
}

/* value-change tick: the gateway badge flashes once when the count moves */
.badge--tick {
  animation: badge-tick var(--motion-slow) var(--motion-easing) 1;
}

@keyframes badge-tick {
  from { background-color: var(--canvas-sunken); }
  to   { background-color: transparent; }
}

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


/* ----- card chrome (panels) ---------------------------------------------- */

.card {
  background: var(--canvas-raised);
  border: 1px solid var(--border-hairline);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-inline-size: 0;
}

.card__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card__icon {
  inline-size: 20px;
  block-size: 20px;
  color: var(--text-muted);
  flex: 0 0 20px;
}

.card__title {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin: 0;
  color: var(--text-primary);
}

.card__meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-subtle);
  margin-inline-start: auto;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

/* ----- activity table (project molecule — pack has no table component) -- */

.table-scroll {
  overflow-x: auto;
}

.activity-table {
  inline-size: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  table-layout: fixed;
}

.activity-table th,
.activity-table td {
  text-align: start;
  padding-block: var(--space-2);
  padding-inline: var(--space-3);
  border-block-end: 1px solid var(--border-rule);
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.activity-table th {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  border-block-end-color: var(--border-strong);
  white-space: nowrap;
}

.activity-table td {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.activity-table td:first-child {
  color: var(--text-subtle);
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* Fixed column widths so the columns pack to the left instead of
   stretching across the full card and leaving 300 px of dead air
   between CALLSIGN and TARGET. */
.activity-table--heard th:nth-child(1),
.activity-table--heard td:nth-child(1) { inline-size: 168px; }
.activity-table--heard th:nth-child(2),
.activity-table--heard td:nth-child(2) { inline-size: 148px; }
.activity-table--heard th:nth-child(3),
.activity-table--heard td:nth-child(3) { inline-size: 112px; }

/* The rail is a 340 px column: a full timestamp does not fit beside a
   callsign there (the fixed-width table clipped it).  Stack them —
   callsign first, timestamp under it — and drop the header row. */
.activity-table--rail thead {
  display: none;
}

.activity-table--rail,
.activity-table--rail tbody {
  display: block;
}

.activity-table--rail tbody tr {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-block: var(--space-2);
  border-block-end: 1px solid var(--border-rule);
}

.activity-table--rail tbody td {
  display: block;
  border: 0;
  padding: 0;
  inline-size: auto;
}

.activity-table--rail tbody td:nth-child(2) {
  order: -1;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.activity-table--rail tbody td:nth-child(1) {
  font-size: var(--text-xs);
}

.activity-table--rail tbody tr:last-child {
  border-block-end: 0;
}

.activity-table tbody tr:last-child td {
  border-block-end: none;
}

/* Rows are keyboard-reachable (tabindex=0 on <tr>); the focus ring has to
   be visible on a table row, so it is drawn inside the row box. */
.activity-table tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.activity-table a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}

.activity-table a:hover,
.activity-table a:focus-visible {
  text-decoration-color: var(--accent);
  color: var(--accent);
}

/* new-since-last-refresh row: accent left border for one refresh cycle, then
   the JS removes the data-fresh attribute */
.activity-table tbody tr[data-fresh="true"] td:first-child {
  border-inline-start: 2px solid var(--accent);
  padding-inline-start: calc(var(--space-3) - 2px);
}

@media (prefers-reduced-motion: no-preference) {
  .activity-table tbody tr[data-fresh="true"] {
    animation: row-flash var(--motion-slow) var(--motion-easing) 1;
  }
}

@keyframes row-flash {
  from { background-color: var(--canvas-sunken); }
  to   { background-color: transparent; }
}

/* empty cell (one row, full span) */
.activity-table__empty {
  text-align: center !important;
  color: var(--text-subtle);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  padding-block: var(--space-6) !important;
}

/* ----- system strip (operator telemetry, one dense row) ----------------- *
 * Demoted from four 163 px tiles.  It is real information for the
 * operator and noise for a visitor, so it gets one line and a 14 px value.
 * -------------------------------------------------------------------------- */

.system-strip {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--canvas-raised);
  border: 1px solid var(--border-hairline);
}

.system-strip__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.system-strip__items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  margin: 0;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: var(--font-mono);
}

.stat__label {
  font-size: var(--text-xs);
  color: var(--text-subtle);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.stat__value {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* Threshold states: the value colour changes AND a text flag appears, so
   the state is not carried by colour alone (WCAG 1.4.1). */
.stat--alert .stat__value { color: var(--status-err-fg); }
.stat--warn  .stat__value { color: var(--status-warn-fg); }

.stat__flag {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  margin: 0;
  color: var(--status-err-fg);
}

.stat--warn .stat__flag { color: var(--status-warn-fg); }

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

.site-footer {
  /* override the brand pack's space-between (which left-aligns a single
     child) — centre the line, like the morse site's footer */
  justify-content: center;
  /* allow wrap so a long single line doesn't push the page wider than
     the viewport on narrow phones (the previous version with 3 inline
     links + separators overflowed the 375 px viewport by ~120 px) */
  flex-wrap: wrap;
  text-align: center;
  /* park the footer at the bottom of the viewport on short pages */
  margin-block-start: auto;
  padding-block: var(--space-4);
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border-rule);
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ----- live regions (sr-only) ------------------------------------------- */

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

/* ----- icon sizing (24x24 default, 16x16 in chrome) --------------------- */

.icon {
  display: inline-block;
  inline-size: 24px;
  block-size: 24px;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  flex: 0 0 auto;
}

.icon--sm {
  inline-size: 16px;
  block-size: 16px;
}

.icon--xs {
  inline-size: 12px;
  block-size: 12px;
}

/* ----- boot loading state ----------------------------------------------- *
 * The dashboard is server-rendered, so by the time the HTML parses the
 * data is already in place.  A body.booting fade-in delayed perceived
 * load on every refresh (5 s on the first poll due to setInterval
 * timing), so the state was removed.  The "(Ns ago)" counter on the
 * refresh label is the honest indicator of data freshness.
 * -------------------------------------------------------------------------- */

/* ----- mobile touch targets (a11y: WCAG 2.5.5, 44x44 minimum) -------- *
 * Phones at 375-414 px have a tighter tap-precision budget than desktop
 * and the brand pack's defaults leave several interactive elements well
 * under 44 px tall (callsign links in tables: 18 px; footer links:
 * 36 px; skip link: 39 px).  This block bumps the tap area without
 * changing the visual size — the text stays at 14 px, the link just
 * gets a larger invisible hit box via min-block-size + display swap.
 * Scoped to mobile so desktop tap targets aren't affected.
 * -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .skip-link {
    min-block-size: 44px;
  }

  .activity-table a {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
  }

  .site-footer a {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
  }

  .connect-panel__copy {
    inline-size: 100%;
    margin-inline-start: 0;
    min-block-size: 44px;
  }
}

/* ----- mobile: stacked activity rows ----------------------------------- *
 * A four-column mono table on a 375 px phone is four cramped columns or
 * a horizontal scroll.  Below 640 px each row becomes a two-line block:
 * callsign + time on the first line, target + gateway on the second.
 * -------------------------------------------------------------------------- */
@media (max-width: 639px) {
  /* 32 px endpoint breaks a 29-character host into three lines on a
     375 px phone.  24 px keeps it to two. */
  .connect-panel__value {
    font-size: var(--text-lg);
  }

  /* the ON AIR metadata was pushed to the far edge by the auto margin —
     on a phone it reads as a stray right-aligned fragment */
  .on-air__meta {
    margin-inline-start: 0;
    inline-size: 100%;
    gap: var(--space-3) var(--space-6);
  }

  .activity-table--heard thead {
    display: none;
  }

  .activity-table--heard,
  .activity-table--heard tbody {
    display: block;
  }

  .activity-table--heard tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-3);
    padding-block: var(--space-3);
    border-block-end: 1px solid var(--border-rule);
  }

  .activity-table--heard tbody td {
    display: block;
    border: 0;
    padding: 0;
    inline-size: auto;
  }

  .activity-table--heard tbody td:nth-child(2) {
    order: -2;
    flex: 1 1 auto;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
  }

  .activity-table--heard tbody td:nth-child(1) {
    order: -1;
    flex: 0 0 auto;
  }

  .activity-table--heard tbody td:nth-child(3),
  .activity-table--heard tbody td:nth-child(4) {
    flex: 0 0 100%;
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  .activity-table--heard tbody td:nth-child(3)::before,
  .activity-table--heard tbody td:nth-child(4)::before {
    content: attr(data-label) " ";
    color: var(--text-subtle);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  .activity-table--heard tbody tr:last-child {
    border-block-end: 0;
  }

  .activity-table--heard tbody .activity-table__empty {
    flex: 0 0 100%;
  }
}
