/* ============================================================
   SEÇÃO: manifesto — docs/secoes/08 + docs/20 (22/10/2026)
   1) .manifesto  — vídeo do Moran que cresce com o scroll (D1), com a
      frase gigante em loop como marca d'água
   2) .statement  — texto em tela cheia revelado pelo scroll (D2)
============================================================ */

/* ---------- 1) Vídeo que cresce com o scroll (docs/20 D1) ----------
   --p (0→1) = progresso do palco sticky. Com suporte, vem de uma
   scroll-driven animation (view-timeline no trilho); sem suporte,
   manifesto.js escreve --p via rAF. Só transform/opacity mudam. */
@property --p {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
.manifesto {
  --manifesto-word: min(var(--fs-giant), 22vh);
  /* Tamanho final: 90vw de largura; altura 16:9 limitada à altura útil da
     tela (em telas baixas o vídeo fica mais panorâmico, com object-fit) */
  --video-w: 90vw;
  --video-h: min(var(--video-w) * 9 / 16, 100svh - var(--header-h-scrolled) - var(--space-7));
  --video-start: .45; /* escala inicial (desktop) */
}
.manifesto__rail {
  height: 200svh;
  view-timeline: --manifesto-rail block;
}
.manifesto__stage {
  position: sticky;
  top: 0;
  display: grid;
  place-items: center;
  height: 100svh;
  overflow-x: clip;
}
.manifesto__stage > * { grid-area: 1 / 1; }

/* Desktop: palco de 100svh, o view-timeline cobre o progresso.
   < 1024 o palco é só do tamanho do vídeo: --p vem do manifesto.js */
@media (min-width: 1024px) { @supports (animation-timeline: view()) {
  .manifesto__rail {
    animation: manifesto-p linear both;
    animation-timeline: --manifesto-rail;
    animation-range: contain 0% contain 100%;
  }
  @keyframes manifesto-p { from { --p: 0; } to { --p: 1; } }
} }

/* Marca d'água: faixa em loop atrás do vídeo + parallax leve com --p */
.manifesto__marquee {
  display: flex;
  width: 100%;
  overflow: hidden;
  user-select: none;
  transform: translate3d(calc(var(--p) * -8%), 0, 0);
}
.manifesto__track {
  display: flex;
  flex: none;
  max-width: none;
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--manifesto-word);
  font-weight: 600;
  /* 1.05: o acento do "Á" maiúsculo não é cortado */
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--color-sand);
  white-space: nowrap;
  animation: manifesto-marquee var(--manifesto-dur, 60s) linear infinite; /* duração: manifesto.js */
  will-change: transform;
}
.manifesto__group { display: flex; flex: none; align-items: center; }
.manifesto__sep {
  flex: none;
  width: .14em;
  height: .14em;
  margin-inline: .45em;
  border-radius: 50%;
  background: var(--color-stone);
}
@keyframes manifesto-marquee {
  to { transform: translate3d(-50%, 0, 0); }
}
/* Fora da tela: pausa (manifesto.js) */
.manifesto__marquee.is-paused .manifesto__track { animation-play-state: paused; }

/* Vídeo: caixa no tamanho final; a escala faz ele "crescer" */
.manifesto__media {
  position: relative;
  z-index: 1;
  width: var(--video-w);
  height: var(--video-h);
  margin: 0;
  overflow: hidden;
  /* raio visual: --radius-lg no início → --radius-md no fim (dividido pela escala) */
  --s: calc(var(--video-start) + (1 - var(--video-start)) * var(--p));
  border-radius: calc((var(--radius-lg) - (var(--radius-lg) - var(--radius-md)) * var(--p)) / var(--s));
  background: var(--color-dark);
  box-shadow: var(--shadow-2);
  transform: scale(var(--s));
  will-change: transform;
}
.manifesto__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
}

/* docs/25 M5: pausa discreta (36 px visíveis, 44 px de toque) no canto e
   "Ver vídeo" sobre o poster se o autoplay for recusado (manifesto.js).
   A escala do vídeo é desfeita (1 / --s): o botão não encolhe junto. */
.manifesto__toggle,
.manifesto__play {
  position: absolute;
  z-index: 1;
  isolation: isolate;
  transform: scale(calc(1 / var(--s)));
  color: var(--color-on-dark);
}
.manifesto__toggle {
  right: var(--space-2);
  bottom: var(--space-2);
  display: grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  transform-origin: 100% 100%;
}
.manifesto__toggle::before {
  content: "";
  position: absolute;
  inset: var(--space-1);
  z-index: -1;
  border-radius: var(--radius-pill);
  background: rgb(28 27 25 / .55); /* --color-ink 55%, como o "Ver" dos cards */
}
.manifesto__toggle .icon { width: 16px; height: 16px; }
.manifesto__toggle-play,
.manifesto__toggle.is-paused .manifesto__toggle-pause { display: none; }
.manifesto__toggle.is-paused .manifesto__toggle-play { display: block; }
.manifesto__play {
  inset: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: max-content;
  height: var(--tap-min);
  margin: auto;
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--btn-light-bg);
  color: var(--color-ink);
  font-size: var(--fs-small);
  font-weight: 500;
  box-shadow: var(--shadow-2);
}
.manifesto__play .icon { width: 16px; height: 16px; }

/* Mobile/tablet (docs/23 MB3): sem o vão de ~250px antes do vídeo.
   O palco tem só a altura do vídeo e fica preso no meio da tela; o trilho
   ganha 40svh de rolagem para o vídeo crescer (antes: 180svh/200svh). */
@media (max-width: 1023px) {
  .manifesto {
    --video-start: .75;
    --stage-h: calc(var(--video-h) + var(--space-4) * 2);
  }
  .manifesto__rail { height: calc(var(--stage-h) + 40svh); }
  .manifesto__stage {
    top: max(var(--header-h-scrolled), (100svh - var(--stage-h)) / 2);
    height: var(--stage-h);
  }
}
@media (max-width: 767px) {
  .manifesto {
    --video-w: calc(100vw - var(--gutter) * 2);
    /* 4:5 corta melhor a fachada na tela em pé */
    --video-h: min(var(--video-w) * 5 / 4, 100svh - var(--header-h-scrolled) - var(--space-7));
    --video-start: .72; /* docs/25 M5: .72 → 1, ida e volta */
  }
  .manifesto__video { object-position: 50% 50%; } /* arquivo mobile já vem recortado em 4:5 */
  /* docs/25 M13: no scroll só a escala muda; o raio fica fixo e escala junto */
  .manifesto__media { border-radius: var(--radius-md); }
}

/* Reduced motion: vídeo parado no poster, já no tamanho final */
@media (prefers-reduced-motion: reduce) {
  .manifesto__rail { height: auto; animation: none; }
  .manifesto__stage { position: static; height: auto; min-height: 100svh; }
  .manifesto { --p: 1; }
  .manifesto__marquee { transform: none; justify-content: center; }
  .manifesto__track { animation: none; }
}

/* ---------- 2) Manifesto em texto, revelado pelo scroll (docs/20 D2) ----------
   --statement-p (0→1) = progresso do palco sticky; com suporte vem de
   scroll-driven animation, senão de manifesto.js (rAF). Cada palavra:
   --wp = clamp(0, p·N − i, 1) → opacity .18 → 1. Ida e volta: descer
   acende, subir apaga. Só opacity/transform mudam. */
@property --statement-p {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
.statement__rail {
  height: 250svh;
  view-timeline: --statement-rail block;
  /* No trilho (onde --statement-p é animada), não no ancestral: var() é
     resolvido onde é declarado. As palavras terminam de acender em 85%. */
  --statement-sp: min(1, var(--statement-p) / .85);
}
@supports (animation-timeline: view()) {
  .statement__rail {
    animation: statement-p linear both;
    animation-timeline: --statement-rail;
    animation-range: contain 0% contain 100%;
  }
  @keyframes statement-p { from { --statement-p: 0; } to { --statement-p: 1; } }
}
.statement__stage {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  height: 100svh;
  padding-block: calc(var(--header-h-scrolled) + var(--space-4)) var(--space-5);
}
.statement__inner {
  display: grid;
  justify-items: center;
  gap: clamp(var(--space-4), 3vh, var(--space-6));
  text-align: center;
}
.statement__quote { display: grid; justify-items: center; gap: clamp(var(--space-3), 2.4vh, var(--space-5)); }
.statement__mark {
  font-family: var(--font-display);
  font-size: clamp(4rem, 9vh, 7rem);
  font-weight: 600;
  line-height: .5;
  height: .4em;
  color: var(--color-accent-soft);
}
.statement__text {
  display: grid;
  gap: .5em;
  max-width: 1000px;
  font-family: var(--font-display);
  /* docs/20: clamp(28px, 4.2vw, 64px), limitado pela altura para caber em 100svh */
  font-size: clamp(min(28px, 3.6vh, 7.4vw), min(4.2vw, 5.6vh), 64px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  text-wrap: pretty;
}
.statement__text p { max-width: none; }
.statement__text strong { font-weight: 600; }
.statement__accent { font-style: normal; color: var(--color-accent); }

/* Miniatura inline (~1em) que acende junto com a palavra anterior */
.statement__pill {
  display: inline-block;
  width: 1.8em;
  height: .9em;
  margin-inline: .08em;
  overflow: hidden;
  vertical-align: -.1em;
  border-radius: var(--radius-pill);
  background: var(--color-sand);
}
.statement__pill img { width: 100%; height: 100%; object-fit: cover; }

.statement__sign {
  font-size: var(--fs-small);
  font-variant: small-caps;
  letter-spacing: .12em;
  color: var(--color-muted);
}
.statement__progress {
  display: block;
  width: min(240px, 50%);
  height: 1px;
  overflow: hidden;
  background: var(--color-line);
}
.statement__progress::after {
  content: "";
  display: block;
  height: 100%;
  background: var(--color-ink);
  transform-origin: left;
  transform: scaleX(var(--statement-sp));
}

/* Revelação (só com JS: manifesto.js divide o texto e põe .is-scrubbed) */
.statement.is-scrubbed .split-word { overflow: visible; }
.statement.is-scrubbed .split-word__in,
.statement.is-scrubbed .statement__pill {
  --wp: clamp(0, var(--statement-sp) * var(--statement-n) - var(--i), 1);
  opacity: calc(.18 + .82 * var(--wp));
}
.statement.is-scrubbed .statement__pill { transform: scale(calc(.85 + .15 * var(--wp))); }
/* Assinatura entra no fim; aspas no começo */
.statement.is-scrubbed .statement__sign {
  --sign: clamp(0, (var(--statement-sp) - .96) * 25, 1);
  opacity: var(--sign);
  transform: translateY(calc((1 - var(--sign)) * 8px));
}
.statement.is-scrubbed .statement__mark { opacity: clamp(.25, var(--statement-sp) * 20, 1); }

/* Pilares: faixa discreta depois do trilho */
.statement__pillars {
  display: grid;
  gap: var(--space-4);
  max-width: 960px;
  margin: 0 auto;
  padding-block: var(--space-6) var(--section-y);
}
.pillar {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--space-4);
  row-gap: var(--space-1);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-line);
}
.pillar .icon { grid-row: span 2; color: var(--color-accent); }
.pillar__title { font-size: var(--fs-body); font-weight: 500; letter-spacing: 0; }
.pillar__text { font-size: var(--fs-small); color: var(--color-ink-2); }

@media (min-width: 768px) {
  .statement__pillars { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
}
@media (max-width: 767px) {
  .statement__rail { height: 160svh; } /* docs/24 C4: menos rolagem presa no celular */
}
/* docs/25 M6: pilares maiores no celular (título 20px/600, texto 16px) */
@media (max-width: 767.98px) {
  .statement__pillars { gap: 0; }
  .pillar {
    grid-template-columns: 40px 1fr;
    column-gap: var(--space-4);
    padding-block: var(--space-5);
  }
  .pillar .icon { width: 28px; height: 28px; }
  .pillar__title {
    margin-bottom: calc(var(--space-1) * 1.5); /* 6px */
    font-size: 1.25rem; /* 20px */
    font-weight: 600;
    line-height: 1.2;
  }
  .pillar__text { font-size: var(--fs-body); line-height: 1.55; }
}
/* Reduced motion / sem JS: seção comum, texto inteiro na cor final */
@media (prefers-reduced-motion: reduce) {
  .statement__rail { height: auto; animation: none; }
  .statement__stage { position: static; height: auto; min-height: 100svh; }
  .statement__rail { --statement-sp: 1; }
}
