/* =============================================================
   SQUARE PASTÉIS 3.0 — CENAS CINEMATOGRÁFICAS
   Tudo aqui depende de html.motion (JS ativo + sem movimento
   reduzido). Se o GSAP não carregar, o JavaScript remove .motion
   e o site volta ao layout estático de styles.css.

   Continuidade: nenhuma cena some de uma vez. Tempos fixados se
   dissolvem uns nos outros (crossfade), luzes se interpolam pela
   rolagem e a cena 3D atravessa a abertura e os combos.
   ============================================================= */

/* ---- Abertura em CSS puro (começa na 1ª pintura, sem esperar o JS) ---- */
@keyframes sqRise { from { transform: translateY(118%); } to { transform: translateY(0); } }
@keyframes sqFade { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes sqBarUp { to { transform: translateY(-100%); } }
@keyframes sqBarDown { to { transform: translateY(100%); } }
.motion .hero:not(.is-in) .line > span,
.motion .hero:not(.is-in) .hero__brand > span { transform: translateY(118%); animation: sqRise 1.25s cubic-bezier(.16,1,.3,1) forwards; }
.motion .hero:not(.is-in) .hero__brand > span { animation-delay: .25s; }
.motion .hero:not(.is-in) .line:nth-child(1) > span { animation-delay: .3s; }
.motion .hero:not(.is-in) .line:nth-child(2) > span { animation-delay: .38s; }
.motion .hero:not(.is-in) .line:nth-child(3) > span { animation-delay: .5s; }
.motion .hero:not(.is-in) .line:nth-child(4) > span { animation-delay: .58s; }
.motion .header__bar { animation: sqFade 1s .2s cubic-bezier(.16,1,.3,1) both; }
.motion .letterbox { display: block; position: absolute; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
.motion .letterbox i { position: absolute; left: 0; right: 0; height: 11svh; background: #000; }
.motion .letterbox i:first-child { top: 0; animation: sqBarUp 1.4s .05s cubic-bezier(.65,0,.35,1) forwards; }
.motion .letterbox i:last-child { bottom: 0; animation: sqBarDown 1.4s .05s cubic-bezier(.65,0,.35,1) forwards; }
.motion .hero__stage { perspective: 1400px; }
.motion .hero__product, .motion .hero__content, .motion .hero__bg { will-change: transform; }

/* ---- Cursor contextual (desktop com mouse; o cursor nativo continua) ---- */
.has-cursor .cursor { display: block; position: fixed; left: 0; top: 0; z-index: 360; pointer-events: none; }
.cursor__dot, .cursor__ring { position: fixed; left: 0; top: 0; border-radius: 50%; pointer-events: none; }
.cursor__dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--c-pink); box-shadow: 0 0 10px var(--c-pink); }
.cursor__ring { width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 1.5px solid rgba(255,255,255,.4); display: grid; place-items: center; -webkit-backdrop-filter: blur(3px) saturate(1.6); backdrop-filter: blur(3px) saturate(1.6); transition: width 420ms var(--ease-glass), height 420ms var(--ease-glass), margin 420ms var(--ease-glass), background 300ms, border-color 300ms; }
.cursor__label { font-size: .72rem; font-weight: 600; color: #fff; opacity: 0; transition: opacity 200ms; white-space: nowrap; }
.cursor.is-link .cursor__ring { width: 58px; height: 58px; margin: -29px 0 0 -29px; border-color: rgba(255,255,255,.7); background: rgba(255,255,255,.06); }
.cursor.is-label .cursor__ring { width: 84px; height: 84px; margin: -42px 0 0 -42px; background: rgba(237,23,76,.55); border-color: rgba(255,255,255,.5); }
.cursor.is-label .cursor__label { opacity: 1; }
.cursor.is-label .cursor__dot { opacity: 0; }
.cursor.is-hidden { opacity: 0; }

/* ---- Revelação de mídia (máscara suave) ---- */
.motion .g-item, .motion .step__media, .motion .kids__frame { will-change: transform; }

/* ---- Oferta: a janela quadrada se abre sobre a fachada ---- */
.motion .offer__stage { height: 100svh; min-height: 0; padding: 0 var(--gutter); }
.motion .offer__window { clip-path: inset(30% 12% 30% 12% round 24px); will-change: clip-path; }
.motion .offer__window img { will-change: transform; }
.motion .offer__frame { display: block; }

/* ======================================================
   DESKTOP ≥ 900 — cenas fixadas
   ====================================================== */
@media (min-width: 900px) {
  /* Abertura: a foto do produto precisa poder sair do palco e "pousar" na vitrine */
  .motion .hero { z-index: 3; }
  .motion .hero__stage { overflow: visible; }
  .motion .hero__beams { overflow: hidden; }

  /* Rodízio: palco fixado; os tempos se dissolvem uns nos outros */
  .motion .rodizio { padding: 0; }
  .motion .rodizio__stage { width: 100%; height: 100svh; overflow: hidden; isolation: isolate; }
  .motion .beat { position: absolute; inset: 0; display: block; padding: 0; }
  .motion .beat:not(.beat--intro) { opacity: 0; }
  .motion .beat__light { display: block; position: absolute; inset: 0; z-index: -1; }
  .motion .beat--intro .beat__light { background: radial-gradient(50% 60% at 80% 40%, rgba(239,39,37,.18), transparent 70%); }
  .motion .beat--mesa .beat__light { background: radial-gradient(60% 70% at 72% 45%, rgba(237,23,76,.26), transparent 70%), radial-gradient(40% 50% at 10% 85%, rgba(167,34,221,.24), transparent 70%); }
  .motion .beat--refri .beat__light { background: radial-gradient(50% 60% at 70% 50%, rgba(3,201,231,.26), transparent 70%), radial-gradient(40% 50% at 20% 20%, rgba(167,34,221,.28), transparent 70%); }
  .motion .beat--acai .beat__light { background: radial-gradient(55% 65% at 72% 50%, rgba(167,34,221,.32), transparent 70%), radial-gradient(40% 50% at 15% 80%, rgba(237,23,76,.2), transparent 70%); }
  .motion .beat__shot { position: absolute; right: 10vw; top: 50%; height: 76svh; width: auto; max-height: none; transform: translateY(-48%); }
  .motion .beat__shot--sticker { right: 12vw; width: 34vw; height: 60svh; }
  .motion .beat__shot--sticker img { width: auto; height: 82%; }
  .motion .beat__copy { position: absolute; left: var(--gutter); top: 50%; width: 48vw; transform: translateY(-50%); }
  .motion .beat--intro .beat__copy { width: auto; right: var(--gutter); transform: translateY(-54%); }
  .motion .beat__title { font-size: clamp(4.5rem, 1rem + 8.4vw, 10rem); }
  .motion .beat__title--xl { font-size: clamp(5rem, 1rem + 10vw, 12.5rem); }
  .motion .rodizio__hud { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 34px; z-index: 5; padding: 0; display: flex; align-items: center; gap: var(--s-6); }
  .motion .rodizio__steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex: none; width: 200px; }
  .motion .rodizio__steps li { flex: 1; height: 3px; border-radius: 3px; background: rgba(245,238,248,.16); overflow: hidden; }
  .motion .rodizio__steps i { display: block; height: 100%; background: var(--c-yellow); box-shadow: 0 0 8px var(--c-yellow); transform-origin: left; transform: scaleX(0); }

  /* Cardápio: trilho horizontal com 3 capítulos */
  .motion .menu { padding: 0; }
  .motion .menu__pin { position: relative; height: 100svh; overflow: hidden; }
  .motion .menu__track { display: flex; width: max-content; height: 100%; margin: 0; gap: 0; will-change: transform; }
  .motion .menu__intro { flex: none; width: 46vw; height: 100%; padding: calc(var(--header-h) + 2rem) 5vw 3rem var(--gutter); display: flex; flex-direction: column; justify-content: center; }
  .motion .chapter { flex: none; width: 94vw; height: 100%; display: block; padding: 0; }
  .motion .chapter__light { inset: 0; }
  .motion .chapter__num { top: auto; bottom: -6vh; right: auto; left: 30vw; font-size: 58svh; opacity: .18; }
  .motion .chapter__img { position: absolute; top: 50%; right: 7vw; width: 30vw; height: 72svh; aspect-ratio: auto; transform: translateY(-46%); }
  .motion .chapter__img--video { width: auto; height: 76svh; aspect-ratio: 9 / 16; right: 10vw; }
  .motion .porcoes { position: absolute; top: 50%; right: 6vw; width: 38vw; transform: translateY(-46%); grid-template-columns: 1.15fr .85fr; grid-template-rows: auto auto; }
  .motion .porcao--1 { grid-column: 1; grid-row: 1 / span 2; }
  .motion .porcao--1 > .media { aspect-ratio: 3 / 4; }
  .motion .chapter__copy { position: absolute; left: 6vw; top: 50%; width: 44vw; transform: translateY(-40%); z-index: 3; }
  .motion .chapter--porcoes .chapter__copy { width: 42vw; }
  .motion .chapter__title { font-size: clamp(5rem, 1rem + 8.4vw, 11rem); }
  .motion .chapter--porcoes .chapter__title { font-size: clamp(3.6rem, .5rem + 4.8vw, 7rem); }
  .motion .menu__bar { display: block; position: absolute; left: var(--gutter); right: var(--gutter); bottom: 26px; height: 2px; border-radius: 2px; background: rgba(245,238,248,.12); }
  .motion .menu__bar i { display: block; height: 100%; background: var(--c-pink); box-shadow: 0 0 10px var(--c-pink); transform-origin: left; transform: scaleX(0); }

  /* Galeria: caminhada em profundidade (perspectiva real) */
  .motion .gallery { padding: 0; }
  .motion .gallery__stage { width: 100%; height: 100svh; position: relative; overflow: hidden; }
  .motion .gallery__intro { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; text-align: center; pointer-events: none; }
  .motion .gallery__h2 { font-size: clamp(6rem, 2rem + 11vw, 15rem); }
  .motion .gallery__hint { margin: var(--s-5) auto 0; }
  .motion .gallery__space { position: absolute; inset: 0; display: block; perspective: 1000px; perspective-origin: 50% 50%; transform-style: preserve-3d; pointer-events: none; }
  .motion .g-fig { position: absolute; left: 50%; top: 50%; width: calc(var(--w) * 1vw); margin: 0 !important; grid-column: auto !important; transform-style: preserve-3d; will-change: transform, opacity; opacity: 0; }
  .motion .gallery__outro { position: absolute; left: 0; right: 0; top: 50%; z-index: 4; margin: 0; transform: translateY(-50%); justify-items: center; text-align: center; opacity: 0; }

  .motion .offer__window { clip-path: inset(24% 33% 24% 33% round 28px); }
}

/* Telas baixas (notebook 13"): reduz títulos monumentais */
@media (min-width: 900px) and (max-height: 760px) {
  .motion .beat__title { font-size: clamp(4rem, 13svh, 8rem); }
  .motion .beat__title--xl { font-size: clamp(4.5rem, 16svh, 10rem); }
  .motion .chapter__title { font-size: clamp(4.5rem, 14svh, 9rem); }
  :root { --fs-hero: clamp(3.6rem, 13svh, 9rem); }
}
