/* ==========================================================================
   Roja Directa TV Oficial — hoja de estilos única
   Misma estructura que pelotalibreplayer.pe / futbollibreplay.com, con la
   paleta propia de este sitio: rojo #d20000, dorado #ffd700 y azul marino.
   ========================================================================== */

:root {
  /* Paleta heredada del sitio original */
  --bg: #0a1825;
  --bg-soft: #0d1b33;
  --surface: #112240;
  --surface-2: #1a2b4a;
  --border: #2a3b55;
  --border-soft: #1c2c46;

  --text: #e0e0e0;
  --text-dim: #aebbcd;
  --text-mute: #8595aa;

  --brand: #d20000;
  --brand-strong: #b10000;
  --brand-dark: #8f0000;
  --brand-soft: rgba(210, 0, 0, .18);
  --gold: #ffd700;
  --live: #ff4d4d;

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

  --shadow: 0 3px 12px rgba(0, 0, 0, .35);
  --ring: 0 0 0 3px rgba(255, 215, 0, .35);

  color-scheme: dark;
}

* { 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(--gold); text-decoration: none; }
a:hover { color: #ffe75c; }
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: #000;
  border-bottom: 3px solid var(--brand);
}

.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: var(--gold); opacity: 1; border-bottom-color: var(--brand); }

#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(0, 0, 0, .6);
}
#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(--gold); }

/* ================= 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(--gold);
  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: var(--surface-2); }
.agenda-item.is-open { background: var(--brand-soft); }

.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(--text);
}
.agenda-item.is-live .agenda-time { color: #fb7185; }

.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(--text);
}

.tag {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-mute);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tag--live { background: rgba(244, 63, 94, .18); color: #fb7185; }
.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-mute); 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(--gold); }

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

.submenu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  transition: background-color .15s, color .15s;
}
.submenu-item:hover { background: var(--surface-2); color: var(--text); }
.submenu-dot {
  width: 7px; height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--text-mute);
  transition: background-color .15s;
}
.submenu-item:hover .submenu-dot { background: var(--gold); }
.submenu-item small { color: var(--text-mute); font-weight: 600; }

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

/* ================= 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: 100%;
  height: 84px;
  padding: 8px;
  border-radius: 10px;
  background: #fff;
}
.card-image img { max-width: 132px; max-height: 66px; width: auto; height: auto; 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(--gold); }

.grid-leagues {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.grid-leagues li {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.grid-leagues a { font-weight: 700; font-size: 14px; }
.grid-leagues span { display: block; margin-top: 2px; color: var(--text-mute); font-size: 12px; }

.grid-sports {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.sport {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  transition: transform .2s, border-color .2s;
}
.sport:hover { transform: translateY(-3px); border-color: var(--brand); color: var(--text); }
.sport em { display: block; margin-bottom: 8px; font-size: 1.8rem; font-style: normal; }
.sport h2 { margin-bottom: 5px; font-size: 17px; }
.sport p { color: var(--text-mute); font-size: 13px; }

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

.info-box {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  font-size: 15px;
}
.info-box b { display: block; color: var(--text); margin-top: 12px; }
.info-box b:first-child { margin-top: 0; }
.info-box span { color: var(--text-dim); }

.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: #000;
  border-top: 3px solid var(--brand);
  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); }
.redes { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.red-item { color: var(--text-dim); font-size: .875rem; font-weight: 600; }
.red-item:hover { color: var(--gold); }
.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; }


/* ================= AÑADIDOS DE ROJA DIRECTA ================= */

/* Las banderas de la agenda son escudos y banderas apaisadas */
.agenda-flag { width: 1.7rem; height: 1.3rem; object-fit: contain; background: transparent; }

/* Páginas de canal y del reproductor */
h1.title { color: var(--gold); font-size: clamp(1.25rem, 3.4vw, 1.7rem); margin: 6px 0 4px; }

.info-box {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  font-size: 15px;
  color: var(--text-dim);
}
.info-box h2 { color: var(--gold); font-size: 17px; margin-bottom: 8px; }

/* El bloque SEO del original usa h3 y h4 */
.prose h3 { color: #fff; font-size: 16.5px; margin: 1.3em 0 .4em; }
.prose h4 { color: var(--text); font-size: 15px; margin: 1.1em 0 .3em; }
