/* ---------- Tokens ---------- */
:root {
  --bg: #14100c;
  --panel: #1f1811;
  --panel-2: #241b13;
  --ink: #f4ead9;
  --muted: #c2ad8e;
  --line: #40331f;
  --line-soft: #2c2216;
  --amber: #ffb200;
  --amber-ink: #1b1410;
  --red: #ff5c4d;

  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;

  --radius: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { max-width: 100%; display: block; }
h1, h2, h3, p, dl, dd, dt, ul { margin: 0; }
ul { list-style: none; padding: 0; }
button { font-family: inherit; }

a {
  color: var(--amber);
  text-decoration-thickness: 1px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--amber);
  color: var(--amber-ink);
  padding: 12px 20px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Masthead ---------- */
.masthead {
  position: relative;
  padding: 64px 24px 32px;
  background: radial-gradient(ellipse at 20% 0%, #241a10 0%, var(--bg) 60%);
  border-bottom: 1px solid var(--line);
  overflow: clip;
  z-index: 1;
}
.masthead::before {
  content: "";
  position: absolute;
  inset: -20% -10%;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 38px,
    var(--line-soft) 38px,
    var(--line-soft) 40px
  );
  opacity: 0.35;
  z-index: -1;
}

.masthead-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  position: relative;
}

.station-id { max-width: 680px; }

.callsign-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.callsign {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px 20px;
  line-height: 0.95;
}
.callsign .freq {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(3.5rem, 12vw, 7.5rem);
  color: var(--amber);
  letter-spacing: -0.02em;
  text-shadow: 0 0 28px rgba(255, 178, 0, 0.35);
}
.callsign .wordmark {
  font-weight: 800;
  font-size: clamp(1.4rem, 3.4vw, 2.5rem);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.tagline {
  margin-top: 20px;
  font-size: clamp(1rem, 1.3vw, 1.125rem);
  color: var(--muted);
  max-width: 46ch;
  line-height: 1.6;
}

.onair {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}
.led-live {
  background: var(--red);
  box-shadow: 0 0 10px 2px rgba(255, 92, 77, 0.7);
  animation: pulse 2.2s ease-in-out infinite;
}

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

/* ---------- Dial ---------- */
.dial { flex: none; }
.dial-ring { fill: var(--panel); stroke: var(--line); stroke-width: 2; }
.dial-face { fill: var(--bg); stroke: var(--line); stroke-width: 1; }
.dial-ticks line { stroke: var(--muted); stroke-width: 2; }
.dial-num {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--muted);
  text-anchor: middle;
}
.needle {
  stroke: var(--amber);
  stroke-width: 3;
  stroke-linecap: round;
  transform-origin: 110px 110px;
  animation: seek 7s ease-in-out infinite alternate;
}
.needle-hub { fill: var(--amber); }
@keyframes seek {
  0% { transform: rotate(-34deg); }
  50% { transform: rotate(28deg); }
  100% { transform: rotate(-10deg); }
}

/* ---------- Console ---------- */
.console {
  max-width: 1180px;
  margin: 40px auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 16px 24px;
  position: relative;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.field select {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px;
  min-height: 44px;
  min-width: 220px;
}
.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

.preset-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), transform 150ms var(--ease);
}
.preset-toggle .preset-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
  flex: none;
  transition: background-color 180ms var(--ease), box-shadow 180ms var(--ease);
}
.preset-toggle[aria-pressed="true"] {
  background: var(--amber);
  color: var(--amber-ink);
  border-color: var(--amber);
}
.preset-toggle[aria-pressed="true"] .preset-led {
  background: var(--amber-ink);
  box-shadow: 0 0 8px 2px rgba(255, 178, 0, 0.5);
}
@media (hover: hover) and (pointer: fine) {
  .preset-toggle:hover { border-color: var(--amber); transform: translateY(-1px); }
}
.preset-toggle:active { transform: scale(0.97); }

.meter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.meter-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
}
.meter-bars .bar {
  width: 5px;
  background: var(--line);
  border-radius: 2px;
  transition: background-color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.meter-bars .bar:nth-child(1) { height: 8px; }
.meter-bars .bar:nth-child(2) { height: 12px; }
.meter-bars .bar:nth-child(3) { height: 16px; }
.meter-bars .bar:nth-child(4) { height: 20px; }
.meter-bars .bar:nth-child(5) { height: 24px; }
.meter-bars .bar.lit {
  background: var(--amber);
  box-shadow: 0 0 6px 1px rgba(255, 178, 0, 0.6);
}

/* ---------- Band jump nav ---------- */
.band-jump {
  max-width: 1180px;
  margin: 28px auto 0;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.band-jump a {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 180ms var(--ease), color 180ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .band-jump a:hover { border-color: var(--amber); color: var(--amber); }
}
.band-jump a:active { transform: scale(0.97); }

/* ---------- Main / listings ---------- */
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 24px 96px;
  position: relative;
  z-index: 1;
}

.day-band { margin-bottom: 64px; }
.day-band:last-child { margin-bottom: 0; }
.day-band h2 {
  font-size: clamp(1.3rem, 2.2vw, 1.75rem);
  font-weight: 800;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.day-date { color: var(--muted); font-weight: 500; }

.cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card { position: relative; }

.tune-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 180ms var(--ease), transform 180ms var(--ease), background-color 180ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .tune-btn:hover {
    border-color: var(--amber);
    transform: translateY(-2px);
    background: var(--panel-2);
  }
}
.tune-btn:active { transform: scale(0.98); }
.tune-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.saved-mark {
  position: absolute;
  top: -8px;
  left: -8px;
  color: var(--amber);
  background: var(--bg);
  border: 1px solid var(--amber);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.tune-freq {
  font-family: var(--mono);
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  font-weight: 700;
  color: var(--amber);
  flex: none;
  min-width: 64px;
}

.tune-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.tune-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
}
.tune-meta {
  font-size: 0.875rem;
  color: var(--muted);
}
.tune-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}
.tag-cat {
  color: var(--amber);
  border-color: var(--amber);
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  margin-bottom: 48px;
}
.empty-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--amber);
  margin-bottom: 12px;
}
.empty-body {
  color: var(--muted);
  max-width: 42ch;
  margin: 0 auto 24px;
}
.reset-btn {
  background: var(--amber);
  color: var(--amber-ink);
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  min-height: 44px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 150ms var(--ease), box-shadow 150ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .reset-btn:hover { box-shadow: 0 0 0 3px rgba(255, 178, 0, 0.35); }
}
.reset-btn:active { transform: scale(0.97); }
.reset-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Footer ---------- */
.signoff {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 1;
}
.signoff-small { margin-top: 8px; opacity: 0.8; }

/* ---------- Detail dialog ---------- */
#detail-dialog {
  width: min(640px, 92vw);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}
#detail-dialog::backdrop {
  background: rgba(8, 6, 4, 0.72);
}
.detail-frame { padding: 28px; }

.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 12px;
}
.detail-freq {
  font-family: var(--mono);
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  color: var(--amber);
}
.close-btn {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  min-height: 44px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 180ms var(--ease), transform 150ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .close-btn:hover { border-color: var(--amber); }
}
.close-btn:active { transform: scale(0.97); }

.detail-tag {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 8px;
}
#detail-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 14px 24px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.detail-meta > div { display: flex; flex-direction: column; gap: 2px; }
.detail-meta dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-meta dd {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.detail-body {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  max-width: 62ch;
}
.detail-body p { margin-bottom: 14px; }
.detail-body p:last-child { margin-bottom: 0; }

.preset-toggle-detail {
  margin-top: 24px;
  width: 100%;
  justify-content: center;
  font-size: 16px;
  padding: 14px 20px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .led-live { animation: none; opacity: 1; }
  .needle { animation: none; transform: rotate(-10deg); }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .masthead { padding: 40px 20px 28px; }
  .masthead-inner { flex-direction: column; align-items: flex-start; gap: 24px; }
  .dial { display: none; }
  .console { flex-direction: column; align-items: stretch; margin-top: 28px; }
  .field { width: 100%; }
  .field input, .field select { width: 100%; min-width: 0; }
  .preset-toggle { width: 100%; justify-content: center; }
  .meter { margin-left: 0; justify-content: space-between; width: 100%; }
  main { padding: 40px 20px 64px; }
  .tune-btn { flex-wrap: wrap; gap: 12px 16px; }
  .tune-freq { min-width: 0; }
  .detail-frame { padding: 20px; }
  .detail-meta { grid-template-columns: 1fr; }
}
