/* ---------- hero v2: foto roja a pantalla completa con estela líquida ----------
   La foto es un <img> (fallback sin WebGL / movimiento reducido); encima, el canvas de OGL
   la pinta igual ("cover" centrado) y añade la estela del ratón. Viñeta y grano van en CSS
   para no tener que renderizar en reposo.
   LEGACY HERO: la fila curvada (Tilted Grid) está en legacy/css/hero-main.css. */
/* capas: foto/fluido < frase < destello 3D (canvas fijo, z-index 1, js/star.js) < menú. La escena aísla
   su apilado (isolation), así la frase (z-index 2 dentro de ella) queda entera por debajo del destello */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: #000;
}

/* escena (se aleja con el telón) y velo negro encima */
.hero__stage {
  position: absolute; inset: 0;
  isolation: isolate;
  overflow: hidden;
  transform-origin: 50% 40%;
}
.hero__shade {
  position: absolute; inset: 0;
  z-index: 3;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.hero__media,
.hero__canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.hero__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  /* BA: Chrome no cuenta como LCP una imagen que cubre TODA la ventana (la toma por un fondo): sin este píxel
     recortado abajo (invisible: debajo está el mismo negro, bajo la viñeta), la página no tenía LCP hasta que
     entraba el titular, después de la intro. Recortar no mueve el layout. */
  clip-path: inset(0 0 1px 0);
}
/* el canvas aparece cuando ya ha pintado la foto (sin parpadeo en negro) */
.hero__canvas { display: block; opacity: 0; }
.hero.is-gl .hero__canvas { opacity: 1; }

/* viñeta inferior: transparente → rgba(0,0,0,.45) en el 35% de abajo */
.hero__stage::before {
  content: "";
  position: absolute; inset: auto 0 0;
  height: 35%;
  z-index: 1;
  background: linear-gradient(to bottom, rgb(0 0 0 / 0), rgb(0 0 0 / 0.45));
  pointer-events: none;
}

/* grano de película: ruido SVG que salta de posición a 12 fps */
.hero__stage::after {
  content: "";
  position: absolute; inset: -50%;
  z-index: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.4 -0.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.06;
  pointer-events: none;
  animation: hero-grain 0.5s steps(6) infinite;
}
@keyframes hero-grain {
  0%   { transform: translate(0, 0); }
  17%  { transform: translate(-7%, 4%); }
  33%  { transform: translate(5%, -9%); }
  50%  { transform: translate(-3%, 8%); }
  67%  { transform: translate(9%, 2%); }
  83%  { transform: translate(-8%, -5%); }
  100% { transform: translate(0, 0); }
}

/* ---------- frase: EL titular del hero, en 2 líneas, centrada en el 61 % del alto ----------
   Por encima, en el hueco entre el menú y el titular, el destello (js/star.js lo mide con el DOM).
   js/hero.js ajusta el tamaño para que la línea más larga ocupe ~86 % del ancho (escritorio) e iguala la otra
   con un poco de letter-spacing; aquí, el tamaño de partida. Debajo, el subtítulo y las dos acciones. El bloque
   ocupa todo el hero (centrado con flex, sin transform: el parallax de GSAP usa y).
   Al hacer scroll las letras "bailan" con larga exposición (js/hero-exposure.js). */
.hero {
  --title-size: clamp(44px, 8vw, 148px);
  --title-bottom: clamp(28px, 5vh, 56px);
}
/* BA (CLS): en escritorio, el mismo ajuste que hace js/hero.js, ya en el CSS, para que el titular no cambie de tamaño
   (y empuje el subtítulo) cuando arranca el JS. La línea más larga, "Es el ritmo de tu negocio.", mide 13.472em en
   Clash Display 500 con -0.02em: 86vw / 13.472 = 6.3836vw (entre 38 y 128 px, como en el JS); la primera, más corta,
   con +0.0065em de letter-spacing para igualarla. Si cambia el texto del titular, el JS lo sigue ajustando (con un
   salto al cargar): rehacer estos dos números. */
@media (min-width: 768px) {
  .hero { --title-size: clamp(38px, 6.3836vw, 128px); }
  .hero__line:first-child .hero__line-in { letter-spacing: -0.0135em; }
}
.hero__copy {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22vh 4vw 0; /* centro del bloque = 50 % + 11 % = 61 % del alto */
  padding-top: 22svh;
  pointer-events: none; /* el fluido sigue respondiendo al ratón */
}
.hero__sub {
  max-width: min(92vw, 60ch);
  margin: 16px 0 0;
  font: 400 clamp(16px, 1.35vw, 21px) / 1.35 var(--font-display);
  letter-spacing: 0.01em;
  text-align: center;
  text-wrap: balance;
  color: rgb(244 242 239 / 0.85);
  text-shadow: 0 1px 14px rgb(0 0 0 / 0.5);
}
.hero__tail {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
  pointer-events: auto;
}
/* principal: píldora blanca fina con el punto REC naranja; secundaria: texto con subrayado fino que crece */
.hero__cta,
.hero__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  font: 500 15px / 1 var(--font-display);
  color: #f4f2ef;
  text-decoration: none;
}
.hero__cta {
  padding: 0 22px;
  border: 1px solid rgb(244 242 239 / 0.75);
  border-radius: 999px;
  background: rgb(11 9 9 / 0.18);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.hero__cta:hover { background: #f4f2ef; border-color: #f4f2ef; color: #0b0909; }
.hero__cta-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #F35411;
  animation: blink var(--beat) steps(1, end) infinite;
}
.hero__cta:hover .hero__cta-dot { animation: none; }
.hero__more {
  position: relative;
  padding: 0 10px;
  text-shadow: 0 1px 12px rgb(0 0 0 / 0.5);
}
.hero__more::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 11px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hero__more:hover::after,
.hero__more:focus-visible::after { transform: scaleX(1); }
.hero__more b { font-weight: 500; transition: translate 0.25s ease; }
.hero__more:hover b { translate: 4px 0; }
.hero :focus-visible { outline: 2px solid #F35411; outline-offset: 3px; }
.js .hero__sub,
.js .hero__actions { opacity: 0; }

.hero__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  font: 500 var(--title-size) / 0.92 var(--font-display);
  letter-spacing: -0.02em;
  color: #f4f2ef;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 40px rgb(0 0 0 / 0.35);
  pointer-events: none; /* el fluido sigue respondiendo al ratón */
  --trail: 0;
}
/* cada línea en su máscara; el margen negativo deja sitio a las tildes sin mover el texto */
.hero__line {
  display: block;
  max-width: 100%;
  overflow: hidden;
  padding: 0.16em 0.04em 0.06em;
  margin: -0.16em -0.04em -0.06em;
}
/* en escritorio cada línea cabe entera; en móvil se parte sola, equilibrada (sin palabras sueltas) */
.hero__line-in { display: inline-block; white-space: nowrap; } /* inline-block: js/hero.js mide el ancho del texto */
/* al terminar la entrada, las máscaras dejan salir a las letras (bailan fuera de su línea con el scroll) */
.hero__title.is-in .hero__line { overflow: visible; }

/* letras (js/hero-exposure.js): una palabra nunca se parte; cada letra se mueve sola.
   Estela de larga exposición: 3 ecos en vertical en sentido contrario al scroll. Solo cambia --trail (en el h1)
   y la sombra se recalcula sola. Sin estela (.is-trailing fuera) las letras llevan la sombra del h1, como siempre. */
.hero__w { display: inline-block; white-space: nowrap; }
.hero__ch { display: inline-block; }
.hero__title.is-trailing .hero__ch {
  text-shadow:
    0 calc(var(--trail) * -0.10em) 0 rgb(243 84 17 / 0.55),
    0 calc(var(--trail) * -0.22em) 0 rgb(243 84 17 / 0.30),
    0 calc(var(--trail) * -0.36em) 0 rgb(244 242 239 / 0.12),
    0 2px 40px rgb(0 0 0 / 0.35);
}
.hero__ch--eq { transform-origin: 50% 100%; } /* RITMO: ecualizador desde abajo */

/* ---------- "SCROLL TO EXPLORE" + flecha fina debajo (la animación, en js/hero.js) ---------- */
.hero__scroll {
  position: absolute;
  z-index: 2;
  left: clamp(24px, 3vw, 56px);
  bottom: var(--title-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.hero__scroll-arrow {
  display: block;
  width: 14px;
  height: 22px;
  overflow: visible;
}
.hero__scroll-arrow [data-scroll-shaft] { stroke-dasharray: 1; }
.hero__scroll-text {
  margin: 0;
  font: 500 11px / 1.35 var(--font-display);
  letter-spacing: 0.14em;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
}

/* antes de la intro: frase y scroll ocultos (JS los hace entrar con "disco:intro-done") */
.js .hero__line-in { transform: translateY(105%); opacity: 0; }
.js .hero__scroll { opacity: 0; }

@media (max-width: 767px) {
  .hero { --title-size: clamp(34px, 10.9vw, 55px); }
  .hero__copy { padding-top: 30vh; padding-top: 30svh; } /* centro ≈ 65 % */
  .hero__line-in { white-space: normal; text-wrap: balance; }
  .hero__tail { width: 100%; }
  .hero__actions { flex-direction: column; align-items: stretch; width: 100%; max-width: 320px; gap: 10px; }
  /* estela con 2 ecos */
  .hero__title.is-trailing .hero__ch {
    text-shadow:
      0 calc(var(--trail) * -0.10em) 0 rgb(243 84 17 / 0.55),
      0 calc(var(--trail) * -0.22em) 0 rgb(243 84 17 / 0.30),
      0 2px 40px rgb(0 0 0 / 0.35);
  }
}
/* menos de 55 fps: sin el tercer eco (js/hero-exposure.js pone la clase) */
.hero__title.is-trailing.is-lite .hero__ch {
  text-shadow:
    0 calc(var(--trail) * -0.10em) 0 rgb(243 84 17 / 0.55),
    0 calc(var(--trail) * -0.22em) 0 rgb(243 84 17 / 0.30),
    0 2px 40px rgb(0 0 0 / 0.35);
}


@media (prefers-reduced-motion: reduce) {
  .hero__stage::after { animation: none; }
}
