/* =============================================================
   NSI · Hero cinematográfico "da tempestade à calma"
   Um vídeo de 18s avança quando o visitante rola para baixo e volta
   quando rola para cima. Só transform e opacity animam.
   ============================================================= */
:root {
  --cin-canvas: #0A1120;
  --cin-accent: #5AA9FF;
  --cin-accent-hover: #7DBBFF;
  --cin-moon: #CFE3FF;
  --cin-text: #EAF0F7;
  --cin-sub: #D9E2EE;
  --cin-dim: #A3B1C6;
  --cin-ease: cubic-bezier(.16, 1, .3, 1);
  --cin-ease-io: cubic-bezier(.65, 0, .35, 1);
  --cin-shadow: 0 1px 2px rgba(5, 8, 16, .95), 0 3px 12px rgba(5, 8, 16, .78), 0 10px 44px rgba(5, 8, 16, .8);
}

/* overflow hidden no html/body transforma o body num contêiner de rolagem
   e quebra o sticky do palco; clip corta a sobra lateral sem esse efeito. */
html:has(.cin), body:has(.cin) { overflow-x: hidden; overflow-x: clip; }

/* Pausa de loops em aba escondida (animation-play-state não herda). */
body.cin-paused *, body.cin-paused *::before, body.cin-paused *::after { animation-play-state: paused !important; }

/* Menu e botões flutuantes somem enquanto o visitante mergulha. */
.nsi-nav, .nsi-flutuante, .cta-fixo { transition: transform .6s var(--cin-ease), opacity .5s var(--cin-ease); }
html.cin-diving .nsi-nav { transform: translateY(-110%); opacity: 0; pointer-events: none; }
html.cin-diving .nsi-flutuante, html.cin-diving .cta-fixo { opacity: 0; pointer-events: none; }

.cin-chip {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 600;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
}

.cin { position: relative; }
.cin-scrub { height: 1000vh; position: relative; }
.cin-stage { position: sticky; top: 0; height: 100vh; overflow: hidden; background: var(--cin-canvas); isolation: isolate; }
.cin-media { position: absolute; inset: 0; transform: scale(var(--z, 1)) translateZ(0); transform-origin: 50% 46%; will-change: transform; }
.cin-poster, .cin-ending, .cin-video { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; background-size: cover; background-position: 50% 50%; }
.cin-video { object-fit: cover; opacity: 0; transition: opacity .8s var(--cin-ease); transform: translateZ(0); }
.cin-stage.video-ready .cin-video { opacity: 1; }
.cin-stage.video-failed .cin-video { display: none; }
.cin-ending { opacity: var(--end, 0); }
.cin-stage.video-ready .cin-ending { opacity: 0; }
.cin-scrim {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 120% 90% at 50% 45%, rgba(8, 12, 22, 0) 38%, rgba(8, 12, 22, .6) 100%),
    linear-gradient(180deg, rgba(8, 12, 22, .35) 0%, rgba(8, 12, 22, 0) 16%, rgba(8, 12, 22, 0) 78%, rgba(10, 17, 32, .7) 100%);
}
.cin-grain {
  position: absolute; inset: 0; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.cin-rain {
  position: absolute; left: 0; right: 0; top: -420px; height: calc(100% + 420px); pointer-events: none;
  opacity: calc(var(--storm, 1) * .5);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='420'%3E%3Cg stroke='%23D2E4FF' stroke-opacity='.55' stroke-width='1' stroke-linecap='round'%3E%3Cline x1='24' y1='12' x2='18' y2='64'/%3E%3Cline x1='96' y1='150' x2='90' y2='200'/%3E%3Cline x1='170' y1='60' x2='164' y2='118'/%3E%3Cline x1='60' y1='280' x2='54' y2='330'/%3E%3Cline x1='140' y1='330' x2='134' y2='386'/%3E%3Cline x1='200' y1='230' x2='194' y2='270'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 220px 420px;
}
.cin-rain-b { background-size: 330px 630px; opacity: calc(var(--storm, 1) * .28); filter: blur(1px); top: -630px; height: calc(100% + 630px); }
.cin-live .cin-rain-a { animation: cin-rain-a .75s linear infinite; animation-delay: -.3s; }
.cin-live .cin-rain-b { animation: cin-rain-b .55s linear infinite; animation-delay: -.2s; }
@keyframes cin-rain-a { to { transform: translate3d(0, 420px, 0); } }
@keyframes cin-rain-b { to { transform: translate3d(0, 630px, 0); } }

/* ---------- Faixas de legenda ---------- */
.cin-band {
  position: absolute; z-index: 3; opacity: 0; visibility: hidden; top: 50%; transform: translateY(-50%);
  pointer-events: none; text-shadow: var(--cin-shadow); color: var(--cin-text);
}
.cin-left { left: clamp(24px, 7vw, 128px); width: min(620px, 46vw); }
.cin-right { right: clamp(24px, 7vw, 128px); width: min(580px, 44vw); text-align: right; }
.cin-center { left: 50%; top: 46%; transform: translate(-50%, -50%); width: min(1040px, 90vw); text-align: center; }
.cin-band::before {
  content: ""; position: absolute; inset: -22% -18%; z-index: -1; pointer-events: none;
  opacity: calc(.25 + .75 * var(--k, 1));
  background: radial-gradient(ellipse 74% 62% at 50% 50%, rgba(5, 8, 16, .64) 0%, rgba(5, 8, 16, .42) 46%, rgba(5, 8, 16, 0) 76%);
}
.cin-right::before { opacity: calc(.15 + .45 * var(--k, 1)); }
.cin-center::before { inset: -26% -12%; }
/* Luz lateral: escurece só o lado da frase e some junto com a faixa. */
.cin-band::after { content: ""; position: absolute; top: -100vh; bottom: -100vh; z-index: -2; pointer-events: none; }
.cin-left::after { left: -30vw; right: -45%; background: linear-gradient(90deg, rgba(6, 10, 20, .8) 0%, rgba(6, 10, 20, .74) 42%, rgba(6, 10, 20, .4) 70%, rgba(6, 10, 20, 0) 100%); }
/* O lado direito cai sobre a névoa mais clara da travessia: degradê mais fundo e mais largo. */
.cin-right::after { right: -30vw; left: -60%; background: linear-gradient(270deg, rgba(6, 10, 20, .84) 0%, rgba(6, 10, 20, .8) 48%, rgba(6, 10, 20, .5) 76%, rgba(6, 10, 20, 0) 100%); }
.cin-center::after { left: -20vw; right: -20vw; background: radial-gradient(ellipse 58% 40% at 50% 50%, rgba(6, 10, 20, .76) 0%, rgba(6, 10, 20, .64) 45%, rgba(6, 10, 20, .28) 75%, rgba(6, 10, 20, 0) 100%); }

.cin-kicker {
  display: inline-block; margin: 0 0 1.1rem; padding: .5rem .8rem; border-radius: 10px; color: var(--cin-moon);
  background: rgba(8, 12, 22, .55); border: 1px solid rgba(163, 177, 198, .24);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-shadow: 0 1px 3px rgba(5, 8, 16, .85);
}
.cin-title {
  font-family: 'Fraunces', Georgia, serif; font-weight: 800; color: var(--cin-text); margin: 0;
  font-size: clamp(2.3rem, 3.9vw + .4rem, 4.4rem); line-height: 1.06; letter-spacing: -.02em;
}
.cin-title-xl { font-size: clamp(2.2rem, 3.6vw + .4rem, 4.2rem); line-height: 1.08; }
.cin-title-xl .cin-line { display: block; }
.cin-title .em, .cin-title em { font-style: italic; font-weight: 800; color: var(--cin-moon); }
.cin-sub {
  font-family: 'Manrope', system-ui, sans-serif; font-weight: 500; color: var(--cin-sub); margin: 1.1rem 0 0;
  font-size: clamp(1rem, .5vw + .85rem, 1.2rem); line-height: 1.55; max-width: 42ch;
}
.cin-right .cin-sub { margin-left: auto; }
.cin-center .cin-sub { margin-left: auto; margin-right: auto; max-width: 54ch; }
.cin-split .w, .cin-split .c { display: inline-block; }
.cin-split .w { padding-bottom: .1em; margin-bottom: -.1em; }
.cin-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Faixa 1: deriva para baixo (a chuva caindo). */
.cin-b1 .w { --kc: clamp(0, (var(--k, 0) - var(--th, 0)) * 2.8, 1); opacity: var(--kc); transform: translateY(calc((1 - var(--kc)) * -24px)); }
.cin-b1 .cin-kicker { opacity: clamp(0, var(--k, 0) * 3, 1); }
.cin-b1 .cin-sub { --ks: clamp(0, (var(--k, 0) - .55) * 3.5, 1); opacity: var(--ks); transform: translateY(calc((1 - var(--ks)) * -12px)); }
/* Faixa 2: desfoque para nítido (atravessando a nuvem). Blur estático; só a opacidade anima. */
.cin-blur { display: grid; }
.cin-blur > span { grid-area: 1 / 1; }
.cin-soft { filter: blur(10px); opacity: calc((1 - var(--k, 0)) * .9); }
.cin-sharp { opacity: var(--k, 0); }
/* Faixa 3: aproximação da profundidade (saindo da nuvem). */
.cin-b3 .w { --kc: clamp(0, (var(--k, 0) - var(--th, 0)) * 2.4, 1); opacity: var(--kc); transform: scale(calc(.82 + .18 * var(--kc))); transform-origin: 50% 70%; }
/* Faixa 4: subida palavra por palavra num assentamento em etapas. */
.cin-b4 .w { --kc: clamp(0, (var(--k, 0) - var(--th, 0) * .8) * 3, 1); opacity: var(--kc); transform: translateY(calc((1 - var(--kc)) * 30px)); }
.cin-b4 .cin-sub { --ks: clamp(0, (var(--k, 0) - .62) * 4, 1); opacity: var(--ks); transform: translateY(calc((1 - var(--ks)) * 14px)); }
.cin-b4 .cin-ctas { --kb: clamp(0, (var(--k, 0) - .78) * 5, 1); opacity: var(--kb); transform: translateY(calc((1 - var(--kb)) * 12px)); }
.cin-band.is-on .cin-ctas { pointer-events: auto; }

.cin-ctas { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2rem; }
.cin-center .cin-ctas { justify-content: center; }
.cin .btn { text-shadow: none; }
.cin .btn-ghost { background: rgba(8, 12, 22, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

/* ---------- Altitude, anel e seta ---------- */
.cin-hud {
  position: absolute; z-index: 4; left: clamp(20px, 4vw, 56px); top: 28px;
  display: flex; align-items: baseline; gap: .8rem; padding: .55rem .85rem; border-radius: 10px;
  color: var(--cin-moon); background: rgba(8, 12, 22, .55); border: 1px solid rgba(96, 110, 140, .3);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-shadow: 0 1px 3px rgba(5, 8, 16, .85);
  opacity: 0; transform: translateY(-8px); transition: opacity .8s var(--cin-ease), transform .8s var(--cin-ease);
}
.cin-hud-l { color: var(--cin-dim); }
.cin-alt { font-variant-numeric: tabular-nums; }
html.cin-diving .cin-hud { opacity: 1; transform: none; }
.cin-loader { position: absolute; z-index: 4; left: 50%; bottom: 28px; transform: translateX(-50%); display: grid; place-items: center; color: var(--cin-moon); }
.cin-loader > * { grid-area: 1 / 1; }
.cin-ring { width: 40px; height: 40px; transition: opacity .6s var(--cin-ease); }
.cin-stage.video-ready .cin-ring, .cin-stage.video-failed .cin-ring { opacity: 0; }
.cin-cue {
  display: flex; flex-direction: column; align-items: center; gap: .35rem; color: var(--cin-moon);
  text-shadow: 0 1px 3px rgba(5, 8, 16, .9); opacity: 0; transition: opacity .8s var(--cin-ease);
}
.cin-stage.video-ready .cin-cue.is-in, .cin-stage.video-failed .cin-cue.is-in { opacity: .9; }
html.cin-diving .cin-cue { opacity: 0 !important; }
.cin-live .cin-cue svg { animation: cin-bob 2.4s var(--cin-ease-io) infinite; animation-delay: -.6s; }
@keyframes cin-bob { 50% { transform: translateY(5px); } }
@media (max-height: 560px) { .cin-hud, .cin-loader { display: none; } }

/* ---------- Portão do hero estático: as MESMAS cinco queries do JS ---------- */
.cin-static { display: none; }
@media (max-width: 720px), (orientation: portrait) and (max-width: 1024px), (orientation: portrait) and (pointer: coarse), (orientation: landscape) and (pointer: coarse) and (max-height: 560px), (prefers-reduced-motion: reduce) {
  .cin-scrub { display: none; }
  .cin-static { display: flex; }
}
.cin-static {
  position: relative; min-height: 88vh; min-height: 88svh; overflow: hidden; align-items: flex-end;
  padding: 96px 0 clamp(40px, 8vh, 80px); background: var(--cin-canvas);
}
.cin-static-bg { position: absolute; inset: 0; background: url('/cinema/tempestade-fim-m.jpg') 50% 50% / cover no-repeat; }
.cin-static-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10, 17, 32, .55) 0%, rgba(10, 17, 32, .1) 28%, rgba(10, 17, 32, .6) 58%, rgba(10, 17, 32, .97) 100%);
}
.cin-static-in { position: relative; z-index: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; text-shadow: var(--cin-shadow); }
.cin-static-in > * { animation: cin-rise 1s var(--cin-ease) both; }
.cin-static-in > *:nth-child(2) { animation-delay: .12s; }
.cin-static-in > *:nth-child(3) { animation-delay: .24s; }
.cin-static-in > *:nth-child(4) { animation-delay: .36s; }
@keyframes cin-rise { from { opacity: 0; transform: translateY(18px); } }
@media (max-width: 720px) {
  .cin-static .cin-ctas { flex-direction: column; }
  .cin-static .btn { width: 100%; white-space: normal; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .cin-static-in > * { animation: none; }
}
