/*
  Tuxedo Rat Studios · estilos do site (one-page noir)

  Dependências:
  - Google Fonts carregadas no index.html: Bodoni Moda (títulos), Cormorant Garamond
    (texto corrido), Josefin Sans (rótulos). Trio que remete a cartaz e cartela de
    cinema dos anos 30/40, coerente com a arte.
  - assets/nightshift-noir-red.webp: a arte com "filtro noir" já aplicado na imagem
    (P&B de alto contraste, só os vermelhos mantêm cor, estilo Sin City). Foi gerado
    com ImageMagick porque CSS não consegue isolar uma cor; comando no README.
  - script.js: marca a seção visível (.in-view) para disparar as animações.

  Decisões não óbvias:
  - Scroll por seção com CSS scroll-snap (sem biblioteca). "mandatory" no desktop;
    no celular vira "proximity", porque a seção do jogo fica mais alta que a tela
    e o mandatory prenderia o usuário no meio dela.
  - Animações só existem com a classe .js no <html> (posta por script inline no head).
    Sem JS, o conteúdo aparece normalmente em vez de ficar invisível.
  - As animações "saem" ao deixar a seção e voltam ao entrar: cada seção funciona
    como um corte de cena.
  - Filtros e máscaras ficam em ::before para não afetarem o texto por cima.
  - O grão é um SVG estático movido só via transform (a GPU só desloca a camada).
*/

:root {
  --black: #070707;
  --paper: #ece6d8;          /* creme de película antiga, não branco puro */
  --dim: #9a9284;
  --gold: #b89a5e;           /* dourado Art Déco, usado com parcimônia */
  --red: #c4282c;            /* puxado para o vermelho dos neons da arte */
  --serif: 'Bodoni Moda', serif;
  --body: 'Cormorant Garamond', serif;
  --label: 'Josefin Sans', sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --iris: cubic-bezier(.6, 0, .2, 1);
  /* Ponto onde está o rato na sacada: as aberturas em íris partem dele */
  --rat: 45% 40%;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-snap-type: y mandatory; }
body { margin: 0; background: var(--black); color: var(--paper); font-family: var(--body); }
a { color: inherit; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }

/* Cada seção ocupa a tela inteira e é um ponto de encaixe do scroll */
.snap { min-height: 100vh; min-height: 100svh; scroll-snap-align: start; position: relative; }

/* ---------- CAMADAS FIXAS DE PELÍCULA ---------- */
.grain {
  position: fixed; inset: -50%; z-index: 50; pointer-events: none; opacity: .09;
  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='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .5s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-4%, 3%); }
  50% { transform: translate(3%, -2%); } 75% { transform: translate(-2%, -4%); }
  100% { transform: translate(0, 0); }
}
/* Vinheta fixa: escurece as bordas de toda a tela, como lente antiga */
.vignette { position: fixed; inset: 0; z-index: 49; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%); }

/* Rótulo pequeno em caixa alta espaçada, estilo crédito de cinema */
.label { font: 400 11px/1.6 var(--label); letter-spacing: .35em; text-transform: uppercase; color: var(--dim); }

/* ---------- ANIMAÇÃO DE ENTRADA (genérica) ---------- */
/* --d = ordem do elemento na seção; gera o escalonamento */
.js .reveal {
  opacity: 0; transform: translateY(28px); filter: blur(8px);
  transition: opacity .9s ease, transform 1.1s var(--ease), filter .9s ease;
  transition-delay: calc(var(--d, 0) * 140ms);
}
.js .in-view .reveal { opacity: 1; transform: none; filter: none; }

/* ---------- MARCADOR DE CENAS (lateral) ---------- */
.reel { position: fixed; right: 28px; top: 50%; transform: translateY(-50%); z-index: 40; display: flex; flex-direction: column; gap: 18px; }
.reel a { display: flex; align-items: center; justify-content: flex-end; gap: 10px; text-decoration: none; color: var(--dim); font: 400 11px var(--label); letter-spacing: .2em; transition: color .3s; }
.reel a::after { content: ''; width: 14px; height: 1px; background: currentColor; transition: width .4s var(--ease); }
.reel a:hover, .reel a.active { color: var(--gold); }
.reel a.active::after { width: 34px; }

/* ---------- ABERTURA ---------- */
.opening { display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
/* Letterbox: faixas pretas reais em cima e embaixo, com os créditos dentro */
.bar { background: var(--black); padding: 22px 5vw; display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 2; }
.bar nav { display: flex; gap: 32px; }
.bar nav a { text-decoration: none; transition: color .2s; }
.bar nav a:hover { color: var(--paper); }
.scene { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 6vw 6vw 6vw; isolation: isolate; }
.scene::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  /* Posição 28% mantém o rato na sacada visível mesmo em tela estreita */
  background:
    radial-gradient(ellipse at 30% 50%, transparent 30%, rgba(0,0,0,.7) 100%),
    linear-gradient(90deg, rgba(7,7,7,.88), rgba(7,7,7,.1) 60%),
    url('assets/nightshift-noir-red.webp') 28% center / cover no-repeat;
}
/* Abertura em íris (transição clássica do cinema mudo), partindo do rato */
.js .scene::before { animation: iris 2s var(--iris) both; }
@keyframes iris { from { clip-path: circle(0% at var(--rat)); } to { clip-path: circle(150% at var(--rat)); } }
/* Na primeira carga os textos esperam a íris abrir */
.js .opening .reveal { transition-delay: calc(900ms + var(--d, 0) * 160ms); }

.title { margin: 0; font: 400 clamp(3.6rem, 11vw, 10.5rem)/.85 var(--serif); letter-spacing: -.02em; }
.js .in-view .title { animation: flicker 6s 3s infinite; }
.title small { display: block; margin-top: .35em; font: 600 clamp(.8rem, 1.6vw, 1.3rem)/1 var(--label); letter-spacing: .9em; color: var(--gold); }
/* Tremida rara de projetor; quase imperceptível de propósito */
@keyframes flicker { 0%, 96%, 100% { opacity: 1; } 97% { opacity: .82; } 98% { opacity: 1; } 99% { opacity: .9; } }
.tagline { margin: 36px 0 0; max-width: 430px; font: italic 400 clamp(1.25rem, 2vw, 1.6rem)/1.35 var(--body); color: #d6cfbf; }

/* Convite para rolar: linha que "escorre" para baixo */
.cue { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.cue::after { content: ''; width: 1px; height: 22px; background: linear-gradient(var(--gold), transparent); animation: drip 2s ease-in-out infinite; transform-origin: top; }
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- SCENE I: CARTELA ---------- */
.card { display: grid; place-items: center; padding: 14vh 7vw; text-align: center; overflow: hidden; }
/* Sombra de persiana: o motivo visual mais clássico do noir. Entra deslizando. */
.card::before {
  content: ''; position: absolute; inset: -30%; pointer-events: none;
  /* Faixas claras finas (luz) entre faixas largas escuras (lâminas), como luz de rua
     atravessando uma persiana. A máscara limita a luz a uma mancha, não à tela toda. */
  background: repeating-linear-gradient(-28deg, transparent 0 70px, rgba(236,230,216,.07) 70px 104px);
  -webkit-mask-image: radial-gradient(ellipse 38% 42% at 34% 40%, #000 0%, rgba(0,0,0,.5) 55%, transparent 100%);
          mask-image: radial-gradient(ellipse 38% 42% at 34% 40%, #000 0%, rgba(0,0,0,.5) 55%, transparent 100%);
}
.js .card::before { opacity: 0; transform: translate(-10%, -6%); transition: opacity 2s ease, transform 3s var(--ease); }
.js .card.in-view::before { opacity: 1; transform: none; }
.frame {
  max-width: 760px; padding: 64px 7vw; position: relative;
  border: 1px solid rgba(184,154,94,.55); outline: 1px solid rgba(184,154,94,.25); outline-offset: 7px;
}
.js .frame { transform: scale(.94); opacity: 0; transition: transform 1.4s var(--ease), opacity 1s ease; }
.js .card.in-view .frame { transform: none; opacity: 1; }
/* Losangos Déco no topo e na base da moldura */
.frame::before, .frame::after { content: '◆'; position: absolute; left: 50%; transform: translateX(-50%); color: var(--gold); font-size: 12px; background: var(--black); padding: 0 14px; }
.frame::before { top: -9px; } .frame::after { bottom: -9px; }
.frame h2 { margin: 22px 0 0; font: 400 clamp(1.9rem, 4vw, 3.4rem)/1.12 var(--serif); }
.frame h2 em { color: var(--gold); }
.frame p { margin: 26px auto 0; max-width: 470px; font-size: 1.25rem; line-height: 1.5; color: var(--dim); }

/* ---------- SCENE II: O PRIMEIRO CASO ---------- */
.feature { display: grid; grid-template-columns: 1.2fr 1fr; border-top: 1px solid #1e1c19; }
.feature-art { position: relative; isolation: isolate; overflow: hidden; }
.feature-art::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  /* Recorte do lado dos neons, até existir imagem do jogo */
  background: linear-gradient(0deg, rgba(7,7,7,.9), transparent 55%), url('assets/nightshift-noir-red.webp') 85% 55% / cover no-repeat;
}
/* Íris de novo, agora vinda do canto, como corte para outra cena */
.js .feature-art::before { clip-path: circle(0% at 15% 40%); transform: scale(1.12); transition: clip-path 1.6s var(--iris), transform 2.4s var(--ease); }
.js .feature.in-view .feature-art::before { clip-path: circle(150% at 15% 40%); transform: none; }
.feature-art span { position: absolute; left: 32px; bottom: 28px; }
.feature-text { padding: 9vw 7vw 9vw 6vw; display: flex; flex-direction: column; justify-content: center; }
.feature-text h2 { margin: 18px 0 0; font: 400 clamp(2.6rem, 5vw, 5rem)/.95 var(--serif); }
.feature-text h2 i { color: var(--red); }
.feature-text p { margin: 28px 0 0; max-width: 380px; font-size: 1.3rem; line-height: 1.45; color: var(--dim); }
.facts { margin-top: 44px; border-top: 1px solid #2a2722; }
.facts div { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid #2a2722; font-size: 1.1rem; }

/* ---------- SCENE III + FIM (uma tela só) ---------- */
.finale { display: flex; flex-direction: column; border-top: 1px solid #1e1c19; }
.follow { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 12vh 7vw 4vh; text-align: center; }
.follow h2 { margin: 18px 0 50px; font: italic 400 clamp(2rem, 4.5vw, 4rem)/1.05 var(--serif); }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.links a {
  padding: 16px 30px; border: 1px solid rgba(184,154,94,.5); text-decoration: none;
  font: 400 12px var(--label); letter-spacing: .3em; text-transform: uppercase; transition: background .25s, color .25s;
}
.links a:hover, .links a:focus-visible { background: var(--gold); color: var(--black); }
footer { padding: 4vh 5vw 36px; text-align: center; }
.fin { font: italic 400 clamp(2.6rem, 6vw, 5rem) var(--serif); margin: 0 0 6vh; }
.fin::before, .fin::after { content: ''; display: inline-block; width: 60px; height: 1px; background: var(--gold); vertical-align: middle; margin: 0 24px; }
.credits { display: flex; justify-content: space-between; }

@media (max-width: 760px) {
  html { scroll-snap-type: y proximity; }
  :root { --rat: 84% 38%; }
  .reel, .bar nav { display: none; } /* one-page: no celular o scroll basta */
  .scene { padding: 10vw 7vw; justify-content: flex-end; padding-bottom: 14vh; }
  .feature { grid-template-columns: 1fr; }
  .feature-art { min-height: 46svh; }
  .feature-text { padding: 50px 7vw 70px; }
  .frame { padding: 48px 8vw; }
  .fin::before, .fin::after { width: 28px; margin: 0 12px; }
  .credits { flex-direction: column; gap: 10px; }
}

/* Janela baixa (notebook pequeno, navegador não maximizado): as seções passam da altura
   da tela, e o snap obrigatório faria a página pular no meio do conteúdo */
@media (max-height: 640px) { html { scroll-snap-type: y proximity; } }

/* Movimento reduzido: tudo visível e parado; o scroll por seção continua */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain, .cue::after, .js .in-view .title { animation: none; }
  .js .scene::before { animation: none; }
  .js .reveal, .js .frame, .js .card::before, .js .feature-art::before {
    opacity: 1; transform: none; filter: none; clip-path: none; transition: none;
  }
}
