/* Throwaway draft E: "Radio". The page is one transistor set you tune.
   Bottle-green body, cream dial face, one signal-red needle.
   Without JS it is a plain programme list of eight stations. */

@font-face {
  font-family: Teko;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fonts/teko-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F;
}
@font-face {
  font-family: Teko;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/teko-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F;
}
@font-face {
  font-family: Tiro;
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('assets/fonts/tiro-devanagari-hindi-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F;
}
@font-face {
  font-family: Tiro;
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url('assets/fonts/tiro-devanagari-hindi-latin-400-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F;
}
@font-face {
  font-family: Tiro;
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('assets/fonts/tiro-devanagari-hindi-devanagari-400-normal.woff2') format('woff2');
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20B9, U+25CC, U+A8E0-A8FF;
}

:root {
  --body: #0f3b33; /* the set's casing */
  --deep: #0a2a24; /* recesses: speaker grille, meter */
  --cream: #f1e6cf; /* dial face, type on the casing */
  --ink: #14211d; /* type on the dial face */
  --red: #e5352b; /* needle, lamp, play */
  --soft: color-mix(in srgb, var(--cream) 74%, var(--body));
  --hair: color-mix(in srgb, var(--cream) 26%, transparent);

  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --clear: 4.75rem; /* room for the draft switcher pill */

  --num: Teko, 'Arial Narrow', sans-serif;
  --text: Tiro, 'Noto Serif Devanagari', Georgia, serif;

  --freq-size: clamp(4.5rem, 23vw, 6.5rem);
  --freq-h: calc(var(--freq-size) * 0.86);
}

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

html {
  background: var(--body);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font: 400 1.0625rem/1.55 var(--text);
  color: var(--cream);
  background: var(--body);
  overflow-x: clip;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
ol,
figure {
  margin: 0;
}

ol {
  padding: 0;
  list-style: none;
}

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

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Small mechanical labels: condensed caps, Latin only. */
.label {
  font: 500 1.05rem/1.2 var(--num);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.15rem 1.5rem 0;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font: 500 1.25rem/1 var(--num);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.btn--line {
  background: none;
  color: var(--cream);
  box-shadow: inset 0 0 0 1.5px var(--cream);
}
@media (hover: hover) {
  .btn:hover {
    background: #fff;
  }
  .btn--line:hover {
    background: var(--cream);
    color: var(--ink);
  }
}

/* ---- the set -------------------------------------------------------- */

.radio__set {
  padding: 1.1rem var(--gutter) 2.5rem;
}

/* ---- nameplate ------------------------------------------------------ */

.plate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--hair);
}
.plate__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.75rem;
  text-decoration: none;
}
.plate__mark {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.3rem;
  border-radius: 50%;
  background: var(--cream);
  color: var(--body);
}
.plate__name {
  display: grid;
  font: 400 1.4rem/1.3 var(--text);
}
.plate__latin {
  font: 500 0.95rem/1 var(--num);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--soft);
}
.plate__pitch {
  grid-column: 1 / -1;
  max-width: 46ch;
  color: var(--soft);
}
.plate__app {
  grid-column: 2;
  grid-row: 1;
  min-height: 2.75rem;
  padding-inline: 1.1rem;
  font-size: 1.1rem;
}

@media (min-width: 56rem) {
  .plate {
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: clamp(1.5rem, 4vw, 4rem);
  }
  .plate__pitch {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    max-width: 52ch;
    font-size: 1rem;
    line-height: 1.45;
  }
  .plate__app {
    grid-column: 3;
  }
}

/* ---- stations: the plain programme list (no JS) ---------------------- */

.station {
  display: grid;
  gap: 1rem;
  padding: 2rem 0 2.25rem;
  border-bottom: 1px solid var(--hair);
}
.station__freq {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font: 700 3.5rem/0.9 var(--num);
}
.station__freq span {
  font: 500 1rem/1 var(--num);
  letter-spacing: 0.16em;
  color: var(--soft);
}

/* The art sits in a speaker grille; between stations the grille shows. */
.station__art {
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  background-color: var(--deep);
  background-image: radial-gradient(circle at center, color-mix(in srgb, var(--cream) 30%, transparent) 1.1px, transparent 1.6px);
  background-size: 9px 9px;
  box-shadow: inset 0 0 0 1px var(--hair);
}
.station__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.station__title {
  margin-top: 0.35rem;
  font: 400 clamp(2rem, 8.4vw, 2.75rem) / 1.08 var(--text);
  text-wrap: balance;
}
.station__title[lang='hi'] {
  line-height: 1.3;
}
.station__latin {
  display: block;
  margin-top: 0.1rem;
  font: 500 1rem/1.2 var(--num);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--soft);
}
.station__tagline {
  max-width: 34ch;
  margin-top: 0.7rem;
  font-size: 1.15rem;
  line-height: 1.45;
  font-style: italic;
}
.station__tagline[lang='hi'] {
  font-style: normal;
  line-height: 1.6;
}
.station__meta {
  margin: 0.55rem 0 1.1rem;
  font-size: 0.95rem;
  color: var(--soft);
}

@media (min-width: 56rem) {
  .station {
    grid-template-columns: 9rem minmax(0, 18rem) minmax(0, 1fr);
    column-gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: start;
  }
}

/* ---- tuner on: shared (JS adds .radio--on) --------------------------- */

.radio--on .radio__set {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  row-gap: 1rem;
  min-height: 100svh;
  padding-bottom: var(--clear);
}

.radio--on .readout {
  display: grid;
  align-items: center;
  min-height: 0;
}
.radio--on .readout__inner {
  position: relative;
}

.radio--on .stations {
  display: grid;
}
.radio--on .station {
  grid-area: 1 / 1;
  grid-template-columns: minmax(0, 1fr) 42%;
  grid-template-rows: calc(var(--freq-h) + 0.5rem) auto;
  gap: 0 1rem;
  padding: 0;
  border: 0;
  visibility: hidden;
}
.radio--on .station.is-near {
  visibility: visible;
}
.radio--on .station__freq {
  display: none;
}
.radio--on .station__art {
  grid-column: 2;
  grid-row: 1;
  aspect-ratio: auto;
  height: 100%;
}
.radio--on .station__art img {
  opacity: 0;
  transition: opacity 0.25s ease;
}
.radio--on .station__body {
  grid-column: 1 / -1;
  grid-row: 2;
  padding-top: 1rem;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.18s ease,
    visibility 0s linear 0.18s;
}
.radio--on.is-tuned .station.is-near .station__art img {
  opacity: 1;
}
.radio--on.is-tuned .station.is-near .station__body {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

/* The live frequency and the between-stations static sit over the stack. */
.radio--on .tuner {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tuner__freq {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  height: var(--freq-h);
  font: 700 var(--freq-size) / 1 var(--num);
  font-variant-numeric: tabular-nums;
  opacity: 0.5;
  transition: opacity 0.18s ease;
}
.tuner__freq span {
  font: 500 clamp(1rem, 1.6vw, 1.5rem) / 1 var(--num);
  letter-spacing: 0.16em;
  color: var(--soft);
}
.is-tuned .tuner__freq {
  opacity: 1;
}
.tuner__static {
  display: grid;
  gap: 0.25rem;
  margin-top: 1.5rem;
  color: var(--soft);
  transition: opacity 0.18s ease;
}
.tuner__static b {
  font: 700 3rem/1 var(--num);
  letter-spacing: 0.1em;
}
.is-tuned .tuner__static {
  opacity: 0;
}

/* ---- controls -------------------------------------------------------- */

.radio--on .controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.play {
  flex: none;
  display: grid;
  place-items: center;
  width: 3.75rem;
  height: 3.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  color: var(--cream);
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--deep);
}
.play svg {
  width: 1.6rem;
  height: 1.6rem;
  fill: currentColor;
}
.play__off,
.play[aria-pressed='true'] .play__on {
  display: none;
}
.play[aria-pressed='true'] .play__off {
  display: block;
}

.controls__state {
  display: grid;
  gap: 0.1rem;
  min-width: 5.25rem;
}
.lamp {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font: 500 1rem/1.2 var(--num);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--soft);
}
.lamp i {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--deep);
  box-shadow: inset 0 0 0 1px var(--hair);
}
.is-playing .lamp {
  color: var(--cream);
}
.is-playing .lamp i {
  background: var(--red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 30%, transparent);
}
.controls__time {
  font: 700 1.6rem/1 var(--num);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.meter {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 2.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: var(--deep);
}
.meter i {
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: var(--cream);
  transform: scaleY(0.12);
  transform-origin: 50% 100%;
}
.meter i:nth-child(n + 11) {
  background: var(--red);
}
.is-playing .meter i {
  animation: level 0.62s ease-in-out infinite alternate;
}
.is-playing .meter i:nth-child(3n) {
  animation-duration: 0.44s;
}
.is-playing .meter i:nth-child(3n + 1) {
  animation-duration: 0.81s;
  animation-delay: -0.3s;
}
.is-playing .meter i:nth-child(4n) {
  animation-delay: -0.5s;
}
.is-playing .meter i:nth-child(n + 11) {
  animation-name: level-peak;
}
@keyframes level {
  from {
    transform: scaleY(0.18);
  }
  to {
    transform: scaleY(0.95);
  }
}
@keyframes level-peak {
  from {
    transform: scaleY(0.08);
  }
  to {
    transform: scaleY(0.55);
  }
}

.controls__hint {
  display: none;
  margin-left: auto;
  font-size: 0.95rem;
  color: var(--soft);
  text-align: right;
}
.hint--wide {
  display: none;
}

/* ---- dial ------------------------------------------------------------ */

.radio--on .dial {
  display: block;
}
.dial {
  --step: 132px;
  --half: 50vw;
  --last: 7;
  position: relative;
  height: 5.75rem;
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  box-shadow:
    0 0 0 4px var(--deep),
    inset 0 2px 0 color-mix(in srgb, var(--ink) 14%, transparent);
  user-select: none;
  -webkit-user-select: none;
}
.dial:focus-visible {
  outline-offset: 7px;
  border-radius: 10px;
}
.dial__window {
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
}
.dial__strip {
  position: relative;
  height: 100%;
  width: calc(var(--half) * 2 + var(--last) * var(--step));
  /* twelve small ticks and two tall ones per station, in phase with the marks */
  background:
    linear-gradient(90deg, var(--ink) 0 2px, transparent 2px) calc(var(--half) - 1px) 100% / calc(var(--step) / 2) 1.15rem repeat-x,
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 62%, transparent) 0 1px, transparent 1px) calc(var(--half) - 0.5px) 100% /
      calc(var(--step) / 12) 0.6rem repeat-x;
}
.dial__mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--half) + var(--i) * var(--step));
  width: 3.5rem;
  margin-left: -1.75rem;
  padding-top: 0.55rem;
  font: 500 1.6rem/1 var(--num);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: color-mix(in srgb, var(--ink) 72%, var(--cream));
  cursor: pointer;
  scroll-snap-align: center;
}
.dial__mark::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 2px;
  height: 2rem;
  margin-left: -1px;
  background: var(--ink);
}
.dial__mark.is-near {
  font-weight: 700;
  color: var(--ink);
}
.dial__needle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--red);
  pointer-events: none;
}
.dial__needle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -6px;
  border: 6px solid transparent;
  border-top: 8px solid var(--red);
  border-bottom: 0;
}
.dial__band {
  position: absolute;
  left: 0.7rem;
  bottom: 0.35rem;
  padding: 0.1rem 0.35rem 0;
  border-radius: 3px;
  background: var(--ink);
  color: var(--cream);
  font: 500 0.85rem/1.2 var(--num);
  letter-spacing: 0.16em;
  pointer-events: none;
}

/* Phones, reduced motion: the dial is a native sideways scroller. */
.radio--strip .dial__window {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.radio--strip .dial__window::-webkit-scrollbar {
  display: none;
}
.radio--strip .hint--narrow {
  display: inline;
}

/* Wide screens: the set is pinned and the strip slides under the needle. */
.radio--pinned .radio__set {
  height: 100vh;
  min-height: 0;
}
.radio--pinned .dial {
  cursor: grab;
  touch-action: pan-y;
}
.radio--pinned .dial.is-dragging {
  cursor: grabbing;
}
.radio--pinned .dial__strip {
  will-change: transform;
}

@media (min-width: 40rem) {
  .controls__hint {
    display: block;
  }
}

@media (min-width: 56rem) {
  :root {
    --freq-size: clamp(6rem, min(13vw, 24vh), 13rem);
  }
  .radio--on .radio__set {
    row-gap: clamp(0.9rem, 2.2vh, 1.75rem);
  }
  .radio--on .station {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-rows: auto;
    column-gap: clamp(2rem, 6vw, 6rem);
    align-items: center;
  }
  .radio--on .station__art {
    grid-column: 2;
    grid-row: 1;
    height: auto;
    aspect-ratio: 16 / 10;
    max-height: 46vh;
    justify-self: end;
    width: 100%;
  }
  .radio--on .station__body {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    padding-top: calc(var(--freq-h) + 0.75rem);
  }
  .radio--on .station__title {
    font-size: clamp(2.25rem, min(4.2vw, 7vh), 4.25rem);
    line-height: 1.05;
  }
  .radio--on .station__title[lang='hi'] {
    line-height: 1.25;
  }
  .radio--on .station__tagline {
    font-size: clamp(1.1rem, 1.5vw, 1.4rem);
  }
  .tuner__static {
    margin-top: 1.25rem;
  }
  .dial {
    height: 6.5rem;
  }
  .dial__mark {
    font-size: 1.9rem;
  }
  .radio--pinned .hint--wide {
    display: inline;
  }
}

/* ---- end of draft ---------------------------------------------------- */

.after {
  padding: 5rem var(--gutter) 7rem;
  border-top: 1px solid var(--hair);
}
.after__line {
  max-width: 44ch;
  margin-top: 0.75rem;
  font-size: clamp(1.3rem, 2.6vw, 1.8rem);
  line-height: 1.35;
}

@media (prefers-reduced-motion: reduce) {
  .radio--on .station__art img,
  .radio--on .station__body,
  .tuner__freq,
  .tuner__static {
    transition: none;
  }
  .is-playing .meter i {
    animation: none;
    transform: scaleY(0.6);
  }
}

/* Fix: the long dial strip must not size the set's grid column. */
.radio__set {
  grid-template-columns: minmax(0, 1fr);
}
.radio__set > * {
  min-width: 0;
}
