/* Sitio de novedades de Grupo NIVAR: estilos compartidos por la portada y las páginas de cada lanzamiento. */

@font-face { font-family: "Bricolage"; src: url(bricolage.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(nunito.woff2) format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  color-scheme: light;
  --papel: #FBF8F4;
  --tinta: #2B2622;
  --tinta-suave: #6E655E;
  --rojo: #A81111;
  --vino: #7F0808;
  --naranja: #D86619;
  --ambar: #EFA220;
  --cine: #0D0303;
  --panel: rgba(255, 255, 255, .64);
  --borde: rgba(43, 38, 34, .08);
  --lateral: clamp(16px, 4vw, 48px);
  --curva: cubic-bezier(.2, .7, .2, 1);
  --sombra-pantalla: 0 36px 90px -36px rgba(127, 8, 8, .38), 0 10px 28px -14px rgba(43, 38, 34, .3);
  --sombra-tarjeta: 0 28px 60px -34px rgba(127, 8, 8, .36), 0 8px 22px -14px rgba(43, 38, 34, .26);
}

* { box-sizing: border-box; margin: 0; }

body {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--papel) radial-gradient(120% 90% at 50% 38%, #FFFDFB 0%, #FBF6F1 55%, #F4EAE3 100%) fixed;
  color: var(--tinta);
  font-family: "Nunito", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img, svg, video { display: block; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--ambar); outline-offset: 3px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── Cabecera y pie ─────────────────────────────────────────────── */

.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(16px, 2.6vw, 28px) var(--lateral) 0;
}
.logo { flex: none; border-radius: 6px; }
.logo img { height: clamp(34px, 3.4vw, 46px); width: auto; }

.volver {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .62em 1.05em .62em .85em;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--borde);
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .25s ease, color .25s ease;
}
.volver svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--curva); }
.volver:hover { background: #fff; color: var(--rojo); }
.volver:hover svg { transform: translateX(-2px); }

main { padding: clamp(12px, 2vw, 24px) var(--lateral) clamp(32px, 5vw, 64px); }

footer {
  padding: 12px 16px clamp(16px, 2vw, 24px);
  text-align: center;
  color: var(--tinta-suave);
  font-size: 13px;
  font-weight: 600;
}

/* ── Piezas comunes ─────────────────────────────────────────────── */

h1, h2 { font-family: "Bricolage", system-ui, sans-serif; font-weight: 800; letter-spacing: -.025em; text-wrap: balance; }
h1 { font-size: clamp(26px, 3.3vw, 44px); line-height: 1.05; }

.linea {
  width: clamp(84px, 9vw, 128px);
  height: 5px;
  margin: clamp(12px, 1.4vw, 18px) auto;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--rojo), var(--naranja) 55%, var(--ambar));
}

/* Píldora blanca con la hoja, como la de "Presentamos" en la portada del video de la intranet. */
.pildora, .nuevo {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  border-radius: 999px;
  background: #fff;
  color: var(--rojo);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 14px 30px -18px rgba(127, 8, 8, .5), inset 0 0 0 1px rgba(168, 17, 17, .12);
}
.pildora { padding: .55em 1.1em .55em .85em; font-size: clamp(14px, 1.15vw, 16px); }
.hoja { flex: none; width: .75em; height: 1.15em; fill: var(--naranja); }

/* Etiqueta de la app: el color lo pone cada app (--app y --app-fondo). */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .34em .75em .34em .62em;
  border-radius: 999px;
  background: var(--app-fondo, #F6E7E7);
  color: var(--app, var(--rojo));
  font-weight: 800;
  font-size: 12.5px;
  line-height: 1.2;
  letter-spacing: .01em;
  white-space: nowrap;
}
.chip::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; }

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--tinta-suave);
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.3;
}

/* Botón rojo de reproducir (el mismo en la pantalla y en las tarjetas). */
.boton {
  display: inline-flex;
  align-items: center;
  gap: .7em;
  padding: .55em 1.25em .55em .55em;
  border: 0;
  border-radius: 999px;
  background: var(--rojo);
  color: #fff;
  font: 700 clamp(13px, 1.7cqi, 19px) / 1 "Bricolage", system-ui, sans-serif;
  letter-spacing: -.005em;
  white-space: nowrap;
  box-shadow: 0 14px 30px -12px rgba(127, 8, 8, .65);
  transition: transform .25s var(--curva), background-color .25s ease;
}

.icono {
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
}
.icono svg { width: 46%; height: 46%; fill: currentColor; }
.icono .girar { display: none; width: 52%; height: 52%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.icono .repetir { width: 50%; height: 50%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

.dura {
  padding-left: .8em;
  border-left: 1px solid rgba(255, 255, 255, .35);
  font-weight: 500;
  opacity: .85;
  font-variant-numeric: tabular-nums;
}

/* ── Portada: lanzamientos ──────────────────────────────────────── */

.inicio { display: flex; flex-direction: column; align-items: center; padding-top: clamp(20px, 4vw, 52px); }

.intro { max-width: 900px; text-align: center; animation: entrar .8s var(--curva) both; }
.intro h1 { margin-top: clamp(16px, 1.8vw, 22px); font-size: clamp(34px, 5.4vw, 70px); line-height: 1; letter-spacing: -.035em; }
.intro .linea { margin-block: clamp(14px, 1.8vw, 22px); }
.acento { color: var(--rojo); }
.bajada {
  max-width: 44ch;
  margin-inline: auto;
  color: var(--tinta-suave);
  font-weight: 600;
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.5;
  text-wrap: balance;
}

.grilla {
  list-style: none;
  width: min(1200px, 100%);
  margin-top: clamp(32px, 5vw, 64px);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: clamp(32px, 4vw, 48px) clamp(20px, 3vw, 40px);
}
.grilla > li { animation: entrar .8s var(--curva) both; }
.grilla > li:nth-child(2) { animation-delay: .08s; }
.grilla > li:nth-child(3) { animation-delay: .16s; }
.grilla > li:nth-child(n+4) { animation-delay: .24s; }

.tarjeta { display: flex; flex-direction: column; gap: 18px; height: 100%; text-decoration: none; }

.miniatura {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: clamp(12px, 1.5vw, 20px);
  overflow: hidden;
  background: var(--cine);
  box-shadow: var(--sombra-tarjeta);
  isolation: isolate;
  container: miniatura / inline-size;
  transition: transform .35s var(--curva), box-shadow .35s ease;
}
.miniatura img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--curva); }
.reproducir { position: absolute; inset: auto 0 7% 0; display: flex; justify-content: center; padding: 0 12px; }

.nuevo {
  position: absolute;
  top: clamp(10px, 3cqi, 18px);
  left: clamp(10px, 3cqi, 18px);
  padding: .45em .85em .45em .65em;
  font-size: clamp(12px, 2.2cqi, 14px);
}
.nuevo[hidden] { display: none; }

.ficha { display: grid; gap: 8px; padding-inline: 4px; }
.ficha h2 { font-size: clamp(21px, 1.9vw, 27px); line-height: 1.12; letter-spacing: -.02em; }
.resumen {
  color: var(--tinta-suave);
  font-weight: 600;
  font-size: clamp(15px, 1.15vw, 16.5px);
  line-height: 1.5;
  text-wrap: pretty;
}

.tarjeta:hover .miniatura { transform: translateY(-4px); box-shadow: 0 40px 80px -36px rgba(127, 8, 8, .45), 0 12px 28px -14px rgba(43, 38, 34, .3); }
.tarjeta:hover .miniatura img { transform: scale(1.025); }
.tarjeta:hover .boton { background: var(--vino); }
.tarjeta:focus-visible { outline: none; }
.tarjeta:focus-visible .miniatura { outline: 3px solid var(--ambar); outline-offset: 4px; }

/* Con tres o más lanzamientos, el más reciente se destaca a todo lo ancho. */
@media (min-width: 900px) {
  .con-destacado > li:first-child { grid-column: 1 / -1; }
  .con-destacado > li:first-child .tarjeta {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(28px, 3.5vw, 56px);
  }
  .con-destacado > li:first-child h2 { font-size: clamp(28px, 2.8vw, 40px); }
  .con-destacado > li:first-child .resumen { font-size: clamp(16px, 1.3vw, 18px); }
}

/* ── Página de un lanzamiento ───────────────────────────────────── */

.lanzamiento { display: flex; flex-direction: column; align-items: center; justify-content: center; }

.escena {
  width: min(1200px, 100%, max(480px, calc((100svh - 350px) * 16 / 9)));
  animation: entrar .8s var(--curva) both;
}

.pantalla {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: clamp(12px, 1.6vw, 22px);
  overflow: hidden;
  background: var(--cine) center / cover no-repeat;
  box-shadow: var(--sombra-pantalla);
  isolation: isolate;
  container: pantalla / inline-size;
  scroll-margin: 16px;
}

video { width: 100%; height: 100%; object-fit: cover; background: transparent; transition: opacity .35s ease; }

.capa {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 16px 7%;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: opacity .35s ease, background-color .35s ease;
  -webkit-tap-highlight-color: transparent;
}
.capa:hover .boton, .final .boton:hover { background: var(--vino); transform: translateY(-2px); }
.capa:focus-visible { outline: none; }
.capa:focus-visible .boton { outline: 3px solid var(--ambar); outline-offset: 4px; }

.aviso {
  display: none;
  max-width: 34ch;
  padding: .7em 1em;
  border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  color: var(--tinta);
  font: 600 clamp(14px, 1.2vw, 16px) / 1.4 "Nunito", system-ui, sans-serif;
  text-align: center;
}

/* Al terminar: ver de nuevo y seguir con el siguiente lanzamiento. */
.final {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4cqi, 20px);
  padding: 16px;
  background: rgba(251, 248, 244, .66);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: aparecer .35s ease both;
}
.final .boton { cursor: pointer; }
.final-enlaces { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 100%; }
.enlace-final {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  max-width: 100%;
  padding: .62em 1.05em;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  font-weight: 700;
  font-size: clamp(12px, 1.35cqi, 15px);
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 12px 26px -16px rgba(43, 38, 34, .5);
  transition: background-color .25s ease, transform .25s var(--curva);
}
.enlace-final strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--rojo); font-weight: 800; }
.enlace-final svg { flex: none; width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.enlace-final:hover { background: #fff; transform: translateY(-1px); }

/* Estados: inicio · cargando · viendo · fin · error */
.pantalla[data-estado="cargando"] .capa { cursor: progress; }
.pantalla[data-estado="cargando"] .icono .play { display: none; }
.pantalla[data-estado="cargando"] .icono .girar { display: block; animation: girar 1s linear infinite; }
.pantalla[data-estado="cargando"] .dura,
.pantalla[data-estado="error"] .dura { display: none; }
.pantalla[data-estado="viendo"] { background-image: none !important; }
.pantalla[data-estado="viendo"] .capa { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .35s ease, visibility 0s .35s; }
.pantalla[data-estado="error"] .capa { justify-content: center; padding-bottom: 0; background: rgba(251, 248, 244, .6); backdrop-filter: blur(3px); }
.pantalla[data-estado="error"] .aviso { display: block; }
.pantalla[data-estado="fin"] .capa { display: none; }
.pantalla[data-estado="fin"] .final { display: flex; }
/* Los videos terminan en negro: al cargar y al terminar se ve la portada, y el video aparece al arrancar. */
.pantalla[data-estado="cargando"] video,
.pantalla[data-estado="fin"] video { opacity: 0; }

.texto { margin-top: clamp(20px, 3vw, 34px); text-align: center; }
.texto .meta { justify-content: center; margin-bottom: clamp(10px, 1.2vw, 14px); }
.descripcion {
  max-width: 56ch;
  margin-inline: auto;
  color: var(--tinta-suave);
  font-weight: 600;
  font-size: clamp(15px, 1.25vw, 18px);
  line-height: 1.5;
  text-wrap: pretty;
}

/* Índice de pasos o capítulos */
.indice {
  width: min(1000px, 100%);
  margin-top: clamp(28px, 4vw, 48px);
  padding: clamp(14px, 2.2vw, 26px);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--borde), 0 30px 70px -50px rgba(127, 8, 8, .35);
  animation: entrar .8s .12s var(--curva) both;
}
.indice-cabeza {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 2px clamp(6px, .9vw, 12px) 12px;
}
.indice h2, .mas h2 { font-size: clamp(20px, 2vw, 24px); line-height: 1.1; }
.indice-cabeza p { color: var(--tinta-suave); font-weight: 600; font-size: 14.5px; }

.pasos { list-style: none; padding: 0; display: grid; gap: 2px 18px; }
@media (min-width: 760px) {
  .pasos { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(var(--filas, 4), auto); grid-auto-flow: column; }
}

.pasos a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  transition: background-color .2s ease;
}
.pasos a:hover { background: rgba(168, 17, 17, .05); }

.num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(168, 17, 17, .3);
  color: var(--rojo);
  font: 800 15px / 1 "Bricolage", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  transition: background-color .25s ease, color .25s ease, box-shadow .25s ease;
}
.num svg { width: 12px; height: 12px; margin-left: 2px; fill: currentColor; }
.paso-titulo { display: block; font-weight: 800; font-size: 16px; line-height: 1.25; transition: color .2s ease; }
.paso-texto { display: block; margin-top: 2px; color: var(--tinta-suave); font-weight: 600; font-size: 14px; line-height: 1.4; }
.tiempo { color: var(--tinta-suave); font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }

.pasos a[aria-current] { background: rgba(168, 17, 17, .07); }
.pasos a[aria-current] .num { background: var(--rojo); color: #fff; box-shadow: 0 8px 18px -8px rgba(127, 8, 8, .7); }
.pasos a[aria-current] .paso-titulo { color: var(--rojo); }

/* Enlace a la app y ayuda (solo si la app los tiene en lanzamientos.mjs) */
.acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 24px;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--borde);
}
.acciones.sueltas { margin-top: clamp(24px, 3vw, 36px); padding-top: 0; border-top: 0; }
.boton-app { gap: .55em; padding: .85em 1.3em; font-size: 16px; text-decoration: none; }
.boton-app svg { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.boton-app:hover { background: var(--vino); transform: translateY(-2px); }
.ayuda { color: var(--tinta-suave); font-weight: 600; font-size: 15px; }
.ayuda a { color: var(--rojo); font-weight: 800; }

/* Más novedades */
.mas { width: min(1000px, 100%); margin-top: clamp(36px, 5vw, 64px); }
.mas h2 { margin-bottom: 16px; text-align: center; }
.mas-lista { list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.mas-lista > li { width: min(460px, 100%); }

.mini {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  padding: 10px 18px 10px 10px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--borde);
  text-decoration: none;
  transition: background-color .25s ease, box-shadow .25s ease, transform .25s var(--curva);
}
.mini:hover { background: #fff; transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--borde), 0 20px 40px -28px rgba(127, 8, 8, .45); }
.mini-img { position: relative; flex: none; width: clamp(116px, 34%, 168px); aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--cine); }
.mini-img img { width: 100%; height: 100%; object-fit: cover; }
.mini-play {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--rojo);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(127, 8, 8, .7);
  transition: background-color .25s ease;
}
.mini-play svg { width: 12px; height: 12px; margin-left: 2px; fill: currentColor; }
.mini:hover .mini-play { background: var(--vino); }
.mini-texto { display: grid; gap: 6px; min-width: 0; }
.mini-texto .chip { justify-self: start; }
.mini-titulo { font: 800 16.5px / 1.2 "Bricolage", system-ui, sans-serif; letter-spacing: -.015em; }
.mini-detalle { color: var(--tinta-suave); font-weight: 700; font-size: 13.5px; }

/* ── Ajustes por tamaño ─────────────────────────────────────────── */

@container pantalla (max-width: 480px) {
  .capa .dura { display: none; }
  .capa { padding-bottom: 5%; }
}

@container miniatura (max-width: 300px) {
  .reproducir .txt { display: none; }
}

@media (max-width: 640px) {
  .escena { width: 100%; }
  .volver { padding: .6em .9em .6em .75em; font-size: 13.5px; }
  .pasos a { gap: 12px; padding: 10px 8px; }
  .mini { gap: 12px; padding-right: 12px; }
}

@keyframes entrar { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes aparecer { from { opacity: 0; } }
@keyframes girar { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .escena, .intro, .grilla > li, .indice, .final { animation: none; }
  .capa, .boton, .miniatura, .miniatura img, .mini, .volver svg, .enlace-final, .boton-app { transition: none; }
  .capa:hover .boton, .final .boton:hover, .tarjeta:hover .miniatura, .tarjeta:hover .miniatura img,
  .mini:hover, .enlace-final:hover, .boton-app:hover, .volver:hover svg { transform: none; }
}
