:root {
  --bg: #08090d;
  --bg-soft: #11131b;
  --panel: rgba(18, 21, 31, .72);
  --panel-strong: rgba(24, 27, 39, .9);
  --text: #f7f7fb;
  --muted: #a9adbd;
  --line: rgba(255, 255, 255, .12);
  --red: #e4212d;
  --red-2: #9d1019;
  --chrome: #d9dde7;
  --chrome-dark: #707787;
  --good: #44d17d;
  --warn: #ffba42;
  --bad: #ff5c5c;
  --shadow: 0 22px 80px rgba(0, 0, 0, .38);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

html[data-theme="light"] {
  --bg: #f4f5f8;
  --bg-soft: #ffffff;
  --panel: rgba(255, 255, 255, .82);
  --panel-strong: rgba(255, 255, 255, .96);
  --text: #151821;
  --muted: #596171;
  --line: rgba(20, 24, 34, .12);
  --chrome: #202532;
  --chrome-dark: #5b6270;
  --shadow: 0 18px 54px rgba(30, 35, 48, .14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(228, 33, 45, .24), transparent 30rem),
    radial-gradient(circle at 82% 24%, rgba(190, 196, 210, .16), transparent 24rem),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 9, 13, .94) 0%, rgba(8, 9, 13, .7) 38%, rgba(8, 9, 13, .4) 70%, rgba(8, 9, 13, .82) 100%),
    linear-gradient(to bottom, rgba(8, 9, 13, .22), rgba(8, 9, 13, .92) 78%, var(--bg) 100%),
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url('../img/nf1j-ham-radio-background.jpg');
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  opacity: .72;
  pointer-events: none;
  z-index: -3;
  transform: translateZ(0);
}

html[data-theme="light"] body::before {
  background:
    linear-gradient(90deg, rgba(244, 245, 248, .9) 0%, rgba(244, 245, 248, .76) 42%, rgba(244, 245, 248, .48) 72%, rgba(244, 245, 248, .82) 100%),
    linear-gradient(to bottom, rgba(244, 245, 248, .28), rgba(244, 245, 248, .94) 78%, var(--bg) 100%),
    linear-gradient(rgba(20,24,34,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,24,34,.03) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
}

html[data-theme="light"] body::after { opacity: .38; }

.site-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px;
  margin: 16px 0 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 14, 20, .66);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}
html[data-theme="light"] .topbar { background: rgba(255,255,255,.78); }

.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; min-width: max-content; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  font-weight: 900;
  letter-spacing: -1px;
  color: white;
  background: linear-gradient(145deg, var(--red), #5e070d 72%);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 12px 30px rgba(228,33,45,.28);
}
.brand-mark span { color: #fff3f4; }
.brand-copy { display: grid; line-height: 1.1; }
.brand-copy small { color: var(--muted); font-size: 12px; margin-top: 4px; }

.main-nav { display: flex; justify-content: center; flex: 1; gap: 8px; }
.main-nav a, .filter, .theme-toggle, .menu-button {
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  transition: .2s ease;
}
.main-nav a:hover, .filter:hover, .theme-toggle:hover, .menu-button:hover { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.06); }
.theme-toggle { display: flex; align-items: center; gap: 8px; border-color: var(--line); background: rgba(255,255,255,.05); }
.menu-button { display: none; font-size: 20px; }

.section, .hero { padding: 74px 0; }
.hero {
  min-height: clamp(640px, 86vh, 920px);
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 18px -8vw auto -8vw;
  height: min(78vh, 760px);
  border-radius: 42px;
  background:
    radial-gradient(circle at 21% 50%, rgba(228, 33, 45, .2), transparent 32rem),
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,0));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 40px 120px rgba(0,0,0,.26);
  pointer-events: none;
  z-index: -1;
}
.section-grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: 34px; align-items: center; }
.eyebrow { color: var(--red); text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 900; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(42px, 7vw, 82px); line-height: .92; letter-spacing: -0.07em; margin-bottom: 22px; }
h2 { font-size: clamp(31px, 4vw, 52px); line-height: 1; letter-spacing: -0.05em; margin-bottom: 16px; }
h3 { font-size: 21px; margin-bottom: 12px; }
.hero-lead, .section-heading p, .about-card p { color: var(--muted); font-size: 18px; line-height: 1.7; }
.section-heading { max-width: 760px; margin-bottom: 28px; }

.hero-actions, .about-actions { display: flex; gap: 14px; flex-wrap: wrap; margin: 28px 0; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { color: white; background: linear-gradient(135deg, #ff3442, var(--red-2)); box-shadow: 0 14px 34px rgba(228,33,45,.32); }
.btn-secondary { color: var(--text); background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,.04)); border: 1px solid var(--line); }
.full-width { width: 100%; }
.text-link { color: var(--red); font-weight: 800; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.signal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.signal-strip span {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
}
.signal-strip strong { color: var(--text); }

.radio-card, .metric-card, .split-panel, .lookup-panel, .tool-card, .resource-card, .about-card {
  border: 1px solid var(--line);
  background: linear-gradient(155deg, var(--panel-strong), var(--panel));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.radio-card { position: relative; overflow: hidden; padding: 28px; min-height: 480px; display: flex; flex-direction: column; justify-content: space-between; }
.radio-card::before { content: ""; position: absolute; inset: -40% -40% auto auto; width: 340px; height: 340px; background: radial-gradient(circle, rgba(228,33,45,.45), transparent 70%); }
.scanner-line { position: absolute; left: 0; right: 0; top: 22%; height: 2px; background: linear-gradient(90deg, transparent, var(--red), transparent); box-shadow: 0 0 26px var(--red); animation: scan 3.5s ease-in-out infinite; }
@keyframes scan { 0%,100% { transform: translateY(0); opacity: .35; } 50% { transform: translateY(230px); opacity: .95; } }
.radio-card-top { display: flex; gap: 10px; align-items: center; color: var(--muted); font-weight: 800; }
.live-dot { width: 12px; height: 12px; background: var(--good); border-radius: 50%; box-shadow: 0 0 22px var(--good); }
.frequency-display { padding: 34px 0; text-align: center; }
.frequency-display small, .frequency-display span { display: block; color: var(--muted); font-weight: 800; letter-spacing: .1em; }
.frequency-display strong { display: block; font-family: "JetBrains Mono", monospace; font-size: clamp(54px, 8vw, 96px); letter-spacing: -.08em; color: var(--chrome); text-shadow: 0 0 42px rgba(228,33,45,.28); }
.meter-grid, .dashboard-grid, .tool-grid, .resource-grid { display: grid; gap: 16px; }
.meter-grid { grid-template-columns: repeat(3, 1fr); }
.meter-grid div { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.05); }
.meter-grid span, .metric-card span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .15em; font-weight: 900; }
.meter-grid strong, .metric-card strong { font-family: "JetBrains Mono", monospace; font-size: 36px; }
.card-note { color: var(--muted); margin: 0; }
code { color: var(--chrome); }

.dashboard-grid { grid-template-columns: repeat(4, 1fr); }
.metric-card { padding: 22px; }
.metric-card small { color: var(--muted); line-height: 1.5; }
.split-panel { display: grid; grid-template-columns: 1fr 330px; gap: 24px; margin-top: 18px; padding: 24px; }
.band-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.band-pill { border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: rgba(255,255,255,.05); }
.band-pill strong { display: block; margin-bottom: 6px; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 900; }
.badge.good { color: #082411; background: var(--good); }
.badge.fair { color: #231500; background: var(--warn); }
.badge.poor { color: #fff; background: var(--bad); }
.status-panel { border-left: 1px solid var(--line); padding-left: 24px; }
.status-panel p { color: var(--muted); line-height: 1.6; }

.lookup-panel { padding: 24px; }
.lookup-form label, .tool-card label { display: block; color: var(--muted); font-weight: 800; margin-bottom: 8px; }
.input-row { display: flex; gap: 10px; }
input {
  width: 100%;
  color: var(--text);
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  font: inherit;
  outline: none;
}
input:focus { border-color: rgba(228,33,45,.72); box-shadow: 0 0 0 4px rgba(228,33,45,.14); }
.lookup-result { margin: 18px 0; padding: 18px; border-radius: 18px; background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--muted); line-height: 1.65; }
.lookup-result strong { color: var(--text); }
.quick-links { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-links.compact a { padding: 10px 12px; font-size: 13px; }

.tool-grid { grid-template-columns: repeat(3, 1fr); }
.tool-card { padding: 22px; }
.tool-readout { font-family: "JetBrains Mono", monospace; font-size: 27px; color: var(--chrome); margin: 12px 0; }
.tool-card small { color: var(--muted); }

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filter { border-color: var(--line); background: rgba(255,255,255,.05); }
.filter.active { background: var(--red); border-color: var(--red); color: white; }
.resource-grid { grid-template-columns: repeat(3, 1fr); }
.resource-card { padding: 22px; min-height: 230px; display: flex; flex-direction: column; }
.resource-card .tag { align-self: flex-start; color: white; background: linear-gradient(135deg, var(--red), var(--red-2)); border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.resource-card p { color: var(--muted); line-height: 1.58; flex: 1; }
.resource-card a { color: var(--text); text-decoration: none; font-weight: 900; }
.resource-card a:hover { color: var(--red); }

.about-card { padding: clamp(28px, 5vw, 54px); max-width: 920px; margin: auto; text-align: center; }
.about-actions { justify-content: center; }
.footer { display: flex; justify-content: space-between; gap: 16px; padding: 34px 0 52px; color: var(--muted); border-top: 1px solid var(--line); }

.reveal { opacity: 0; transform: translateY(18px); animation: reveal .7s ease forwards; }
.delay-1 { animation-delay: .1s; }
.delay-2 { animation-delay: .2s; }
.delay-3 { animation-delay: .3s; }
@keyframes reveal { to { opacity: 1; transform: translateY(0); } }

@media (max-width: 930px) {
  body::before {
    background:
      linear-gradient(to bottom, rgba(8, 9, 13, .88), rgba(8, 9, 13, .62) 38%, rgba(8, 9, 13, .94) 83%, var(--bg) 100%),
      linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: auto, 42px 42px, 42px 42px;
  }
  body::after { background-position: 72% center; opacity: .52; }
  html[data-theme="light"] body::before {
    background:
      linear-gradient(to bottom, rgba(244,245,248,.88), rgba(244,245,248,.7) 38%, rgba(244,245,248,.96) 83%, var(--bg) 100%),
      linear-gradient(rgba(20,24,34,.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(20,24,34,.03) 1px, transparent 1px);
    background-size: auto, 42px 42px, 42px 42px;
  }
  html[data-theme="light"] body::after { opacity: .26; }
  .site-shell { width: min(100% - 22px, 1180px); }
  .topbar { border-radius: 24px; flex-wrap: wrap; }
  .menu-button { display: inline-flex; margin-left: auto; }
  .theme-toggle { margin-left: 0; }
  .main-nav { display: none; width: 100%; order: 5; flex-direction: column; }
  .main-nav.open { display: flex; }
  .section-grid, .split-panel { grid-template-columns: 1fr; }
  .dashboard-grid, .band-grid, .tool-grid, .resource-grid { grid-template-columns: repeat(2, 1fr); }
  .status-panel { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 22px; }
}

@media (max-width: 620px) {
  body::after { background-position: 78% top; background-size: auto 100vh; }
  .hero { min-height: auto; }
  .hero::before { inset: 8px -18px auto -18px; height: 100%; border-radius: 28px; }
  .brand-copy small { display: none; }
  .brand-mark { width: 48px; height: 48px; }
  .hero, .section { padding: 48px 0; }
  .dashboard-grid, .band-grid, .tool-grid, .resource-grid, .meter-grid { grid-template-columns: 1fr; }
  .input-row { flex-direction: column; }
  .footer { flex-direction: column; }
  .frequency-display strong { font-size: 58px; }
}
