/* Asteriq · portada con vídeo guiado por el scroll y sistema de movimiento (skill 10k-websites).
   Complementa styles.css; todo el contenido es legible sin estas animaciones. */

:root {
  --ease-out: cubic-bezier(.22, .8, .24, 1);
  --ease-soft: cubic-bezier(.45, .05, .25, 1);
  --tshadow: 0 1px 2px rgba(5, 16, 15, .95), 0 3px 12px rgba(5, 16, 15, .78), 0 10px 44px rgba(5, 16, 15, .8);
  --cold: #2D9CDB;
  --warm: #F2994A;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Solo en body (ya lo declara styles.css): si html tuviera overflow distinto de visible, el bloqueo de la guía dejaría de funcionar */

/* ---------- Marca: logotipo del cliente, sin modificar ---------- */
.brand { gap: 10px; }
.brand-word { white-space: nowrap; }
.brand-logo { width: 34px; height: 34px; flex: none; }
.brand-footer .brand-logo { width: 30px; height: 30px; }

/* ---------- Portada con vídeo ---------- */
.hero-scrub {
  position: relative;
  height: 480vh;
  background: var(--green-900);
}
/* El escenario se fija bajo la cabecera: título y botones caben enteros en la primera pantalla */
.scrub-stage {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  height: calc(100svh - var(--header-h));
  overflow: hidden;
  background: var(--green-900);
}
.poster, .scrub-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.poster { background: var(--green-900) center / cover no-repeat; }
.scrub-video {
  object-fit: cover;
  opacity: 0;
  transform: translateZ(0);
  will-change: transform;
  transition: opacity .6s var(--ease-soft);
}
.video-ready .scrub-video { opacity: 1; }
.video-failed .scrub-video { display: none; }

/* Capa 1 de legibilidad: oscurecimiento base, más intenso en la columna de texto */
.scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7, 22, 20, .74) 0%, rgba(7, 22, 20, .5) 34%, rgba(7, 22, 20, 0) 60%),
    radial-gradient(ellipse 120% 90% at 50% 45%, rgba(7, 22, 20, 0) 40%, rgba(7, 22, 20, .55) 100%),
    linear-gradient(0deg, rgba(7, 22, 20, .6) 0%, rgba(7, 22, 20, 0) 26%);
}

/* Anillo de carga del vídeo y señal de desplazamiento */
.ring {
  position: absolute;
  right: 28px;
  bottom: 28px;
  width: 36px;
  height: 36px;
  color: var(--turquoise);
  opacity: .9;
  transform: rotate(-90deg);
  transition: opacity .4s var(--ease-soft);
}
.ring circle { transition: stroke-dashoffset .12s linear; }
.video-ready .ring, .video-failed .ring { opacity: 0; }
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  color: rgba(255, 255, 255, .7);
  transition: opacity .4s var(--ease-soft);
}
.hero-scrub.is-past-start .scroll-cue { opacity: 0; }

/* Composición: título (fijo) · tramos (cambian con el scroll) · botones (fijos) */
.hero-layout {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: clamp(20px, 6vh, 64px);
  padding-bottom: clamp(24px, 7vh, 72px);
  color: #fff;
}
.hero-title {
  position: relative;
  isolation: isolate;
  align-self: flex-start;
  font-size: clamp(2.125rem, min(1.2rem + 3.6vw, 9vh), 4.5rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 700;
  text-shadow: var(--tshadow);
  text-wrap: balance;
}
.ht-line { display: block; }
/* Móvil: 34–40 px; «Automatización» cabe entera también a 320 px */
@media (max-width: 600px) { .hero-title { font-size: clamp(2.125rem, 9.6vw, 2.5rem); } }
/* Capa 2 del título: velo local para que se lea sobre cualquier fotograma */
.hero-title::before {
  content: "";
  position: absolute;
  inset: -34% -30% -34% -14%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 66% at 42% 50%, rgba(5, 16, 15, .7) 0%, rgba(5, 16, 15, .56) 55%, rgba(5, 16, 15, 0) 86%);
}

/* Tramos de texto: segundo nivel, en el hueco entre título y botones */
.bands {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: clamp(12px, 3vh, 32px) 0;
}
.band {
  position: absolute;
  left: 0;
  top: 50%;
  width: min(560px, 46vw);
  opacity: 0;
  color: #fff;
  text-shadow: var(--tshadow);
  transform: translateY(-50%);
  pointer-events: none;
}
.band.is-on { pointer-events: auto; }
/* Velo local que se intensifica mientras el tramo está activo */
.band::before {
  content: "";
  position: absolute;
  inset: -22% -18%;
  z-index: -1;
  pointer-events: none;
  opacity: calc(.25 + .75 * var(--k, 1));
  background: radial-gradient(ellipse 72% 62% at 42% 50%, rgba(5, 16, 15, .66) 0%, rgba(5, 16, 15, .42) 46%, rgba(5, 16, 15, 0) 76%);
}
.band-settle::before { inset: -18% -26% -30% -20%; background: radial-gradient(ellipse 72% 66% at 40% 52%, rgba(5, 16, 15, .82) 0%, rgba(5, 16, 15, .58) 52%, rgba(5, 16, 15, 0) 80%); }

.band-line, .hero-claim {
  font-size: clamp(1.375rem, min(.95rem + 1.25vw, 4.4vh), 2rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 650;
}
.hero-claim { font-weight: 700; line-height: 1.15; margin-bottom: 14px; }
.band-settle .lead { font-size: clamp(1.0625rem, .95rem + .3vw, 1.2rem); color: rgba(255, 255, 255, .92); max-width: 32em; }

.hero-actions { flex: none; }
.hero-actions .hero-support { margin-top: 14px; color: rgba(255, 255, 255, .86); text-shadow: var(--tshadow); }

/* Coreografía: solo transform y opacity, guiada por --k (0 a 1) y reversible */
.w { display: inline-block; }
.band .c { display: inline-block; }
/* (a) Dispersión y (b) rejilla: las letras llegan como hojas en el aire */
[data-split="scatter"] .c, [data-split="grid"] .c {
  --kc: clamp(0, (var(--k, 0) - var(--th, 0)) * 2.6, 1);
  opacity: var(--kc);
  transform:
    translate(calc((1 - var(--kc)) * var(--jx, 0px)), calc((1 - var(--kc)) * var(--jy, 0px)))
    rotate(calc((1 - var(--kc)) * var(--jr, 0deg)));
}
/* (f) Caída: las palabras bajan a su sitio, como las hojas */
.band-2 .w {
  --kc: clamp(0, (var(--k, 0) - var(--th, 0)) * 2.8, 1);
  opacity: var(--kc);
  transform: translateY(calc((1 - var(--kc)) * -26px));
}
/* (e) Subida palabra a palabra y asentamiento escalonado */
.band-settle .hero-claim .w {
  --kc: clamp(0, (var(--k, 0) - var(--th, 0)) * 3, 1);
  opacity: var(--kc);
  transform: translateY(calc((1 - var(--kc)) * 24px));
}
.band-settle .lead { --ks: clamp(0, (var(--k, 0) - .62) * 4, 1); opacity: var(--ks); transform: translateY(calc((1 - var(--ks)) * 14px)); }

/* ---------- Portada fija: móviles, tabletas en vertical, movimiento reducido y sin JavaScript ---------- */
/* Las cinco condiciones deben coincidir carácter a carácter con hero-scrub.js */
@media (max-width: 720px), (orientation: portrait) and (max-width: 1024px), (orientation: portrait) and (pointer: coarse), (orientation: landscape) and (pointer: coarse) and (max-height: 560px), (prefers-reduced-motion: reduce) {
  .hero-scrub { height: auto; }
  .scrub-stage {
    position: relative;
    top: auto;
    height: auto;
    min-height: calc(100svh - var(--header-h));
    display: flex;
    align-items: flex-end;
    background:
      linear-gradient(0deg, rgba(10, 30, 28, .97) 0%, rgba(10, 30, 28, .9) 45%, rgba(10, 30, 28, .55) 72%, rgba(10, 30, 28, .25) 100%),
      url('../img/hero-ending.jpg') 72% 30% / cover no-repeat,
      var(--green-900);
  }
  .poster, .scrub-video, .scrim, .ring, .scroll-cue { display: none; }
  .hero-layout { height: auto; width: 100%; display: block; padding-top: clamp(96px, 22vh, 220px); padding-bottom: 40px; }
  .bands { margin: 18px 0 26px; }
  .band:not(.band-settle) { display: none; }
  .band-settle {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    max-width: 640px;
    transform: none;
    opacity: 1 !important;
    --k: 1 !important;
    pointer-events: auto;
  }
  .band-settle::before { display: none; }
}
html:not(.js) .hero-scrub { height: auto; }
html:not(.js) .scrub-stage {
  position: relative;
  top: auto;
  height: auto;
  min-height: calc(100svh - var(--header-h));
  display: flex;
  align-items: flex-end;
  background:
    linear-gradient(0deg, rgba(10, 30, 28, .97) 0%, rgba(10, 30, 28, .9) 45%, rgba(10, 30, 28, .55) 72%, rgba(10, 30, 28, .25) 100%),
    url('../img/hero-ending.jpg') 72% 30% / cover no-repeat,
    var(--green-900);
}
html:not(.js) .poster, html:not(.js) .scrub-video, html:not(.js) .scrim, html:not(.js) .ring, html:not(.js) .scroll-cue { display: none; }
html:not(.js) .hero-layout { height: auto; width: 100%; display: block; padding-top: clamp(96px, 22vh, 220px); padding-bottom: 40px; }
html:not(.js) .bands { margin: 18px 0 26px; }
html:not(.js) .band:not(.band-settle) { display: none; }
html:not(.js) .band-settle { position: relative; left: auto; top: auto; width: auto; max-width: 640px; transform: none; opacity: 1; pointer-events: auto; }
html:not(.js) .band-settle::before { display: none; }

/* Pantallas de escritorio bajas: se mantiene el vídeo y se retiran elementos pequeños */
@media (max-height: 560px) { .ring, .scroll-cue { display: none; } }

/* ---------- Recorrido de un aviso: sección propia con el fotograma final ---------- */
.recorrido { position: relative; overflow: hidden; }
.recorrido-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 960px) {
  .recorrido-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 56px; }
}
.recorrido-figure {
  position: relative;
  margin: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-dark);
  box-shadow: 0 24px 56px rgba(0, 0, 0, .3);
  aspect-ratio: 3 / 2;
  background: var(--green-800);
}
@media (max-width: 599px) { .recorrido-figure { aspect-ratio: 4 / 3; } }   /* recorte móvil propio */
.recorrido-figure picture { display: block; height: 100%; }
.recorrido-figure img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
.recorrido-figure figcaption {
  position: absolute;
  left: 14px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(7, 22, 20, .72);
  color: rgba(255, 255, 255, .86);
  font-size: .8125rem;
}

/* ---------- Motivo: el asterisco del logotipo, trazo a trazo ---------- */
.asterisk-mark {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: -3px;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  fill: none;
}
.asterisk-mark line { stroke-dasharray: 17; stroke-dashoffset: 0; }

/* Cabecera en dos columnas (Soluciones): evita repetir el mismo esqueleto que la sección siguiente */
@media (min-width: 960px) {
  .head-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 56px;
    max-width: none;
    align-items: end;
  }
  .head-split .eyebrow { grid-column: 1 / -1; }
  .head-split h2 { margin-bottom: 0; }
}

/* ---------- Capa de ambiente en las secciones oscuras ---------- */
.ambient { position: relative; isolation: isolate; overflow: hidden; }   /* la luz no sobresale de su sección */
.ambient::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  opacity: .55;
  background:
    radial-gradient(40% 36% at 18% 28%, rgba(45, 156, 219, .16), transparent 70%),
    radial-gradient(38% 34% at 84% 72%, rgba(242, 153, 74, .12), transparent 70%);
}

/* ---------- Sistema de movimiento (solo si el script de movimiento está activo) ---------- */
/* Entradas cortas y discretas. Si el script falla, no se añade .motion-ok y todo queda visible */
.motion-ok .reveal {
  transition: opacity .55s var(--ease-out), transform .55s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.motion-ok .reveal:not(.in) { opacity: 0; transform: translateY(12px); }
.motion-ok .reveal.done { transition-delay: 0s; }

/* Líneas que se dibujan al entrar */
.motion-ok .flow .flow-step:not(:last-child)::before { transform-origin: top; transition: transform .9s var(--ease-out); transition-delay: calc(var(--i, 0) * 180ms + 250ms); }
.motion-ok .flow:not(.in) .flow-step:not(:last-child)::before { transform: scaleY(0); }
@media (min-width: 860px) {
  .motion-ok .phases .phase:not(:last-child)::before { transform-origin: left; transition: transform 1s var(--ease-out); transition-delay: calc(var(--i, 0) * 220ms + 300ms); }
  .motion-ok .phases:not(.in) .phase:not(:last-child)::before { transform: scaleX(0); }
}
@media (max-width: 859px) {
  .motion-ok .phases .phase:not(:last-child)::before { transform-origin: top; transition: transform 1s var(--ease-out); transition-delay: calc(var(--i, 0) * 220ms + 300ms); }
  .motion-ok .phases:not(.in) .phase:not(:last-child)::before { transform: scaleY(0); }
}
.motion-ok .asterisk-mark line { transition: stroke-dashoffset .7s var(--ease-out); }
.motion-ok .asterisk-mark line:nth-child(2) { transition-delay: .08s; }
.motion-ok .asterisk-mark line:nth-child(3) { transition-delay: .16s; }
.motion-ok .asterisk-mark line:nth-child(4) { transition-delay: .24s; }
.motion-ok .eyebrow:not(.in) .asterisk-mark line { stroke-dashoffset: 17; }

/* La deriva de luz de las secciones oscuras se retiró el 24/09/2026: competía con la lectura. La luz queda fija. */

/* Movimiento reducido: todo en su estado final */
@media (prefers-reduced-motion: reduce) {
  .motion-ok .reveal, .motion-ok .reveal:not(.in) { opacity: 1; transform: none; transition: none; }
  .motion-ok .flow .flow-step::before, .motion-ok .phases .phase::before { transform: none !important; transition: none !important; }
  .motion-ok .asterisk-mark line { stroke-dashoffset: 0 !important; transition: none !important; }
}

/* Pie: nota de contenido generado con IA */
.footer-ai { margin-top: 6px; font-size: .9375rem; color: rgba(255, 255, 255, .72); }

/* Táctil: objetivos cómodos sin cambiar el diseño */
@media (pointer: coarse) { .btn { min-height: 48px; } }
