/* =====================================================================
   FESTRUM — Cinematic Motion stylesheet
   Companion to festrum.js (motion engine v3)
   ===================================================================== */

:root {
  --ease-cine:   cubic-bezier(0.65, 0, 0.35, 1);
  --ease-expo:   cubic-bezier(0.19, 1, 0.22, 1);
  --ease-quint:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-quart:  cubic-bezier(0.165, 0.84, 0.44, 1);
  --ease-back:   cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============== 1. Word-mask text reveal ============== */
[data-split] .w-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  line-height: 1.08;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}
[data-split] .w-inner {
  display: inline-block;
  transform: translateY(115%) rotate(2deg);
  transition: transform 1.1s var(--ease-quint);
  transition-delay: calc(var(--w-i, 0) * 55ms);
  will-change: transform;
}
[data-split].in .w-inner {
  transform: translateY(0) rotate(0);
}

/* Bold cinematic single-line reveal (no per-word split) */
.cine-reveal {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}
.cine-reveal > * {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1.2s var(--ease-quint) 0.1s;
  will-change: transform;
}
.cine-reveal.in > * { transform: translateY(0); }

/* ============== 2. Generic reveal upgrade ============== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1.1s var(--ease-quint), transform 1.1s var(--ease-quint);
  transition-delay: calc(var(--stagger-i, 0) * 80ms);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }

.reveal-up   { transform: translateY(40px); }
.reveal-down { transform: translateY(-32px); }
.reveal-left { transform: translateX(36px); }
.reveal-right{ transform: translateX(-36px); }
.reveal-zoom { transform: scale(0.94); transform-origin: center; }
.reveal-blur { filter: blur(14px); opacity: 0; }
.reveal-blur.in { filter: blur(0); opacity: 1; transition: filter 1.4s var(--ease-quint), opacity 1.4s var(--ease-quint); }

/* ============== 3. Image reveal mask + ken burns ============== */
.img-mask {
  position: relative;
  overflow: hidden;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.6s var(--ease-expo);
}
.img-mask.in { clip-path: inset(0 0% 0 0); }
.img-mask img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.18);
  transition: transform 6s var(--ease-quint);
}
.img-mask.in img { transform: scale(1.02); }

.img-reveal {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.img-reveal::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, #1a1814 0%, #2b2820 50%, #1a1814 100%);
  z-index: 2;
  transform-origin: right center;
  transform: scaleX(1);
  transition: transform 1.4s var(--ease-expo);
}
.img-reveal.in::before { transform: scaleX(0); }
.img-reveal img {
  transform: scale(1.16);
  transition: transform 5s var(--ease-quint);
}
.img-reveal.in img { transform: scale(1.02); }

/* ============== 4. Parallax bindings ============== */
[data-parallax] { transform: translate3d(0, var(--p-y, 0px), 0); will-change: transform; }
[data-parallax-scale] { transform: scale(var(--p-s, 1)); will-change: transform; }
[data-parallax-fade] { opacity: var(--p-o, 1); }

/* Combined parallax holder */
.depth {
  position: relative;
  perspective: 1200px;
  transform-style: preserve-3d;
}
.depth-layer {
  will-change: transform;
  transition: transform 0.6s var(--ease-quint);
}

/* ============== 5. Scroll progress hairline ============== */
.fs-scroll-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #D6C6A5, #E5D7B6, #D6C6A5, transparent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 200;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ============== 6. Gold dust canvas ============== */
.fs-gold-dust {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
  opacity: 0.85;
}

/* ============== 7. Cursor companion ============== */
html.has-fs-cursor,
html.has-fs-cursor * { cursor: none !important; }
html.has-fs-cursor input,
html.has-fs-cursor textarea { cursor: text !important; }

.fs-cursor-dot {
  position: fixed; top: 0; left: 0;
  width: 6px; height: 6px;
  background: #E5D7B6;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
.fs-cursor-ring {
  position: fixed; top: 0; left: 0;
  width: 38px; height: 38px;
  border: 1px solid rgba(214, 198, 165, 0.55);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.4s var(--ease-quint), height 0.4s var(--ease-quint), border-color 0.4s, background 0.4s, opacity 0.3s;
}
.fs-cursor-ring.hover {
  width: 72px; height: 72px;
  border-color: rgba(229, 215, 182, 0.85);
  background: rgba(214, 198, 165, 0.08);
}

/* ============== 8. Magnetic hover ============== */
[data-magnetic] {
  display: inline-flex;
  transition: transform 0.35s var(--ease-quint);
  will-change: transform;
}

/* ============== 9. Curtain orchestration ============== */
html.is-loading { overflow-x: hidden; overflow-y: auto; }
.page-curtain {
  position: fixed; inset: 0;
  background: #15140F;
  z-index: 9000;
  transform-origin: bottom center;
  transition: transform 1.3s var(--ease-expo), opacity 0.6s ease 0.9s;
  pointer-events: none;
}
.page-curtain::before,
.page-curtain::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(214,198,165,0.06) 100%);
}
.page-curtain::after {
  background: radial-gradient(circle at 50% 60%, rgba(214,198,165,0.10), transparent 60%);
}
.page-curtain.lift {
  transform: translateY(-101%);
  pointer-events: none;
}

.page-out {
  position: fixed; inset: 0;
  background: #15140F;
  z-index: 9001;
  transform: translateY(101%);
  transition: transform 0.7s var(--ease-expo);
  pointer-events: none;
}
.page-out.cover { transform: translateY(0); }

/* ============== 10. Marquee polish ============== */
@keyframes fs-marquee-smooth {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* ============== 11. Section section-active state ============== */
section[data-section] { transition: opacity 0.9s var(--ease-quint); }

/* ============== 12. Floating elements (gentle drift) ============== */
@keyframes fs-float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-14px) rotate(0.6deg); }
}
.float-slow { animation: fs-float 9s ease-in-out infinite; }
.float-med  { animation: fs-float 6s ease-in-out infinite; }
.float-fast { animation: fs-float 4.2s ease-in-out infinite; }

/* ============== 13. Shimmer (luxury sheen on key elements) ============== */
@keyframes fs-shimmer {
  0%   { background-position: -200% 50%; }
  100% { background-position: 200% 50%; }
}
.shimmer {
  background: linear-gradient(110deg,
    transparent 0%,
    transparent 40%,
    rgba(229, 215, 182, 0.45) 50%,
    transparent 60%,
    transparent 100%);
  background-size: 200% 100%;
  animation: fs-shimmer 6s linear infinite;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============== 14. Key icon idle pulse ============== */
@keyframes fs-key-pulse {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(214,198,165,0)); }
  50%      { filter: drop-shadow(0 0 18px rgba(214,198,165,0.55)); }
}
.key-pulse { animation: fs-key-pulse 4s ease-in-out infinite; }

/* ============== 15. Hover lifts ============== */
.hover-lift {
  transition: transform 0.6s var(--ease-quint), box-shadow 0.6s var(--ease-quint);
}
.hover-lift:hover {
  transform: translateY(-6px);
}

/* ============== 16. Smooth-scroll body lock prevention ============== */
html.has-smooth-scroll body { overscroll-behavior-y: none; }

/* ============== 17. Reduced-motion overrides ============== */
@media (prefers-reduced-motion: reduce) {
  [data-split] .w-inner,
  .cine-reveal > *,
  .reveal,
  .img-mask,
  .img-mask img,
  .img-reveal::before,
  .img-reveal img,
  .page-curtain,
  .page-out,
  .float-slow, .float-med, .float-fast,
  .shimmer,
  .key-pulse {
    transition-duration: 0.001ms !important;
    animation: none !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
    opacity: 1 !important;
  }
  .fs-scroll-progress, .fs-gold-dust, .fs-cursor-dot, .fs-cursor-ring { display: none !important; }
}

/* ============== 18. Mobile: tone down heavy effects ============== */
@media (max-width: 820px) {
  .fs-cursor-dot, .fs-cursor-ring { display: none !important; }
  [data-parallax] { transform: none !important; }
  .img-mask { transition-duration: 1.1s; }
  [data-split] .w-inner { transition-duration: 0.85s; transition-delay: calc(var(--w-i, 0) * 35ms); }
}
