/* ==========================================================================
   Pelota Libre TV — estilos de los reproductores (canales y /embed/eventos.html)
   Mismo diseño que futbollibreplay.com. Toda la paleta está en :root.
   ========================================================================== */

:root {
  /* Paleta clara */
  --bg: #f4f7f5;
  --bg-soft: #eaf0ec;
  --surface: #ffffff;
  --surface-2: #f1f5f2;
  --border: #d9e3dc;
  --border-soft: #e7eee9;

  --text: #16211b;
  --text-dim: #4a5a51;
  --text-mute: #74847a;

  --brand: #16a34a;
  --brand-strong: #16a34a;
  --brand-dark: #15803d;
  --brand-soft: rgba(22, 163, 74, .09);
  --live: #e11d48;

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

  --shadow: 0 2px 10px rgba(20, 50, 30, .07);
  --ring: 0 0 0 3px rgba(22, 163, 74, .25);

  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 { width: 27px; height: 27px; flex: none; }
.logo i { font-style: normal; opacity: .85; font-weight: 700; }

.navbar { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: flex-end; }
.navbar a {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  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; }

.section-title {
  color: var(--text);
  text-align: center;
  margin: 35px 0 18px;
}

/* ================= TARJETAS DE CANAL ================= */

.cards-container {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 560px) { .cards-container { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .cards-container { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--brand); }

.card-image {
  display: grid;
  place-items: center;
  padding: 10px 0;
}
.card-image span {
  display: grid;
  place-items: center;
  width: 86px; height: 86px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #fff;
}
.card-image img { width: 66px; height: 66px; object-fit: contain; }

.card h3 { color: var(--text); margin-bottom: 5px; font-size: 16px; }
.card p { color: var(--text-mute); font-size: 13px; line-height: 1.45; margin-bottom: 14px; }

.btn-watch {
  display: inline-block;
  margin-top: auto;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  background: var(--brand-strong);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: background-color .2s;
}
.card:hover .btn-watch,
.btn-watch:hover { background: var(--brand); color: #fff; }

/* ================= 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 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: 900px) {
  .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; }
  .section-title { font-size: 17px; }
}

@media (max-width: 480px) {
  .card { padding: 14px 10px; }
  .card-image span { width: 66px; height: 66px; }
  .card-image img { width: 50px; height: 50px; }
  .card h3 { font-size: 14px; }
}

@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; } }
