/* XLX159 Reflector Hub — design system
   Operator-first. Mobile-first. Dark mode by default.
   Color system anchored on the existing XLX blue/cyan accent. */

:root {
  --bg: #0a0e14;
  --bg-elev: #11161f;
  --bg-elev-2: #1a2029;
  --border: #2a3340;
  --border-strong: #3a4555;
  --text: #ffffff;            /* main text — pure white for max contrast */
  --text-dim: #d4dde7;        /* secondary text — was #c8d2dd (~80%), now ~86% — clearly readable on translucent cards */
  --text-faint: #aab6c4;      /* tertiary text — was #97a4b3 (~62%), now ~72% — readable but still subordinate */
  --accent: #38bdf8;        /* cyan-400 */
  --accent-strong: #0ea5e9; /* cyan-500 */
  --accent-glow: rgba(56, 189, 248, 0.18);
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 8px 24px rgba(0,0,0,.5);
  --radius: 10px;
  --radius-lg: 14px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #f7f9fc;
  --bg-elev: #ffffff;
  --bg-elev-2: #e3eaf3;
  --border: #d0d8e3;
  --border-strong: #a8b4c4;
  --text: #0a0e14;
  --text-dim: #4b5563;
  --text-faint: #6b7787;
  --accent: #0284c7;
  --accent-strong: #0369a1;
  --accent-glow: rgba(2, 132, 199, 0.12);
  --shadow-1: 0 1px 2px rgba(0,0,0,.05);
  --shadow-2: 0 8px 24px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

html { color-scheme: dark light; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Reusable translucent panel — used everywhere cards/panels need to
   show the pinned background photo through. Combines a dark glass
   background with backdrop-filter blur so the photo bleeds through
   without making text hard to read. Mirrors the look of the hero
   Connect card so the entire page feels consistent. */
.glass {
  background: rgba(10, 14, 20, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.glass-soft {
  /* Slightly more transparent for nested panels (e.g. status-meta,
     infrastructure footer) so the photo watermark stays visible. */
  background: rgba(10, 14, 20, 0.42);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  backdrop-filter: blur(10px) saturate(130%);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Dark overlay layer that sits on top of the fixed hero image (z: -1)
   and below all content (z: 0 default for body, but body itself doesn't
   create a stacking context here). Sits in z-index: 0 so it overlays
   the -1 image but the page content (default z-index auto, normal
   stacking context) renders on top of it. This is what turns the
   photo from a competing visual into a subtle watermark. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg,
      rgba(10,14,20,0.15) 0%,
      rgba(10,14,20,0.08) 50%,
      rgba(10,14,20,0.28) 100%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

code, kbd, pre, samp { font-family: var(--font-mono); font-size: 0.92em; }
code { background: var(--bg-elev-2); padding: 0.15em 0.4em; border-radius: 4px; }

button {
  font: inherit;
  color: inherit;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.875rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
button:hover { background: var(--bg-elev); border-color: var(--border-strong); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* Layout */
.container { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #061018;
  padding: 0.5rem 1rem;
  z-index: 1000;
  font-weight: 600;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* Header / nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  /* Translucent header — lets the pinned photo bleed through subtly
     behind the nav so the page feels consistent with the hero treatment. */
  background: rgba(10, 14, 20, 0.5);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .site-header { background: rgba(255, 255, 255, 0.7); }

.site-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.brand-mark { display: inline-flex; align-items: center; gap: 0.45rem; }
.brand-text { font-size: 1rem; }
.brand-text .badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}
.site-nav a,
.site-nav button {
  color: var(--text-dim);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
}
.site-nav a:hover,
.site-nav button:hover { color: var(--text); background: var(--bg-elev); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--bg-elev); }
/* The nav Contact button is the primary contact entry point on the
   page (per current user preference). Make it visually obvious — accent
   pill style so it's immediately findable and obviously clickable. */
.site-nav button[data-contact-open] {
  color: #061018;
  background: var(--accent);
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  margin-left: 0.4rem;
}
.site-nav button[data-contact-open]:hover {
  background: var(--accent-strong);
  color: #061018;
}
.site-nav a:focus-visible,
.site-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.theme-toggle {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
}
.theme-toggle .sun, .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: inline; }
[data-theme="light"] .theme-toggle .sun { display: inline; }
[data-theme="light"] .theme-toggle { border-color: var(--border); }

@media (max-width: 720px) {
  .site-header .container { gap: 0.5rem; }
  .brand-text { display: none; }
  .site-nav a { padding: 0.4rem 0.55rem; font-size: 0.88rem; }
  .site-nav a.cta-nav { display: none; }
}

/* Hero — full-viewport background with silhouette image that stays
   pinned to the viewport (position: fixed) while content scrolls past.
   The hero section itself is just the text overlay; the image lives in
   a separate fixed layer behind everything. */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 600px;
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  background: transparent;
  margin: 0;
  padding: 4rem 0;
  box-sizing: border-box;
}
/* Fixed-position background layer. Sits behind every other section so
   when the user scrolls past the hero, the photo remains as a backdrop.
   Hero gets top-of-page prominence because the hero text sits on top of
   it (z-index 2); later sections also scroll over it but their own
   backgrounds cover it where needed (e.g. .alt, .section-infrastructure). */
.hero-image {
  position: fixed;
  inset: 0;
  z-index: -1;
  margin: 0;
  padding: 0;
  pointer-events: none;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  /* Lower opacity than the hero version because the photo is now a
     full-page backdrop rather than confined to the hero. Combined with
     the body::before dark gradient overlay, this creates a subtle
     watermark effect — visible but not competing with the foreground. */
  opacity: 0.55;
  filter: saturate(1.15) contrast(1.05);
}
/* Gradient overlays for text legibility: a dark wash from the top
   fading to a slightly clearer middle, then a darker bottom band to
   keep the connection card visible. */
/* Hero gradient — was a heavy 0.65→0.75 dark gradient that made the hero
   noticeably darker than the rest of the page. Removed (see the
   comment on body::before, which now provides a uniform wash across
   the entire viewport). The .hero::before pseudo-element is removed
   entirely so the body::before wash applies evenly — scrolling from
   the hero into the rest of the page is now seamless.

   The hero text keeps its own text-shadow so it stays readable against
   the pinned photo even without the heavy gradient wash. */
.hero .container { position: relative; z-index: 2; width: 100%; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 3rem; align-items: center; }
@media (max-width: 880px) { .hero .container { grid-template-columns: 1fr; } }

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 1.25rem;
  font-weight: 800;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.hero h1 .accent { color: var(--accent); }
.hero p.lede {
  font-size: 1.25rem;
  color: var(--text);
  margin: 0 0 2rem;
  max-width: 56ch;
  text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}

.hero .connect-card {
  background: rgba(17, 22, 31, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-2);
}
[data-theme="light"] .hero .connect-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(0,0,0,0.08);
}
.connect-card h2 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 0.6rem;
}
.connect-card .one-liner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  background: rgba(10, 14, 20, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.95rem;
}
.connect-card .one-liner code { background: transparent; padding: 0; flex: 1; word-break: break-all; }
.connect-card .port-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.connect-card .port-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.75rem;
  background: rgba(10, 14, 20, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.connect-card .port-row .label { color: var(--text-dim); }
.connect-card .port-row .value { font-family: var(--font-mono); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s, transform 0.06s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #061018; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-secondary { background: var(--bg-elev-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-elev); border-color: var(--border-strong); }
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Hero buttons are larger and more prominent than the default */
.hero .btn {
  padding: 0.95rem 1.4rem;
  font-size: 1.05rem;
  border-radius: 10px;
}
.hero .btn-primary {
  box-shadow: 0 6px 24px rgba(14, 165, 233, 0.35);
}
.hero .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text);
}
.hero .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.4);
}
[data-theme="light"] .hero .btn-secondary {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: var(--text);
}

/* Sections */
section { padding: 4rem 0; }
.section-lastheard { padding: 1rem 0 3rem; }
section.alt {
  /* Translucent alt-band — gives a subtle visual rhythm change between
     sections without fully blocking the pinned background photo. The
     photo still bleeds through. */
  background: rgba(10, 14, 20, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
section h2 {
  font-size: 1.8rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
  font-weight: 700;
}
section .section-lede { color: var(--text-dim); margin: 0 0 2rem; max-width: 60ch; }
section .section-head { margin-bottom: 2rem; }

/* Live status */
.status-board {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
}
@media (max-width: 800px) { .status-board { grid-template-columns: 1fr; } }

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
@media (max-width: 540px) { .status-grid { grid-template-columns: repeat(2, 1fr); } }

.status-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  background: rgba(10, 14, 20, 0.5);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.status-cell .module-letter {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.05rem;
  color: white;
}
.status-cell .module-name { font-weight: 600; font-size: 0.92rem; }
.status-cell .module-state {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.status-cell .module-state .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint);
}
.status-cell.is-active .module-state .dot { background: var(--success); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); animation: pulse 2.4s ease-in-out infinite; }
.status-cell.is-busy .module-state .dot { background: var(--warn); }
.status-cell.is-offline .module-state .dot { background: var(--danger); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); } 50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.04); } }

.status-cell .last-heard {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: auto;
}

.status-meta {
  background: rgba(10, 14, 20, 0.5);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.status-meta h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}
.status-meta dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.25rem; }
.status-meta dt { color: var(--text); font-size: 0.9rem; font-weight: 500; }
.status-meta dd { margin: 0; font-family: var(--font-mono); font-size: 0.9rem; color: var(--text); }
.status-meta .refresh-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: auto; }
.status-meta .last-update { font-size: 0.82rem; color: var(--text-dim); }

/* Always-on infrastructure cards (KK7DFM D-Star gateway, AllStar nodes) */
.section-infrastructure {
  padding: 3rem 0 2rem;
}
.section-infrastructure + .section-lastheard { padding-top: 1.5rem; }

.infrastructure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.85rem;
}
.infra-card {
  background: rgba(10, 14, 20, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem 1rem;
  align-items: center;
}
.infra-card.is-online  { border-left-color: var(--success); }
.infra-card.is-offline { border-left-color: var(--danger); }
.infra-card.is-degraded { border-left-color: var(--warn); }
.infra-card.is-pending { border-left-color: var(--text-faint); }

.infra-card .infra-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  flex: 0 0 40px;
}
.infra-card .infra-body { min-width: 0; }
.infra-card .infra-title {
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  color: var(--text);
}
.infra-card .infra-title .infra-kind {
  /* Small uppercase kind label (D-STAR GATEWAY, ALLSTAR NODE) —
     was var(--text-faint) which read as too dim on the dark card.
     Now uses the brighter dim token so the label is clearly readable
     but still visually subordinate to the title. */
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.infra-card .infra-meta {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 0.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}
.infra-card .infra-meta .text-mono { font-family: var(--font-mono); }

.infra-card .infra-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 12%, transparent);
  white-space: nowrap;
}
.infra-card .infra-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}
.infra-card.is-online  .infra-badge { color: var(--success); }
.infra-card.is-offline .infra-badge { color: var(--danger); }
.infra-card.is-degraded .infra-badge { color: var(--warn); }
.infra-card.is-pending .infra-badge { color: var(--text-dim); }
.infra-card.is-online .infra-badge .dot {
  animation: pulse 2.4s ease-in-out infinite;
}

.infra-card .infra-detail {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--border);
  padding-top: 0.6rem;
  margin-top: 0.4rem;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.88rem;
}
/* Definition labels (Uptime, Linked peers, Keyups, App) — was
   var(--text-faint) which was too dim. Now uses --text-dim so
   the label is clearly readable without competing with the dd value. */
.infra-card .infra-detail dt { color: var(--text-dim); font-weight: 500; }
.infra-card .infra-detail dd { margin: 0; font-family: var(--font-mono); color: var(--text); }

.infra-card .infra-error {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: var(--danger);
  font-family: var(--font-mono);
  margin-top: 0.4rem;
}

.infrastructure-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.infrastructure-footer button {
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
}
.infrastructure-footer button:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.infrastructure-footer button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (max-width: 540px) {
  .infra-card { grid-template-columns: auto 1fr; }
  .infra-card .infra-badge { grid-column: 1 / -1; justify-self: start; }
}

/* Linked peers sub-list inside the AllStar card */
.infra-peers {
  grid-column: 1 / -1;
  margin-top: 0.6rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.65rem;
}
.infra-peer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.infra-peer-table thead th {
  text-align: left;
  font-weight: 700;
  color: var(--text-dim);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.5rem 0.45rem;
  border-bottom: 1px solid var(--border);
}
.infra-peer-table tbody td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}
.infra-peer-table tbody tr:last-child td { border-bottom: none; }
.infra-peer-table .infra-peer-node { font-family: var(--font-mono); font-weight: 600; width: 5rem; color: var(--text); }
.infra-peer-table .infra-peer-call { font-weight: 600; width: 6rem; color: var(--text); }
.infra-peer-table .infra-peer-freq { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-dim); white-space: nowrap; }
.infra-peer-table .infra-peer-tone {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  white-space: nowrap;
}
.infra-peer-table .infra-peer-city { color: var(--text-dim); }
@media (max-width: 540px) {
  .infra-peer-table thead { display: none; }
  .infra-peer-table tbody td {
    display: block;
    width: auto !important;
    padding: 0.15rem 0;
    border: none;
  }
  .infra-peer-table tbody td::before {
    content: attr(data-label);
    display: inline-block;
    width: 5rem;
    color: var(--text-faint);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 0.5rem;
  }
}

/* Contact form (modal — opened by the nav Contact button) */

/* Modal container — covers the whole viewport, hidden by default */
.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 2rem);
}
.contact-modal[hidden] { display: none; }

.contact-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 12, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
}
.contact-modal-panel {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  width: 100%;
  max-width: 36rem;
  max-height: calc(100vh - 4rem);
  max-height: calc(100dvh - 4rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: contact-modal-in 160ms ease-out;
}
@keyframes contact-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.contact-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 0.5rem;
}
.contact-modal-head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.contact-modal-lede {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.45;
  max-width: 32ch;
}
.contact-modal-close {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.contact-modal-close:hover {
  background: var(--bg-elev);
  color: var(--text);
}
.contact-modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Form inside the modal — uses the same .contact-* classes so existing
   styles carry over. The only change: the form is now scrollable
   inside the panel rather than stretching the page. */
.contact-modal .contact-form {
  margin: 0;
  border: none;
  border-radius: 0;
  padding: 0.5rem 1.25rem 1.25rem;
  box-shadow: none;
  overflow-y: auto;
  flex: 1 1 auto;
  background: transparent;
}
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
}
.contact-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.contact-field-wide { grid-column: 1 / -1; }
.contact-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.contact-optional {
  margin-left: 0.4rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.7rem;
  color: var(--text-faint);
  opacity: 0.7;
}
.contact-field input,
.contact-field select,
.contact-field textarea {
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 120ms ease, background-color 120ms ease;
}
.contact-field input:focus,
.contact-field select:focus,
.contact-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.contact-field input:invalid:not(:placeholder-shown),
.contact-field textarea:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}
.contact-field textarea { resize: vertical; min-height: 6.5rem; line-height: 1.5; }
.contact-help {
  font-size: 0.78rem;
  color: var(--text-faint);
}
.contact-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.contact-submit {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.4rem;
  background: var(--accent);
  color: #061018;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 120ms ease;
}
.contact-submit:hover { background: var(--accent-strong); }
.contact-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.contact-submit:active { transform: translateY(1px); }
.contact-note {
  font-size: 0.8rem;
  color: var(--text-faint);
}
.contact-result {
  margin-top: 0.85rem;
  font-size: 0.9rem;
  min-height: 1.25em;
  color: var(--text-dim);
}
.contact-result.is-success { color: var(--success); }
.contact-result.is-error { color: var(--danger); }
@media (max-width: 540px) {
  .contact-grid { grid-template-columns: 1fr; }
}

.status-note {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* Module-letter colors (used everywhere a module is referenced) */
.ml-A { background: #2563eb; } /* D-Star blue */
.ml-B { background: #16a34a; } /* DMR green */
.ml-C { background: #9333ea; } /* YSF purple */
.ml-D { background: #d97706; } /* P25 amber */
.ml-E { background: #dc2626; } /* NXDN red */
.ml-F { background: #0d9488; } /* M17 teal */

/* Feature/value cards */
.value-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (max-width: 700px) { .value-grid { grid-template-columns: 1fr; } }

.value-card {
  background: rgba(10, 14, 20, 0.5);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
a.value-card:hover {
  border-color: var(--accent);
  background: rgba(10, 14, 20, 0.62);
  text-decoration: none;
  transform: translateY(-1px);
}
.value-card h3 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  line-height: 1.3;
}
.value-card h3 .icon { flex-shrink: 0; }
.value-card p { margin: 0; color: var(--text-dim); }
.value-card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 8px;
  flex-shrink: 0;
}

/* Connection page */
.kv-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.kv-table th, .kv-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.kv-table tr:last-child th, .kv-table tr:last-child td { border-bottom: none; }
.kv-table th { font-weight: 600; color: var(--text-dim); background: var(--bg-elev-2); width: 38%; }
.kv-table td { font-family: var(--font-mono); }
.kv-table .copy-cell { display: flex; align-items: center; gap: 0.5rem; }
.kv-table .copy-cell code { background: transparent; padding: 0; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-dim);
  padding: 0;
  flex-shrink: 0;
}
.copy-btn:hover { color: var(--text); border-color: var(--accent); }
.copy-btn.is-copied { color: var(--success); border-color: var(--success); }
.copy-btn svg { width: 16px; height: 16px; }

/* Tabs */
.tabs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text-dim);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.tab[aria-selected="true"] {
  background: var(--bg-elev);
  border-color: var(--border);
  border-bottom-color: var(--bg-elev);
  color: var(--text);
  position: relative;
  top: 1px;
}
.tab:hover { color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tabpanel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.tabpanel[hidden] { display: none; }
.tabpanel h3 { margin-top: 0; }
.tabpanel ul, .tabpanel ol { padding-left: 1.25rem; }
.tabpanel li { margin-bottom: 0.4rem; }

/* Steps */
.steps { counter-reset: step; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.steps li {
  position: relative;
  padding: 1rem 1.25rem 1rem 3.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #061018;
  border-radius: 50%;
  font-weight: 800;
  font-family: var(--font-mono);
}
.steps li strong { display: block; margin-bottom: 0.3rem; }

/* Tips */
.tip {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-left: 3px solid var(--success);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.85rem 1rem;
  margin: 0.85rem 0;
  font-size: 0.92rem;
  color: var(--text);
}
.tip strong { color: var(--success); margin-right: 0.3rem; }

/* Module detail (rendered into data-module-tabs on the modules page) */
.module-detail-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.module-detail-head .ml-letter {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.4rem;
  color: white;
  flex-shrink: 0;
}
.module-detail-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}
.module-detail-head p { margin: 0; font-size: 0.95rem; }
.module-detail .tabpanel h4 {
  margin: 1.25rem 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.module-detail .tabpanel h4:first-child { margin-top: 0; }

/* Module letter chips (used in lists, badges) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.chip .ml-letter {
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.78rem;
  color: white;
}

/* Connection method chooser */
.method-tabs .tab { font-size: 0.92rem; }

/* Module picker (Modules page) */
.module-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.module-picker .pick {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.module-picker .pick[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--bg-elev-2);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.module-picker .pick:hover { border-color: var(--border-strong); }
.module-picker .pick .ml-letter {
  width: 32px; height: 32px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1rem;
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.module-picker .pick .meta { display: flex; flex-direction: column; }
.module-picker .pick .name { font-weight: 600; font-size: 0.95rem; }
.module-picker .pick .full { font-size: 0.78rem; color: var(--text-faint); }

/* FAQ */
.faq details {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
}
.faq details[open] { border-color: var(--border-strong); }
.faq summary {
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--text-faint);
  transition: transform 0.2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .answer { padding: 0 1.25rem 1.25rem; color: var(--text-dim); }
.faq .answer p:first-child { margin-top: 0; }
.faq .answer p:last-child { margin-bottom: 0; }

/* Rules */
.rules-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .rules-list { grid-template-columns: 1fr; } }
.rule-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
}
.rule-card h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.rule-card p { margin: 0; color: var(--text-dim); }
.rule-card .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.8rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Footer */
.site-footer {
  background: rgba(10, 14, 20, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}
.site-footer .container {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 760px) { .site-footer .container { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .site-footer .container { grid-template-columns: 1fr; } }

.site-footer h4 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 0.85rem;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.45rem; }
.site-footer p { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 0.85rem; }
.footer-bottom {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Page header (for non-home pages) */
.page-header {
  padding: 3rem 0 1.5rem;
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.page-header p { color: var(--text-dim); margin: 0; max-width: 60ch; font-size: 1.05rem; }

/* Utilities */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.text-dim { color: var(--text-dim); }
.text-mono { font-family: var(--font-mono); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }

/* Inline list of mode chips */
.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

/* Tag */
.tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.tag.beginner { color: var(--success); border-color: rgba(34, 197, 94, 0.4); background: rgba(34, 197, 94, 0.08); }
.tag.advanced { color: var(--warn); border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); }

/* Last heard table */
.lastheard-table {
  background: rgba(10, 14, 20, 0.5);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.lastheard-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.lastheard-table thead {
  background: rgba(10, 14, 20, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.lastheard-table th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.lastheard-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  vertical-align: middle;
  color: var(--text);
}
.lastheard-table tbody tr:last-child td { border-bottom: none; }
.lastheard-table tbody tr:hover { background: rgba(255, 255, 255, 0.05); }
.lastheard-table tbody tr.is-transmitting {
  background: rgba(34, 197, 94, 0.12);
}
.lastheard-table tbody tr.is-transmitting:hover {
  background: rgba(34, 197, 94, 0.18);
}
.lastheard-table .lh-time { color: var(--text-dim); white-space: nowrap; }
.lastheard-table .lh-mod {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.8rem;
  color: white;
}
.lastheard-table .lh-call { font-weight: 600; }
.lastheard-table .lh-via { color: var(--text-dim); }
.lastheard-table .tx-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 0.5rem;
  vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: tx-pulse 1.4s ease-out infinite;
}
@keyframes tx-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.lh-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}
.lh-status {
  color: var(--text-dim);
  font-size: 0.85rem;
}
.lh-status-err { color: var(--danger); }
