/* Reproductor de las demos (js/demo-player.js). Escritorio: video + columna de capítulos y colores al lado.
   Móvil: video a ancho completo y, pegados debajo, capítulos en una fila deslizable y los colores. */
.dp { --ar: 1 / 1; --side: clamp(120px, 11vw, 170px); display: grid; grid-template-columns: minmax(0, 1fr) var(--side); grid-template-areas: "stage side" "colors ."; column-gap: clamp(12px, 1.4vw, 20px); row-gap: 14px; align-items: stretch; }
.flip .dp { grid-template-columns: var(--side) minmax(0, 1fr); grid-template-areas: "side stage" ". colors"; }
.dp { --arn: 1; --maxh: 78vh; }
/* el escenario nunca pasa de la altura de la ventana: el ancho sale del aspect-ratio y queda pegado a los capítulos */
.dp-stage { grid-area: stage; width: min(100%, calc(var(--maxh) * var(--arn))); justify-self: end; }
.flip .dp-stage { justify-self: start; }
.dp-row .dp-stage, .dp.waiting .dp-stage { justify-self: center; }
@media (max-width: 820px), (orientation: portrait) { .dp { --maxh: 70svh; } }
.dp-side { grid-area: side; }
.dp-colors { grid-area: colors; }
.dp.waiting, .flip .dp.waiting { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage"; }
.dp.waiting .dp-side, .dp.waiting .dp-colors { display: none; }

.dp-stage { position: relative; aspect-ratio: var(--ar); border-radius: var(--r, 20px); overflow: hidden; background: var(--bg, #225845); box-shadow: var(--sh); isolation: isolate; transition: background-color .25s; }
.dp.waiting .dp-stage { aspect-ratio: 16 / 11; }
.dp-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; opacity: 0; z-index: 0; pointer-events: none; }
.dp-v.on { opacity: 1; z-index: 1; }
.dp-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 2; pointer-events: none; display: block; }

/* secciones «sin fondo» (avisos, nota): el video blanco se funde con la página; sin caja, sombra ni radio */
.bare .dp-stage { background: transparent; box-shadow: none; border-radius: 0; overflow: visible; }
.bare .dp.waiting .dp-stage { border-radius: var(--r, 20px); overflow: hidden; }
.bare .dp-ctl .dp-btn { background: rgba(20, 20, 20, .42); }
.bare .dp-v, .bare .dp-poster { inset: 4%; width: 92%; height: 92%; }   /* aire alrededor de la nota / tarjetas */

/* bloque de espera mientras el video no existe */
.dp-wait { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; color: #fff; padding: 24px;
  background-color: var(--mat, #225845); background-image: linear-gradient(rgba(255, 255, 255, .2) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .2) 1px, transparent 1px); background-size: 34px 34px; background-position: -1px -1px; }
.dp-face { width: 72px; height: 72px; margin-bottom: 4px; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .25)); }
.dp-wait strong { font: 700 clamp(1.3rem, 2.2vw, 1.7rem)/1.1 var(--hand, cursive); }
.dp-wait small { font: 500 .98rem/1.3 var(--sans, sans-serif); opacity: .85; }

/* controles sobre el video */
.dp-ctl { position: absolute; right: 12px; bottom: 12px; z-index: 3; display: flex; gap: 8px; }
.dp-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; display: grid; place-items: center; padding: 0; cursor: pointer; color: #fff; background: rgba(20, 20, 20, .58); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .15s, transform .15s; }
.dp-btn:hover { background: rgba(20, 20, 20, .8); transform: scale(1.06); }
.dp-btn svg { width: 20px; height: 20px; }
.dp-big { position: absolute; left: 50%; top: 50%; z-index: 3; width: 78px; height: 78px; margin: -39px 0 0 -39px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; background: var(--sun, #ffc02a); color: #141414; box-shadow: 0 10px 26px -8px rgba(0, 0, 0, .5); transition: transform .15s; }
.dp-big:hover { transform: scale(1.06); }
.dp-big svg { width: 34px; height: 34px; margin-left: 4px; }

/* columna de capítulos: nunca más alta que el video (contain: size → su alto lo pone la fila del video) */
.dp-side { contain: size; min-width: 0; display: flex; flex-direction: column; }
.dp-ch { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: space-evenly; align-items: flex-start; gap: 2px; overflow: hidden; }
.flip .dp-ch { align-items: flex-end; }
.dp-ch li { max-width: 100%; }
.dp-chb { position: relative; display: block; max-width: 180px; text-align: left; border: 0; background: transparent; color: #5d594f; cursor: pointer; padding: .34em .7em .42em; border-radius: 9px;
  font: 600 clamp(.8rem, .42rem + .5vw, .98rem)/1.15 var(--sans, sans-serif); letter-spacing: -.015em; transition: background .15s, color .15s; }
.flip .dp-chb { text-align: right; }
.dp-chb span { position: relative; z-index: 1; }
.dp-chb i { position: absolute; left: .7em; right: .7em; bottom: 3px; height: 2px; border-radius: 2px; background: currentColor; transform-origin: left; transform: scaleX(var(--p, 0)); opacity: 0; }
.dp-chb:hover { background: rgba(20, 20, 20, .06); color: #141414; }
.dp-chb.on { background: var(--sun, #ffc02a); color: #141414; }
.dp-chb.on i { opacity: .55; }
/* si no caben: dos columnas de botones pequeños */
.dp-tight .dp-ch { display: grid; grid-template-columns: 1fr 1fr; align-content: space-evenly; justify-items: start; gap: 4px; }
.dp-tight .dp-chb { font-size: clamp(.72rem, .4rem + .4vw, .85rem); padding: .3em .5em .38em; }
/* último recurso: fila deslizable bajo el video (como en móvil) */
.dp-row, .flip .dp-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "side" "colors"; }
.dp-row .dp-side { contain: none; }
.dp-row .dp-ch { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 6px; justify-content: flex-start; }
.dp-row .dp-ch::-webkit-scrollbar { display: none; }
.dp-row .dp-ch li { flex: none; }
.dp-row .dp-chb { white-space: nowrap; max-width: none; background: rgba(20, 20, 20, .06); }

/* colores: fila de círculos pequeños bajo el video */
.dp-colors { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 4px; align-items: center; }
.dp-dot { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; flex: none;
  background: var(--c); box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0, 0, 0, .16), 0 3px 8px rgba(0, 0, 0, .18); transition: transform .15s; }
.dp-dot:hover { transform: scale(1.12); }
.dp-dot[aria-checked="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px #141414, 0 3px 8px rgba(0, 0, 0, .18); }

@media (max-width: 820px) {
  .dp, .flip .dp { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "side" "colors"; gap: 0; }
  .dp-side { contain: none; }
  .flip .dp-ch { align-items: center; }
  .flip .dp-chb { text-align: left; }
  .dp-chb { max-width: none; }
  .dp-stage { border-radius: 14px; box-shadow: none; justify-self: center; }
  .dp-side { flex-direction: column; padding: 10px var(--pad, 18px) 0; }
  .dp-ch { flex-direction: row; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--pad, 18px)); padding: 0 var(--pad, 18px); scroll-padding: 0 var(--pad, 18px); }
  .dp-ch::-webkit-scrollbar { display: none; }
  .dp-ch li { flex: none; }
  .dp-ch { justify-content: flex-start; overflow-y: hidden; }
  .dp-chb { white-space: nowrap; padding: 8px 13px 10px; font-size: .95rem; background: rgba(20, 20, 20, .06); }
  .dp-colors { padding: 10px var(--pad, 18px) 0; gap: 12px; }
  .dp-dot { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) { .dp-stage, .dp-btn, .dp-dot, .dp-chb { transition: none; } }
