/* ==========================================================================
   LEXUNA FX — animasi frontend (khusus halaman publik)
   Ringan: hanya transform/opacity, dijeda otomatis saat di luar layar.
   ========================================================================== */

:root {
    --fx-teal: #7ff0d0;
    --fx-sky: #38bdf8;
    --fx-violet: #6366f1;
    --fx-pink: #db2777;
    --fx-amber: #f59e0b;
}

/* ---------- Progress scroll ---------- */
#fx-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 100%;
    transform-origin: 0 50%; transform: scaleX(0);
    background: linear-gradient(90deg, var(--fx-teal), var(--fx-sky), var(--fx-violet), var(--fx-pink));
    z-index: 100001; pointer-events: none; will-change: transform;
}

/* ---------- Orb latar (ringan, tanpa blur) ---------- */
.fx-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.fx-orb {
    position: absolute; border-radius: 50%; opacity: .5;
    background: radial-gradient(circle at 50% 50%, var(--c) 0%, transparent 68%);
    animation: fxDrift var(--t, 26s) ease-in-out infinite alternate;
    will-change: transform;
}
.fx-orb.o1 { --c: rgba(99, 102, 241, .22); width: 520px; height: 520px; left: -140px; top: 8%; --t: 28s; }
.fx-orb.o2 { --c: rgba(56, 189, 248, .16); width: 460px; height: 460px; right: -120px; top: 44%; --t: 32s; animation-delay: -9s; }
.fx-orb.o3 { --c: rgba(219, 39, 119, .14); width: 420px; height: 420px; left: 30%; bottom: -160px; --t: 36s; animation-delay: -16s; }
@keyframes fxDrift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(60px, -40px, 0) scale(1.12); } }

/* ---------- Reveal saat scroll ---------- */
html.fx-ready .fx-reveal { opacity: 0; transform: translate3d(0, 28px, 0) scale(.985); transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--fx-d, 0ms); }
html.fx-ready .fx-reveal.fx-in { opacity: 1; transform: none; }

/* ---------- Efek tilt kartu ---------- */
.fx-tilt-on { transition: transform .12s ease-out, box-shadow .3s ease !important; will-change: transform; }
.fx-tilt-on::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(260px circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, .13), transparent 60%);
    opacity: 0; transition: opacity .25s ease;
}
.fx-tilt-on:hover::after { opacity: 1; }

/* ---------- Gradient teks bergerak ---------- */
html body .text-gradient, html body .text-gradient-purple-pink {
    background-size: 220% 100%; animation: fxGradShift 6s ease-in-out infinite alternate;
}
@keyframes fxGradShift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

/* ---------- Slot animasi ---------- */
.fx-art { position: relative; width: 100%; max-width: 560px; height: 250px; margin: 22px auto 0; pointer-events: none; }
.fx-art.fx-art-hero { position: absolute; inset: 0; max-width: none; height: auto; margin: 0; z-index: 0; opacity: .5; }
.fx-art.fx-art-wide { max-width: 640px; }
@media (max-width: 640px) { .fx-art { height: 210px; } }

/* ---------- Banner kategori (halaman hosting) ---------- */
.fx-banner {
    position: relative; display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 12px;
    margin: 0 0 28px; padding: 22px 26px; border-radius: 1.6rem; overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .02));
    border: 1px solid rgba(255, 255, 255, .10); box-shadow: 0 24px 60px -34px rgba(0, 0, 0, .9);
}
.fx-banner::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .9;
    background: radial-gradient(520px 220px at 88% 40%, var(--fx-a, rgba(99, 102, 241, .22)), transparent 70%);
}
.fx-banner-text { position: relative; z-index: 2; }
.fx-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font-size: 10px; font-weight: 800;
    letter-spacing: .14em; text-transform: uppercase; color: var(--fx-teal); background: rgba(127, 240, 208, .10); border: 1px solid rgba(127, 240, 208, .28);
}
.fx-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--fx-teal); animation: fxPing 1.6s ease-out infinite; }
.fx-banner-text h3 { margin: 12px 0 6px; font-size: clamp(1.25rem, 2.6vw, 1.9rem); line-height: 1.15; }
.fx-banner-text p { margin: 0; font-size: .85rem; line-height: 1.6; color: #b4c3d6; max-width: 34rem; }
.fx-banner .fx-art { margin: 0; height: 230px; max-width: none; }
@media (max-width: 820px) {
    .fx-banner { grid-template-columns: 1fr; padding: 18px; }
    .fx-banner .fx-art { height: 200px; }
}

/* ---------- Panggung 3D berlapis ---------- */
.fx-stage {
    position: absolute; inset: 0; transform-style: preserve-3d;
    transform: perspective(1100px) rotateX(var(--rx, 4deg)) rotateY(var(--ry, -8deg));
    animation: fxSway 11s ease-in-out infinite;
}
.fx-art.is-hover .fx-stage { animation: none; transition: transform .25s ease-out; }
.fx-layer { position: absolute; inset: 0; transform: translateZ(var(--z, 0px)); }
.fx-svg { width: 100%; height: 100%; display: block; overflow: visible; }
@keyframes fxSway {
    0%, 100% { transform: perspective(1100px) rotateX(5deg) rotateY(-12deg); }
    50% { transform: perspective(1100px) rotateX(2deg) rotateY(12deg); }
}
.fx-glow { position: absolute; left: 50%; top: 46%; width: 70%; height: 80%; transform: translate(-50%, -50%) translateZ(-60px); background: radial-gradient(closest-side, var(--fx-a, rgba(99, 102, 241, .35)), transparent); animation: fxBreath 5s ease-in-out infinite; }
.fx-floor {
    position: absolute; left: -12%; right: -12%; bottom: -14%; height: 62%;
    transform: translateZ(-40px) rotateX(70deg); transform-origin: 50% 100%;
    background-image: linear-gradient(var(--fx-line, rgba(127, 240, 208, .32)) 1px, transparent 1px), linear-gradient(90deg, var(--fx-line, rgba(127, 240, 208, .32)) 1px, transparent 1px);
    background-size: 38px 38px; animation: fxFloor 2.6s linear infinite;
    -webkit-mask-image: radial-gradient(closest-side, #000 25%, transparent 78%); mask-image: radial-gradient(closest-side, #000 25%, transparent 78%);
}
@keyframes fxFloor { from { background-position: 0 0, 0 0; } to { background-position: 0 38px, 0 0; } }
@keyframes fxBreath { 0%, 100% { opacity: .65; transform: translate(-50%, -50%) translateZ(-60px) scale(1); } 50% { opacity: 1; transform: translate(-50%, -50%) translateZ(-60px) scale(1.1); } }

/* Aksen per-scene */
.fx-s-cloud { --fx-a: rgba(56, 189, 248, .30); --fx-line: rgba(127, 240, 208, .30); }
.fx-s-network { --fx-a: rgba(99, 102, 241, .32); --fx-line: rgba(129, 140, 248, .34); }
.fx-s-cctv { --fx-a: rgba(239, 68, 68, .22); --fx-line: rgba(248, 113, 113, .26); }
.fx-s-design { --fx-a: rgba(219, 39, 119, .28); --fx-line: rgba(244, 114, 182, .28); }
.fx-s-web { --fx-a: rgba(99, 102, 241, .30); --fx-line: rgba(129, 140, 248, .30); }
.fx-s-blog { --fx-a: rgba(245, 158, 11, .22); --fx-line: rgba(251, 191, 36, .24); }
.fx-s-contact { --fx-a: rgba(34, 197, 94, .22); --fx-line: rgba(74, 222, 128, .26); }
.fx-s-social { --fx-a: rgba(219, 39, 119, .28); --fx-line: rgba(244, 114, 182, .26); }
.fx-s-tracking { --fx-a: rgba(245, 158, 11, .24); --fx-line: rgba(251, 191, 36, .26); }
.fx-s-status { --fx-a: rgba(34, 197, 94, .26); --fx-line: rgba(74, 222, 128, .28); }
.fx-s-generic, .fx-s-hero { --fx-a: rgba(99, 102, 241, .30); --fx-line: rgba(127, 240, 208, .26); }

/* ---------- Primitif animasi SVG ---------- */
.fx-float { animation: fxFloat 4.2s ease-in-out infinite; }
.fx-float.d2 { animation-delay: -1.4s; animation-duration: 5s; }
.fx-float.d3 { animation-delay: -2.8s; animation-duration: 3.6s; }
@keyframes fxFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.fx-blink { animation: fxBlink 1.5s steps(1, end) infinite; }
@keyframes fxBlink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: .18; } }
.fx-spin { transform-box: fill-box; transform-origin: center; animation: fxSpin 16s linear infinite; }
.fx-spin.rev { animation-direction: reverse; animation-duration: 22s; }
@keyframes fxSpin { to { transform: rotate(360deg); } }
.fx-dash { stroke-dasharray: 5 9; animation: fxDash 1.6s linear infinite; }
@keyframes fxDash { to { stroke-dashoffset: -28; } }
.fx-wave { transform-box: fill-box; transform-origin: 50% 100%; animation: fxWave 2.4s ease-out infinite; opacity: 0; }
.fx-wave.w2 { animation-delay: .45s; } .fx-wave.w3 { animation-delay: .9s; }
@keyframes fxWave { 0% { opacity: 0; transform: scale(.7); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.12); } }
.fx-pulse-ring { transform-box: fill-box; transform-origin: center; animation: fxRing 2.2s ease-out infinite; }
@keyframes fxRing { 0% { opacity: .8; transform: scale(.4); } 100% { opacity: 0; transform: scale(1.9); } }
@keyframes fxPing { 0% { box-shadow: 0 0 0 0 rgba(127, 240, 208, .7); } 100% { box-shadow: 0 0 0 10px rgba(127, 240, 208, 0); } }
.fx-pop { transform-box: fill-box; transform-origin: center; animation: fxPop 4.5s ease-out infinite; }
@keyframes fxPop { 0%, 8% { opacity: 0; transform: scale(0); } 14%, 88% { opacity: 1; transform: scale(1); } 96%, 100% { opacity: 0; transform: scale(.6); } }
.fx-rise { animation: fxRise 5s ease-in infinite; opacity: 0; }
@keyframes fxRise { 0% { opacity: 0; transform: translateY(40px) scale(.6); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-190px) scale(1.15); } }
.fx-scan { animation: fxScan 3.6s ease-in-out infinite alternate; }
@keyframes fxScan { from { transform: translateY(0); } to { transform: translateY(96px); } }
.fx-cam-head { transform-origin: 148px 122px; animation: fxCam 7s ease-in-out infinite alternate; }
@keyframes fxCam { from { transform: rotate(-20deg); } to { transform: rotate(16deg); } }
.fx-walk { animation: fxWalk 6.5s linear infinite; }
@keyframes fxWalk { from { transform: translateX(-26px); } to { transform: translateX(150px); } }
.fx-build { transform-box: fill-box; transform-origin: 50% 100%; animation: fxBuild 9s ease infinite; opacity: 0; }
@keyframes fxBuild { 0% { opacity: 0; transform: translateY(10px) scale(.94); } 9%, 84% { opacity: 1; transform: none; } 93%, 100% { opacity: 0; transform: translateY(-4px) scale(.98); } }
.fx-line-write { transform-box: fill-box; transform-origin: 0 50%; animation: fxWrite 6s ease-in-out infinite; }
@keyframes fxWrite { 0% { transform: scaleX(0); opacity: 1; } 22%, 80% { transform: scaleX(1); opacity: 1; } 95%, 100% { transform: scaleX(1); opacity: 0; } }
.fx-cursor { animation: fxCursor 9s ease-in-out infinite; }
@keyframes fxCursor { 0%, 10% { transform: translate(40px, 40px); } 38% { transform: translate(190px, 118px); } 44% { transform: translate(190px, 118px) scale(.88); } 50% { transform: translate(190px, 118px); } 82%, 100% { transform: translate(40px, 40px); } }
.fx-flap { transform-origin: 260px 138px; animation: fxFlap 6s ease-in-out infinite; }
@keyframes fxFlap { 0%, 8% { transform: scaleY(1); } 22%, 70% { transform: scaleY(-1); } 86%, 100% { transform: scaleY(1); } }
.fx-letter { animation: fxLetter 6s ease-in-out infinite; }
@keyframes fxLetter { 0%, 14% { transform: translateY(26px); } 36%, 70% { transform: translateY(-34px); } 86%, 100% { transform: translateY(26px); } }
.fx-bounce { animation: fxBounce 1.5s ease-in-out infinite; }
@keyframes fxBounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } 60% { transform: translateY(-14px); } }
.fx-dots circle { animation: fxDot 1.2s ease-in-out infinite; }
.fx-dots circle:nth-child(2) { animation-delay: .15s; } .fx-dots circle:nth-child(3) { animation-delay: .3s; }
@keyframes fxDot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
.fx-ecg { stroke-dasharray: 90 400; animation: fxEcg 2.6s linear infinite; }
@keyframes fxEcg { from { stroke-dashoffset: 490; } to { stroke-dashoffset: 0; } }
.fx-bar { transform-box: fill-box; transform-origin: 50% 100%; animation: fxBar 1.8s ease-in-out infinite; }
@keyframes fxBar { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
.fx-sweep { transform-box: fill-box; transform-origin: 0 100%; animation: fxSpin 5s linear infinite; }

/* Pause saat di luar layar / tab tidak aktif */
.fx-paused *, .fx-paused { animation-play-state: paused !important; }

/* ---------- Terminal RouterOS ---------- */
.fx-term {
    position: absolute; left: 4px; bottom: 6px; width: min(300px, 70%); z-index: 3; padding: 8px 10px 10px; border-radius: 10px;
    background: rgba(5, 12, 24, .88); border: 1px solid rgba(127, 240, 208, .28); box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .8);
    font: 600 10.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #9ff7e0; text-align: left; transform: translateZ(60px);
}
.fx-term .bar { display: flex; gap: 5px; margin-bottom: 6px; }
.fx-term .bar i { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; }
.fx-term .bar i:nth-child(2) { background: #f59e0b; } .fx-term .bar i:nth-child(3) { background: #22c55e; }
.fx-term .ln { white-space: nowrap; overflow: hidden; text-overflow: clip; min-height: 16px; }
.fx-term .ln b { color: #7dd3fc; font-weight: 700; }
.fx-term .caret { display: inline-block; width: 6px; height: 11px; background: #9ff7e0; vertical-align: -2px; animation: fxBlink 1s steps(1, end) infinite; }

/* ---------- Carousel 3D (galeri) ---------- */
.fx-carousel { position: absolute; inset: 0; perspective: 900px; display: flex; align-items: center; justify-content: center; }
.fx-tiltwrap { transform-style: preserve-3d; transform: rotateX(-10deg); width: 0; height: 0; }
.fx-ring { position: relative; transform-style: preserve-3d; animation: fxRotY 24s linear infinite; width: 0; height: 0; }
.fx-card3d { position: absolute; left: -58px; top: -74px; width: 116px; height: 148px; transform: rotateY(calc(var(--i) * 60deg)) translateZ(168px); border-radius: 12px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .22); box-shadow: 0 18px 30px -12px rgba(0, 0, 0, .7); background: linear-gradient(150deg, var(--g1), var(--g2)); }
.fx-card3d svg { position: absolute; inset: 0; width: 100%; height: 100%; }
@keyframes fxRotY { to { transform: rotateY(360deg); } }

/* ---------- Kubus 3D (hero beranda) ---------- */
.fx-cube-wrap { position: absolute; width: 90px; height: 90px; perspective: 600px; }
.fx-cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: fxCube 14s linear infinite; }
.fx-cube i { position: absolute; inset: 0; border: 1.5px solid rgba(127, 240, 208, .55); background: rgba(127, 240, 208, .05); }
.fx-cube i:nth-child(1) { transform: translateZ(45px); } .fx-cube i:nth-child(2) { transform: rotateY(180deg) translateZ(45px); }
.fx-cube i:nth-child(3) { transform: rotateY(90deg) translateZ(45px); } .fx-cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(45px); }
.fx-cube i:nth-child(5) { transform: rotateX(90deg) translateZ(45px); } .fx-cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(45px); }
@keyframes fxCube { from { transform: rotateX(-24deg) rotateY(0deg); } to { transform: rotateX(-24deg) rotateY(360deg); } }
.fx-glyph { position: absolute; font: 800 20px/1 ui-monospace, Menlo, Consolas, monospace; color: rgba(127, 240, 208, .8); animation: fxFloat 5s ease-in-out infinite; }

/* ---------- Aksesibilitas / performa ---------- */
html.fx-reduce .fx-orb, html.fx-reduce .fx-stage, html.fx-reduce .fx-floor, html.fx-reduce .fx-glow,
html.fx-reduce .fx-art *, html.fx-reduce .text-gradient, html.fx-reduce .text-gradient-purple-pink { animation: none !important; }
html.fx-reduce .fx-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
html.fx-lite .fx-orbs, html.fx-lite .fx-floor, html.fx-lite .fx-glow { display: none; }
html.fx-lite .fx-stage { animation: none; }
@media (max-width: 640px) { .fx-orb.o2, .fx-orb.o3 { display: none; } .fx-art.fx-art-hero { opacity: .28; } }
@media print { .fx-orbs, .fx-art, #fx-progress { display: none !important; } }

/* Konten hero beranda tetap di atas animasi latar */
.fx-art-hero ~ section { position: relative; z-index: 1; }
