/* Hero scroll-driven — Madrugada de luna llena */
/* El fondo arranca del navy de la pagina y se va oscureciendo, para que el hero
   no se vea como un bloque negro pegado. */
.hero-stage { position: relative; height: 320vh; background: linear-gradient(180deg, var(--color-primary) 0%, #12283d 9%, #0a1220 34%); }
.hero-sticky {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
/* Capa de tratamiento sobre el canvas: vineta cinematografica (esquinas),
   velo a la izquierda (legibilidad del copy) y leve fundido inferior.
   Va sobre el canvas y bajo el copy. */
.hero-sticky::after {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(135% 120% at 60% 45%, transparent 52%, rgba(8,14,28,.6) 100%),
    linear-gradient(90deg, rgba(8,14,28,.92) 0%, rgba(8,14,28,.5) 24%, rgba(8,14,28,0) 50%),
    linear-gradient(0deg, rgba(10,18,32,.8) 0%, rgba(10,18,32,0) 12%);
}
/* Canvas full-bleed (cover): la escena llena toda la pantalla, sin caja ni
   franjas negras. El difuminado lo da la vineta de .hero-sticky::after. */
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }

/* Copy: ancla a la izquierda en desktop */
.hero-copy {
  position: relative; z-index: 4; max-width: 540px; padding: 0 6vw;
  margin-right: auto; color: #fff;
}
.hero-badge {
  display: inline-block; font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--color-accent); padding: 8px 16px; border: 1px solid rgba(201,162,39,.4);
  border-radius: 30px; margin-bottom: 24px;
}
.hero-title {
  font-family: 'Cormorant Garamond', serif; font-weight: 700;
  font-size: clamp(44px, 7vw, 84px); line-height: 1.02; letter-spacing: -2px;
  color: #fff; margin-bottom: 18px; text-shadow: 0 4px 24px rgba(0,0,0,.5);
}
.hero-tagline { font-size: clamp(16px, 2vw, 20px); color: rgba(255,255,255,.9); line-height: 1.8; margin-bottom: 28px; }
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; }

/* Libro fallback CSS 3D — se abre con una variable --open (0..1) seteada por JS */
.hero-book {
  position: absolute; right: 8vw; top: 50%; z-index: 3;
  width: 300px; height: 450px; transform: translateY(-50%);
  perspective: 1800px;
}
.hero-book-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.hero-book-cover, .hero-book-page {
  position: absolute; inset: 0; border-radius: 2px 6px 6px 2px;
  backface-visibility: hidden;
}
.hero-book-cover {
  z-index: 2; transform-origin: left center;
  transform: rotateY(calc(var(--open, 0) * -150deg));
  box-shadow: 0 30px 60px rgba(0,0,0,.6);
}
.hero-book-cover img { width: 100%; height: 100%; object-fit: cover; border-radius: 2px 6px 6px 2px; }
.hero-book-page {
  z-index: 1; background: #f3ead6; color: #5b4d36;
  font-family: 'Cormorant Garamond', serif; font-size: 17px; line-height: 1.6;
  padding: 40px 30px; display: flex; align-items: center;
  opacity: var(--open, 0);
}

.hero-scroll-hint {
  position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%); z-index: 5;
}
.hero-scroll-hint span {
  display: block; width: 2px; height: 42px;
  background: linear-gradient(to bottom, var(--color-accent), transparent);
  animation: heroScrollPulse 2s infinite;
}
@keyframes heroScrollPulse { 0%,100% { height: 42px; opacity: 1 } 50% { height: 60px; opacity: .4 } }

/* Móvil: hero estático y apilado (portada arriba, copy abajo). Sin sticky,
   sin canvas, sin superposiciones. Layout simple y a prueba de balas. */
@media (max-width: 768px) {
  .hero-stage { height: auto; background: var(--color-primary); }
  .hero-sticky {
    position: static; height: auto; overflow: visible;
    flex-direction: column; justify-content: flex-start; align-items: center;
    gap: 26px; padding: 88px 24px 56px;
  }
  .hero-canvas { display: none !important; }
  .hero-sticky::after { display: none; }
  .hero-book {
    display: block !important; /* por si el canvas lo oculto en desktop y luego se redimensiona */
    position: relative; right: auto; top: auto; transform: none; perspective: none;
    width: 190px; height: 285px; margin: 0 auto; flex: 0 0 auto;
  }
  .hero-book-inner { transform: none; }
  .hero-book-cover {
    position: static; transform: none !important; transform-origin: center;
    box-shadow: 0 22px 44px rgba(0,0,0,.55);
  }
  .hero-book-cover img { border-radius: 4px; }
  .hero-book-page { display: none; }
  .hero-copy { margin: 0; max-width: none; padding: 0; text-align: center; }
  .hero-ctas { justify-content: center; }
  .hero-scroll-hint { display: none; }
}

/* Respeto a reduced-motion: hero estático con la portada cerrada */
@media (prefers-reduced-motion: reduce) {
  .hero-stage { height: 100vh; }
  .hero-book-cover { transform: none !important; }
  .hero-book-page { display: none; }
}
