/* ---------------------------------------------------------------- tokens */

:root {
  --ink: #17100d;
  --paper: #f6ece1;
  --ember: #c8402c;

  --glass: rgba(24, 15, 12, 0.46);
  --glass-edge: rgba(255, 255, 255, 0.16);
  --glass-blur: blur(26px) saturate(1.35);

  --text: rgba(255, 255, 255, 0.94);
  --text-dim: rgba(255, 255, 255, 0.62);
  --text-faint: rgba(255, 255, 255, 0.42);

  --dock-gap: clamp(14px, 3vh, 26px);
  --shell: clamp(12px, 2.4vw, 28px);
}

/* ------------------------------------------------------------------ base */

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

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ----------------------------------------------------------------- stage */

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.stage__art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 44% 46%;
  /* The illustration is warm already; a touch more contrast helps text sit on it. */
  filter: saturate(1.04) contrast(1.03);
  /* Slight overscale so micro-shake never shows empty edges.
     Transform is driven by js/groove.js to the current track's tempo. */
  transform: scale(1.035);
  will-change: transform;
}

/* Darkens the top and bottom just enough for the chrome to stay legible. */
.stage__wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(12, 7, 5, 0.5) 0%, rgba(12, 7, 5, 0) 22%),
    linear-gradient(to top, rgba(12, 7, 5, 0.66) 0%, rgba(12, 7, 5, 0) 34%),
    radial-gradient(120% 80% at 50% 30%, rgba(12, 7, 5, 0) 38%, rgba(12, 7, 5, 0.36) 100%);
}

/* Fine noise so the flat vector art reads as printed rather than digital. */
.stage__grain {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.5'/></svg>");
}

/* -------------------------------------------------------------- wordmark */

.wordmark {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.02em;
  margin: 0;
  /* Bias the block upward so it lands on the painted wall, clear of the dock. */
  padding-bottom: 15vh;
  pointer-events: none;

  font-family: 'Noto Sans Kannada', 'Baloo Tamma 2', sans-serif;
  font-weight: 900;
  font-size: clamp(3rem, 11.5vw, 9.5rem);
  line-height: 0.98;
  letter-spacing: -0.005em;
  color: var(--paper);
  text-align: center;
  text-shadow:
    0 2px 0 rgba(90, 22, 12, 0.35),
    0 10px 42px rgba(30, 8, 4, 0.5);
}

.wordmark__line {
  display: block;
}

/* --------------------------------------------------------------- top bar */

.topbar {
  position: fixed;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: calc(var(--shell) * 0.8) var(--shell);
  font-size: 13px;
}

.topbar__side {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.topbar__side--end {
  justify-content: flex-end;
}

.clock {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

.station {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px 5px 11px;
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.station:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.station__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55);
  animation: pulse 2.6s ease-out infinite;
}

/* Off the shared broadcast: the dot goes amber and stops breathing. */
.station[data-live='false'] .station__dot {
  background: #f5b642;
  animation: none;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.links a {
  color: var(--text-dim);
  transition: color 0.2s ease;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.links a:hover {
  color: var(--text);
}

.links__out {
  opacity: 0.55;
  font-size: 0.85em;
}

/* ------------------------------------------------------------------ sink */

/* The audio iframe must stay rendered and on-screen or browsers throttle it. */
.sink {
  position: fixed;
  z-index: -1;
  right: 0;
  bottom: 0;
  width: 240px;
  height: 135px;
  opacity: 0;
  pointer-events: none;
}

.sink iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ------------------------------------------------------------------ dock */

.dock {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: calc(var(--dock-gap) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(840px, calc(100vw - 2 * var(--shell)));
}

.unmute {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--ember);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 8px 26px rgba(140, 34, 20, 0.5);
  animation: rise 0.4s ease both, nudge 2.8s ease-in-out 1s infinite;
}

.unmute svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes nudge {
  0%, 88%, 100% { transform: translateY(0); }
  94% { transform: translateY(-3px); }
}

/* ---------------------------------------------------------------- player */

.player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas:
    "meta meta meta"
    "disc transport volume";
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
  width: 100%;
  padding: 14px 16px 12px;
  border: 1px solid var(--glass-edge);
  border-radius: 28px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 18px 50px rgba(10, 5, 3, 0.45);
}

.meta {
  grid-area: meta;
  min-width: 0;
}

.disc {
  grid-area: disc;
  justify-self: start;
}

.transport {
  grid-area: transport;
  justify-self: center;
}

.volume {
  grid-area: volume;
  justify-self: end;
}

/* Spinning record ---------------------------------------------------- */

.disc {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  background: #241a16;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  animation: spin 9s linear infinite;
  animation-play-state: paused;
}

.player[data-playing='true'] .disc {
  animation-play-state: running;
}

.disc__art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.42);
  opacity: 1;
  transition: opacity 0.35s ease;
}

.disc__art.is-swap {
  opacity: 0.35;
}

.disc__spindle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(20, 12, 9, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Track metadata ----------------------------------------------------- */

.meta {
  min-width: 0;
}

.meta.is-fresh .meta__title,
.meta.is-fresh .meta__artist {
  animation: credit-in 0.35s ease both;
}

.meta__clip {
  min-width: 0;
  overflow: hidden;
}

.meta__sub {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
  min-width: 0;
}

.meta__clip--artist {
  flex: 1 1 auto;
  min-width: 0;
}

.meta__title,
.meta__artist {
  margin: 0;
  white-space: nowrap;
}

.meta__clip:not(.is-marquee) .meta__title,
.meta__clip:not(.is-marquee) .meta__artist {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.meta__clip.is-marquee {
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 1.4em), transparent);
}

.meta__clip.is-marquee .meta__title,
.meta__clip.is-marquee .meta__artist {
  display: inline-block;
  padding-right: 1.6em;
  animation: credit-scroll var(--marquee-ms, 10s) linear 1.1s infinite;
}

.meta__title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
}

.meta__artist {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
}

.times {
  flex: 0 0 auto;
  margin: 0;
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@keyframes credit-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes credit-scroll {
  0%, 14% { transform: translateX(0); }
  86%, 100% { transform: translateX(calc(-1 * var(--marquee, 0px))); }
}

/* Scrubber ----------------------------------------------------------- */

.scrub {
  position: relative;
  margin-top: 8px;
  padding: 6px 0;
  cursor: pointer;
  touch-action: none;
}

.scrub:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 3px;
  border-radius: 4px;
}

.scrub__rail {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.scrub__fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: #fff;
}

.scrub__knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transform: translateY(-50%) scale(0);
  transition: transform 0.18s ease;
}

.scrub:hover .scrub__knob,
.scrub:focus-visible .scrub__knob,
.scrub.is-dragging .scrub__knob {
  transform: translateY(-50%) scale(1);
}

/* Transport ---------------------------------------------------------- */

.transport {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctl {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  color: #fff;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    background 0.18s ease,
    transform 0.18s cubic-bezier(0.22, 1, 0.32, 1),
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.ctl svg {
  display: block;
  grid-area: 1 / 1;
  pointer-events: none;
  fill: currentColor;
}

.ctl--skip {
  width: 44px;
  height: 44px;
  color: rgba(255, 255, 255, 0.94);
}

.ctl--skip svg {
  width: 22px;
  height: 22px;
}

.ctl--primary {
  width: 52px;
  height: 52px;
  margin: 0 4px;
  background: #fff;
  color: #16110e;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.ctl--primary .ctl__play svg,
.ctl--primary .ctl__pause svg {
  width: 22px;
  height: 22px;
}

.ctl__play,
.ctl__pause {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

/* Optical shift: nudge play left; pause stays math-centered. */
.ctl__play {
  transform: translateX(-2px);
}

.ctl--vol {
  width: 44px;
  height: 44px;
  color: rgba(255, 255, 255, 0.92);
}

.ctl--vol svg {
  width: 22px;
  height: 22px;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

@media (hover: hover) and (pointer: fine) {
  .ctl--skip:hover,
  .ctl--vol:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .ctl--primary:hover {
    transform: scale(1.04);
  }
}

.ctl--skip:active,
.ctl--vol:active {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(0.94);
}

.ctl--primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
}

.ctl__pause,
.player[data-playing='true'] .ctl__play {
  opacity: 0;
  pointer-events: none;
}

.player[data-playing='true'] .ctl__play {
  transform: translateX(-2px) scale(0.6);
}

.player[data-playing='true'] .ctl__pause {
  opacity: 1;
  transform: scale(1);
}

.ctl--vol {
  width: 44px;
  height: 44px;
  color: rgba(255, 255, 255, 0.92);
}

.ctl--vol svg {
  width: 22px;
  height: 22px;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

@media (hover: hover) and (pointer: fine) {
  .ctl--skip:hover,
  .ctl--vol:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .ctl--primary:hover {
    transform: scale(1.04);
  }
}

.ctl--skip:active,
.ctl--vol:active {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(0.94);
}

.ctl--primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
}

.ctl__pause,
.player[data-playing='true'] .ctl__play {
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}

.player[data-playing='true'] .ctl__pause {
  opacity: 1;
  transform: scale(1);
}

.volume__off,
.player[data-muted='true'] .volume__on {
  opacity: 0;
  transform: scale(0.7);
}

.player[data-muted='true'] .volume__off {
  opacity: 1;
  transform: scale(1);
}

.player[data-muted='true'] .volume__fill {
  opacity: 0.35;
}

/* Volume ------------------------------------------------------------- */

.volume {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: visible;
}

.volume__flyout {
  display: contents;
}

.volume__meter {
  position: relative;
  width: 88px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  touch-action: none;
}

.volume__meter:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 4px;
}

.volume__fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--vol, 85%);
  border-radius: inherit;
  background: #fff;
  pointer-events: none;
}

.volume__thumb {
  position: absolute;
  top: 50%;
  left: var(--vol, 85%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ------------------------------------------------------------------ hint */

.hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.34);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  transition: opacity 0.4s ease;
}

.hint kbd {
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  font: inherit;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 760px) {
  .dock {
    width: min(100%, calc(100vw - 2 * var(--shell)));
  }

  .wordmark {
    padding-bottom: 24vh;
  }

  .topbar {
    font-size: 12px;
  }

  /*
    Headings stay full-width on top. Disc, transport and volume share
    the row underneath — same three siblings as desktop.
  */
  .player {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas:
      "meta meta meta"
      "disc transport volume";
    column-gap: 8px;
    row-gap: 10px;
    padding: 14px 14px 12px;
    border-radius: 24px;
  }

  .transport {
    gap: 6px;
  }

  .player {
    overflow: visible;
  }

  .volume {
    position: relative;
    z-index: 8;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    overflow: visible;
  }

  /* Grows up from the speaker, collapses back down with a fade — not sucked into the icon. */
  .volume__flyout {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    z-index: 8;
    width: 36px;
    height: 0;
    padding: 0;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(22, 12, 9, 0.94);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition:
      height 0.28s cubic-bezier(0.22, 1, 0.32, 1),
      padding 0.28s cubic-bezier(0.22, 1, 0.32, 1),
      opacity 0.2s ease;
  }

  .volume.is-open .volume__flyout {
    height: 116px;
    padding: 12px 0;
    opacity: 1;
    pointer-events: auto;
  }

  .volume__meter {
    position: relative;
    right: auto;
    bottom: auto;
    width: 6px;
    height: 88px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: none;
  }

  .volume__fill {
    top: auto;
    width: 100%;
    height: var(--vol, 85%);
  }

  .volume__thumb {
    top: auto;
    left: 50%;
    bottom: var(--vol, 85%);
    width: 16px;
    height: 16px;
    transform: translate(-50%, 50%);
  }

  .disc {
    width: 52px;
    height: 52px;
  }

  .meta__title {
    font-size: 15px;
  }

  .meta__artist {
    font-size: 13px;
  }

  .ctl--skip,
  .ctl--vol {
    width: 44px;
    height: 44px;
  }

  .ctl--skip svg,
  .ctl--vol svg {
    width: 24px;
    height: 24px;
  }

  .ctl--primary .ctl__play svg,
  .ctl--primary .ctl__pause svg {
    width: 22px;
    height: 22px;
  }

  .ctl--primary {
    width: 54px;
    height: 54px;
    margin: 0 2px;
  }

  .hint {
    display: none;
  }
}

@media (max-width: 400px) {
  .links a:not(:last-child) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .disc,
  .station__dot,
  .unmute,
  .meta.is-fresh .meta__title,
  .meta.is-fresh .meta__artist,
  .meta__clip.is-marquee .meta__title,
  .meta__clip.is-marquee .meta__artist {
    animation: none !important;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}
