/* ------------------------------------------------------------------
   24.601 MHz — Jessica Mulein
   Night sea, dial-lamp amber, one red needle.
   Anybody (variable width) is the machine: dial, headings.
   Alegreya is the voice: everything you read.
   ------------------------------------------------------------------ */

@font-face {
  font-family: "Anybody";
  src: url("fonts/anybody-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya";
  src: url("fonts/alegreya-latin-var.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya";
  src: url("fonts/alegreya-latin-italic-var.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --sky: #0c2131;       /* night sky, top of the hero */
  --horizon: #1a4560;   /* last light on the horizon */
  --sea: #10293a;       /* page */
  --glass: #0a1a25;     /* dial glass */
  --hull: #071620;      /* ship silhouette */
  --glow: #ffb547;      /* dial lamp */
  --needle: #ff4a2f;    /* the needle, the mast light */
  --foam: #dfe8ea;      /* body text */
  --salt: #93adb9;      /* secondary text */
  --rule: rgb(147 173 185 / 0.16);

  /* dial scale: 24.0 to 28.2 MHz */
  --fmin: 24;
  --fspan: 4.2;

  --gutter: 1rem;
  --page: 72rem;
  --receiver-h: 5.5rem;

  color-scheme: dark;
}
@media (min-width: 48rem) {
  :root { --gutter: 2rem; }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--receiver-h);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--sea);
  color: var(--foam);
  font-family: "Alegreya", Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.6;
  font-kerning: normal;
}

a {
  color: var(--glow);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 2px solid var(--glow);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 30;
  padding: 0.5rem 0.75rem;
  background: var(--glow);
  color: var(--glass);
  font: 600 1rem/1.2 "Anybody", sans-serif;
}
.skip-link:focus { top: 0.5rem; }

/* ---------------------------------------------------------------- */
/* The receiver                                                      */
/* ---------------------------------------------------------------- */

.receiver {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(#07131b, var(--glass));
  border-bottom: 1px solid rgb(255 181 71 / 0.22);
  box-shadow: 0 12px 28px -14px rgb(0 0 0 / 0.7);
  overflow: clip;
}
.receiver-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0.375rem var(--gutter) 0.5rem;
  display: grid;
  gap: 0.125rem;
}

.readout {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  font-family: "Anybody", sans-serif;
  color: var(--glow);
}
.freq {
  font-weight: 700;
  font-stretch: 72%;
  font-size: 1.375rem;
  line-height: 1;
  text-shadow: 0 0 14px rgb(255 181 71 / 0.45);
}
/* fixed-width digits so the readout doesn't shimmy while tuning */
.freq .d { display: inline-block; width: 0.56em; text-align: center; }
.freq .pt { display: inline-block; width: 0.24em; text-align: center; }
.unit {
  font-weight: 500;
  font-stretch: 85%;
  font-size: 0.8125rem;
  color: var(--salt);
}
.meter {
  margin-left: auto;
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 0.875rem;
  align-self: center;
}
.meter i {
  display: block;
  width: 4px;
  background: rgb(147 173 185 / 0.25);
  border-radius: 1px;
}
.meter i:nth-child(1) { height: 30%; }
.meter i:nth-child(2) { height: 45%; }
.meter i:nth-child(3) { height: 60%; }
.meter i:nth-child(4) { height: 80%; }
.meter i:nth-child(5) { height: 100%; }
.meter i.on { background: var(--glow); box-shadow: 0 0 6px rgb(255 181 71 / 0.6); }

@media (min-width: 48rem) {
  .receiver-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 2rem;
    padding-block: 0.625rem;
  }
  .readout {
    order: 2;
    padding: 0.5rem 0.875rem;
    border: 1px solid rgb(255 181 71 / 0.2);
    border-radius: 3px;
    background: rgb(0 0 0 / 0.25);
  }
  .freq { font-size: 1.875rem; }
  .meter { margin-left: 0.5rem; height: 1.125rem; }
}

.dial { padding-inline: 1.25rem; }
.scale {
  position: relative;
  height: 3.5rem;
  --x: calc((var(--nf) - var(--fmin)) / var(--fspan) * 100%);
}
.dial-glow {
  position: absolute;
  inset: -0.5rem -4rem;
  background: radial-gradient(8rem 3.5rem at var(--x) 100%, rgb(255 181 71 / 0.2), transparent);
  pointer-events: none;
}

.stations {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  inset: 0 0 auto 0;
  height: 1.375rem;
}
.stations a {
  position: absolute;
  top: 0;
  left: calc((var(--f) - var(--fmin)) / var(--fspan) * 100%);
  transform: translateX(-50%);
  padding: 0 0.25rem;
  white-space: nowrap;
  font: 600 0.8125rem/1.375rem "Anybody", sans-serif;
  font-stretch: 82%;
  color: rgb(255 181 71 / 0.62);
  text-decoration: none;
}
.stations a:hover,
.stations a[aria-current] {
  color: var(--glow);
  text-shadow: 0 0 10px rgb(255 181 71 / 0.7);
}

.bands span,
.ticks {
  position: absolute;
  top: 1.5rem;
  height: 1.125rem;
}
.bands span {
  left: calc((var(--from) - var(--fmin)) / var(--fspan) * 100%);
  width: calc((var(--to) - var(--from)) / var(--fspan) * 100%);
  background: repeating-linear-gradient(-55deg, rgb(147 173 185 / 0.28) 0 1px, transparent 1px 4px);
  font-size: 0;
}
.ticks {
  left: 0;
  width: 100%;
  overflow: visible;
  stroke: rgb(255 181 71 / 0.55);
  stroke-width: 1;
}
.ticks line { vector-effect: non-scaling-stroke; }

.numbers span {
  position: absolute;
  top: 2.625rem;
  left: calc((var(--f) - var(--fmin)) / var(--fspan) * 100%);
  transform: translateX(-50%);
  font: 600 0.6875rem/1 "Anybody", sans-serif;
  font-stretch: 80%;
  color: rgb(255 181 71 / 0.55);
}

.needle {
  position: absolute;
  top: 1.25rem;
  bottom: 0;
  left: var(--x);
  width: 2px;
  margin-left: -1px;
  background: var(--needle);
  border-radius: 1px;
  box-shadow: 0 0 8px rgb(255 74 47 / 0.75);
}
.needle::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  translate: -50% 0;
  border: 4px solid transparent;
  border-top: 5px solid var(--needle);
  border-bottom: 0;
}

@media (min-width: 48rem) {
  .scale { height: 3.75rem; }
  .stations a { font-size: 0.9375rem; }
  .bands span {
    font: 500 0.625rem/1.125rem "Anybody", sans-serif;
    font-stretch: 80%;
    color: var(--salt);
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
  }
  .numbers span { top: 2.75rem; font-size: 0.75rem; }
}

/* ---------------------------------------------------------------- */
/* Hero: the station ID, the ship on the horizon                     */
/* ---------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: calc(100svh - var(--receiver-h));
  display: grid;
  grid-template-rows: 1fr auto;
  background: linear-gradient(to bottom, var(--sky) 0%, #11304a 70%, var(--horizon) 100%);
  overflow: clip;
}
.hero-copy {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(3rem, 10vh, 7rem) var(--gutter) 2.5rem;
  align-self: center;
}
h1 {
  margin: 0;
  font-family: "Anybody", sans-serif;
  font-weight: 800;
  font-stretch: 62%;
  font-size: clamp(4.5rem, 24vw, 14rem);
  line-height: 0.84;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: var(--glow);
  text-shadow: 0 0 0.35em rgb(255 181 71 / 0.28);
}
h1 span { display: block; }
.tagline {
  max-width: 30ch;
  margin: 1.75rem 0 0;
  font-style: italic;
  font-size: clamp(1.3rem, 2.4vw, 1.625rem);
  line-height: 1.45;
}

.horizon {
  position: relative;
  height: clamp(7rem, 16vw, 10rem);
}
.horizon::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: rgb(147 173 185 / 0.45);
}
.ship {
  position: absolute;
  bottom: 0;
  right: clamp(1rem, 9vw, 9rem);
  width: clamp(9rem, 22vw, 14rem);
  height: auto;
  overflow: visible;
}
.ship .hull { fill: var(--hull); stroke: none; }
.ship .mast { stroke: var(--hull); stroke-width: 3; }
.ship .stay { stroke: var(--hull); stroke-width: 1; }
.ship .mast-light { fill: var(--needle); filter: drop-shadow(0 0 3px var(--needle)); }
.ship .lights { fill: var(--glow); opacity: 0.85; }
.ship .wave { fill: none; stroke: var(--glow); stroke-width: 1.5; stroke-linecap: round; }
.ship .w1 { opacity: 0.85; }
.ship .w2 { opacity: 0.55; }
.ship .w3 { opacity: 0.3; }

/* ---------------------------------------------------------------- */
/* Stations (sections)                                               */
/* ---------------------------------------------------------------- */

.station {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(4rem, 10vw, 7.5rem) var(--gutter);
  display: grid;
  row-gap: 0.75rem;
}
.station + .station { border-top: 1px solid var(--rule); }
@media (min-width: 48rem) {
  .station {
    grid-template-columns: 10rem minmax(0, 38rem);
    column-gap: 2.5rem;
    align-items: baseline;
  }
}

.station-freq {
  margin: 0;
  font: 600 1rem/1 "Anybody", sans-serif;
  font-stretch: 80%;
  letter-spacing: 0.02em;
  color: var(--salt);
}

h2 {
  margin: 0 0 1.5rem;
  font-family: "Anybody", sans-serif;
  font-weight: 750;
  font-stretch: 72%;
  font-size: clamp(2.75rem, 7vw, 4.25rem);
  line-height: 1;
  color: var(--glow);
  text-wrap: balance;
}

.station-body p { margin: 0 0 1.25rem; max-width: 36rem; }
.station-body > :last-child { margin-bottom: 0; }

.deck {
  font-style: italic;
  font-size: 1.375rem;
  color: var(--salt);
}
.epigraph {
  margin: 0 0 1.5rem;
  max-width: 34rem;
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.45;
}
.listen { margin-top: 2rem; }
.listen a {
  font: 650 1.375rem/1.2 "Anybody", sans-serif;
  font-stretch: 85%;
}
.credit {
  font-size: 1rem;
  color: var(--salt);
}
.closer {
  margin-top: 2rem;
  font: 650 1.75rem/1.2 "Anybody", sans-serif;
  font-stretch: 78%;
  color: var(--glow);
}

.parts {
  list-style: none;
  margin: 2rem 0;
  padding: 0;
  display: grid;
  gap: 1rem 1.5rem;
}
@media (min-width: 30rem) {
  .parts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.parts li {
  padding-left: 0.875rem;
  border-left: 2px solid rgb(255 181 71 / 0.35);
}
.part-n {
  display: block;
  font-size: 1rem;
  font-style: italic;
  color: var(--salt);
}
.part-name {
  display: block;
  font: 650 1.375rem/1.2 "Anybody", sans-serif;
  font-stretch: 80%;
}

/* ---------------------------------------------------------------- */
/* Sign-off                                                          */
/* ---------------------------------------------------------------- */

.signoff {
  max-width: var(--page);
  margin: 0 auto;
  padding: 3.5rem var(--gutter) 4rem;
  border-top: 1px solid var(--rule);
}
.signoff p { margin: 0 0 0.5rem; }
.signoff-line {
  font: 650 1.5rem/1.2 "Anybody", sans-serif;
  font-stretch: 75%;
  color: var(--glow);
}

/* ---------------------------------------------------------------- */
/* Static: louder between stations (opacity set by dial.js)         */
/* ---------------------------------------------------------------- */

.static {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.6 -0.55'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* ---------------------------------------------------------------- */
/* Power-on: the dial warms up, the needle sweeps in (dial.js),      */
/* the name tunes in, the mast starts transmitting. Once.            */
/* ---------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .js h1 { animation: tune-in 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .js .dial-glow { animation: warm-up 1.3s linear both; }
  .js .ship .wave { animation: transmit 0.7s ease-out both; }
  .js .ship .w1 { animation-delay: 1.4s; }
  .js .ship .w2 { animation-delay: 1.6s; }
  .js .ship .w3 { animation-delay: 1.8s; }
}

@keyframes tune-in {
  0%   { font-stretch: 150%; letter-spacing: 0.06em; filter: blur(12px); opacity: 0; }
  30%  { opacity: 0.55; filter: blur(7px); }
  65%  { font-stretch: 58%; filter: blur(1.5px); }
  100% { font-stretch: 62%; letter-spacing: 0.005em; filter: blur(0); opacity: 1; }
}
@keyframes warm-up {
  0%   { opacity: 0; }
  20%  { opacity: 0.35; }
  28%  { opacity: 0.1; }
  55%  { opacity: 0.7; }
  62%  { opacity: 0.45; }
  100% { opacity: 1; }
}
@keyframes transmit {
  from { opacity: 0; }
}
