/* ==========================================================================
   FILME DE ABERTURA — Saborosa de Salinas
   Mobile primeiro. Um palco fixo (position: sticky) dentro de uma seção alta;
   a rolagem dentro da seção move a linha do tempo de script.js.
   Regra de desempenho: a rolagem só anima transform, opacity, um clip-path
   (frente da garrafa) e um stroke-dashoffset (montanhas gravadas).
   ========================================================================== */

.film {
  --bottle-h: min(56svh, calc(100svh - 280px), 600px);
  --bottle-bottom: 64px;
  --bottle-cy: calc(100svh - var(--bottle-bottom) - var(--bottle-h) / 2); /* centro vertical da garrafa */
  --cream: #f6ead3;
  --gold-soft: #e2bd84;
  position: relative;
  height: 600svh;
  background: #112f27;
}
.film__stage {
  position: sticky;
  top: 0;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
}

/* ---------- Cena 0: céu, sol, serra ---------- */
.film__sky {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 70% at 50% 38%, #fbf5ea 0%, #f3e8d6 45%, #e9d8bf 100%);
}
.film__sun {
  position: absolute; z-index: 1;
  left: 50%; top: calc(var(--bottle-cy) - 9svh);
  width: min(82vw, 520px); aspect-ratio: 1;
  margin: calc(min(82vw, 520px) / -2) 0 0 calc(min(82vw, 520px) / -2);
}
.film__sun-in {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #efd9bb, #ddbf96 70%, #cfa979);
  box-shadow: 0 0 0 28px rgba(206, 168, 117, .08), 0 0 0 64px rgba(206, 168, 117, .05);
}
.film__seal { position: absolute; inset: 6%; width: 88%; height: 88%; overflow: visible; }
.film__seal text { font: 600 8.4px var(--font-body); letter-spacing: .2em; fill: #9a7a52; opacity: .8; }

.film__defs { position: absolute; }
.film__range { position: absolute; left: -4%; right: -4%; bottom: 0; height: 46svh; }
.film__range svg { width: 100%; height: 100%; display: block; }
.film__range--far  { z-index: 2; height: 52svh; }
.film__range--mid  { z-index: 3; height: 42svh; }
.film__range--near { z-index: 4; height: 30svh; }
.film__mist {
  position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; height: 26svh;
  background: linear-gradient(to bottom, rgba(233, 216, 191, 0), rgba(233, 216, 191, .85) 70%, #e9d8bf);
  pointer-events: none;
}

/* ---------- Cena 1+: a noite verde ---------- */
.film__night {
  position: absolute; z-index: 6;
  left: 50%; top: var(--bottle-cy);
  width: 190vmax; aspect-ratio: 1;
  margin: -95vmax 0 0 -95vmax;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 80px, rgba(238, 213, 165, .07) 81px, transparent 82px),
    radial-gradient(circle, #2f5a49 0%, #1c4537 22%, #133429 42%, #0f2a22 60%);
  transform: scale(0);
  will-change: transform;
}
.film__year {
  position: absolute; z-index: 7;
  left: 0; right: 0; top: calc(var(--bottle-cy) - 22vw);
  text-align: center;
  font: 500 44vw/1 var(--font-title);
  letter-spacing: -.06em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(226, 189, 132, .55);
  opacity: 0;
  pointer-events: none;
}
.film__engrave {
  position: absolute; z-index: 8; left: 0; bottom: 0; width: 100%; height: 22svh;
  fill: none; stroke: #d6b073; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round;
  opacity: .55;
}
.film__engrave path { stroke-dasharray: 1; stroke-dashoffset: 1; vector-effect: non-scaling-stroke; }

/* ---------- Título da abertura ---------- */
.film__intro {
  position: absolute; z-index: 11;
  left: 7%; right: 7%; top: calc(112px + env(safe-area-inset-top, 0px));
  pointer-events: none;
}
.mask { display: block; overflow: hidden; padding: 0 .1em .14em 0; margin-bottom: -.14em; }
.mask > * { display: inline-block; }
.film__kicker { margin: 0; font-size: 9px; font-weight: 700; letter-spacing: .26em; text-transform: uppercase; color: var(--burgundy); }
.film__title {
  margin: 12px 0 14px;
  font: 500 clamp(50px, 14vw, 84px)/1.0 var(--font-title);
  letter-spacing: -.065em;
  color: var(--ink);
}
.film__title em { font-weight: 400; color: var(--green); }
.film__lede { margin: 0; max-width: 270px; font-size: 13px; line-height: 1.65; color: #6c6052; }

/* ---------- Garrafa ---------- */
.film__bottle {
  position: absolute; z-index: 10;
  left: 50%; bottom: var(--bottle-bottom);
  height: var(--bottle-h);
  width: calc(var(--bottle-h) * .2494);              /* proporção da foto 409 × 1640 */
  margin-left: calc(var(--bottle-h) * -.1247);
  will-change: transform;
}
.film__bottle-in { position: absolute; inset: 0; }
.film__face { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.film__face--front { clip-path: inset(0 0 0 var(--wipe, 0%)); }
/* Feixe de luz que atravessa a garrafa; recortado na silhueta da própria foto */
.film__beam {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent calc(var(--wipe, 0%) - 9%), rgba(255, 239, 205, .95) var(--wipe, 0%), transparent calc(var(--wipe, 0%) + 9%));
  -webkit-mask: url(./assets/garrafa-frente.webp) center / 100% 100% no-repeat;
          mask: url(./assets/garrafa-frente.webp) center / 100% 100% no-repeat;
}
.film__shadow {
  position: absolute; z-index: -1; left: -30%; right: -30%; bottom: -6px; height: 18px;
  border-radius: 50%; background: #5b4126; filter: blur(12px); opacity: .28;
}

/* ---------- Cenas de texto ---------- */
.film__scenes { position: absolute; inset: 0; z-index: 12; pointer-events: none; color: var(--cream); }
.scene {
  position: absolute; left: 7%; right: 7%;
  top: calc(92px + env(safe-area-inset-top, 0px));
  text-align: center;
  opacity: 0;
}
.scene .eyebrow { color: var(--gold-soft); font-size: 9px; }
.scene h2 { margin: 8px 0 10px; font: 500 clamp(32px, 9vw, 48px)/1.04 var(--font-title); letter-spacing: -.05em; }
.scene h2 em { font-weight: 400; color: #e8c690; }
.scene p { margin: 0 auto; max-width: 300px; font-size: 12.5px; line-height: 1.65; color: #d9d6c6; }

/* ---------- Anotações editoriais ---------- */
.note {
  position: absolute; z-index: 11;
  display: grid; gap: 2px;
  color: var(--cream); opacity: 0;
  font-size: 8.5px; letter-spacing: .2em; text-transform: uppercase; font-weight: 700;
}
.note strong { font: 500 34px/1 var(--font-title); letter-spacing: -.04em; text-transform: none; color: #f3dcb2; }
.note strong small { font: 400 15px var(--font-title); letter-spacing: 0; margin-left: 3px; color: var(--gold-soft); }
.note small { font-weight: 600; letter-spacing: .12em; color: #cbbd9f; }
.note__line { display: block; height: 1px; width: 44px; background: var(--gold-soft); margin-bottom: 8px; transform-origin: left center; }
.note--year { left: 6%;  top: calc(var(--bottle-cy) + 12svh); }
.note--vol  { right: 6%; top: calc(var(--bottle-cy) + 2svh); text-align: right; justify-items: end; }
.note--abv  { right: 6%; top: calc(var(--bottle-cy) + 13svh); text-align: right; justify-items: end; }
.note--vol .note__line, .note--abv .note__line { transform-origin: right center; }

/* ---------- HUD ---------- */
.film__hud {
  position: absolute; z-index: 13; left: 6%; right: 6%; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-size: 9px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
}
.film__cue { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.film__cue i { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #b3a085; border-radius: 50%; font-style: normal; font-size: 14px; letter-spacing: 0; }
.film__meter { position: absolute; inset: 0 0 0 auto; width: 100%; display: flex; align-items: center; justify-content: flex-end; gap: 14px; color: #dcc9a9; opacity: 0; }
.film__meter-bar { flex: 1; max-width: 220px; height: 1px; background: rgba(224, 202, 160, .3); }
.film__meter-bar i { display: block; height: 100%; background: #e7be80; transform-origin: left; transform: scaleX(var(--film-p, 0)); }

/* ---------- Entrada (roda uma vez ao carregar; só nos elementos internos) ---------- */
@keyframes film-up   { from { transform: translateY(110%); } to { transform: none; } }
@keyframes film-rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes film-sun  { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }
@keyframes film-fade { from { opacity: 0; } to { opacity: 1; } }
.film__sun-in            { animation: film-sun 1.8s cubic-bezier(.16, .84, .24, 1) .1s both; }
.film__range svg         { animation: film-rise 1.6s cubic-bezier(.16, .84, .24, 1) both; }
.film__range--far svg    { animation-delay: .15s; }
.film__range--mid svg    { animation-delay: .28s; }
.film__range--near svg   { animation-delay: .4s; }
.film__kicker .mask > *  { animation: film-up 1s cubic-bezier(.16, .84, .24, 1) .3s both; }
.film__title .mask > *   { animation: film-up 1.2s cubic-bezier(.16, .84, .24, 1) .42s both; }
.film__title-b > *       { animation-delay: .56s !important; }
.film__lede              { animation: film-fade 1.2s ease .95s backwards; }
.film__bottle-in         { animation: film-rise 1.6s cubic-bezier(.16, .84, .24, 1) .5s both; }
.film__hud, .nav         { animation: film-fade 1.2s ease 1.1s backwards; }

/* ---------- Telas baixas (iPhone SE, Android compactos) ---------- */
@media (max-width: 700px) and (max-height: 700px) {
  .film { --bottle-h: min(52svh, calc(100svh - 250px)); --bottle-bottom: 56px; }
  .film__intro { top: 96px; }
  .film__lede { display: none; }
  .scene { top: 74px; }
  .scene p { font-size: 11.5px; }
}

/* ---------- Tablet e desktop ---------- */
@media (min-width: 701px) {
  .film {
    --bottle-h: min(80svh, 820px);
    --bottle-bottom: 8svh;
    height: 660svh;
  }
  .film__sun { left: 70%; width: min(44vw, 640px); margin: calc(min(44vw, 640px) / -2) 0 0 calc(min(44vw, 640px) / -2); top: calc(var(--bottle-cy) - 6svh); }
  .film__range--far { height: 50svh; } .film__range--mid { height: 40svh; } .film__range--near { height: 27svh; }
  .film__intro { left: 8%; right: auto; top: 50%; transform: translateY(-50%); max-width: 46vw; }
  .film__kicker { font-size: 10px; }
  .film__title { font-size: clamp(64px, 7.6vw, 128px); margin: 18px 0 22px; }
  .film__lede { font-size: 15px; max-width: 330px; line-height: 1.85; }
  .film__year { font-size: min(34vw, 520px); top: calc(var(--bottle-cy) - min(17vw, 260px)); }
  .scene { left: 8%; right: auto; width: min(34vw, 460px); top: 50%; transform: translateY(-50%); text-align: left; }
  .scene .eyebrow { font-size: 10px; }
  .scene h2 { font-size: clamp(44px, 4.6vw, 74px); margin: 16px 0 18px; }
  .scene p { margin: 0; font-size: 14.5px; line-height: 1.85; max-width: 340px; }
  .note strong { font-size: 52px; }
  .note strong small { font-size: 20px; }
  .note { font-size: 10px; }
  .note__line { width: 90px; }
  .note--year { left: calc(56vw + var(--bottle-h) * .2); top: calc(var(--bottle-cy) - 14svh); }
  .note--vol  { right: auto; left: calc(56vw + var(--bottle-h) * .2); top: calc(var(--bottle-cy) - 6svh); text-align: left; justify-items: start; }
  .note--abv  { right: auto; left: calc(56vw + var(--bottle-h) * .2); top: calc(var(--bottle-cy) + 9svh); text-align: left; justify-items: start; }
  .note--vol .note__line, .note--abv .note__line { transform-origin: left center; }
  .film__hud { left: 7%; right: 7%; bottom: 28px; font-size: 10px; }
  .film__meter-bar { max-width: 300px; }
}

/* ---------- Movimento reduzido: composição estática da abertura ---------- */
@media (prefers-reduced-motion: reduce) {
  .film { height: auto; }
  .film__stage { position: relative; height: 100svh; }
  .film__sun-in, .film__range svg, .film__kicker .mask > *, .film__title .mask > *,
  .film__lede, .film__bottle-in, .film__hud, .nav { animation: none !important; }
  .film__scenes, .note, .film__meter, .film__year, .film__engrave, .film__night { display: none; }
}
@media (prefers-reduced-motion: reduce) and (min-width: 701px) {
  .film__bottle { transform: translateX(20vw); }
}

/* ==========================================================================
   Etapas 2–3 — luz: brilho atrás da garrafa na passagem e reflexo sobre o rótulo
   (sem ampliar letras nem deformar as artes)
   ========================================================================== */
.film__glow {
  position: absolute; z-index: 7; left: 50%; top: var(--bottle-cy);
  width: 120vmin; aspect-ratio: 1; margin: -60vmin 0 0 -60vmin; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 170, .32), rgba(255, 226, 170, 0) 62%);
  opacity: 0; pointer-events: none;
}
/* Reflexo diagonal que atravessa o rótulo na aproximação; recortado na silhueta */
.film__glint {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(115deg, transparent calc(var(--glint, 0%) - 14%), rgba(255, 250, 236, .7) var(--glint, 0%), transparent calc(var(--glint, 0%) + 14%));
  -webkit-mask: url(./assets/garrafa-frente.webp) center / 100% 100% no-repeat;
          mask: url(./assets/garrafa-frente.webp) center / 100% 100% no-repeat;
}
@media (prefers-reduced-motion: reduce) {
  .film__glow, .film__glint { display: none; }
}
/* Celulares bem pequenos (ex.: 320×568): garrafa um pouco menor para o texto da cena respirar */
@media (max-width: 360px) and (max-height: 700px) {
  .film { --bottle-h: calc(100svh - 285px); }
}
