/* Próspero Studio · Preproducción
   Tableros armados en la página (grids de presentaciones y tableros con guion y video, según
   las láminas y maquetas del cliente) y el carrusel de fotografías (carrusel.js).
   Se carga después de seccion.css. */

/* Courier Prime (Quote-Unquote Apps), licencia SIL Open Font License 1.1: la letra de guion de las maquetas. */
@font-face {
  font-family: "Courier Prime";
  src: url("../fonts/CourierPrime-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("../fonts/CourierPrime-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tableros ----------
   Cada pieza trae su caja en píxeles de la maqueta de 1600 × 900 (--x, --y, --w, --h) y en
   escritorio se coloca en proporción. Las medidas del guion van en unidades del tablero (cqw)
   para que el texto corte sus renglones igual que en la maqueta a cualquier ancho. */

.tablero {
  position: relative;
  aspect-ratio: 16 / 9;
  container-type: inline-size;
  overflow: hidden;
}
/* El fondo va en su propia capa para que la apertura recorte sólo el fondo y no las piezas, que
   tienen su propia entrada. Con el tablero entero recortado, el navegador daba sus imágenes por
   ocultas y no pedía varias hasta terminar la apertura: llegaban tarde y de golpe. */
.tablero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fondo);
}
.tablero__pieza {
  position: absolute;
  left: calc(var(--x) * 100% / 1600);
  top: calc(var(--y) * 100% / 900);
  width: calc(var(--w) * 100% / 1600);
  height: calc(var(--h) * 100% / 900);
  margin: 0;
}
.tablero__logo { object-fit: contain; }
/* Fondo en imagen (El Guardián, archivos del cliente): horizontal en escritorio y vertical en
   móvil; el navegador sólo descarga la que toca. El gris de --fondo queda debajo mientras carga. */
.tablero--netflix-el-guardian::before {
  background-image: url("../img/pre/texturas/netflix-el-guardian-16x9.webp");
  background-position: center;
  background-size: cover;
}

.tablero__foto {
  display: block;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, .3);
}
.tablero__foto img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s var(--expo);
}
@media (hover: hover) {
  .tablero__foto:hover img { transform: scale(1.06); }
}
.tablero__foto:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.tablero .video__play svg { width: clamp(52px, 5.4cqw, 104px); }

/* Etiquetas del encabezado: imagen del cliente */
.etiquetas { object-fit: contain; }

/* Guion: hoja blanca, letra de máquina en mayúsculas, formato de guion cinematográfico */
.guion {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 calc(var(--lados) * 100cqw / 1600);
  overflow: hidden;
  background: #fff;
  color: #000;
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: calc(16.8 * 100cqw / 1600);
  font-weight: 400;
  line-height: 1.15;
  text-transform: uppercase;
  /* Sobre la hoja blanca el cursor #efefef de la sección no se vería: aquí va el rosa del inicio */
  cursor: url("../img/cursor.png") 16 15, auto;
  cursor: -webkit-image-set(url("../img/cursor.png") 1x, url("../img/cursor@2x.png") 2x) 16 15, auto;
  cursor: image-set(url("../img/cursor.png") 1x, url("../img/cursor@2x.png") 2x) 16 15, auto;
}
.guion p { margin-top: 0; margin-bottom: 1.15em; }   /* sin tocar los lados: ahí va la sangría del diálogo */
.guion p:last-child { margin-bottom: 0; }
.guion strong,
.guion__escena,
.guion__personaje { font-weight: 700; }
.guion__cabeza { text-align: center; }
.guion__dialogo { margin-left: var(--sangria); max-width: var(--renglon); }
.guion--centro .guion__personaje { text-align: center; }
.guion--sangria .guion__personaje { margin-left: var(--sangria); }
.guion sup { font-size: .62em; line-height: 0; vertical-align: .62em; }

/* Entrada: el fondo del tablero se descubre de arriba hacia abajo y sus piezas llegan por filas en el mismo sentido */
.js .tablero::before {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.25s var(--expo);
}
.js .lamina.visible .tablero::before { clip-path: inset(0 0 0 0); }
.js .tablero__pieza {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s ease, transform 1s var(--expo);
  transition-delay: calc(.32s + var(--i, 0) * 55ms);
}
.js .lamina.visible .tablero__pieza { opacity: 1; transform: none; }
.js .lamina.asentado .tablero__pieza { transition-delay: 0s; }
.js.rebobinando .lamina.visible .tablero::before { clip-path: inset(0 0 100% 0); transition: clip-path .3s cubic-bezier(.6, 0, .9, .3); }
.js.rebobinando .lamina.visible .tablero__pieza { opacity: 0; transition: opacity .2s ease; transition-delay: 0s; }

/* Móvil: las piezas se apilan; las fotos van a dos columnas con la proporción de su casilla */
@media (max-width: 767px) {
  .tablero {
    aspect-ratio: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: row dense;
    gap: 8px;
    padding: 24px 10px 10px;
  }
  .tablero__pieza { position: relative; left: auto; top: auto; width: auto; height: auto; }
  .tablero--netflix-el-guardian::before { background-image: url("../img/pre/texturas/netflix-el-guardian-9x16.webp"); }
  /* Ancho propio del archivo como tope: un logotipo pequeño (Don Ramón) no se estira.
     --movil, cuando una pieza lo trae, fija su ancho (Netflix, sobre El Guardián). */
  .tablero__logo { grid-column: 1 / -1; justify-self: center; width: var(--movil, min(82%, 300px, var(--natural))); max-height: 120px; margin-bottom: 14px; }
  .tablero__logo + .tablero__logo { margin-top: -6px; }
  .etiquetas { grid-column: 1 / -1; justify-self: center; width: var(--movil, min(68%, 240px, var(--natural))); margin: -2px 0 14px; }
  .guion {
    grid-column: 1 / -1;
    display: block;
    padding: 22px 16px;
    font-size: 12px;
  }
  .guion__dialogo { margin-left: 3ch; max-width: none; }
  .guion--sangria .guion__personaje { margin-left: 3ch; }
  .tablero__video { grid-column: 1 / -1; }
  .tablero__foto { aspect-ratio: calc(var(--w) / var(--h)); }
  .tablero__foto--ancha { grid-column: 1 / -1; }
  /* Turno por fila de la rejilla de dos columnas (--im), no por la altura en escritorio */
  .js .tablero__pieza { transition-delay: calc(.32s + var(--im, 0) * 70ms); }
}

/* ---------- Carrusel ----------
   Fotografías a pantalla completa sobre fondo oscuro. La foto pulsada vuela desde su lugar
   (un «fantasma» que carrusel.js anima con transform y clip-path) hasta su caja aquí. */

html.carrusel-abierto { overflow: hidden; }

.carrusel {
  --arriba: 72px;
  --abajo: 88px;
  --lados: clamp(64px, 7vw, 136px);
  position: fixed;
  inset: 0;
  z-index: 60;
  color: #f2f2f2;
  overscroll-behavior: contain;
}
.carrusel[hidden] { display: none; }

.carrusel__fondo {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 14, .96);
  opacity: 0;
  transition: opacity .45s ease;
}
.carrusel--visible .carrusel__fondo { opacity: 1; }

.carrusel__pista {
  position: absolute;
  inset: 0;
  display: flex;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}
.carrusel__diapo {
  flex: 0 0 100%;
  height: 100%;
  margin: 0;
  display: grid;
  place-items: center;
  padding: var(--arriba) var(--lados) var(--abajo);
  box-sizing: border-box;
}
/* La caja de cada foto sale de su proporción (--ar) y del espacio disponible, sin esperar a que cargue */
.carrusel__diapo img {
  display: block;
  width: min(100%, calc((100vh - var(--arriba) - var(--abajo)) * var(--ar)));
  width: min(100%, calc((100dvh - var(--arriba) - var(--abajo)) * var(--ar)));
  height: auto;
  aspect-ratio: var(--ar);
  background: rgba(255, 255, 255, .04);
  opacity: 0;
  transition: opacity .35s ease;
  -webkit-user-drag: none;
}
.carrusel__diapo img.cargada { opacity: 1; }
/* Mientras vuela el fantasma, la foto real espera oculta debajo */
.carrusel--abriendo .carrusel__diapo.actual img,
.carrusel--cerrando .carrusel__diapo.actual img { opacity: 0; transition: none; }

.carrusel__fantasma {
  position: fixed;
  z-index: 61;
  margin: 0;
  overflow: hidden;
  transform-origin: 0 0;
  pointer-events: none;
  will-change: transform, clip-path;
}
.carrusel__fantasma img { display: block; width: 100%; height: 100%; object-fit: cover; }
.carrusel-origen { visibility: hidden; }

.carrusel__cerrar,
.carrusel__flecha {
  position: absolute;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  opacity: 0;
  transition: opacity .3s ease, background-color .3s ease, transform .5s var(--expo);
}
.carrusel__cerrar { top: 14px; right: 16px; }
.carrusel__cerrar::before,
.carrusel__cerrar::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(45deg);
}
.carrusel__cerrar::after { transform: rotate(-45deg); }
.carrusel__flecha { top: 50%; margin-top: -26px; }
.carrusel__flecha--atras { left: calc((var(--lados) - 52px) / 2); }
.carrusel__flecha--adelante { right: calc((var(--lados) - 52px) / 2); }
.carrusel__flecha svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.carrusel__flecha--adelante svg { transform: scaleX(-1); }
.carrusel__flecha[disabled] { pointer-events: none; }
.carrusel--visible .carrusel__flecha[disabled] { opacity: .18; }
@media (hover: hover) {
  .carrusel__cerrar:hover,
  .carrusel__flecha:hover { background: rgba(255, 255, 255, .08); }
  .carrusel__cerrar:hover { transform: rotate(90deg); }
  .carrusel__flecha--atras:hover { transform: translateX(-3px); }
  .carrusel__flecha--adelante:hover { transform: translateX(3px); }
}
.carrusel__cerrar:focus-visible,
.carrusel__flecha:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.carrusel__barra {
  position: absolute;
  left: var(--lados);
  right: var(--lados);
  bottom: 0;
  height: var(--abajo);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-size: 13px;
  letter-spacing: .07em;
  line-height: 1.3;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity .3s ease;
}
.carrusel__barra p { margin: 0; }
.carrusel__nombre { font-weight: 700; }
.carrusel__nombre span { margin-left: .7em; font-weight: 400; opacity: .7; }
.carrusel__cuenta { font-variant-numeric: tabular-nums; opacity: .8; white-space: nowrap; }

.carrusel--visible .carrusel__barra,
.carrusel--visible .carrusel__cerrar,
.carrusel--visible .carrusel__flecha { opacity: 1; transition-delay: .22s, 0s, 0s; }

@media (max-width: 767px) {
  .carrusel { --arriba: 66px; --abajo: 116px; --lados: 0px; }
  .carrusel__cerrar { top: 8px; right: 8px; }
  .carrusel__flecha { top: auto; bottom: 32px; margin: 0; }
  .carrusel__flecha--atras { left: 10px; }
  .carrusel__flecha--adelante { right: 10px; }
  .carrusel__barra {
    left: 72px;
    right: 72px;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    text-align: center;
    font-size: 12px;
  }
  .carrusel__nombre span { display: block; margin: 2px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .carrusel__fondo,
  .carrusel__diapo img { transition-duration: .01s; }
}
