/* ───────────── latebrew ───────────── */

:root {
  --bg: #07081c;
  --ink: #f2e9da;
  --ink-2: #c6bfd4;
  --ink-3: #9089ad;
  --line: #22224a;
  --panel: #0c0d28;
  --live: #ff4136;
  --dial: #ffb547;
  --dial-ink: #1d0f02;
  --glass: #120f2e;
  --f-sans: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --f-mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 4.5vw, 64px);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}
/* by day the station sleeps and the page is the morning sky */
:root[data-time="day"] {
  --bg: #cbdbe8;
  --ink: #12162e;
  --ink-2: #333a58;
  --ink-3: #4b5472;
  --line: #b0c2d3;
  --panel: #d8e4ee;
  --live: #a2403f;
  --dial: #c46a12;
  --dial-ink: #fff6e8;
  --glass: #e4ecf2;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line) var(--bg); scrollbar-width: thin; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.6 var(--f-sans); font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  caret-color: var(--dial);
  transition: background-color 1.2s var(--ease), color 1.2s var(--ease);
  overflow-x: hidden;
}
::selection { background: var(--dial); color: var(--dial-ink); }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--dial); outline-offset: 4px; border-radius: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, p { margin: 0; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--bg); padding: .5rem .8rem; border-radius: 4px; }
.skip:focus { top: 12px; }

/* ───────────── header ───────────── */
.top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px var(--gutter);
}
.mark { display: flex; align-items: flex-start; gap: 5px; color: var(--ink); line-height: 0; text-decoration: none; }
.logo { display: block; width: 123px; height: 21px; }
.lamp { width: 6px; height: 6px; background: var(--live); margin-top: 0; }
.js .lamp { animation: lamp 2.6s steps(1) infinite; }
:root[data-time="day"] .lamp { background: var(--ink-3); animation: none; opacity: .5; }
@keyframes lamp { 0%, 82% { opacity: 1; } 83%, 86% { opacity: .35; } 87% { opacity: 1; } }

.top-right { display: flex; align-items: center; gap: 22px; }
.status { display: flex; align-items: center; gap: .55em; font: 400 12px/1 var(--f-mono); color: var(--ink-2); letter-spacing: .02em; }
.status .dot { width: 6px; height: 6px; background: var(--live); }
:root[data-time="day"] .status .dot { background: transparent; box-shadow: inset 0 0 0 1px var(--ink-3); }
.status .sep { color: var(--ink-3); }
.status time { font-variant-numeric: tabular-nums; color: var(--ink); }
.skip-time {
  display: inline-flex; align-items: center; gap: .6em;
  font: 400 12px/1 var(--f-mono); color: var(--ink-2);
  padding: 9px 12px 9px 10px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: color .3s, box-shadow .3s, background-color .3s;
}
.skip-time:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-3); background: color-mix(in oklab, var(--ink) 5%, transparent); }
.skip-time svg { width: 12px; height: 12px; fill: currentColor; flex: none; }
.skip-time .i-sun { display: none; }
:root[data-time="night"] .skip-time .i-moon { display: none; }
:root[data-time="night"] .skip-time .i-sun { display: block; }

/* ───────────── hero ───────────── */
.hero { position: relative; }
.hero-copy { position: relative; z-index: 1; }
.hero-copy {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: end; gap: 1.25rem 6vw;
  padding: clamp(8px, 3vh, 40px) var(--gutter) 0;
}
.hello {
  font: 600 clamp(2.1rem, 5.2vw, 5rem)/1 var(--f-sans);
  font-variation-settings: "opsz" 96; letter-spacing: -.035em; text-wrap: balance;
}
.hello span { display: block; }
.hello .rest { color: var(--ink-3); font-weight: 500; }
.hello [data-hello-a] { font-variant-numeric: tabular-nums; }
.lede { max-width: 38ch; color: var(--ink-2); font-size: clamp(1rem, 1.25vw, 1.15rem); padding-bottom: .4em; text-wrap: pretty; }

.js .hero-copy > * { animation: rise 1.1s var(--ease) both; }
.js .hero-copy > :nth-child(2) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } }

/* the city: whole-number pixels, the sky is the page */
.band {
  position: relative; overflow: hidden; display: flex; justify-content: center; margin-top: clamp(4px, 2vh, 28px);
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent);
  mask-image: linear-gradient(to bottom, #000 82%, transparent);
}
.band canvas { flex: none; display: block; image-rendering: pixelated; }
.js .band canvas { animation: dusk 1.6s var(--ease) both .1s; }
@keyframes dusk { from { opacity: 0; filter: brightness(.4) saturate(.6); } }

/* ───────────── the dial ───────────── */
.tuner { padding: clamp(48px, 9vh, 110px) var(--gutter) clamp(40px, 7vh, 90px); }
.tuner-head { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem 6vw; align-items: end; margin-bottom: clamp(28px, 5vh, 52px); }
.tuner-head h2 { font: 600 clamp(1.8rem, 3.4vw, 3.1rem)/1.02 var(--f-sans); letter-spacing: -.03em; }
.tuner-head p { color: var(--ink-2); max-width: 40ch; text-wrap: pretty; }

.radio { display: grid; gap: 18px; }

/* backlit dial glass */
.dial {
  position: relative; height: 92px; border-radius: 10px; cursor: ew-resize; touch-action: pan-y;
  background:
    radial-gradient(120% 140% at var(--glow, 50%) 120%, color-mix(in oklab, var(--dial) 30%, transparent), transparent 62%),
    var(--glass);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 10px 24px -12px rgb(0 0 0 / .55);
  overflow: hidden; user-select: none; -webkit-user-select: none;
  transition: background-color 1.2s var(--ease);
}
.dial:focus-visible { outline-offset: 6px; }
.scale { position: absolute; inset: 0 22px; }
.tick { position: absolute; bottom: 18px; width: 1px; height: 10px; background: var(--ink-3); opacity: .55; transform: translateX(-50%); }
.tick.mid { height: 16px; opacity: .8; }
.tick.big { height: 24px; background: var(--ink-2); opacity: 1; }
.tick-n { position: absolute; top: 16px; transform: translateX(-50%); font: 400 11px/1 var(--f-mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.mark-st { position: absolute; bottom: 8px; width: 7px; height: 4px; transform: translateX(-50%); background: var(--dial); opacity: .7; }
.needle {
  position: absolute; top: 8px; bottom: 8px; width: 3px; margin-left: -1.5px; left: 50%;
  background: var(--live); border-radius: 2px;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--live) 30%, transparent), 0 0 18px 2px color-mix(in oklab, var(--live) 45%, transparent);
}
.needle.glide { transition: left .7s var(--ease); }

.presets { position: relative; height: 34px; margin: 0 22px; }
.preset {
  position: absolute; top: 0; transform: translateX(-50%);
  font: 400 12px/1 var(--f-mono); color: var(--ink-3); padding: 8px 6px; white-space: nowrap;
  transition: color .25s;
}
.preset:hover { color: var(--ink); }
.preset[aria-current="true"] { color: var(--dial); }

.readout {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 1.2rem clamp(24px, 5vw, 72px);
  padding: clamp(20px, 3.5vw, 36px) clamp(20px, 3.5vw, 40px);
  border-radius: 10px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden; min-height: 168px;
}
.static { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; opacity: 0; pointer-events: none; mix-blend-mode: screen; transition: opacity .2s; }
:root[data-time="day"] .static { mix-blend-mode: multiply; }
.freq { position: relative; min-width: 5.6ch; display: flex; align-items: baseline; gap: .35em; font: 500 clamp(3rem, 9vw, 7.5rem)/.9 var(--f-mono); letter-spacing: -.06em; color: var(--dial); font-variant-numeric: tabular-nums; }
.freq small { font-size: .16em; letter-spacing: .08em; color: var(--ink-3); font-weight: 400; }
.show { position: relative; display: grid; gap: .35rem; }
.show-name { font: 600 clamp(1.6rem, 3vw, 2.6rem)/1 var(--f-sans); letter-spacing: -.025em; }
.show-desc { color: var(--ink-2); max-width: 44ch; }
.show-air { display: flex; align-items: center; gap: .6em; margin-top: .35rem; font: 400 12px/1.4 var(--f-mono); color: var(--ink-3); }
.air-dot { width: 6px; height: 6px; flex: none; box-shadow: inset 0 0 0 1px currentColor; }
.readout[data-tuned="false"] .show-name { color: var(--ink-3); }

.tone {
  justify-self: start; display: inline-flex; align-items: center; gap: .6em;
  font: 400 12px/1 var(--f-mono); color: var(--ink-2); padding: 10px 14px 10px 12px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line); transition: color .3s, box-shadow .3s;
}
.tone:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-3); }
.tone svg { width: 12px; height: 12px; fill: currentColor; }
.tone[aria-pressed="true"] { color: var(--dial); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--dial) 55%, transparent); }

/* ───────────── close ───────────── */
.close { padding: clamp(40px, 10vh, 130px) var(--gutter) clamp(48px, 10vh, 120px); }
.close-line { font: 600 clamp(2.2rem, 6.4vw, 6rem)/.98 var(--f-sans); font-variation-settings: "opsz" 96; letter-spacing: -.04em; text-wrap: balance; }
.close-line span { display: block; }
.close-line .rest { color: var(--ink-3); font-weight: 500; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem;
  padding: 22px var(--gutter) 28px; border-top: 1px solid var(--line);
  font: 400 12px/1.6 var(--f-mono); color: var(--ink-3);
}
.foot a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line); transition: color .2s, text-decoration-color .2s; }
.foot a:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ───────────── narrow ───────────── */
@media (max-width: 820px) {
  .hero-copy, .tuner-head { grid-template-columns: 1fr; }
  .status .sep, .status [data-status] { display: none; }
  .readout { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .top { padding-top: 16px; padding-bottom: 16px; }
  .logo { width: 82px; height: 14px; }
  .skip-time span { display: none; }
  .skip-time { padding: 9px; }
  .scale, .presets { margin: 0 12px; inset: 0 12px; }
  .preset { font-size: 11px; padding: 8px 2px; }
  .preset .p-name { display: none; }
  .preset .p-f { margin: 0; opacity: 1; }
}
.preset .p-f { color: inherit; opacity: .7; margin-right: .5em; }

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