/* ========================================
   Radio Page — Roscas y Cotufas
   ======================================== */

/* --- Reset y base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* --- Variables de tema --- */
:root {
  --bg: #f5f5f5;
  --bg-card: #343434;
  --text: #343434;
  --text-inv: #fff;
  --text-muted: #888;
  --accent-red: #ff3b3b;
  --shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
  --radius: 24px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-card: #1a1a1a;
  --text: #e8e8e8;
  --text-inv: #fff;
  --text-muted: #666;
  --shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Comfortaa', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

/* --- Grano / textura --- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background: repeating-conic-gradient(#777 0.00004%, transparent 0.0003%, transparent 0.00045%, #999 0.0006%) 50% 50% / 600px 600px;
  mix-blend-mode: overlay;
}

/* --- Lineas de frecuencia de fondo --- */
.bg-frequency {
  position: fixed;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.04;
}

.bg-frequency span {
  display: block;
  width: 2px;
  border-radius: 1px;
  background: var(--text);
  animation: bgFreq 3s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * 0.15s);
}

@keyframes bgFreq {
  0% { height: 20px; }
  50% { height: calc(40px + var(--i) * 8px); }
  100% { height: 30px; }
}

/* --- Navegacion --- */
.radio-nav {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 680px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-card);
  border-radius: 50px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  transition: background var(--transition), box-shadow var(--transition);
}

[data-theme="dark"] .radio-nav {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-inv);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
}

.nav-back svg {
  stroke: var(--text-inv);
}

.nav-back:hover {
  opacity: 0.6;
}

.nav-back span {
  display: none;
}

@media (min-width: 600px) {
  .nav-back span {
    display: inline;
  }
}

.on-air {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.5;
  transition: opacity 0.5s;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.on-air.active {
  opacity: 1;
}

.on-air-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 4px var(--accent-red);
  transition: box-shadow 0.5s;
}

.on-air.active .on-air-dot {
  animation: onAirPulse 1.8s ease-in-out infinite;
}

@keyframes onAirPulse {
  0%, 100% {
    box-shadow: 0 0 4px var(--accent-red), 0 0 8px rgba(255, 59, 59, 0.2);
  }
  50% {
    box-shadow: 0 0 8px var(--accent-red), 0 0 20px rgba(255, 59, 59, 0.4);
  }
}

.on-air-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--text-inv);
}

/* --- Theme toggle --- */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--text-inv);
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.theme-toggle svg {
  stroke: var(--text-inv);
}

.sun-icon, .moon-icon {
  position: absolute;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

/* --- Contenido principal --- */
.radio-main {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 80px 20px 60px;
}

/* --- Bloque de imagen --- */
.image-block {
  margin-bottom: 32px;
  animation: fadeSlideUp 0.8s ease-out both;
}

.image-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transform: rotate(-1.2deg);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), box-shadow var(--transition);
}

.image-frame:hover {
  transform: rotate(0deg) scale(1.01);
}

.image-frame img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  animation: kenBurns 25s ease-in-out infinite alternate;
}

@keyframes kenBurns {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

.image-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.02) 3px,
    rgba(0, 0, 0, 0.02) 4px
  );
  pointer-events: none;
}

.image-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  pointer-events: none;
}

.image-station {
  position: absolute;
  bottom: 16px;
  left: 20px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
}

/* --- Divisor de frecuencia --- */
.freq-divider {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  margin: -8px 0 28px;
  overflow: hidden;
}

.freq-divider span {
  display: block;
  width: 2px;
  border-radius: 1px;
  background: var(--text);
  opacity: 0.12;
  animation: freqBar 2s ease-in-out infinite alternate;
}

.freq-divider span:nth-child(odd) {
  height: 8px;
  animation-delay: 0s;
}

.freq-divider span:nth-child(even) {
  height: 16px;
  animation-delay: 0.3s;
}

.freq-divider span:nth-child(3n) {
  height: 12px;
  animation-delay: 0.6s;
}

.freq-divider span:nth-child(5n) {
  height: 22px;
  animation-delay: 0.1s;
}

.freq-divider span:nth-child(7n) {
  height: 6px;
  animation-delay: 0.4s;
}

@keyframes freqBar {
  0% { transform: scaleY(1); }
  50% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.2); }
}

/* --- Titulo --- */
.title-block {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeSlideUp 0.8s ease-out 0.2s both;
}

.title-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.radio-title {
  font-family: 'Bebas Neue', sans-serif;
  line-height: 0.82;
  letter-spacing: 4px;
  margin-bottom: 16px;
}

.title-line {
  display: block;
  font-size: clamp(72px, 18vw, 150px);
  opacity: 0;
  transform: translateY(40px) skewY(2deg);
  animation: titleReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(0.3s + var(--delay) * 0.12s);
}

.title-ampersand {
  font-size: clamp(36px, 8vw, 60px) !important;
  letter-spacing: 12px;
  opacity: 0;
  color: var(--text-muted);
}

@keyframes titleReveal {
  to {
    opacity: 1;
    transform: translateY(0) skewY(0);
  }
}

.radio-date {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-top: 8px;
}

/* --- Reproductor --- */
.player-section {
  margin-bottom: 40px;
  animation: fadeSlideUp 0.8s ease-out 0.4s both;
}

.player-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: background var(--transition), box-shadow var(--transition);
}

.player-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1.5px;
  background: linear-gradient(
    135deg,
    rgba(255, 59, 59, 0.3),
    transparent 40%,
    transparent 60%,
    rgba(255, 255, 255, 0.08)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}

.player-card.playing::before {
  opacity: 1;
}

/* --- Visualizador --- */
.visualizer {
  width: 100%;
  height: 50px;
  margin-bottom: 12px;
  border-radius: 8px;
  display: block;
}

/* --- Controles --- */
.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.play-btn {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-inv);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.3s, background 0.3s, transform 0.15s;
}

.play-btn:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
}

.play-btn:active {
  transform: scale(0.93);
}

.play-btn svg {
  position: relative;
  z-index: 1;
}

#icon-play {
  margin-left: 3px;
}

.play-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-red);
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

.player-card.playing .play-ring {
  animation: ringPulse 2s ease-out infinite;
}

@keyframes ringPulse {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

.player-track {
  flex: 1;
  min-width: 0;
}

/* --- Barra de progreso --- */
.progress-wrap {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.progress-bg {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.progress-fill {
  position: absolute;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--text-inv);
  border-radius: 2px;
  transition: width 0.1s linear;
}

.progress-handle {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 14px;
  height: 14px;
  background: var(--text-inv);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.2s;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.progress-wrap:hover .progress-handle,
.progress-wrap.seeking .progress-handle {
  transform: translate(-50%, -50%) scale(1);
}

.time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  font-variant-numeric: tabular-nums;
}

.time-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
}

/* --- Contexto --- */
.context-block {
  margin-bottom: 32px;
  animation: fadeSlideUp 0.8s ease-out 0.5s both;
}

.context-inner {
  position: relative;
  padding-left: 40px;
}

.context-mark {
  position: absolute;
  top: -20px;
  left: 0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 100px;
  line-height: 1;
  color: var(--text);
  opacity: 0.06;
  pointer-events: none;
  user-select: none;
}

.context-inner p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-muted);
  max-width: 480px;
}

/* --- Ecualizador decorativo --- */
.eq-strip {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 3px;
  height: 45px;
  margin-bottom: 40px;
  opacity: 0.08;
  transition: opacity 0.5s;
}

.eq-strip.active {
  opacity: 0.2;
}

.eq-strip span {
  display: block;
  width: 3px;
  height: 6px;
  border-radius: 1.5px;
  background: var(--text);
  transition: height 0.3s;
}

.eq-strip.active span {
  height: var(--h);
  animation: eqBounce var(--d) ease-in-out infinite alternate;
}

@keyframes eqBounce {
  0% { height: 6px; }
  100% { height: var(--h); }
}

/* --- Botones de accion --- */
.cta-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeSlideUp 0.8s ease-out 0.6s both;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  color: var(--text-inv);
  padding: 14px 28px;
  border-radius: 50px;
  text-decoration: none;
  font-family: 'Comfortaa', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, background var(--transition);
}

.btn-share:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.btn-share:active {
  transform: translateY(0) scale(0.97);
}

.btn-home {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 1px;
  transition: color 0.2s;
}

.btn-home:hover {
  color: var(--text);
}

/* --- Animacion de entrada general --- */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsive --- */
@media (min-width: 768px) {
  .radio-main {
    padding-top: 100px;
    padding-bottom: 80px;
  }

  .image-frame {
    transform: rotate(-0.8deg);
  }

  .image-frame:hover {
    transform: rotate(0) scale(1.005);
  }

  .player-card {
    padding: 20px 24px;
  }

  .visualizer {
    height: 60px;
  }

  .play-btn {
    width: 64px;
    height: 64px;
  }

  .context-inner {
    padding-left: 56px;
  }

  .context-mark {
    font-size: 130px;
    top: -28px;
  }
}

@media (max-width: 380px) {
  .radio-title .title-line {
    font-size: 58px;
  }

  .player-card {
    padding: 16px;
  }

  .play-btn {
    width: 48px;
    height: 48px;
  }

  .play-btn svg {
    width: 22px;
    height: 22px;
  }
}

/* --- Transiciones de tema --- */
.image-frame,
.player-card,
.btn-share,
.nav-back,
.on-air-label,
.title-tag,
.radio-date,
.context-inner p,
.btn-home,
.eq-strip span,
.freq-divider span,
.bg-frequency span {
  transition: background var(--transition), color var(--transition),
    box-shadow var(--transition), border-color var(--transition);
}
