/* ============================================================
   Koperasi SMKSBS: premium motion pack ("fx").
   Same rules as live.css: transform + opacity only (one small text shimmer),
   everything pauses off-screen, nothing runs on weak devices / reduced motion.
   Loaded after dark.css. fx.js adds the markup hooks.
   ============================================================ */

/* ---------- richer scroll reveals ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal { transform: translate3d(0, 34px, 0) scale(.965); transition: opacity 700ms var(--ease-out), transform 800ms cubic-bezier(.2,.9,.25,1.05); }
  html.js .reveal.in { transform: none; }
  html.js .section-heading.reveal::after { transform: scaleX(0); transform-origin: left; transition: transform 900ms var(--ease-out) 200ms; }
  html.js .section-heading.reveal.in::after { transform: scaleX(1); }
}

/* ---------- hero headline: words rise in, accent line shimmers ---------- */
.fx-words .w { display: inline-block; overflow: hidden; vertical-align: top; padding: .24em .24em .24em .1em; margin: -.24em -.24em -.24em -.1em; }
.fx-words .w > span { display: inline-block; padding: .1em .2em; margin: -.1em -.2em; transform: translate3d(0, 115%, 0) rotate(4deg); transform-origin: left bottom; opacity: 0;
  animation: fxWord 900ms cubic-bezier(.2,.9,.25,1) calc(var(--i) * 75ms + 180ms) forwards; }
.fx-words em .w > span {
  background: linear-gradient(100deg, var(--azure) 0%, var(--azure) 38%, #F2A458 50%, var(--azure) 62%, var(--azure) 100%) 0 0 / 260% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  animation: fxWord 900ms cubic-bezier(.2,.9,.25,1) calc(var(--i) * 75ms + 180ms) forwards, fxShimmer 5.5s ease-in-out calc(var(--i) * 75ms + 1400ms) infinite;
}
.home-hero.fx-off .fx-words em .w > span { animation-play-state: running, paused; }
@keyframes fxWord { to { transform: none; opacity: 1; } }
@keyframes fxShimmer { 0% { background-position: 100% 0; } 55%, 100% { background-position: 0 0; } }

/* the little gold dashes breathe */
.hero-eyebrow .dot, .section-heading .dot { transform-origin: left center; animation: fxDash 3.6s ease-in-out infinite; }
@keyframes fxDash { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(1.9); } }

/* ---------- cursor spotlight on cards (fine pointers only) ---------- */
.fx-glow { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 300ms ease;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(232,135,58,.16), rgba(232,135,58,0) 62%); z-index: 1; }
.fx-spot { position: relative; }
@media (hover: hover) { .fx-spot:hover > .fx-glow { opacity: 1; } }
[data-theme="dark"] .fx-glow { background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(244,162,97,.18), rgba(244,162,97,0) 62%); }

/* ---------- buttons: sheen sweep ---------- */
.cta-btn, .home-search button { position: relative; overflow: hidden; isolation: isolate; }
.cta-btn::after, .home-search button::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, rgba(255,255,255,0), rgba(255,255,255,.55), rgba(255,255,255,0)); transform: translate3d(0,0,0) skewX(-18deg); }
.cta-btn:hover::after, .home-search button:hover::after { animation: fxSheen 800ms ease-out; }
.cta-btn::after { animation: fxSheen 1100ms ease-out 2.2s 1; }
@keyframes fxSheen { to { transform: translate3d(520%, 0, 0) skewX(-18deg); } }

/* ---------- CTA band: slow aurora ---------- */
.cta-band { position: relative; overflow: hidden; isolation: isolate; }
.cta-band > * { position: relative; z-index: 1; }
.cta-band::before { content: ""; position: absolute; width: 520px; height: 520px; left: -120px; top: -260px; border-radius: 50%; z-index: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,255,255,.28), rgba(255,255,255,0)); animation: fxAurora1 14s ease-in-out infinite alternate; }
.cta-band::after { content: ""; position: absolute; width: 460px; height: 460px; right: -100px; bottom: -280px; border-radius: 50%; z-index: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,214,150,.38), rgba(255,214,150,0)); animation: fxAurora2 17s ease-in-out infinite alternate; }
@keyframes fxAurora1 { to { transform: translate3d(360px, 140px, 0) scale(1.2); } }
@keyframes fxAurora2 { to { transform: translate3d(-380px, -90px, 0) scale(1.15); } }

/* ---------- hero extras: orbit rings + pointer parallax ---------- */
.live-bg { transition: transform 900ms cubic-bezier(.2,.8,.2,1); }
.live-bg .lr { position: absolute; border-radius: 50%; border: 1.5px dashed rgba(232,135,58,.32); will-change: transform; animation: fxSpin var(--d, 60s) linear infinite; }
.live-bg .lr-1 { width: 420px; height: 420px; right: 6%; top: -110px; --d: 70s; }
.live-bg .lr-2 { width: 260px; height: 260px; left: 30%; bottom: -90px; --d: 48s; animation-direction: reverse; border-color: rgba(102,144,242,.30); }
@keyframes fxSpin { to { transform: rotate(360deg); } }
[data-theme="dark"] .live-bg .lr { border-color: rgba(244,162,97,.28); }
[data-theme="dark"] .live-bg .lr-2 { border-color: rgba(157,182,245,.28); }
.live-bg.is-paused .lr { animation-play-state: paused !important; }
.home-hero-inner { will-change: transform, opacity; }

/* ---------- products and activity cards ---------- */
.sp-image { overflow: hidden; }
.sp-image img { transition: transform 700ms cubic-bezier(.2,.8,.2,1); }
@media (hover: hover) {
  .shop-product:hover .sp-image img, .act-card:hover .act-img img { transform: scale(1.07); }
  .shop-product .sp-add-btn:hover { transform: translateY(-1px); }
}
.act-img { overflow: hidden; }
.act-img img { transition: transform 700ms cubic-bezier(.2,.8,.2,1); }
.stat .num { display: inline-block; }
.stat.in .num, .stat:hover .num { animation: fxPop 700ms var(--ease-spring) 1; }
@keyframes fxPop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ---------- ripple (buttons and cards) ---------- */
.fx-ripple-host { position: relative; overflow: hidden; }
.fx-ripple { position: absolute; border-radius: 50%; pointer-events: none; width: 20px; height: 20px; margin: -10px 0 0 -10px; background: rgba(255,255,255,.5); animation: fxRipple 620ms ease-out forwards; z-index: 2; }
@keyframes fxRipple { to { transform: scale(14); opacity: 0; } }

/* ---------- mobile: tab bar feels alive ---------- */
@media (max-width: 820px) {
  .tabbar a { transition: transform 220ms var(--ease-spring), color 200ms ease; }
  .tabbar a:active { transform: scale(.86); }
  .tabbar a.current svg { animation: fxTab 520ms var(--ease-spring) 1; }
  .quick-card:active, .shop-product:active, .act-card:active { transform: scale(.975); }
  .fx-glow { display: none; }
}
@keyframes fxTab { 0% { transform: translateY(4px) scale(.8); } 55% { transform: translateY(-4px) scale(1.18); } 100% { transform: none; } }

/* ---------- off switches ---------- */
html.no-live .live-bg .lr, html.no-live .cta-band::before, html.no-live .cta-band::after { animation: none !important; display: none; }
html.no-live .fx-words em .w > span { animation: fxWord 900ms cubic-bezier(.2,.9,.25,1) calc(var(--i) * 75ms + 180ms) forwards; }
@media (prefers-reduced-motion: reduce) {
  .fx-words .w > span { transform: none; opacity: 1; animation: none; }
  .cta-band::before, .cta-band::after, .live-bg .lr, .cta-btn::after, .hero-eyebrow .dot, .section-heading .dot { animation: none !important; }
  .fx-glow, .fx-ripple { display: none; }
}
