/* Puerto Rico Racing Radio — exact flyer player + hotspot overlays */

:root {
  --asphalt: #0a0a0c;
  --red: #e10600;
  --red-hot: #ff1a1a;
  --white: #f5f5f5;
  --drawer-bg: #0e0e12;
  --drawer-w: min(360px, 92vw);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--asphalt);
  color: var(--white);
  font-family: Oswald, system-ui, sans-serif;
}

.radio-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
  overflow-x: hidden;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 40%, #1a1a1e 0%, #0a0a0c 70%),
    url("assets/flyer-player.png") center / cover;
  background-blend-mode: darken;
  filter: brightness(0.25) contrast(1.1);
  transform: scale(1.08);
  pointer-events: none;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ========== Flyer stage ========== */
.flyer-stage {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  max-width: 100%;
}

.flyer-clip {
  position: relative;
  width: 100%;
  aspect-ratio: 1280 / 720;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 12px 48px rgba(0,0,0,.65);
}

.flyer-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  aspect-ratio: 1280 / 720;
  user-select: none;
  -webkit-user-drag: none;
}

.flyer-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  pointer-events: none;
}

/* Mini: flyer-mini.png is flyer px 206–1080 × 239–524, cleaned below the buttons.
   The layer keeps full-flyer geometry so the hotspots line up. */
.flyer-stage[data-mode="mini"] .flyer-clip {
  aspect-ratio: 874 / 285;
  border-radius: 14px;
  background: url("assets/flyer-mini.png?v=20260930b") 0 0 / 100% 100% no-repeat;
  box-shadow: 0 0 0 1px rgba(255,255,255,.14), 0 8px 28px rgba(0,0,0,.55);
  cursor: pointer;
}
.flyer-stage[data-mode="mini"] .flyer-img,
.flyer-stage[data-mode="mini"] .patch { display: none; }
.flyer-stage[data-mode="mini"] .flyer-layer {
  left: calc(-100% * 206 / 874);
  top: calc(-100% * 239 / 285);
  width: calc(100% * 1280 / 874);
  height: calc(100% * 720 / 285);
  aspect-ratio: auto;
}

/* Homepage iframe: /radio/?mini=1 */
html:has(.radio-page.is-embed),
.radio-page.is-embed {
  background: transparent;
}
.radio-page.is-embed {
  min-height: 0;
  display: block;
  padding: 0;
  overflow: hidden;
}
.radio-page.is-embed .page-bg,
.radio-page.is-embed .expand-hit { display: none !important; }
.radio-page.is-embed .flyer-stage { width: 100%; }
.radio-page.is-embed .flyer-stage[data-mode="mini"] .flyer-clip { box-shadow: none; }
.flyer-stage[data-mode="full"] .mini-only { display: none !important; }
.flyer-stage[data-mode="mini"] .full-only { display: none !important; }

.expand-hit {
  display: none;
  margin-top: 8px;
  width: 100%;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.45);
  color: #fff;
  font: 600 0.85rem Oswald, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.flyer-stage[data-mode="mini"] .expand-hit { display: block; }
.expand-hit:hover { background: rgba(225,6,0,.35); border-color: var(--red); }

/* ========== Hotspots (pct of 1280×720 flyer) ========== */
.hot {
  position: absolute;
  z-index: 5;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 8px;
}
.hot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  background: rgba(255,255,255,.08);
}
.hot:hover { background: rgba(255,255,255,.06); }

/* Play circle — bbox ≈ 49.7%–56.6% × 57.8%–69.7% */
.hot-play {
  left: 49.5%;
  top: 57.5%;
  width: 7.2%;
  height: 12.2%;
  border-radius: 50%;
}
.hot-play:hover { background: rgba(225,6,0,.12); box-shadow: 0 0 24px rgba(225,6,0,.35); }

/* Fav / Share / Menu — rounded squares right of play */
.hot-fav {
  left: 62.4%;
  top: 59.8%;
  width: 4.8%;
  height: 8.2%;
  border-radius: 12px;
}
.hot-share {
  left: 68.5%;
  top: 59.8%;
  width: 4.9%;
  height: 8.2%;
  border-radius: 12px;
}
.hot-menu {
  left: 74.7%;
  top: 59.8%;
  width: 4.8%;
  height: 8.2%;
  border-radius: 12px;
}
.hot-fav.is-on {
  box-shadow: inset 0 0 0 2px var(--red-hot);
  background: rgba(225,6,0,.18);
}

/* Social icons — bottom strip */
.hot-soc {
  top: 86.8%;
  width: 3.6%;
  height: 5.5%;
  border-radius: 6px;
  display: block;
}
.hot-fb  { left: 35.8%; }
.hot-ig  { left: 41.8%; }
.hot-yt  { left: 48.0%; }
.hot-x   { left: 54.5%; }
.hot-tt  { left: 60.5%; }

.hot-web {
  left: 41%;
  top: 93.5%;
  width: 22%;
  height: 4.2%;
  border-radius: 4px;
  display: block;
}

/* ========== Visual patches ========== */
.patch {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: center;
}

/* Cover "SUENA AHORA" with flag + SONANDO AHORA */
.patch-sonando {
  /* Overlay cleaned SUENA area; TRANSPARENT bg so glass card border never gets painted over */
  left: 16.0%;
  top: 70.5%;
  width: 22.0%;
  height: 4.0%;
  background: transparent;
  color: #ff1a1a;
  font-family: Oswald, Anton, Impact, sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: clamp(9px, 1.55vw, 18px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  padding: 0 3px 0 0.6%;
  gap: 0.35em;
  justify-content: flex-start;
  text-shadow:
    0 0 6px rgba(0,0,0,.95),
    0 1px 2px rgba(0,0,0,.9),
    0 0 10px rgba(200,16,46,.55);
}
.patch-sonando .pr-flag {
  flex: 0 0 auto;
  width: clamp(14px, 2.1vw, 26px);
  height: auto;
  aspect-ratio: 60 / 40;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.28);
  object-fit: cover;
  display: block;
}
.patch-sonando span {
  white-space: nowrap;
}

/* Cover "RÁPIDO, BORICUA Y SIN FRENOS" — taller to hide white speck over P */
.patch-slogan {
  left: 18.0%;
  top: 73.6%;
  width: 46%;
  height: 5.6%;
  background: transparent;
  color: #fff;
  font-family: Anton, Impact, sans-serif;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(12px, 2.15vw, 26px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  padding: 0 4px;
  justify-content: flex-start;
  white-space: nowrap;
  overflow: hidden;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  text-shadow:
    0 0 6px rgba(0,0,0,.95),
    0 1px 3px rgba(0,0,0,.9),
    0 0 1px #000;
}

/* Red heartbeat in front of EN VIVO; right edge stays left of the E at 604px */
.live-heartbeat {
  position: absolute;
  z-index: 4;
  left: 41.88%;
  top: 34.72%;
  width: 4.84%;
  height: 6.67%;
  pointer-events: none;
}
.live-heartbeat svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.live-heartbeat polyline {
  fill: none;
  stroke: #ff1a1a;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.live-heartbeat .hb-base { opacity: .28; }
.live-heartbeat .hb-line {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 0 3px rgba(255,26,26,.95)) drop-shadow(0 0 8px rgba(200,16,46,.7));
  animation: prr-hb-trace 1.4s linear infinite;
}
@keyframes prr-hb-trace {
  0% { stroke-dashoffset: 100; opacity: 1; }
  60% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

/* EN VIVO red-dot glow — tight on the flyer live dot only */
.live-pulse {
  position: absolute;
  z-index: 4;
  left: 60.15%;
  top: 37.35%;
  width: 1.15%;
  height: 2.05%;
  border-radius: 50%;
  background: #ff1a1a;
  box-shadow: 0 0 5px 2px rgba(255,20,20,.85), 0 0 12px 3px rgba(200,16,46,.5);
  pointer-events: none;
  animation: prr-pulse 1.4s ease-in-out infinite;
}
@keyframes prr-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 6px 2px rgba(255,20,20,.85), 0 0 14px 4px rgba(200,16,46,.55); }
  50% { opacity: .55; transform: scale(1.35); box-shadow: 0 0 12px 5px rgba(255,20,20,.95), 0 0 28px 10px rgba(200,16,46,.4); }
}

/* Playing state: opaque red disc fully hides flyer play triangle, shows pause bars */
.play-state {
  position: absolute;
  z-index: 6;
  left: 49.2%;
  top: 57.2%;
  width: 7.8%;
  height: 13.2%;
  border-radius: 50%;
  pointer-events: none;
  display: none;
  align-items: center;
  justify-content: center;
  /* Flat opaque red — fully hides flyer play triangle (no ghost) */
  background: #e10600;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.22),
    inset 0 -3px 6px rgba(0,0,0,.35),
    0 0 0 2px rgba(255,255,255,.1),
    0 0 20px 5px rgba(225,6,0,.6);
  overflow: hidden;
}
.play-state::before,
.play-state::after {
  content: "";
  display: block;
  width: 14%;
  height: 36%;
  background: #fff;
  border-radius: 2px;
  margin: 0 5%;
  box-shadow: 0 0 6px rgba(0,0,0,.5);
  position: relative;
  z-index: 2;
}
.flyer-stage.is-live .play-state,
.hot-play.is-playing ~ .play-state {
  display: flex;
}

/* ========== Side drawer (slide from right) ========== */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}
.drawer:not([hidden]) {
  pointer-events: auto;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  opacity: 0;
  transition: opacity .28s ease;
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--drawer-w);
  background: var(--drawer-bg);
  border-left: 1px solid rgba(255,255,255,.12);
  box-shadow: -12px 0 40px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform .32s cubic-bezier(.22,.9,.3,1);
  padding: 0 0 env(safe-area-inset-bottom);
}
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer.is-open .drawer-panel { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.drawer-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.drawer-close {
  width: 36px; height: 36px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.drawer-close:hover { background: rgba(225,6,0,.35); }

.prog-list {
  list-style: none;
  margin: 0;
  padding: 8px 12px;
  overflow-y: auto;
  flex: 1;
}
.prog-list li {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  border-radius: 6px;
}
.prog-list li:hover { background: rgba(255,255,255,.04); }
.prog-tag {
  display: inline-block;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--red-hot);
  background: rgba(225,6,0,.15);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}
.prog-title {
  margin: 4px 0;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.3;
}
.prog-meta {
  margin: 0;
  font-size: .78rem;
  opacity: .65;
}
.drawer-note {
  margin: 0;
  padding: 12px 16px 16px;
  font-size: .72rem;
  opacity: .45;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  z-index: 300;
  background: rgba(20,20,24,.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.15);
  font-size: .9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Embed floating root */
.prr-embed-root {
  position: fixed;
  z-index: 99990;
  right: 16px;
  bottom: 16px;
  width: min(420px, calc(100vw - 24px));
  font-family: Oswald, system-ui, sans-serif;
}
.prr-embed-root .flyer-stage { width: 100%; }
.prr-embed-root.is-open {
  width: min(720px, calc(100vw - 24px));
  right: 50%;
  bottom: 50%;
  transform: translate(50%, 50%);
}
.prr-embed-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99989;
  background: rgba(0,0,0,.55);
  display: none;
}
.prr-embed-root.is-open .prr-embed-backdrop,
.prr-embed-root.is-open ~ .prr-embed-backdrop { display: block; }

.prr-close-full {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

@media (max-width: 520px) {
  .radio-page { padding: 6px; }
  .patch-sonando { font-size: clamp(8px, 2.8vw, 14px); width: 22%; }
  .patch-slogan { font-size: clamp(9px, 3.2vw, 16px); width: 50%; }
  .play-state { left: 48.5%; top: 56.5%; width: 9%; height: 14%; }
  .hot-fav, .hot-share, .hot-menu {
    /* slightly larger hit area on phones */
    width: 5.5%;
    height: 9.5%;
  }
  .hot-play { width: 9%; height: 14%; left: 48.5%; top: 56.5%; }
  .prr-embed-root { right: 8px; left: 8px; width: auto; bottom: 10px; }
  .prr-embed-root.is-open { left: 8px; right: 8px; width: auto; transform: none; bottom: 10px; }
}
