/* motion-base.css — required by every effect in luxury-web-animations */

:root {
  /* Motion tokens — keep these consistent site-wide; inconsistency reads as "template". */
  --fx-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fx-ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --fx-dur-fast: 0.35s;
  --fx-dur: 0.7s;
  --fx-dur-slow: 1.2s;

  /* Theme tokens — override per project (or let color-shift sections animate them). */
  --fx-bg: #0f0e0c;
  --fx-fg: #f2ece2;
  --fx-accent: #c9a36b;
  --fx-muted: rgba(242, 236, 226, 0.55);
  --fx-radius: 18px;
}

/* ---------- Lenis (smooth scroll) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-scrolling iframe { pointer-events: none; }

/* ---------- FOUC-safe pre-hidden states ----------
   Only applied once motion-core has run (html.js) and motion is allowed.
   If GSAP fails to load, html.js is never added and everything stays visible. */
html.fx-js:not(.reduced-motion) [data-fx="masked-headline"],
html.fx-js:not(.reduced-motion) [data-fx="split-reveal"],
html.fx-js:not(.reduced-motion) [data-fx="blur-text"] { visibility: hidden; }

html.fx-js:not(.reduced-motion) [data-fx="clip-reveal"] { clip-path: inset(0 0 100% 0); }
html.fx-js:not(.reduced-motion) [data-fx="fade-up"] { opacity: 0; transform: translateY(40px); }

/* ---------- Reduced motion: everything visible, nothing moving ---------- */
html.reduced-motion [data-fx],
html.reduced-motion [data-fx] * {
  animation: none !important;
  transition-duration: 0.01ms !important;
}
html.reduced-motion [data-fx="masked-headline"],
html.reduced-motion [data-fx="split-reveal"],
html.reduced-motion [data-fx="blur-text"],
html.reduced-motion [data-fx="clip-reveal"],
html.reduced-motion [data-fx="fade-up"] {
  visibility: visible !important;
  opacity: 1 !important;
  transform: none !important;
  clip-path: none !important;
  filter: none !important;
}

/* ---------- Utilities ---------- */
.fx-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.fx-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Film grain — the single cheapest "expensive" upgrade. Add <div class="fx-grain" aria-hidden="true"></div> once per page. */
.fx-grain {
  position: fixed; inset: -50%; width: 200%; height: 200%;
  pointer-events: none; z-index: 9990; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: fx-grain 1s steps(6) infinite;
}
@keyframes fx-grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-6%, 4%); }
  40% { transform: translate(4%, -6%); }
  60% { transform: translate(-3%, -2%); }
  80% { transform: translate(6%, 3%); }
  100% { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) { .fx-grain { animation: none; } }

/* Effects toggle the `hidden` attribute (menu panels, filtered items). Component display rules must never beat it. */
[data-fx] [hidden], [data-fx][hidden] { display: none !important; }
