/* ============================================================
   Koperasi SMKSBS: "live" ambient motion.
   Cheap by design: only transform + opacity (GPU composited), no blur filters,
   no canvas, no libraries. motion.js pauses everything that is off-screen or
   in a hidden tab, and removes it on low-power devices / reduced motion.
   ============================================================ */
.live-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; contain: layout paint style; }
.home-hero > .home-hero-inner, .shop-banner > .shop-banner-inner { position: relative; z-index: 1; }

/* soft colour glows that drift (radial gradients, not blur filters) */
.live-bg .lg { position: absolute; border-radius: 50%; will-change: transform; opacity: .9; }
.live-bg .lg-1 { width: 620px; height: 620px; left: -160px; top: -240px; background: radial-gradient(closest-side, rgba(232,135,58,.30), rgba(232,135,58,0)); animation: liveDrift1 18s ease-in-out infinite alternate; }
.live-bg .lg-2 { width: 560px; height: 560px; right: -140px; bottom: -260px; background: radial-gradient(closest-side, rgba(102,144,242,.26), rgba(102,144,242,0)); animation: liveDrift2 22s ease-in-out infinite alternate; }
.live-bg .lg-3 { width: 340px; height: 340px; left: 42%; top: 10%; background: radial-gradient(closest-side, rgba(217,185,104,.22), rgba(217,185,104,0)); animation: liveDrift3 26s ease-in-out infinite alternate; }

/* floating school icons */
.live-bg .lf { position: absolute; width: 44px; height: 44px; color: var(--azure); opacity: .20; will-change: transform; animation: liveFloat var(--d, 9s) ease-in-out var(--del, 0s) infinite alternate; }
.live-bg .lf svg { width: 100%; height: 100%; stroke-width: 1.6; }
.live-bg .lf:nth-child(4) { left: 6%;  top: 22%; --d: 9s;  --del: -1s; }
.live-bg .lf:nth-child(5) { left: 44%; top: 8%;  --d: 11s; --del: -4s; width: 34px; height: 34px; }
.live-bg .lf:nth-child(6) { right: 8%; top: 18%; --d: 10s; --del: -2s; width: 52px; height: 52px; }
.live-bg .lf:nth-child(7) { right: 30%; bottom: 10%; --d: 12s; --del: -6s; width: 38px; height: 38px; }
.live-bg .lf:nth-child(8) { left: 22%; bottom: 8%; --d: 8s; --del: -3s; width: 30px; height: 30px; }

/* tiny drifting dots */
.live-bg .ld { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); opacity: .0; will-change: transform, opacity; animation: liveRise var(--d, 12s) linear var(--del, 0s) infinite; }
.live-bg .ld:nth-child(9)  { left: 12%; bottom: -10px; --d: 13s; --del: -2s; }
.live-bg .ld:nth-child(10) { left: 34%; bottom: -10px; --d: 16s; --del: -9s; }
.live-bg .ld:nth-child(11) { left: 58%; bottom: -10px; --d: 12s; --del: -5s; }
.live-bg .ld:nth-child(12) { left: 76%; bottom: -10px; --d: 15s; --del: -11s; }
.live-bg .ld:nth-child(13) { left: 90%; bottom: -10px; --d: 14s; --del: -7s; }

@keyframes liveDrift1 { to { transform: translate3d(140px, 90px, 0) scale(1.15); } }
@keyframes liveDrift2 { to { transform: translate3d(-120px, -80px, 0) scale(1.12); } }
@keyframes liveDrift3 { to { transform: translate3d(-90px, 60px, 0) scale(.9); } }
@keyframes liveFloat { from { transform: translate3d(0, 0, 0) rotate(-6deg); } to { transform: translate3d(10px, -22px, 0) rotate(8deg); } }
@keyframes liveRise { 0% { transform: translate3d(0, 0, 0); opacity: 0; } 12% { opacity: .55; } 85% { opacity: .35; } 100% { transform: translate3d(14px, -380px, 0); opacity: 0; } }

/* paused when off-screen (set by motion.js) */
.live-bg.is-paused *, .live-bg.is-paused { animation-play-state: paused !important; }

/* tiny living details elsewhere */
@keyframes liveGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(232,135,58,.0); } 50% { box-shadow: 0 0 0 8px rgba(232,135,58,.14); } }
.cart-fab.has-items { animation: liveGlow 2.6s ease-in-out infinite; }
.quick-card:hover .quick-icon svg, .quick-card:focus-visible .quick-icon svg { animation: liveWiggle 620ms var(--ease-spring); }
@keyframes liveWiggle { 0% { transform: rotate(0); } 25% { transform: rotate(-12deg) scale(1.1); } 60% { transform: rotate(8deg) scale(1.1); } 100% { transform: rotate(0) scale(1); } }
.shop-banner-icon { animation: liveBob 4.5s ease-in-out infinite alternate; }
@keyframes liveBob { to { transform: translateY(-5px) rotate(-3deg); } }

/* off: low-power devices, data saver, reduced motion */
html.no-live .live-bg, html.no-live .cart-fab.has-items { display: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { .live-bg { display: none !important; } .cart-fab.has-items, .shop-banner-icon { animation: none !important; } }

/* phones: fewer layers = less work */
@media (max-width: 820px) {
  .live-bg .lg-3, .live-bg .ld:nth-child(n+11), .live-bg .lf:nth-child(n+7) { display: none; }
  .live-bg .lg-1 { width: 380px; height: 380px; left: -140px; top: -160px; }
  .live-bg .lg-2 { width: 360px; height: 360px; right: -140px; bottom: -180px; }
  .live-bg .lf { opacity: .16; }
}
/* dark theme */
[data-theme="dark"] .live-bg .lf { color: #9DB6F5; opacity: .16; }
[data-theme="dark"] .live-bg .lg-1 { background: radial-gradient(closest-side, rgba(244,162,97,.22), rgba(244,162,97,0)); }
[data-theme="dark"] .live-bg .lg-2 { background: radial-gradient(closest-side, rgba(102,144,242,.30), rgba(102,144,242,0)); }
