/* ==========================================================================
   Pelota Libre TV — hoja de estilos única
   Sin frameworks, sin webfonts. Toda la paleta está en :root.
   Estructura y anchos calcados de futbollibrecl.com (una sola columna).
   ========================================================================== */

: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;
  --agenda-text: #010101;

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

/* ================= DESCRIPCIÓN ================= */

.description {
  padding: 16px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.7;
  box-shadow: var(--shadow);
}
.description strong { color: var(--text); }
.description p + p { margin-top: .7em; }

/* ================= AGENDA ================= */

#wraper {
  width: 100%;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.agenda-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: .45rem .6rem;
  background: linear-gradient(to right, var(--brand-strong), var(--brand-dark));
  color: #fff;
  text-align: center;
}
#title-agenda { font-size: .95rem; font-weight: 700; margin: 0; }

#menu { margin: 0; padding: 0; }

.agenda-item {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background-color .15s;
}
.agenda-item:last-child { border-bottom: 0; }
.agenda-item:hover { background: #f9fbfc; }

.agenda-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agenda-info { display: flex; align-items: center; flex: 1; min-width: 0; }

.agenda-time {
  flex: none;
  width: 3.4rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
  color: var(--agenda-text);
}
.agenda-item.is-live .agenda-time { color: var(--live); }

.agenda-flag {
  flex: none;
  width: 1.5rem; height: 1.5rem;
  margin-left: .5rem;
  border-radius: 3px;
  object-fit: cover;
  background: var(--surface-2);
}

.agenda-title {
  flex: 1;
  min-width: 0;
  margin-left: .75rem;
  font-weight: 600;
  font-size: 15px;
  color: var(--agenda-text);
}

.tag {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tag--live { background: rgba(225, 29, 72, .1); color: var(--live); }
.tag--next { background: var(--brand-soft); color: var(--brand-dark); }
.tag--ended { background: transparent; border: 1px solid var(--border); color: var(--text-mute); }

/* Los eventos ya emitidos se atenúan para que destaquen los que vienen. */
.agenda-item.is-ended .agenda-time,
.agenda-item.is-ended .agenda-title { color: var(--text-dim); font-weight: 600; }
.agenda-item.is-ended .agenda-flag { opacity: .6; }
.agenda-item.is-ended:hover .agenda-title { color: var(--text-dim); }

.agenda-chevron { flex: none; color: var(--text-mute); transition: transform .25s ease; }
.agenda-item.is-open .agenda-chevron { transform: rotate(180deg); color: var(--brand); }

/* Submenú desplegable con animación de altura */
.agenda-submenu {
  height: 0;
  opacity: 0;
  overflow: hidden;
  margin-left: 2.9rem;
  transition: height .35s ease, opacity .3s ease, margin-top .35s ease;
}
.agenda-submenu.open { opacity: 1; margin-top: 8px; }

.agenda-submenu li + li { border-top: 1px solid #e5e7eb; }
.submenu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: #4a5568;
  font: 400 15px/1.4 Arial, Helvetica, sans-serif;
  transition: color .15s;
}
.submenu-item:hover { color: #05b548; }
/* Pequeño triángulo de "play" delante de cada señal */
.submenu-dot {
  flex: none;
  width: 0; height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #010101;
  transition: border-color .15s;
}
.submenu-item:hover .submenu-dot { border-left-color: #05b548; }
.submenu-item small { color: var(--text-mute); font-size: 12px; }

.agenda-msg { padding: 26px 14px; text-align: center; color: var(--text-mute); font-size: 14px; }

/* Buscador de la agenda */
.agenda-search {
  position: relative;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.agenda-search svg {
  position: absolute;
  top: 50%; left: 24px;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  color: var(--text-mute);
  pointer-events: none;
}
#agenda-q {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
#agenda-q::placeholder { color: var(--text-mute); }
#agenda-q:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.agenda-item.is-hidden { display: none; }

/* ================= 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; }

/* ================= PUBLICIDAD ================= */
/* Contenedores con la medida ya reservada: no provocan saltos de diseño. */

.ad { display: grid; place-items: center; margin: 18px auto; overflow: hidden; }
.ad--leaderboard { width: 728px; height: 90px; max-width: 100%; }
.ad--box { width: 300px; height: 250px; max-width: 100%; }
@media (max-width: 767px) { .ad--leaderboard { display: none; } }

/* ================= 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; }
  #title-agenda { font-size: .88rem; }
  .section-title { font-size: 17px; }
  .agenda-title { font-size: 14px; }
  .agenda-submenu { margin-left: 1rem; }
}

@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; }
  .agenda-time { width: 2.9rem; font-size: 14px; }
  .tag { display: none; }
}

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

/* ================= PARTIDO DESTACADO ================= */
/* Campo "destacado" de Strapi: va arriba de la agenda con una estrella
   mientras no haya terminado (el orden lo decide app.js). */
.agenda-item.is-top {
  background: #fff6dd;
  box-shadow: inset 3px 0 0 #f4bc3f;
}
.agenda-item.is-top:hover { background: #fdf0cc; }
/* Con las señales desplegadas, casi blanco para que se lean bien. */
.agenda-item.is-top.is-open,
.agenda-item.is-top.is-open:hover { background: #fffdf7; }
.agenda-star {
  flex: none;
  width: 15px; height: 15px;
  margin-left: .5rem;
  color: #f2b53a;
}

/* ================= 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; } }
