/* =========================================================
   Yaadein Radio — Nostalgia Music Site
   ========================================================= */

:root {
  --accent: #e3a857;
  --accent-light: #f6cd8b;
  --accent-glow: rgba(227, 168, 87, 0.45);

  --ink: #f5efe4;
  --ink-dim: rgba(245, 239, 228, 0.7);
  --ink-faint: rgba(245, 239, 228, 0.45);

  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-top: rgba(255, 255, 255, 0.15);
  --glass-bottom: rgba(255, 255, 255, 0.055);

  --safe-t: max(1rem, env(safe-area-inset-top));
  --safe-r: max(1rem, env(safe-area-inset-right));
  --safe-b: max(1rem, env(safe-area-inset-bottom));
  --safe-l: max(1rem, env(safe-area-inset-left));

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: #0a0806;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a { color: inherit; }

.page {
  position: relative;
  min-height: 100dvh;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------------- Background ---------------- */

.hero-bg {
  position: fixed;
  inset: 0;
  z-index: -20;
  background-image: url("public/bg/scene-wide.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.02);
}

@media (orientation: portrait) {
  .hero-bg {
    background-image: url("public/bg/scene-tall.png");
  }
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: -15;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.35),
    transparent 42%,
    transparent 58%,
    rgba(0, 0, 0, 0.80)
  );
}

/* ---------------- Grain overlay ---------------- */

.grain-overlay {
  position: fixed;
  inset: -10%;
  z-index: -10;
  width: 120%;
  height: 120%;
  mix-blend-mode: overlay;
  opacity: 0.3;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 8s steps(4) infinite;
}

@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-1%, 1%); }
  50%  { transform: translate(1%, -1%); }
  75%  { transform: translate(-1%, -1%); }
  100% { transform: translate(0, 0); }
}

/* ---------------- Top bar ---------------- */

.top-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
  flex-wrap: wrap;
}

.clock {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(to bottom, var(--glass-top), var(--glass-bottom));
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
}

.clock__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

#clockTime .colon {
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.listener-count {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-dim);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(to bottom, var(--glass-top), var(--glass-bottom));
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  white-space: nowrap;
}

.listener-count__pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7CE38B;
  box-shadow: 0 0 0 0 rgba(124, 227, 139, 0.6);
  animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(124, 227, 139, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(124, 227, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 227, 139, 0); }
}

.social-links {
  display: inline-flex;
  gap: 1.1rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-dim);
}

.social-links a {
  text-decoration: none;
  padding: 0.3rem 0.1rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.social-links a:hover,
.social-links a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------------- Playlist chips ---------------- */

.playlist-bar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem var(--safe-r) 0 var(--safe-l);
  flex-wrap: wrap;
}

.playlist-chip {
  border: 1px solid var(--glass-border);
  background: linear-gradient(to bottom, var(--glass-top), var(--glass-bottom));
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  color: var(--ink-dim);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  transition: color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.playlist-chip:hover { color: var(--ink); }

.playlist-chip:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

.playlist-chip.is-active {
  color: #241a0d;
  background: linear-gradient(to bottom, var(--accent-light), var(--accent));
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 18px var(--accent-glow);
}

/* ---------------- Player wrapper ---------------- */

.player {
  position: relative;
  z-index: 10;
  margin-top: auto;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
}

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

.player-desktop,
.player-mobile,
.playlist-chip,
.clock,
.listener-count {
  box-shadow:
    0 16px 48px -12px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.player-desktop,
.player-mobile {
  border: 1px solid var(--glass-border);
  background: linear-gradient(to bottom, var(--glass-top), var(--glass-bottom));
  backdrop-filter: blur(24px) saturate(1.7);
  -webkit-backdrop-filter: blur(24px) saturate(1.7);
}

/* ---------------- Player visual (vinyl + video frame) ---------------- */

.player-visual {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
}

.player-visual--sm { transform: scale(0.86); transform-origin: left center; }

/* Decorative vinyl disc — pure CSS, never contains the video, so it
   always looks perfect regardless of playback/error state. */

.vinyl {
  position: relative;
  flex: none;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(
      circle at center,
      #1c1712 0px,
      #1c1712 2px,
      #0c0a08 3px,
      #0c0a08 4px
    );
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.vinyl--sm { width: 64px; height: 64px; }

.vinyl.playing { animation: spin 8s linear infinite; }
.vinyl.paused { animation-play-state: paused; }

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

.vinyl__label {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34%;
  height: 34%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: linear-gradient(to bottom, var(--accent-light), var(--accent));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.vinyl__spindle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

/* Real, visible YouTube frame — a genuine rectangle at 16:9, filled
   edge-to-edge with no scaling/cropping tricks, so both normal
   playback and YouTube's own error states render cleanly and legibly.
   It sits offset over the vinyl like an album sleeve peeking out from
   behind the record — never hidden, zero-opacity, or off-screen. */

.video-frame {
  position: relative;
  flex: none;
  width: 96px;
  aspect-ratio: 16 / 9;
  margin-left: -22px;
  border-radius: 10px;
  overflow: hidden;
  background: #050403;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(10, 8, 6, 0.6);
}

.video-frame--sm {
  width: 78px;
  margin-left: -18px;
}

.video-frame__wrap {
  position: absolute;
  inset: 0;
}

.video-frame__wrap iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.yt-mount {
  width: 100%;
  height: 100%;
}

/* ---------------- Track info ---------------- */

.track-info { min-width: 0; }

.track-info__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-info__artist {
  margin: 0.1rem 0 0;
  font-size: 12.5px;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- Seek bar ---------------- */

.seek { width: 100%; }

.seek__hit {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
  touch-action: none;
  cursor: pointer;
}

.seek__hit:focus-visible .seek__rail {
  outline: 2px solid var(--accent-light);
  outline-offset: 4px;
  border-radius: 4px;
}

.seek__rail {
  position: relative;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

.seek__progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.seek__knob {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--accent);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s ease;
  pointer-events: none;
}

.seek__hit:hover .seek__knob,
.seek__hit:focus-visible .seek__knob,
.seek__hit.is-dragging .seek__knob {
  transform: translate(-50%, -50%) scale(1);
}

.time-row { margin-top: 0.35rem; }

.time {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

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

.transport {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
}

.btn {
  border: none;
  background: transparent;
  color: var(--ink-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.btn--ghost {
  width: 36px;
  height: 36px;
}

.btn--ghost:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }

.btn--touch {
  width: 44px;
  height: 44px;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

.btn--play {
  width: 52px;
  height: 52px;
  color: #241a0d;
  background: linear-gradient(to bottom, var(--accent-light), var(--accent));
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn--play:hover { transform: scale(1.04); }
.btn--play:active { transform: scale(0.97); }

.btn--play[data-playing="true"] .icon-play { display: none; }
.btn--play[data-playing="false"] .icon-pause { display: none; }

/* =========================================================
   DESKTOP PLAYER  (>= 640px)
   ========================================================= */

.player-desktop {
  display: none;
}

.player-mobile {
  display: flex;
}

@media (min-width: 640px) {
  .player-desktop {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 640px;
    border-radius: 9999px;
    padding: 12px 20px 12px 12px;
  }

  .player-desktop .track-info { flex: 1 1 auto; }

  .player-mobile { display: none; }
}

/* =========================================================
   MOBILE PLAYER  (< 640px)
   ========================================================= */

.player-mobile {
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 420px;
  border-radius: 26px;
  padding: 16px 18px;
}

.player-mobile__row1 {
  display: flex;
  align-items: center;
  gap: 14px;
}

.track-info--mobile {
  flex: 1 1 auto;
  align-self: center;
}

.player-mobile__row3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------------- Utility / a11y ---------------- */

@media (prefers-reduced-motion: reduce) {
  .vinyl.playing { animation: none; }
  .grain-overlay { animation: none; }
  .listener-count__pulse { animation: none; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .playlist-bar { display: none; }
}

/* ---------------- Runtime warning ---------------- */

.runtime-warning {
  position: relative;
  z-index: 20;
  margin: var(--safe-t) var(--safe-r) 0 var(--safe-l);
  padding: 0.7rem 1rem;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #2a1607;
  background: linear-gradient(to bottom, var(--accent-light), var(--accent));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.runtime-warning code {
  background: rgba(0, 0, 0, 0.15);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.78em;
}

/* =========================================================
   ABOUT SECTION
   ========================================================= */

.about {
  position: relative;
  z-index: 5;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: 4rem var(--safe-r) 3rem var(--safe-l);
}

.about::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(6, 4, 2, 0.55), rgba(6, 4, 2, 0.92));
  z-index: -1;
}

.about__inner {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

.about__eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-light);
}

.about__heading {
  margin: 0 0 1.1rem;
  font-size: clamp(1.8rem, 4.4vw, 2.9rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 20ch;
}

.about__lede {
  margin: 0 0 2.75rem;
  max-width: 56ch;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-dim);
}

.about__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 3.5rem;
}

.about__card {
  border: 1px solid var(--glass-border);
  background: linear-gradient(to bottom, var(--glass-top), var(--glass-bottom));
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-radius: 18px;
  padding: 1.4rem 1.3rem 1.6rem;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.7);
}

.about__card-mark {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  margin-bottom: 0.7rem;
}

.about__card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.98rem;
  font-weight: 600;
}

.about__card p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-dim);
}

.about__footer {
  padding-top: 2rem;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.about__footer-brand {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.about__footer-links {
  display: flex;
  gap: 1.1rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.about__footer-links a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.about__footer-links a:hover,
.about__footer-links a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.about__footer-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.72rem;
  color: var(--ink-faint);
}

@media (max-width: 720px) {
  .about__grid { grid-template-columns: 1fr; }
}
