:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #111111;
  --kicker: #0058a3;
  --gap: 12px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--text); }
body.no-scroll { overflow: hidden; }

/* ================= Sección en portada ================= */
.reels {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.reels__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 2px solid var(--line);
  padding-top: .6rem;
  margin-bottom: 1rem;
}
.reels__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.4rem;
}
.reels__controls { display: flex; gap: .5rem; margin-top: -5px; }

.round-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid #ccc;
  background: #fff;
  color: #111;
  display: grid; place-items: center;
  cursor: pointer;
  transition: border-color .2s, opacity .2s;
}
.round-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.round-btn:hover:not(:disabled) { border-color: #111; }
.round-btn:disabled { opacity: .3; cursor: default; }

.reels__rail {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.reels__rail::-webkit-scrollbar { display: none; }

.reels__track {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 5 * var(--gap)) / 6);
  gap: var(--gap);
}

/* Miniatura vertical tipo reel */
.reel {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 0; padding: 0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  background: #333 center / cover no-repeat;
  color: #fff;
  text-align: left;
  font: inherit;
}
.reel video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .3s;
}
.reel.is-previewing video { opacity: 1; }
.reel::after {               /* degradado para que se lea el texto */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,0) 55%);
}
.reel__play {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  display: grid; place-items: center;
}
.reel__play::after {
  content: "";
  margin-left: 3px;
  border-left: 9px solid #fff;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}
.reel__duration {
  position: absolute; top: 12px; right: 10px; z-index: 1;
  font-size: .75rem; font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.reel__title {
  position: absolute; left: 10px; right: 10px; bottom: 12px; z-index: 1;
  margin: 0;
  font-family: "Roboto", sans-serif;
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
}
.reel:focus-visible, .round-btn:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--kicker); outline-offset: 3px;
}

/* ================= Popup reproductor ================= */
.player {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}
.player[hidden] { display: none; }
.player__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.92);
  animation: fade .25s ease;
}
.player__stage {
  position: relative;
  height: min(90vh, 820px);
  aspect-ratio: 9 / 16;
  max-width: 100vw;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  animation: pop .25s ease;
}
.player__stage video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  background: #222 center / cover no-repeat;
}
/* 3 <video> apilados (anterior/actual/siguiente): solo se ve el activo */
.player__stage video:not(.is-active) { visibility: hidden; }
.player__close { position: absolute; top: 1rem; right: 1rem; z-index: 3; }
.player__nav { position: relative; z-index: 2; flex: none; }

/* Barras de progreso estilo stories */
.player__progress {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 2;
  display: flex; gap: 4px;
}
.player__progress span {
  flex: 1; height: 3px;
  background: rgba(255,255,255,.35);
  border-radius: 2px;
  overflow: hidden;
}
.player__progress span i {
  display: block; height: 100%; width: 0;
  background: #fff;
}
.player__progress span.done i { width: 100%; }

.player__top {
  position: absolute; top: 22px; right: 10px; z-index: 2;
  display: flex; gap: 6px;
}
.icon-btn {
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: rgba(0,0,0,.45);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#mute .ico-sound, #mute.is-on .ico-muted { display: none; }
#mute.is-on .ico-sound { display: block; }
#toggle .ico-play, #toggle.is-paused .ico-pause { display: none; }
#toggle.is-paused .ico-play { display: block; }

.player__info {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 3rem 1rem 1.2rem;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
  color: #fff;
}
.player__info .kicker { color: #9cc9ff; }
.kicker { margin: 0 0 .25rem; font-size: .8rem; font-weight: 600; color: var(--kicker); }
.player__title {
  margin: 0 0 .6rem;
  font-family: "Roboto", sans-serif;
  font-size: 1.25rem;
  line-height: 1.2;
  color: #ffffff;
}
.player__link { color: #fff; font-size: .9rem; font-weight: 600; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop  { from { opacity: 0; transform: scale(.96); } }

/* ================= Responsive ================= */
@media (max-width: 1000px) {
  .reels__track { grid-auto-columns: calc((100% - 3 * var(--gap)) / 4); }
}
@media (max-width: 640px) {
  .reels__track { grid-auto-columns: 42%; }
  .reels__controls { display: none; }

  .player { gap: 0; }
  .player__stage { height: 100%; width: 100%; border-radius: 0; aspect-ratio: auto; }
  .player__nav { display: none; }      /* en móvil se navega deslizando o tocando */
  .player__close { top: 2.2rem; left: .75rem; right: auto; background: rgba(0,0,0,.45); color: #fff; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .reels__rail { scroll-behavior: auto; }
  .player__backdrop, .player__stage { animation: none; }
}
