/* ============================================================
   Network radio — retro handheld in the sidebar (sidebar-player.js).
   A graphite device on the light sidebar: CRT-ish screen with the
   track's cover, a speaker grille, three raised keys.
   ============================================================ */

/* Sticks to the bottom of the scrolling sidebar, so the radio stays in
   reach on short screens; the fade keeps nav items from showing through. */
.side-player {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 10px -6px 12px;
  padding: 18px 6px 6px;
  background: linear-gradient(to bottom, transparent, var(--glass-page, #fff) 16px);
}
.side-player[hidden] { display: none; }

.side-radio {
  --radio-ink: #ececef;
  --radio-dim: rgb(236 236 239 / 62%);
  padding: 10px 10px 12px;
  border-radius: 22px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgb(255 255 255 / 7%), transparent 60%),
    linear-gradient(165deg, #2e2e33, #19191c 70%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 9%),
    inset 0 -2px 0 rgb(0 0 0 / 45%),
    0 1px 2px rgb(0 0 0 / 25%),
    0 16px 30px -18px rgb(0 0 0 / 65%);
  color: var(--radio-ink);
}

/* ── screen ── */

.side-radio-screen {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 13px;
  background: #0b0b0d;
  box-shadow:
    0 0 0 3px #0d0d0f,
    0 0 0 4px rgb(255 255 255 / 6%);
  isolation: isolate;
}

.side-radio-art,
.side-radio-cover {
  position: absolute;
  inset: 0;
  display: block;
}
.side-radio-cover img { transform: scale(1.02); }
.side-radio.is-playing .side-radio-cover img {
  animation: side-radio-drift 18s ease-in-out infinite alternate;
}
@keyframes side-radio-drift {
  from { transform: scale(1.02); }
  to { transform: scale(1.12) translate(-2%, -1%); }
}

/* Scanlines + vignette + a curved glass reflection. */
.side-radio-screen::before,
.side-radio-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.side-radio-screen::before {
  background:
    repeating-linear-gradient(0deg, rgb(0 0 0 / 16%) 0 1px, transparent 1px 3px),
    radial-gradient(130% 110% at 50% 50%, transparent 60%, rgb(0 0 0 / 45%));
}
.side-radio-screen::after {
  background: linear-gradient(160deg, rgb(255 255 255 / 16%), transparent 32%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 5%);
  border-radius: inherit;
}

.side-radio-osd {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  padding: 22px 8px 8px;
  background: linear-gradient(to top, rgb(0 0 0 / 72%), transparent);
  font-family: "Departure Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  line-height: 1.25;
  letter-spacing: 0.02em;
  color: var(--radio-ink);
  text-shadow: 0 0 6px rgb(255 255 255 / 25%);
}
.side-radio-osd.is-top {
  top: 0;
  bottom: auto;
  align-items: flex-start;
  padding: 7px 8px 18px;
  background: linear-gradient(to bottom, rgb(0 0 0 / 55%), transparent);
  color: var(--radio-dim);
  text-transform: uppercase;
}

.side-radio-status {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.side-radio-dot {
  width: 5px;
  height: 5px;
  flex: none;
  align-self: center;
  border-radius: 50%;
  background: rgb(255 255 255 / 45%);
}
.side-radio.is-playing .side-radio-dot {
  background: #ff4d4d;
  box-shadow: 0 0 6px #ff4d4d;
  animation: side-radio-blink 1.6s ease-in-out infinite;
}
@keyframes side-radio-blink {
  50% { opacity: 0.35; }
}
.side-radio-state { flex: none; color: var(--radio-dim); }
.side-radio-state::after { content: " —"; }
.side-radio-title,
.side-radio-creator {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-radio-title:hover,
.side-radio-creator:hover { text-decoration: underline; }
.side-radio-title:focus-visible,
.side-radio-creator:focus-visible {
  outline: 1px solid var(--radio-ink);
  outline-offset: 1px;
}
.side-radio-creator { text-transform: none; }
.side-radio-creator[hidden] { display: none; }
.side-radio-time { flex: none; font-variant-numeric: tabular-nums; color: var(--radio-dim); }

.side-radio-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 2px;
  background: rgb(255 255 255 / 10%);
}
.side-radio-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--radio-ink);
  box-shadow: 0 0 6px rgb(255 255 255 / 45%);
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
  transition: transform 0.25s linear;
}

/* ── speaker grille ── */

.side-radio-grille {
  height: 26px;
  margin: 12px 6px 10px;
  border-radius: 8px;
  background:
    radial-gradient(circle, #09090b 1.15px, transparent 1.7px) 0 0 / 7px 7px,
    linear-gradient(#1c1c1f, #222226);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 55%), 0 1px 0 rgb(255 255 255 / 5%);
}

/* ── keys ── */

.side-radio-keys {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 6px;
  border-radius: 14px;
  background: #121214;
  box-shadow: inset 0 1px 3px rgb(0 0 0 / 60%), 0 1px 0 rgb(255 255 255 / 6%);
}

/* html[data-theme] + button outranks the nordic global button skin. */
html[data-theme] button.side-radio-key {
  height: 38px;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(#3a3a40, #26262b);
  color: #d9d9de;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 10%),
    0 2px 0 #0a0a0c,
    0 3px 6px rgb(0 0 0 / 45%);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}
html[data-theme] button.side-radio-key:hover:not(:disabled) {
  background: linear-gradient(#424249, #2b2b30);
  color: #fff;
  transform: none;
}
html[data-theme] button.side-radio-key:active:not(:disabled),
html[data-theme] button.side-radio-key[aria-pressed="true"] {
  background: linear-gradient(#2a2a2f, #232327);
  box-shadow:
    inset 0 1px 3px rgb(0 0 0 / 55%),
    0 0 0 #0a0a0c;
  transform: translateY(2px);
}
html[data-theme] button.side-radio-key:disabled {
  opacity: 0.45;
  cursor: default;
}
html[data-theme] button.side-radio-key:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.side-radio-key svg { display: block; }

/* Mobile drawer: a sheet that scrolls anyway — keep the radio in flow and
   compact so it never covers the navigation. */
@media (max-width: 1023px) {
  .side-player {
    position: static;
    padding: 0;
    background: none;
  }
  .side-radio { max-width: 300px; }
  .side-radio-screen { aspect-ratio: 16 / 9; }
}

@media (prefers-reduced-motion: reduce) {
  .side-radio.is-playing .side-radio-cover img,
  .side-radio.is-playing .side-radio-dot { animation: none; }
  .side-radio-progress::after { transition: none; }
}
