/* ==========================================================================
   Página inicial — narrativa 3D "Atlas" (static/js/hero3d.bundle.js)
   Sem JavaScript, sem WebGL ou com "prefers-reduced-motion": versão estática
   (livro 3D em CSS + etapas em lista). Com WebGL, o script adiciona .is-3d:
   palco em ecrã inteiro, fixado durante o scroll, com legendas por etapa.
   ========================================================================== */
.story { position: relative; padding: 90px 0; }
.story-canvas, .story-word, .story-hud { display: none; }
.story-inner { display: grid; grid-template-columns: 340px 1fr; gap: 40px; align-items: center; }
.story-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.story-step { padding: 18px 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.story-caption { display: block; font-family: var(--mono); font-size: .72rem; letter-spacing: .24em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.story-step h3 { font-size: 1.25rem; margin-bottom: .35em; }
.story-step p { margin: 0; color: var(--muted); }
.story-step .btn { margin-top: 16px; }
@media (max-width: 860px) { .story-inner { grid-template-columns: 1fr; } }

/* ---------- Versão 3D ---------- */
.story.is-3d { padding: 0; }
.story.is-3d .story-stage { position: relative; height: 100vh; height: 100svh; overflow: hidden; }
.story.is-3d .story-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; opacity: 0; transition: opacity 1.4s cubic-bezier(.2, .8, .2, 1); }
.story.is-3d.is-ready .story-canvas { opacity: 1; }
.story.is-3d .story-cover { display: none; }

/* Palavra-marca gigante, atrás do livro (o canvas é transparente) */
.story.is-3d .story-word {
  display: flex; position: absolute; inset: 0; z-index: 0; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(7rem, 27vw, 30rem); line-height: .8; letter-spacing: -.06em;
  background: linear-gradient(180deg, rgba(255, 255, 255, .17) 10%, rgba(129, 140, 248, .09) 60%, rgba(5, 8, 22, 0) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  white-space: nowrap; pointer-events: none; user-select: none;
}

/* Legendas técnicas por etapa */
.story.is-3d .story-inner { position: absolute; inset: 0; z-index: 2; display: block; max-width: none; pointer-events: none; }
.story.is-3d .story-steps { position: absolute; inset: 0; display: block; }
.story.is-3d .story-step {
  position: absolute; top: 50%; width: min(400px, 30vw); padding: 0; border: 0; border-radius: 0; background: none;
  opacity: 0; visibility: hidden; transform: translate3d(0, calc(-50% + 36px), 0); filter: blur(8px);
  transition: opacity .8s cubic-bezier(.2, .8, .2, 1), transform 1s cubic-bezier(.2, .8, .2, 1), filter .8s, visibility 0s linear 1s;
  pointer-events: auto;
}
.story.is-3d .story-step-left { left: max(24px, 6vw); }
.story.is-3d .story-step-right { right: max(24px, 6vw); }
.story.is-3d .story-step.is-active { opacity: 1; visibility: visible; transform: translate3d(0, -50%, 0); filter: none; transition-delay: 0s; }
.story.is-3d .story-caption::before { content: ""; display: inline-block; width: 28px; height: 1px; margin-right: 12px; vertical-align: middle; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.story.is-3d .story-step h3 { font-size: clamp(1.35rem, 2.1vw, 2rem); line-height: 1.12; letter-spacing: -.02em; text-shadow: 0 6px 30px rgba(5, 8, 22, .8); }
.story.is-3d .story-step p { font-family: var(--mono); font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.story.is-3d .story-hud { display: block; position: absolute; left: max(24px, 6vw); bottom: 28px; z-index: 2; font-family: var(--mono); font-size: .72rem; letter-spacing: .24em; color: var(--muted); }
.story-hud-count { color: var(--heading); }

@media (max-width: 860px) {
  .story.is-3d .story-word { align-items: flex-start; padding-top: 14vh; font-size: 34vw; }
  .story.is-3d .story-step {
    top: auto; bottom: 64px; left: 16px; right: 16px; width: auto; padding: 16px 18px;
    background: rgba(5, 8, 22, .62); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border); border-radius: var(--radius); transform: translate3d(0, 30px, 0);
  }
  .story.is-3d .story-step.is-active { transform: none; }
  .story.is-3d .story-hud { bottom: 20px; left: 16px; }
}
