/* ===================================
   3D Animations & Interactive Effects
   =================================== */

/* ===== Custom Cursor ===== */
.custom-cursor-active,
.custom-cursor-active * {
    cursor: none !important;
}

#bl-cursor {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 999999;
}

.cursor-dot {
    position: fixed;
    width: 8px;
    height: 8px;
    background: var(--primary-400);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 12px var(--primary-400);
    transition: width 0.2s ease, height 0.2s ease, background 0.2s ease;
}

.cursor-ring {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(16, 185, 129, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.7;
    transition: width 0.25s ease, height 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

#bl-cursor.cursor-hover .cursor-dot {
    width: 14px;
    height: 14px;
    background: var(--accent-400);
    box-shadow: 0 0 18px var(--accent-400);
}

#bl-cursor.cursor-hover .cursor-ring {
    width: 60px;
    height: 60px;
    border-color: rgba(245, 158, 11, 0.55);
    opacity: 0.45;
}

#bl-cursor.cursor-click .cursor-dot {
    transform: translate(-50%, -50%) scale(0.65);
}

#bl-cursor.cursor-click .cursor-ring {
    transform: translate(-50%, -50%) scale(1.35);
    opacity: 0.25;
}

/* ===== Card Tilt Sheen ===== */
.card-sheen {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    border-radius: inherit;
    transition: background 0.05s linear;
}

/* ===== Button Ripple ===== */
.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.28);
    transform: scale(0);
    animation: rippleExpand 0.72s ease-out forwards;
    pointer-events: none;
}

@keyframes rippleExpand {
    to {
        transform: scale(1);
        opacity: 0;
    }
}

/* ===== Hero 3D Scene Container ===== */
.hero-3d-scene {
    position: relative;
    width: 100%;
    min-height: 460px;
    border-radius: var(--radius-2xl);
    overflow: hidden;
}

#hero-canvas {
    display: block;
    width: 100% !important;
    min-height: 460px;
}

/* Canvas floating labels */
.canvas-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.canvas-label {
    position: absolute;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(16, 185, 129, 0.1);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    animation: labelFloat 4s ease-in-out infinite;
}

.c-lbl-1 { top: 8%;   left: 4%;  animation-delay: 0s; }
.c-lbl-2 { top: 8%;   right: 4%; animation-delay: -1.1s; }
.c-lbl-3 { bottom: 9%; left: 4%;  animation-delay: -2.2s; }
.c-lbl-4 { bottom: 9%; right: 4%; animation-delay: -3.3s; }

@keyframes labelFloat {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-9px); }
}

.clbl-icon  { font-size: 1.4rem; line-height: 1; }

.clbl-value {
    display: block;
    font-size: var(--font-size-lg);
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.clbl-text {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1;
    margin-top: 2px;
}

/* Fallback if Three.js not loaded */
.canvas-fallback {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: var(--space-4);
}

.canvas-fallback.visible { display: flex; }

.fb-building {
    font-size: 5rem;
    animation: float 4s ease-in-out infinite;
}

/* ===== 3D Scroll Reveal ===== */
.reveal-3d-left {
    opacity: 0;
    transform: perspective(800px) rotateY(-22deg) translateX(-50px);
    transition: opacity 0.8s cubic-bezier(0.175,0.885,0.32,1.275),
                transform 0.8s cubic-bezier(0.175,0.885,0.32,1.275);
}

.reveal-3d-right {
    opacity: 0;
    transform: perspective(800px) rotateY(22deg) translateX(50px);
    transition: opacity 0.8s cubic-bezier(0.175,0.885,0.32,1.275),
                transform 0.8s cubic-bezier(0.175,0.885,0.32,1.275);
}

.reveal-3d-up {
    opacity: 0;
    transform: perspective(800px) rotateX(18deg) translateY(45px);
    transition: opacity 0.8s cubic-bezier(0.175,0.885,0.32,1.275),
                transform 0.8s cubic-bezier(0.175,0.885,0.32,1.275);
}

.reveal-3d-scale {
    opacity: 0;
    transform: perspective(800px) scale(0.82) translateZ(-70px);
    transition: opacity 0.8s cubic-bezier(0.175,0.885,0.32,1.275),
                transform 0.8s cubic-bezier(0.175,0.885,0.32,1.275);
}

.reveal-3d-left.revealed,
.reveal-3d-right.revealed,
.reveal-3d-up.revealed,
.reveal-3d-scale.revealed {
    opacity: 1;
    transform: perspective(800px) rotateY(0) rotateX(0) translateX(0) translateY(0) translateZ(0) scale(1);
}

/* Stagger delays */
[data-rev-idx="1"] { transition-delay: 0ms; }
[data-rev-idx="2"] { transition-delay: 110ms; }
[data-rev-idx="3"] { transition-delay: 220ms; }
[data-rev-idx="4"] { transition-delay: 330ms; }
[data-rev-idx="5"] { transition-delay: 440ms; }
[data-rev-idx="6"] { transition-delay: 550ms; }

/* ===== Neon border pulse ===== */
@keyframes neonPulse {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary-500), 0 0 20px rgba(16,185,129,0.2);
        border-color: rgba(16,185,129,0.5);
    }
    50% {
        box-shadow: 0 0 12px var(--primary-400), 0 0 45px rgba(16,185,129,0.4),
                    0 0 65px rgba(6,182,212,0.2);
        border-color: rgba(16,185,129,0.85);
    }
}

.neon-border { animation: neonPulse 3s ease-in-out infinite; }

/* ===== Perspective grid decoration (section divider) ===== */
.persp-grid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 180px;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent calc(6.25% - 1px),
            rgba(16,185,129,0.07) calc(6.25% - 1px),
            rgba(16,185,129,0.07) 6.25%
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent calc(20% - 1px),
            rgba(16,185,129,0.05) calc(20% - 1px),
            rgba(16,185,129,0.05) 20%
        );
    transform: perspective(400px) rotateX(55deg);
    transform-origin: bottom center;
    pointer-events: none;
    opacity: 0.7;
}

/* ===== Glow orb backgrounds ===== */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    animation: orbDrift 18s ease-in-out infinite;
}

@keyframes orbDrift {
    0%, 100% { transform: translate(0,0) scale(1); }
    33%  { transform: translate(25px,-18px) scale(1.04); }
    66%  { transform: translate(-20px,25px) scale(0.96); }
}

/* ===== Mobile overrides ===== */
@media (max-width: 600px) {
    .canvas-label { display: none; }
    .hero-3d-scene,
    #hero-canvas  { min-height: 300px; }
}

@media (max-width: 968px) {
    .c-lbl-1, .c-lbl-2 { top: 4%; }
    .c-lbl-3, .c-lbl-4 { bottom: 4%; }
}
