/* ==========================================================================
   Fama FM — Player da Rádio
   Paleta:
     --bg        fundo principal solicitado pelo cliente (#1C3CA3)
     --bg-deep   variação mais escura, usada em gradiente sutil
     --card      painel do player
     --accent    azul claro (extraído do modelo enviado)
     --accent-2  laranja do mascote (detalhe/hover)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #1c3ca3;
  --bg-deep: #132c7c;
  --card: #0e2166;
  --card-border: rgba(255, 255, 255, 0.10);
  --accent: #76caef;
  --accent-2: #ffab2e;
  --white: #ffffff;
  --muted: rgba(255, 255, 255, 0.68);
  --muted-soft: rgba(255, 255, 255, 0.45);
  --radius-lg: 32px;
  --radius-md: 20px;
  --font-display: "Baloo 2", "Trebuchet MS", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--white);
  background:
    radial-gradient(60% 55% at 18% -10%, rgba(118, 202, 239, 0.20), transparent 60%),
    radial-gradient(55% 50% at 100% 0%, rgba(255, 171, 46, 0.14), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--white);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  font-weight: 600;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* ---------- Wrapper geral ---------- */

.page {
  width: 100%;
  max-width: 640px;
  padding: clamp(20px, 5vw, 40px) 20px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* ---------- Cabeçalho / mascote ---------- */

.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: clamp(18px, 4vw, 28px);
}

.hero__logo-wrap {
  width: clamp(120px, 30vw, 168px);
  height: clamp(120px, 30vw, 168px);
  margin-bottom: 6px;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.35));
  animation: float 5s ease-in-out infinite;
}

.hero__logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero__wordmark {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero__wordmark-svg {
  display: block;
  height: clamp(52px, 13vw, 78px);
  width: auto;
}

/* ---------- Card do player ---------- */

.player-card {
  width: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)), var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 5vw, 30px) clamp(18px, 5vw, 30px) clamp(24px, 5vw, 30px);
  box-shadow:
    0 24px 60px -18px rgba(4, 10, 40, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
}

.player-card__status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted-soft);
  flex-shrink: 0;
}

.player-card.is-playing .live-dot {
  background: #ff5c5c;
  box-shadow: 0 0 0 0 rgba(255, 92, 92, 0.6);
  animation: pulse 1.6s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 92, 92, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(255, 92, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 92, 92, 0); }
}

.player-card__track {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 4vw, 1.3rem);
  line-height: 1.35;
  min-height: 1.35em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.player-card__track--muted {
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
}

/* ---------- Controles ---------- */

.player-card__controls {
  display: flex;
  align-items: center;
  gap: clamp(12px, 4vw, 18px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 10px 12px 10px 10px;
}

.play-btn {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 18px -6px rgba(118, 202, 239, 0.55);
}

.play-btn:hover {
  background: var(--accent-2);
  transform: translateY(-1px) scale(1.03);
}

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

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

.play-btn .icon-play {
  margin-left: 3px;
}

.play-btn[aria-pressed="true"] .icon-play,
.play-btn[aria-pressed="false"] .icon-pause {
  display: none;
}

.play-btn[aria-pressed="true"] .icon-pause,
.play-btn[aria-pressed="false"] .icon-play {
  display: block;
}

/* Visualizador de ondas */

.visualizer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  min-width: 0;
}

.visualizer span {
  display: block;
  width: 4px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), rgba(118, 202, 239, 0.35));
  height: 8px;
  transition: height 0.2s ease;
}

.player-card.is-playing .visualizer span {
  animation: bounce 1.1s ease-in-out infinite;
}

/* Quando a Web Audio API consegue ler o som de verdade, o JS assume o
   controle da altura de cada barra (dados reais de frequência) e a
   animação CSS "genérica" é desligada para não competir com ela. */
.player-card.audio-reactive .visualizer span {
  animation: none;
  transition: height 0.08s linear;
}

.visualizer span:nth-child(1) { animation-delay: -1.1s; }
.visualizer span:nth-child(2) { animation-delay: -0.9s; }
.visualizer span:nth-child(3) { animation-delay: -0.7s; }
.visualizer span:nth-child(4) { animation-delay: -0.5s; }
.visualizer span:nth-child(5) { animation-delay: -0.3s; }
.visualizer span:nth-child(6) { animation-delay: -0.15s; }
.visualizer span:nth-child(7) { animation-delay: -0.6s; }
.visualizer span:nth-child(8) { animation-delay: -0.85s; }

@keyframes bounce {
  0%, 100% { height: 8px; }
  50% { height: 26px; }
}

/* Volume */

.volume {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.volume__icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.volume__icon:hover {
  color: var(--accent);
}

.volume__icon svg {
  width: 20px;
  height: 20px;
}

.volume__range {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(64px, 18vw, 100px);
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.25);
  outline: none;
  cursor: pointer;
}

.volume__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--accent);
  cursor: pointer;
}

.volume__range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--accent);
  cursor: pointer;
}

.volume__range::-moz-range-progress {
  background: var(--accent);
  height: 4px;
  border-radius: 3px;
}

/* Estado de erro sutil */
.player-card__error {
  margin: 12px 2px 0;
  font-size: 0.82rem;
  color: #ffd1d1;
  display: none;
}

.player-card.has-error .player-card__error {
  display: block;
}

/* ---------- Redes sociais ---------- */

.social {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(12px, 4vw, 20px);
  margin-top: clamp(28px, 6vw, 40px);
}

.social__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
}

.social__icon svg {
  width: 26px;
  height: 26px;
}

.social__icon:hover,
.social__icon:focus-visible {
  background: var(--accent-2);
  transform: translateY(-4px);
}

.social__icon:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

/* ---------- Rodapé ---------- */

.footer {
  margin-top: clamp(30px, 7vw, 48px);
  text-align: center;
  color: var(--muted-soft);
  font-size: 0.8rem;
}

.footer p {
  margin: 4px 0;
}

/* ---------- Responsivo ---------- */

@media (max-width: 420px) {
  .player-card__controls {
    flex-wrap: nowrap;
    padding: 8px 8px 8px 8px;
  }

  .volume__range {
    width: 56px;
  }

  .social__icon {
    width: 50px;
    height: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__logo-wrap,
  .live-dot,
  .visualizer span {
    animation: none !important;
  }
}
