/* ==========================================================================
   ADR Transport 2026 — Hero panorámico 3D

   Tres planos:
     1. .hero__fondos     foto a sangre del slide activo (cruce + Ken Burns +
                          paralaje de puntero). Sin 3D.
     2. .hero__panorama   carrusel de tarjetas en profundidad: la activa al
                          frente, las siguientes se curvan hacia atrás a la
                          derecha como un panorama. Aquí vive el preserve-3d.
     3. .hero__texto      titulares por RELEVO (el saliente se va antes de que
                          entre el nuevo), fuera de cualquier contexto 3D.

   Trampas ya documentadas en otros proyectos y evitadas aquí:
     (1) max-width:none en las fotos que deben desbordar su caja
     (2) velos FUERA del contexto preserve-3d
     (3) sin will-change en capas con foto
     (4) top:0 en paneles inactivos posicionados en absoluto
     (5) relevo de texto .3s / .6s + .3s, nunca cruce
     (6) overflow:clip (no hidden) para no crear contexto de scroll
     (7) sin translateZ en el texto: agranda la caja y lo recorta
   ========================================================================== */

.hero {
  --px: 0; --py: 0;
  position: relative;
  min-height: max(640px, min(100svh, 1000px));
  display: flex; flex-direction: column;
  background: var(--negro);
  color: #fff;             /* superficie oscura: declara su color */
  overflow: clip;          /* (6) */
  isolation: isolate;
}

/* ---------------------------------------------------------------- 1. fondos */
.hero__fondos { position: absolute; inset: 0; z-index: -3; }
.hero__fondo {
  position: absolute; inset: 0; top: 0;   /* (4) */
  opacity: 0;
  transition: opacity 1.2s var(--curva);
}
.hero__fondo.esta-activo { opacity: 1; }
.hero__fondo img {
  position: absolute; left: 50%; top: 50%;
  width: 112%; height: 112%;
  max-width: none;                         /* (1) */
  object-fit: cover;
  transform: translate(calc(-50% + var(--px) * -18px), calc(-50% + var(--py) * -12px)) scale(1.04);
  transition: transform 9s linear;
}
.hero__fondo.esta-activo img {
  transform: translate(calc(-50% + var(--px) * -18px), calc(-50% + var(--py) * -12px)) scale(1.14);
}

/* ---------------------------------------------------------------- velos (2) */
.hero__velo { position: absolute; inset: 0; z-index: -2; pointer-events: none; }
.hero__velo--lado {
  background:
    linear-gradient(90deg, rgba(10,10,12,.95) 0%, rgba(10,10,12,.84) 34%, rgba(10,10,12,.35) 62%, rgba(10,10,12,.55) 100%),
    linear-gradient(to top, rgba(10,10,12,.95) 0%, rgba(10,10,12,0) 38%),
    linear-gradient(to bottom, rgba(10,10,12,.6) 0%, rgba(10,10,12,0) 22%);
}
.hero__velo--perforado {
  left: auto; width: 55%;
  background: var(--perforado-claro);
  -webkit-mask-image: linear-gradient(to left, #000, transparent 85%);
  mask-image: linear-gradient(to left, #000, transparent 85%);
  opacity: .8;
}
/* Cuña roja diagonal que sube desde la esquina, como en las piezas del cliente */
.hero__cuña {
  position: absolute; z-index: -1; pointer-events: none;
  left: 0; bottom: 0;
  width: min(46vw, 640px); height: min(52vh, 460px);
  background: linear-gradient(135deg, var(--rojo-vivo) 0%, var(--rojo) 55%, #5A0000 100%);
  clip-path: polygon(0 18%, 100% 100%, 0 100%);
  opacity: .9;
  animation: hero-cuña 1.4s var(--curva) .2s both;
}
.hero__cuña::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 49.6%, rgba(255,255,255,.35) 50%, transparent 50.6%);
}
@keyframes hero-cuña { from { clip-path: polygon(0 100%, 0 100%, 0 100%); } }

/* ---------------------------------------------------------------- estructura */
.hero__cuerpo {
  position: relative; z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: center;
  gap: clamp(1.5rem, 1rem + 3vw, 4rem);
  padding-top: calc(var(--cabecera-alto) + 2.5rem);
  padding-bottom: 2rem;
}

/* ---------------------------------------------------------------- 3. texto por relevo (5) */
.hero__texto { position: relative; display: grid; }
.hero__slide {
  grid-area: 1 / 1;        /* todos en la misma celda: el alto lo da el más alto, sin saltos */
  align-self: center;
  opacity: 0; visibility: hidden;
  transform: translateY(-14px);
  transition: opacity .3s var(--curva-salida), transform .3s var(--curva-salida), visibility 0s .3s;
}
.hero__slide.esta-activo {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .6s var(--curva) .3s, transform .6s var(--curva) .3s, visibility 0s .3s;
}

.hero__gorro {
  display: inline-flex; align-items: center; gap: .7em;
  padding: .5em 1.1em .5em .6em;
  margin-bottom: var(--e-5);
  font-family: var(--f-display); font-stretch: 112%;
  font-size: var(--t-xs); font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-full);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.hero__gorro b {
  display: grid; place-items: center; min-width: 2.1em; height: 2.1em; padding: 0 .4em;
  border-radius: var(--r-full); background: var(--rojo); font-weight: 800; letter-spacing: 0;
}

.hero__titulo {
  font-family: var(--f-display); font-stretch: 106%; font-weight: 900;
  font-size: clamp(2.2rem, 1rem + 3.7vw, 4.9rem);
  line-height: .96; letter-spacing: -.035em;
  margin: 0 0 var(--e-5);
  text-shadow: 0 4px 40px rgba(0,0,0,.35);
}
.hero__titulo em { color: var(--rojo-luz); font-style: normal; }
/* Las palabras entran en cascada cada vez que su slide se activa */
.hero__slide .partido .palabra > span { --retraso: 320ms; }
.hero__slide:not(.esta-activo) .partido .palabra > span { transform: translateY(105%); transition-duration: .2s; transition-delay: 0s; }
.hero__slide.esta-activo .partido .palabra > span { transform: none; }

.hero__entrada {
  font-size: var(--t-md); line-height: 1.6;
  color: #DCDCE3; max-width: 36rem;
  margin-bottom: var(--e-6);
}
.hero__botones { display: flex; flex-wrap: wrap; gap: var(--e-3); }

/* ---------------------------------------------------------------- 2. panorama 3D */
.hero__panorama {
  position: relative;
  height: clamp(20rem, 42vw, 34rem);
  perspective: 1700px;
  perspective-origin: 30% 50%;
}
.hero__anillo {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(calc(var(--px) * -6deg)) rotateX(calc(var(--py) * 4deg));
  transition: transform .8s var(--curva);
}
.hero__tarjeta {
  --d: 0;
  position: absolute; top: 50%; left: 0;
  width: min(88%, 31rem);
  aspect-ratio: 16 / 10;
  margin: 0; padding: 0; border: 0;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--carbon);
  cursor: pointer;
  transform-origin: 0% 50%;
  box-shadow: 0 50px 90px -40px rgba(0,0,0,.85);
  transition: transform 1.1s var(--curva), opacity 1.1s var(--curva), filter 1.1s var(--curva);
}
.hero__tarjeta.sin-transicion { transition: none; }
.hero__tarjeta img {
  width: 100%; height: 100%; max-width: none; object-fit: cover;
  transform: scale(1.08);
  transition: transform 7s linear;
}
.hero__tarjeta.esta-activa img { transform: scale(1.18); }
.hero__tarjeta::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
  background: linear-gradient(to top, rgba(10,10,12,.8), transparent 55%);
}
.hero__tarjeta.esta-activa::after { box-shadow: inset 0 0 0 2px rgba(255,90,82,.85); }
.hero__rotulo {
  position: absolute; left: 1.2rem; right: 1.2rem; bottom: 1.1rem; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-family: var(--f-display); font-stretch: 112%; font-weight: 700; font-size: var(--t-sm);
  color: #fff; text-align: left;
}
.hero__rotulo span:first-child { color: var(--rojo-luz); font-weight: 900; }
.hero__vivo {
  position: absolute; top: 1rem; left: 1rem; z-index: 1;
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35em .75em; border-radius: var(--r-full);
  background: rgba(10,10,12,.7); color: #fff;
  font-size: var(--t-xs); font-weight: 600;
  opacity: 0; transition: opacity .5s .6s;
}
.hero__vivo::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #3BD16F; box-shadow: 0 0 0 0 rgba(59,209,111,.6); animation: latido-verde 2s infinite; }
@keyframes latido-verde { 70% { box-shadow: 0 0 0 8px rgba(59,209,111,0); } 100% { box-shadow: 0 0 0 0 rgba(59,209,111,0); } }
.hero__tarjeta.esta-activa .hero__vivo { opacity: 1; }

/* Posiciones por distancia al slide activo. hero.js escribe data-d. */
.hero__tarjeta[data-d="0"]  { transform: translate3d(0, -50%, 0) rotateY(0deg); opacity: 1; z-index: 4; }
.hero__tarjeta[data-d="1"]  { transform: translate3d(76%, -50%, -240px) rotateY(-30deg); opacity: .85; filter: brightness(.68); z-index: 3; }
.hero__tarjeta[data-d="2"]  { transform: translate3d(138%, -50%, -520px) rotateY(-40deg); opacity: .5; filter: brightness(.45); z-index: 2; }
.hero__tarjeta[data-d="-1"] { transform: translate3d(-70%, -50%, 160px) rotateY(22deg); opacity: 0; z-index: 5; pointer-events: none; }

/* ---------------------------------------------------------------- barra inferior */
.hero__barra {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: clamp(1rem, .5rem + 2vw, 2.5rem);
  padding-block: 1.25rem 1.75rem;
  border-top: 1px solid rgba(255,255,255,.14);
}
.hero__indice { font-family: var(--f-display); font-stretch: 118%; font-weight: 800; font-size: var(--t-sm); color: var(--texto-o2); font-variant-numeric: tabular-nums; flex: none; }
.hero__indice b { color: #fff; font-size: 1.6em; font-weight: 900; }
.hero__pestanas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; flex: 1; }
.hero__pestana {
  position: relative;
  padding: .9rem 0 0; margin: 0;
  background: none; border: 0; cursor: pointer; text-align: left;
  font-family: var(--f-display); font-stretch: 108%; font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em;
  color: rgba(255,255,255,.6);
  transition: color .3s;
}
.hero__pestana::before, .hero__pestana::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 3px;
  background: rgba(255,255,255,.18);
}
.hero__pestana::after { background: var(--rojo-vivo); transform: scaleX(0); transform-origin: left; }
.hero__pestana[aria-selected="true"] { color: #fff; }
.hero__pestana[aria-selected="true"]::after { animation: hero-avance var(--hero-duracion, 7s) linear forwards; }
.hero.esta-pausado .hero__pestana[aria-selected="true"]::after { animation-play-state: paused; }
.hero__pestana:hover { color: #fff; }
@keyframes hero-avance { to { transform: scaleX(1); } }

.hero__flechas { display: flex; gap: .5rem; flex: none; }
.hero__flecha {
  display: grid; place-items: center;
  width: 48px; height: 48px; padding: 0;
  background: rgba(255,255,255,.06); color: #fff;
  border: 1px solid rgba(255,255,255,.22); border-radius: 50%;
  cursor: pointer;
  transition: background-color .25s, border-color .25s, transform .35s var(--curva);
}
.hero__flecha:hover { background: var(--rojo); border-color: var(--rojo); transform: scale(1.06); }
.hero__flecha svg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- responsivo */
@media (max-width: 1080px) {
  .hero__cuerpo { grid-template-columns: minmax(0, 1fr); align-content: end; padding-bottom: 1rem; }
  .hero__panorama { display: none; }
  .hero__velo--lado {
    background: linear-gradient(to top, rgba(10,10,12,.97) 0%, rgba(10,10,12,.82) 45%, rgba(10,10,12,.45) 75%, rgba(10,10,12,.6) 100%);
  }
  .hero__cuña { width: 70vw; height: 30vh; opacity: .75; }
}
@media (max-width: 760px) {
  .hero__pestana { font-size: 0; padding-top: .5rem; }
  .hero__pestanas { gap: .5rem; }
  .hero__flecha { width: 42px; height: 42px; }
  .hero__entrada { font-size: 1.02rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__fondo img, .hero__fondo.esta-activo img, .hero__tarjeta img { transition: none; transform: translate(-50%, -50%) scale(1.04); }
  .hero__tarjeta img { transform: none; }
  .hero__pestana[aria-selected="true"]::after { animation: none; transform: scaleX(1); }
  .hero__cuña { animation: none; }
}
