/* WEB/css/home-hero.css
   Portada (index.html) — solo se carga ahí. Los colores y fuentes salen de css/variables.css (compartidos con todo el sitio).
   Capas del escenario, de atrás hacia adelante:
   0 fondo (ondas WebGL / imagen)  1 velo  2 portada-recorte (.hero__tapa)  3 nombre  4 Juan  5 frase + tarjetas  6 nav  7 "desliza" */

body.home {
  --veil: 9, 7, 4;
  color-scheme: dark;
}
body.home :focus-visible { outline: 1px solid var(--gold-bright); outline-offset: 4px; }
body.home a { text-decoration: none; }

/* ---------- Escenario ---------- */
.hero-scroll__pista { display: none; }
.stage {
  position: relative;
  height: 100vh; /* fallback */
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: #0d0a06;
  text-align: center;
}
.hero-anim .hero-scroll__pista { display: block; height: 250vh; height: 250svh; }
.hero-anim .stage { position: sticky; top: 0; }

.veil {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 54% 64% at 50% 44%, rgba(var(--veil), 0.86) 0, rgba(var(--veil), 0.55) 45%, rgba(var(--veil), 0) 78%),
    linear-gradient(0deg, rgba(var(--veil), 0.92) 0, rgba(var(--veil), 0) 38%),
    linear-gradient(180deg, rgba(var(--veil), 0.92) 0, rgba(var(--veil), 0.6) 9%, rgba(var(--veil), 0) 24%);
}
.hero-anim .veil { opacity: 0; } /* aparece con el scroll; la portada inicial queda igual que siempre */

/* ---------- Nav ---------- */
.nav {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 28px) clamp(16px, 5vw, 72px) 0;
}
.hero-anim .nav { opacity: 0; visibility: hidden; }
.logo { font-family: var(--font-serif); font-weight: 500; font-size: 15px; letter-spacing: 0.34em; color: var(--gold-bright); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.social { display: flex; gap: 20px; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; }
/* El padding agranda el área de toque sin mover nada (el margen negativo lo compensa). */
.social a { color: var(--text); padding: 14px 6px; margin: -14px -6px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); transition: color 0.4s; }
.social a:hover { color: var(--gold-bright); }

/* ---------- Portada recortada (tu efecto original: el nombre deja ver el fondo y crece) ---------- */
.hero__tapa { display: none; }
.hero-anim .stage {
  --tapa-fs: min(11.5vw, 10rem);
  --tapa-lines: 2;
  --tapa-up: 3.5rem; /* sube el grupo nombre + indicador para centrarlo visualmente */
}
.hero-anim .hero__tapa {
  position: absolute; top: 0; left: 0; right: 0; height: 100vh; height: 100svh; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  padding-bottom: calc(var(--tapa-up) * 2);
  background: #000;
  mix-blend-mode: multiply;
  overflow: hidden;
  pointer-events: none;
}
.hero__tapa-texto {
  --k: 1;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: calc(var(--tapa-fs) * var(--k));
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  color: #fff;
}
.hero__tapa-texto > span { display: block; }

.hero__desliza { display: none; }
.hero-anim .hero__desliza {
  position: absolute; top: 0; left: 0; right: 0; height: 100vh; height: 100svh; z-index: 7;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 1.5rem;
  padding-top: calc(50vh - var(--tapa-up) + var(--tapa-fs) * var(--tapa-lines) * 0.5 + 1.75rem);
  padding-top: calc(50svh - var(--tapa-up) + var(--tapa-fs) * var(--tapa-lines) * 0.5 + 1.75rem);
  pointer-events: none;
}
.hero__desliza span {
  font-size: clamp(0.8rem, 2.4vw, 1rem);
  letter-spacing: 0.32em; text-transform: uppercase; font-weight: 400;
  color: var(--text); text-shadow: 0 1px 18px rgba(0, 0, 0, 0.7);
  padding-left: 0.32em; /* compensa el tracking para centrar */
}
.hero__desliza i { position: relative; display: block; width: 1px; height: 4.5rem; background: rgba(201, 163, 78, 0.3); overflow: hidden; }
.hero__desliza i::after {
  content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 45%;
  background: var(--gold-bright);
  animation: desliza-baja 1.9s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes desliza-baja { from { transform: translateY(-100%); } to { transform: translateY(230%); } }

/* ---------- Nombre (detrás de Juan). La cortina de hero-scroll.js se aplica a .name-wrap ---------- */
.name-wrap { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.hero-anim .name-wrap { -webkit-mask-image: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0)); mask-image: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0)); }
.name {
  position: absolute; left: 0; right: 0; top: 13vh; top: 13svh; margin: 0;
  font-family: var(--font-serif); font-weight: 500; line-height: 0.86; letter-spacing: 0.03em;
  /* Limitado también por el alto: en pantallas bajas el nombre no se come toda la portada. */
  font-size: clamp(54px, 12.2vw, 210px);
  font-size: clamp(54px, min(12.2vw, 20svh), 210px);
  text-wrap: balance; text-transform: uppercase;
  background: linear-gradient(180deg, #f3dfab 0%, var(--gold) 52%, var(--gold-dim) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  transform-origin: 50% 30%;
}
.name span { display: block; }
.name span + span { margin-top: 0.08em; }

/* ---------- Juan: la misma foto dos veces. Silueta translúcida debajo, foto a color encima ---------- */
.juan {
  position: absolute; left: 50%; bottom: 0; z-index: 4;
  height: 84vh; height: 84svh; aspect-ratio: 2 / 3; max-width: 100%;
  transform: translateX(-50%); transform-origin: 50% 100%;
  pointer-events: none;
}
.juan img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; }
.juan__sil { filter: brightness(0); opacity: 0; }
.hero-anim .juan__foto { opacity: 0; }

/* ---------- Frase + tarjetas (solo al final de la secuencia) ---------- */
.reveal {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr) minmax(0, 340px);
  align-items: end; gap: 24px;
  padding: 0 clamp(16px, 5vw, 72px) calc(env(safe-area-inset-bottom, 0px) + 7vh);
  text-align: left;
}
.hero-anim .reveal { opacity: 0; visibility: hidden; }
.phrase {
  margin: 0; text-align: center; font-family: var(--font-serif); font-style: italic; font-weight: 400;
  font-size: clamp(26px, 2.6vw, 40px); line-height: 1.15; color: var(--text);
  text-wrap: balance; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 2px 28px rgba(0, 0, 0, 0.85);
}
.phrase .rule { display: block; width: 44px; height: 1px; margin: 0 auto 18px; background: var(--gold); }

.door {
  display: flex; flex-direction: column; gap: 12px; padding: 26px 26px 24px; text-align: left;
  font: inherit; color: var(--text);
  background: rgba(10, 8, 5, 0.86); /* sin backdrop-filter: el desenfoque sobre WebGL en vivo es caro, sobre todo en móvil */
  border: 1px solid rgba(201, 163, 78, 0.5); border-radius: 0; cursor: pointer;
  transition: border-color 0.5s, background 0.5s;
}
.door:hover { border-color: var(--gold-bright); background: rgba(16, 12, 7, 0.92); }
.door__tag { font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--text-muted); }
.door h2 { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: 40px; line-height: 1; letter-spacing: 0.01em; }
.door p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-muted); }
.door__cta { display: flex; align-items: center; gap: 12px; margin-top: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.door__cta svg { flex: none; transition: transform 0.5s; }
.door:hover .door__cta svg { transform: translateX(6px); }

/* Salto para teclado y lectores de pantalla */
.salto { position: absolute; left: 16px; top: 16px; z-index: 20; padding: 10px 14px; background: var(--gold); color: #0a0a0a; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; transform: translateY(-200%); }
.salto:focus { transform: none; }

/* ---------- Pie ---------- */
body.home .redes { flex-wrap: wrap; padding-inline: 16px; }
body.home .redes a { color: var(--text-muted); }
body.home .redes a:hover { color: var(--gold-bright); }

/* ---------- Pantallas medias (tabletas en horizontal, laptops chicas) ---------- */
@media (max-width: 1100px) {
  .reveal { grid-template-columns: minmax(0, 280px) minmax(0, 1fr) minmax(0, 280px); gap: 16px; }
  .door { padding: 20px 20px 18px; }
  .door h2 { font-size: 34px; }
}

/* ---------- Pantallas bajas (celular en horizontal, ventanas chaparras) ---------- */
@media (max-height: 560px) and (min-width: 600px) {
  .nav { padding-top: 14px; }
  .name { top: 11svh; }
  .juan { height: 88svh; }
  .reveal { grid-template-columns: 200px minmax(0, 1fr) 200px; gap: 12px; padding-bottom: 12px; }
  .door { padding: 12px 14px; gap: 6px; }
  .door h2 { font-size: 26px; }
  .door p { display: none; }
  .door__cta { margin-top: 0; }
  .phrase { font-size: 19px; }
  .phrase .rule { display: none; }
}

/* ---------- Móvil ---------- */
@media (max-width: 820px) {
  .social { display: none; }
  .logo { font-size: 13px; letter-spacing: 0.28em; }
  .hero-anim .stage { --tapa-fs: min(12.5vw, 6.5rem); }
  .name { top: 21vh; top: 21svh; font-size: clamp(46px, 14.2vw, 120px); }
  /* Más ancho que la pantalla a propósito (el escenario recorta los lados): así la cabeza sube y tapa parte del nombre, como en escritorio. */
  .juan { height: 78vh; height: 78svh; max-width: none; }
  .reveal {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  }
  .phrase { grid-column: 1 / -1; order: -1; margin-bottom: 8px; font-size: 24px; }
  .phrase .rule { margin-bottom: 12px; }
  /* Tarjeta compacta: etiqueta arriba; título a la izquierda y flecha a la derecha, sin encimarse. */
  .door {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "tag tag" "titulo flecha";
    align-items: center; gap: 8px 8px; padding: 13px 14px; background: rgba(10, 8, 5, 0.92);
  }
  .door__tag { grid-area: tag; font-size: 11px; letter-spacing: 0.18em; }
  .door h2 { grid-area: titulo; font-size: 26px; min-width: 0; }
  .door p { display: none; }
  .door__cta { grid-area: flecha; margin: 0; }
  .door__cta span { display: none; }
  .veil {
    background:
      radial-gradient(ellipse 95% 50% at 50% 30%, rgba(var(--veil), 0.88) 0, rgba(var(--veil), 0.5) 55%, rgba(var(--veil), 0) 85%),
      linear-gradient(0deg, rgba(var(--veil), 0.95) 0, rgba(var(--veil), 0) 45%),
      linear-gradient(180deg, rgba(var(--veil), 0.92) 0, rgba(var(--veil), 0.6) 9%, rgba(var(--veil), 0) 24%);
  }
}
@media (max-width: 360px) {
  .door { padding: 12px 11px; }
  .door h2 { font-size: 21px; }
  .door__cta svg { width: 16px; }
  .door__tag { letter-spacing: 0.12em; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__desliza i::after { animation: none; }
  .door, .door__cta svg, .social a { transition: none; }
}
