/*
  HERO V3 «cinematográfico» — se carga después de v2.css. Solo presentación (sin precios ni condiciones comerciales).
  Fondo carbón/grafito, tipografía gigante en blanco con acento morado, videos de fondo sutiles y botones siempre visibles.
  Sin JavaScript se ve el primer mensaje completo. Con prefers-reduced-motion no hay videos, ni rotación automática, ni movimiento.
*/
.hero3 {
  --h3-dur: 7000ms;
  --h3-carbon: #0d0d11;
  --h3-grafito: #1b1b23;
  --h3-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative; isolation: isolate; overflow: hidden;
  /* el encabezado (78px) es pegajoso: el hero ocupa el resto de la pantalla, sin pasarse en móviles bajos */
  min-height: clamp(560px, calc(100svh - 78px), 980px);
  display: grid; align-items: stretch;
  background: radial-gradient(90% 70% at 85% 0%, rgba(145, 54, 255, 0.22), transparent 62%), linear-gradient(180deg, var(--h3-grafito), var(--h3-carbon) 70%);
  color: #fff;
}

/* ---- fondo: póster estático + video sutil (se carga solo el activo y el siguiente) ---- */
.h3-fondo { position: absolute; inset: 0; z-index: -1; }
.h3-bg { position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s var(--h3-ease); }
.h3-bg.activo { opacity: 1; }
.h3-poster, .h3-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.h3-poster { transform: scale(1.04); }
.h3-bg.activo .h3-poster { animation: h3-zoom calc(var(--h3-dur) * 1.5) linear forwards; }
.h3-video { opacity: 0; transition: opacity 1.2s ease; }
.h3-bg.listo .h3-video { opacity: 1; }
/* oscurecimiento: lectura perfecta del texto sobre cualquier fotograma (más oscuro a la izquierda y abajo, donde va el texto y los botones) */
.h3-velo { position: absolute; inset: 0; background:
  linear-gradient(90deg, rgba(13, 13, 17, 0.92) 0%, rgba(13, 13, 17, 0.8) 55%, rgba(13, 13, 17, 0.66) 100%),
  linear-gradient(0deg, rgba(13, 13, 17, 0.94) 0%, rgba(13, 13, 17, 0) 46%),
  linear-gradient(180deg, rgba(13, 13, 17, 0.6) 0%, rgba(13, 13, 17, 0) 26%),
  radial-gradient(60% 50% at 80% 10%, rgba(145, 54, 255, 0.2), transparent 70%); }
@keyframes h3-zoom { from { transform: scale(1.04); } to { transform: scale(1.12); } }

/* ---- contenido ---- */
.h3-in { width: 100%; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; gap: clamp(14px, 2.4svh, 26px); padding-block: clamp(24px, 4svh, 52px) clamp(18px, 2.6svh, 32px); }
.h3-h1 { margin: 0; font-family: var(--display); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; line-height: 1.5; color: rgba(247, 246, 251, 0.82); max-width: 90ch; }
.h3-msgs { position: relative; flex: 1; display: grid; align-content: center; min-height: clamp(240px, 40svh, 520px); }
.h3-msg { grid-area: 1 / 1; display: none; flex-direction: column; align-items: flex-start; gap: clamp(10px, 1.9svh, 18px); }
.h3-msg.activo, .h3-msg.saliendo { display: flex; }
.h3-msg.saliendo { pointer-events: none; }
.h3-pilar { display: inline-flex; align-items: center; gap: 12px; margin: 0; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--lima); }
.h3-num { display: inline-grid; place-items: center; min-width: 2.4em; padding: 0.3em 0.55em; border: 1px solid rgba(201, 162, 255, 0.55); border-radius: 999px; font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }
/* tipografía gigante: Bricolage Grotesque condensada, peso 800, interlineado cerrado */
.h3-titulo { margin: 0; font-family: var(--display); font-weight: 800; font-stretch: 78%; font-size: clamp(3.4rem, min(14.2vw, 15.5svh), 10.6rem); line-height: 0.88; letter-spacing: -0.035em; text-transform: none; max-width: 11.5ch; text-wrap: balance; color: #fff; }
.h3-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.h3-w > span { display: inline-block; will-change: transform; transform: translateY(108%); }
/* Hasta que la tipografía esté lista el texto no se ve (así no salta al cambiar de fuente: CLS ≈ 0); si algo falla, aparece solo tras 2,6 s */
.hero3:not(.h3-lista) .h3-msgs { visibility: hidden; animation: h3-mostrar 0.01s 2.6s forwards; }
.hero3:not(.h3-lista) .h3-w > span { animation: h3-sube 0.01s 2.6s both; }
@keyframes h3-mostrar { to { visibility: visible; } }
.h3-ac > span { color: var(--lima); background: linear-gradient(100deg, #E3CCFF, #B07CFF 55%, #9136FF); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.h3-sub { margin: 0; max-width: 46ch; font-size: clamp(1.02rem, 1.6vw, 1.3rem); line-height: 1.5; color: rgba(247, 246, 251, 0.86); }
.h3-mas { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 0.9rem; color: #fff; padding-bottom: 3px; border-bottom: 2px solid var(--violeta); transition: gap 0.3s var(--h3-ease), border-color 0.3s; }
.h3-mas:hover { gap: 13px; border-color: var(--lima); }

/* entrada y salida de cada mensaje: las palabras suben desde una máscara, una tras otra */
.hero3.h3-lista .h3-msg.activo .h3-w > span { animation: h3-sube 0.95s var(--h3-ease) both; animation-delay: calc(var(--i) * 85ms + 120ms); }
.hero3.h3-lista .h3-msg.activo .h3-pilar, .hero3.h3-lista .h3-msg.activo .h3-sub, .hero3.h3-lista .h3-msg.activo .h3-mas { animation: h3-aparece 0.8s var(--h3-ease) both; }
.hero3.h3-lista .h3-msg.activo .h3-pilar { animation-delay: 0ms; }
.hero3.h3-lista .h3-msg.activo .h3-sub { animation-delay: 520ms; }
.hero3.h3-lista .h3-msg.activo .h3-mas { animation-delay: 640ms; }
.h3-msg.saliendo .h3-w > span { animation: h3-baja 0.55s cubic-bezier(0.55, 0, 0.8, 0.4) both; animation-delay: calc(var(--i) * 35ms); }
.h3-msg.saliendo .h3-pilar, .h3-msg.saliendo .h3-sub, .h3-msg.saliendo .h3-mas { animation: h3-sale 0.4s ease both; }
@keyframes h3-sube { from { transform: translateY(108%) rotate(3deg); } to { transform: none; } }
@keyframes h3-baja { from { transform: none; } to { transform: translateY(-108%) rotate(-2deg); } }
@keyframes h3-aparece { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes h3-sale { to { opacity: 0; transform: translateY(-10px); } }

/* ---- botones de contacto: siempre dentro de la primera pantalla ---- */
.h3-acciones { display: flex; flex-wrap: wrap; gap: 12px; }
.h3-acciones .btn { padding: 17px 28px; font-size: 0.95rem; }
.hero3 .btn-violeta { box-shadow: 0 14px 34px -12px rgba(145, 54, 255, 0.75); }
.hero3 .btn-linea { color: #fff; border-color: rgba(247, 246, 251, 0.55); background: rgba(13, 13, 17, 0.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.hero3 .btn-linea:hover { color: var(--tinta); border-color: #fff; }
.hero3 .btn-linea::before { background: #fff; }

/* ---- controles: progreso, contador, anterior / pausa / siguiente ---- */
.h3-ctrl { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 14px; border-top: 1px solid rgba(247, 246, 251, 0.14); }
.h3-prog { display: flex; flex: 1; gap: 10px; margin: 0; padding: 0; list-style: none; max-width: 760px; }
.h3-prog li { flex: 1; min-width: 0; }
.h3-pg { position: relative; display: block; width: 100%; padding: 14px 0 0; text-align: left; color: rgba(247, 246, 251, 0.7); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; line-height: 1.3; }
.h3-pg i { position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 3px; background: rgba(247, 246, 251, 0.22); overflow: hidden; }
.h3-pg i::after { content: ''; position: absolute; inset: 0; background: var(--lima); transform: scaleX(0); transform-origin: left; }
.h3-pg.hecho i::after { transform: scaleX(1); }
.h3-pg.activo { color: #fff; }
.h3-pg.activo i::after { animation: h3-llena var(--h3-dur) linear forwards; }
.hero3.pausa .h3-pg.activo i::after, .hero3.sin-auto .h3-pg.activo i::after { animation-play-state: paused; }
.hero3.sin-auto .h3-pg.activo i::after { animation: none; transform: scaleX(1); }
@keyframes h3-llena { to { transform: scaleX(1); } }
.h3-pg span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h3-pg::after { content: ''; position: absolute; left: 0; right: 0; top: -12px; bottom: -8px; } /* zona de toque más grande */
.h3-botones { display: flex; align-items: center; gap: 8px; }
.h3-cont { margin-right: 8px; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.08em; color: rgba(247, 246, 251, 0.75); font-variant-numeric: tabular-nums; }
.h3-cont b { color: #fff; }
.h3-b { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid rgba(247, 246, 251, 0.4); border-radius: 50%; background: rgba(13, 13, 17, 0.4); color: #fff; transition: background-color 0.25s, border-color 0.25s, color 0.25s, transform 0.25s var(--h3-ease); }
.h3-b:hover { background: #fff; color: var(--tinta); border-color: #fff; }
.h3-b:active { transform: scale(0.94); }
.h3-b .ic { width: 18px; height: 18px; fill: currentColor; }
.h3-ic-play { display: none; }
.hero3.pausa-usuario .h3-ic-pausa { display: none; }
.hero3.pausa-usuario .h3-ic-play { display: block; }
.hero3 :focus-visible { outline: 3px solid var(--lima); outline-offset: 3px; }

/* ---- móvil: el texto sigue siendo el protagonista y los botones quedan a la vista ---- */
@media (max-width: 720px) {
  .hero3 { min-height: clamp(600px, calc(100svh - 70px), 860px); }
  .h3-in { gap: 18px; }
  .h3-titulo { font-size: clamp(3.3rem, 17.4vw, 5.6rem); max-width: 100%; }
  .h3-msgs { min-height: clamp(300px, 46svh, 440px); }
  .h3-acciones { gap: 10px; }
  .h3-acciones .btn { flex: 1 1 100%; padding: 17px 22px; }
  .h3-pg span, .h3-cont { display: none; }
  .h3-pg { padding-top: 18px; }
  .h3-ctrl { gap: 14px; }
  .h3-b { width: 48px; height: 48px; }
}
@media (max-width: 400px) { .h3-pilar { font-size: 0.74rem; } .h3-h1 { font-size: 0.7rem; letter-spacing: 0.14em; } }
@media (min-width: 721px) and (max-width: 1000px) { .h3-pg span { display: none; } }
/* pantallas bajas: se compacta para que los botones y los controles sigan a la vista */
@media (max-height: 780px) { .h3-titulo { font-size: clamp(3.2rem, min(14.2vw, 13svh), 10.6rem); } .h3-msgs { min-height: 0; } .h3-in { padding-block: 18px 14px; gap: 12px; } .h3-mas { display: none; } .h3-sub { font-size: 1rem; } .h3-acciones .btn { padding: 14px 24px; } }
@media (max-width: 720px) and (max-height: 780px) { .h3-titulo { font-size: clamp(3rem, min(17.4vw, 11.5svh), 5.6rem); } .h3-sub { font-size: 0.96rem; line-height: 1.4; } .h3-pilar { font-size: 0.74rem; } .h3-h1 { font-size: 0.68rem; } }

/* ---- sin movimiento: sin videos, sin zoom, sin animaciones; el cambio de mensaje es directo ---- */
@media (prefers-reduced-motion: reduce) {
  .h3-bg, .h3-video { transition: none; }
  .h3-bg.activo .h3-poster { animation: none; transform: none; }
  .h3-video { display: none; }
  .h3-w > span { transform: none !important; }
  .hero3 .h3-msg.activo .h3-w > span, .hero3 .h3-msg.activo .h3-pilar, .hero3 .h3-msg.activo .h3-sub, .hero3 .h3-msg.activo .h3-mas, .hero3 .h3-msg.saliendo * { animation: none !important; }
  .h3-pg.activo i::after { animation: none; transform: scaleX(1); }
  .h3-mas { transition: none; }
}
/* impresión: solo el mensaje activo y sin fondo */
@media print { .h3-fondo, .h3-ctrl { display: none; } .hero3 { min-height: 0; background: #fff; color: #000; } .h3-titulo, .h3-sub { color: #000; } .h3-ac > span { -webkit-text-fill-color: #000; } }

/* la barra de WhatsApp fija del móvil se oculta mientras los botones del hero están a la vista (no se tapan los controles ni se duplican) */
body.h3-botones-vistos .barra-wa { visibility: hidden; opacity: 0; transform: translateY(14px); }
.barra-wa { transition: opacity 0.3s, transform 0.3s, visibility 0.3s; }

/* ---- VARIANTE de vista previa (?encabezado=transparente): encabezado transparente sobre el hero oscuro; sólido y legible al hacer scroll ---- */
body.h3-hdr header.top { position: fixed; left: 0; right: 0; background: linear-gradient(180deg, rgba(13, 13, 17, 0.78), rgba(13, 13, 17, 0)); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
body.h3-hdr header.top.solido, body.h3-hdr header.top.menu-abierto { background: color-mix(in srgb, var(--fondo) 94%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--linea); }
body.h3-hdr .hero3 { min-height: clamp(580px, 100svh, 1040px); }
body.h3-hdr .h3-in { padding-top: calc(78px + clamp(14px, 3svh, 36px)); }
/* mientras es transparente: logo, menú y botón en claro */
body.h3-hdr header.top:not(.solido):not(.menu-abierto) .marca span { color: #fff; }
/* LOGO (una sola fuente: logo-uti.png → logo-uti-oscuro.png y logo-uti-claro.png, misma silueta; ver scripts/preparar-logo.mjs). Las dos versiones se apilan en una caja de 44×40 que no
   cambia nunca: solo se cruzan en opacidad al pasar de encabezado transparente a sólido/menú abierto → sin saltos de tamaño, posición ni geometría. */
.marca .logo-par { position: relative; flex: none; display: block; width: 44px; height: 40px; }
.marca .logo-par img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; object-fit: contain; mix-blend-mode: normal; transform: none; transition: opacity 0.3s ease; will-change: opacity; }
.marca:hover .logo-par img { transform: none; }
.marca .logo-par .logo-uti { opacity: 1; }
.marca .logo-par .logo-uti-claro { opacity: 0; }
body.h3-hdr header.top:not(.solido):not(.menu-abierto) .marca .logo-par .logo-uti { opacity: 0; }
body.h3-hdr header.top:not(.solido):not(.menu-abierto) .marca .logo-par .logo-uti-claro { opacity: 1; }
body.h3-hdr header.top:not(.solido):not(.menu-abierto) .desk-nav a { color: rgba(247, 246, 251, 0.9); }
body.h3-hdr header.top:not(.solido):not(.menu-abierto) .desk-nav a:hover { color: #fff; }
body.h3-hdr header.top:not(.solido):not(.menu-abierto) .desk-nav a::after { background: var(--lima); }
body.h3-hdr header.top:not(.solido):not(.menu-abierto) .menu-btn { color: #fff; border-color: rgba(247, 246, 251, 0.7); }
body.h3-hdr header.top .marca span, body.h3-hdr header.top .desk-nav a { transition: color 0.3s; }
body.h3-hdr header.top :focus-visible { outline-color: var(--violeta); }
body.h3-hdr header.top:not(.solido):not(.menu-abierto) :focus-visible { outline-color: var(--lima); }
@media (max-width: 720px) { body.h3-hdr .hero3 { min-height: clamp(600px, 100svh, 900px); } body.h3-hdr .h3-in { padding-top: calc(70px + 14px); } }
