/* ============================================================
   AGÊNCIA VIRA — Home: Scroll Story
   Só usado em index.html. Reaproveita as custom properties de
   css/style.css (--green, --cream, --accent, --ink, --maxw etc.)
   ============================================================ */

/* ---------- Boot: evita flash antes do GSAP calcular o estado ---------- */
html.story-boot .beat { opacity: 0; }

/* ---------- Cena de vídeo ---------- */
.scene { position: relative; }
.scene[data-vh="100"] { height: 100vh; }
.scene[data-vh="320"] { height: 320vh; }
.scene[data-vh="340"] { height: 340vh; }

.scene-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--ink);
}
/* Container do vídeo. No desktop ocupa a tela toda (texto por cima);
   no mobile vira um painel de altura própria (texto vai pra baixo). */
.scene-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.scene-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
/* Escurecimento leve e uniforme — o contraste do texto já vem da
   "plaquinha" translúcida de cada .beat, então o scrim não precisa
   mais escurecer pesado nas bordas (isso criava um efeito de "buraco
   preto" bem na costura entre uma cena e a seguinte). */
.scene-scrim {
  position: absolute;
  inset: 0;
  background: rgba(20,24,13,.16);
  pointer-events: none;
}
.scene .chrome {
  position: absolute;
  top: 32px;
  left: 24px;
  z-index: 2;
  margin-bottom: 0;
}
.scene-curtain {
  position: absolute;
  inset: 0;
  background: var(--green-d);
  transform-origin: 100% 50%;
}

/* ---------- Beats (mensagens que sobem por cima do vídeo) ----------
   Padrão: texto na lateral esquerda (mais elegante que dead-center
   sobre o vídeo). Exceções pontuais via .beat--right / .beat--center. */
.scene-beats {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center start;
  padding: 0 28px;
  pointer-events: none;
}
.beat {
  grid-area: 1 / 1;
  max-width: 600px;
  text-align: left;
  margin-left: clamp(20px, 6vw, 100px);
  margin-right: auto;
  color: var(--cream);
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  line-height: 1.22;
  text-shadow: 0 4px 30px rgba(0,0,0,.4);
  background: rgba(15,18,10,.4);
  backdrop-filter: blur(10px) saturate(1.05);
  border-radius: 18px;
  padding: 16px 30px;
  pointer-events: none;
  will-change: transform, opacity, filter;
}
.beat .serif { color: var(--accent); }
.beat--punch { max-width: 640px; font-size: clamp(2.2rem, 5.8vw, 4.2rem); padding: 22px 36px; }
.beat--lead {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 28px;
  font-family: var(--body);
  font-weight: 400;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  color: var(--muted);
}
.beat--lead .hero-cta { justify-content: flex-start; }

.beat--card {
  grid-area: 1 / 1;
  justify-self: center;
  margin: 0;
  text-align: left;
  max-width: 380px;
  background: rgba(20,24,13,.55);
  backdrop-filter: blur(12px) saturate(1.1);
  border: 1px solid rgba(243,239,226,.16);
  border-radius: var(--radius);
  padding: 28px 30px;
  font-family: var(--body);
}
.beat--card b { display: block; font-family: var(--display); font-size: 1.35rem; margin-bottom: 4px; color: var(--cream); }
.beat--card span { display: block; color: var(--accent); font-weight: 600; font-size: .85rem; letter-spacing: .02em; margin-bottom: 14px; }
.beat--card p { color: var(--muted); font-size: .98rem; margin: 0; }

.beat--left { justify-self: start; margin-left: clamp(20px, 6vw, 100px); margin-right: auto; }
.beat--right { justify-self: end; margin-left: auto; margin-right: clamp(20px, 6vw, 100px); }
.beat--center { justify-self: center; margin-left: auto; margin-right: auto; max-width: 780px; text-align: center; }

/* ---------- Hint de scroll (só no Ato I) ---------- */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--cream);
  opacity: .7;
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  transition: opacity .5s var(--ease);
}
.scroll-hint::after {
  content: "";
  width: 1px;
  height: 30px;
  background: linear-gradient(var(--cream), transparent);
  animation: hint-drop 1.6s ease-in-out infinite;
}
.scroll-hint.is-hidden { opacity: 0; }
@keyframes hint-drop {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  50.01% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- Interlúdio (sem vídeo) ---------- */
.interlude { position: relative; overflow: hidden; text-align: center; }
.interlude .vr-mark {
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(14rem, 42vw, 34rem);
  color: rgba(80,104,56,.05);
}
.interlude-title {
  position: relative; z-index: 2;
  font-size: clamp(2.6rem, 7.4vw, 5.4rem);
  color: var(--green-d);
}
.interlude-sub {
  position: relative; z-index: 2;
  margin-top: 26px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.2rem, 2.6vw, 1.8rem);
  color: var(--green-dd);
}

/* ---------- Emenda (faixa de transição pro resto do site) ---------- */
.emenda-cta { position: relative; overflow: hidden; }
.emenda-cta .vr-mark { right: -2%; bottom: -30%; font-size: 24rem; color: rgba(243,239,226,.06); }
.emenda-inner { position: relative; z-index: 2; text-align: center; max-width: 760px; margin: 0 auto; }
.emenda-cta h2 { font-size: clamp(1.9rem, 4.4vw, 3.1rem); margin-bottom: 34px; color: var(--cream); }
.emenda-cta .hero-cta { justify-content: center; }
.emenda-cta .hero-stats { justify-content: center; margin-top: 56px; }

/* ---------- Fallback: prefers-reduced-motion e JS desligado ---------- */
@media (prefers-reduced-motion: reduce) {
  .scene { height: auto !important; }
  .scene-stage { position: static !important; height: auto !important; display: block !important; overflow: visible; }
  .scene-media { position: relative !important; inset: auto !important; aspect-ratio: 16 / 9; max-height: none !important; }
  .scene-beats { position: static; display: flex; flex-direction: column; gap: 20px; padding: 40px 24px; background: var(--ink2); pointer-events: auto; }
  .beat, .beat--card, .beat--left, .beat--right, .beat--center {
    grid-area: auto; position: static; opacity: 1 !important; transform: none !important;
    filter: none !important; justify-self: auto; margin: 0; max-width: 100%; text-align: left; pointer-events: auto;
  }
  .beat--lead { align-items: flex-start; }
  .scene-curtain, .scroll-hint { display: none; }
}
html.no-story .scene { height: auto !important; }
html.no-story .scene-stage { position: static !important; height: auto !important; display: block !important; overflow: visible; }
html.no-story .scene-media { position: relative !important; inset: auto !important; aspect-ratio: 16 / 9; max-height: none !important; }
html.no-story .scene-beats { position: static; display: flex; flex-direction: column; gap: 20px; padding: 40px 24px; background: var(--ink2); pointer-events: auto; }
html.no-story .beat,
html.no-story .beat--card,
html.no-story .beat--left,
html.no-story .beat--right,
html.no-story .beat--center {
  grid-area: auto; position: static; opacity: 1; transform: none;
  filter: none; justify-self: auto; margin: 0; max-width: 100%; text-align: left; pointer-events: auto;
}
html.no-story .beat--lead { align-items: flex-start; }
html.no-story .scene-curtain, html.no-story .scroll-hint { display: none; }

/* ---------- Responsivo (mobile) ----------
   Aqui a lógica INVERTE em relação ao desktop: em vez de o texto flutuar
   por cima do vídeo, a tela é dividida — vídeo em cima, texto embaixo.
   Numa tela estreita a legenda sobreposta tapava a imagem inteira e
   estragava as duas coisas; separando, cada uma respira. Como o texto
   passa a ficar sobre fundo sólido, ele também perde a "plaquinha"
   translúcida (não precisa mais de contraste artificial). */
@media (max-width: 780px) {
  .scene { background: var(--ink); }

  .scene-stage {
    height: 100vh;
    height: 100svh; /* svh evita o pulo quando a barra do navegador some */
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .scene-media {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 4 / 5;
    max-height: 56svh;
  }
  /* Ato I é uma composição horizontal (as duas ovelhas se esticando):
     recorte vertical destruiria a cena, então mostra o quadro inteiro.
     Como a faixa de vídeo fica baixa, o texto não estica — o conjunto
     vídeo+texto é centralizado junto, em vez de sobrar um vazio embaixo. */
  #ato-1 .scene-media { aspect-ratio: 16 / 9; max-height: none; }
  #ato-1 .scene-beats { flex: 0 1 auto; }

  .scene-video { object-position: center !important; }

  .scene-beats {
    position: relative;
    inset: auto;
    flex: 1 1 auto;
    min-height: 0;
    place-items: center;
    padding: 26px 22px;
  }
  .beat {
    text-align: center;
    margin: 0;
    max-width: 100%;
    font-size: clamp(1.25rem, 5.2vw, 1.7rem);
    background: none;
    backdrop-filter: none;
    padding: 0;
    text-shadow: none;
  }
  .beat--punch { font-size: clamp(1.6rem, 7vw, 2.2rem); padding: 0; }
  .beat--lead { font-size: 1rem; gap: 20px; align-items: center; }
  .beat--lead .hero-cta { justify-content: center; }
  .beat--card { max-width: 100%; padding: 22px 24px; }
  .beat--left, .beat--right, .beat--center { justify-self: center; margin: 0; }

  .scene .chrome { top: 18px; left: 20px; }
  .scroll-hint { bottom: 18px; }
}
