/* Familia pelota-libre — canales y /embed/eventos.html. Colores editables: var(--c-*). */

:root {
  /* Paleta clara */
  --bg: var(--c-fondo);
  --bg-soft: #eaf0ec;
  --surface: #ffffff;
  --surface-2: #f1f5f2;
  --border: #d9e3dc;
  --border-soft: #e7eee9;

  --text: var(--c-texto);
  --text-dim: #4a5a51;
  --text-mute: #74847a;

  --brand: var(--c-primario);
  --brand-strong: var(--c-primario);
  --brand-dark: var(--c-oscuro);
  --brand-soft: color-mix(in srgb, var(--c-primario) 9%, transparent);
  --live: #e11d48;

  --r-sm: 6px;
  --r: 10px;

  --shadow: 0 2px 10px rgba(20, 50, 30, .07);
  --ring: 0 0 0 3px color-mix(in srgb, var(--c-primario) 25%, transparent);

  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img, svg, iframe { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
ul { list-style: none; }

:where(button, a, input, select, textarea, summary):focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

/* ================= HEADER ================= */

header.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 22px;
  background: linear-gradient(to right, var(--brand-strong), var(--brand-dark));
  box-shadow: 0 2px 8px rgba(20, 50, 30, .15);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .3px;
  white-space: nowrap;
  flex: none;
}
.logo:hover { color: #fff; }
.logo svg, .logo img { width: 27px; height: 27px; flex: none; }
.logo img { object-fit: contain; }
.logo-punto { fill: var(--c-acento); }
.logo i { font-style: normal; opacity: .85; font-weight: 700; }

.navbar { display: flex; gap: .9rem; flex-wrap: nowrap; justify-content: flex-end; min-width: 0; }
.navbar a {
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: .9;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: opacity .2s, border-color .2s;
}
.navbar a:hover,
.navbar a[aria-current="page"] { color: #fff; opacity: 1; border-bottom-color: #fff; }

#menu-toggle {
  display: none;
  background: none;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 2px;
}
#menu-toggle svg { width: 1.6rem; height: 1.6rem; }

/* Panel lateral en móvil */
#menu-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 30, 20, .45);
}
#menu-modal.open { display: block; }

.modal-content {
  position: relative;
  width: 270px;
  max-width: 80%;
  height: 100%;
  padding: 22px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
#menu-close {
  position: absolute;
  top: 14px; right: 14px;
  background: none;
  border: 0;
  color: var(--text-mute);
  cursor: pointer;
}
#menu-close svg { width: 1.5rem; height: 1.5rem; }
#menu-close:hover { color: var(--text); }

.modal-nav { display: flex; flex-direction: column; margin-top: 2.2rem; }
.modal-nav a {
  padding: 12px 2px;
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
}
.modal-nav a:hover { color: var(--brand); }

/* ================= MAIN ================= */
/* Mismo cálculo que el sitio de referencia: 91.66 % de ancho con tope
   del 66.66 % de la pantalla. Se añade un tramo intermedio para que en
   portátiles de 1024-1200 px no quede exageradamente estrecho. */

main {
  width: 91.666667%;
  max-width: 66.666667%;
  margin: .6rem auto;
  padding: 20px 0;
  flex: 1 0 auto;
}

@media (max-width: 1200px) { main { max-width: 92%; } }
@media (max-width: 768px)  { main { width: 100%; max-width: 95%; padding: 12px 0; } }

/* ================= TÍTULOS ================= */

h1 {
  color: var(--brand);
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
  margin: .6rem 0 18px;
}
h2 { font-size: 20px; font-weight: 700; line-height: 1.3; }
h3 { font-size: 15px; font-weight: 700; }

/* ================= REPRODUCTOR ================= */

.subiframe {
  width: 100%;
  margin: 16px auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
.preframe { border-radius: 8px; overflow: hidden; background: #000; }
#embedIframe { width: 100%; aspect-ratio: 16 / 9; border: 0; }

.centerfull { width: 100%; text-align: center; }

#btnIframe {
  width: 100%;
  max-width: 240px;
  margin: 8px auto 4px;
  padding: 9px 20px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--brand-strong);
  color: #fff;
  font: 600 13px/1 inherit;
  cursor: pointer;
  transition: background-color .2s;
}
#btnIframe:hover { background: var(--brand); }

.player-hint { margin-top: 6px; color: var(--text-mute); font-size: 13px; }

/* ================= TEXTO LARGO / FAQ ================= */

.prose { color: var(--text-dim); font-size: 15px; line-height: 1.75; }
.prose h2 { color: var(--text); margin: 1.6em 0 .5em; }
.prose h2:first-child { margin-top: 0; }
.prose p { margin-bottom: 1em; }
.prose strong { color: var(--text); }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.3em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: .35em; }
.prose li::marker { color: var(--brand); }

.faq { display: grid; gap: 10px; }
.faq details {
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.faq summary {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  list-style: none;
  font-size: 15px;
  font-weight: 700;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "＋"; color: var(--brand); }
.faq details[open] summary::before { content: "－"; }
.faq details > div { margin-top: 9px; color: var(--text-dim); font-size: 14px; }
.faq p { margin-top: 9px; color: var(--text-dim); font-size: 14px; }

.section { margin-top: 32px; }

/* ================= FOOTER ================= */

footer.site-footer {
  margin-top: auto;
  padding: 18px 22px;
  background: var(--bg-soft);
  border-top: 1px solid var(--border-soft);
  color: var(--text-mute);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  font-size: .875rem;
}
.footer-title { color: var(--text-dim); }
.footer-title strong { color: var(--text); }
.footer-legal { width: 100%; color: var(--text-mute); font-size: .78rem; line-height: 1.5; }

/* ================= RESPONSIVE ================= */

@media (max-width: 1080px) {
  .navbar { display: none; }
  #menu-toggle { display: flex; }
  header.site-header { padding: 8px 16px; }
  .logo { font-size: 19px; }
}

@media (max-width: 768px) {
  h1 { font-size: 22px; }
}


@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Secciones fuera de pantalla: el navegador ahorra trabajo de renderizado. */
.defer { content-visibility: auto; contain-intrinsic-size: auto 480px; }

/* ================= REPRODUCTOR SIN DESTELLO BLANCO ================= */
/* Mientras carga, el iframe queda oculto sobre el fondo negro de .preframe y
   aparece con un fundido cuando app.js quita "is-loading". La animación es
   solo un respaldo por si app.js no llegara a ejecutarse. */
#embedIframe { transition: opacity .3s ease; }
.preframe.is-loading #embedIframe { opacity: 0; animation: player-reveal .3s ease 6s forwards; }
@keyframes player-reveal { to { opacity: 1; } }

/* ================= MIGAS DE PAN ================= */
.migas { margin: 0 0 8px; color: var(--text-mute); font-size: 13px; }
.migas a { color: var(--text-dim); }
.migas a:hover { color: var(--brand); }
.migas [aria-current] { color: var(--text); font-weight: 600; }

/* ================= ANUNCIOS ================= */
.ad { margin: 16px auto; text-align: center; overflow: hidden; }
.ad:empty { display: none; }

/* ================= REDES (pie) ================= */
.redes { display: flex; gap: 1rem; }
.red-item { color: var(--text-dim); font-size: .875rem; }
.red-item:hover { color: var(--brand); }

/* ================= PÁGINA DE CANAL ================= */
/* El reproductor manda: ancho, arriba, justo bajo la cabecera. Debajo, texto discreto. */
main.canal { width: 100%; max-width: 1180px; padding: 12px 16px 24px; margin: 0 auto; }
main.canal .subiframe { margin-top: 0; }
.canal-texto { max-width: 860px; margin: 22px auto 0; }
.canal-texto h1 { color: var(--text); text-align: left; font-size: 19px; font-weight: 700; margin: 0 0 8px; }
.canal-texto .prose { color: var(--text-mute); font-size: 14px; line-height: 1.7; }
.canal-texto .prose strong { color: var(--text-dim); }
@media (max-width: 768px) {
  main.canal { padding: 0 0 20px; }
  main.canal .subiframe { border-radius: 0; border-left: 0; border-right: 0; }
  .canal-texto { padding: 0 14px; }
  .canal-texto h1 { font-size: 17px; }
}

/* Reproductor lo más grande posible SIN scroll: 16:9 limitado por el alto de la ventana
   (alto visible − cabecera − 22 px de margen; el botón de recargar puede quedar debajo). Pensado para laptops de 15,6" (≈1366×768 / 1536×730 útiles). */
.subiframe { max-width: none !important; width: 100% !important; padding-top: 8px !important; margin-top: 0 !important; }
.subiframe .preframe {
  position: relative !important; padding: 0 !important; height: auto !important; max-width: 100% !important;
  aspect-ratio: 16 / 9; margin: 0 auto !important;
  width: min(100%, calc((100svh - var(--alto-cabecera, 56px) - 22px) * 16 / 9)) !important;
}
.subiframe .preframe iframe { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; border: 0; }
.subiframe .player-hint { margin: 4px 0 0 !important; }

/* Como en el original (pedido 29-oct): el texto bajo los canales sin caja, sobre el fondo de la página,
   y el reproductor de canales y eventos sin el cuadro que lo enmarcaba. */
.texto-seo, .texto-seo.description { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.subiframe { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 8px 0 0 !important; }

/* ================= REPRODUCTOR EN NAVEGADORES VIEJOS ================= */
/* TV y Android antiguos: sin aspect-ratio (Chrome < 88) el cuadro quedaba con alto 0;
   se usa el truco del padding 16:9. top/left por si falta inset (Chrome < 87). */
.subiframe .preframe iframe { top: 0 !important; left: 0 !important; }
@supports not (aspect-ratio: 16 / 9) {
  .subiframe .preframe { height: 0 !important; padding-top: 56.25% !important; }
}
/* Con movimiento reducido no hay animación de respaldo: el iframe se ve desde el principio. */
@media (prefers-reduced-motion: reduce) {
  .preframe.is-loading #embedIframe { opacity: 1; }
}
