/* ========================================
   DJ ABHI-Maheshtala — 3D Parallax System
   Premium scroll-reactive effects
   ======================================== */

/* ---- Parallax Sections ---- */
.parallax-section {
    perspective: 1200px;
    perspective-origin: 50% 50%;
    overflow: hidden;
}

/* ---- 3D Scroll Reveal System ---- */
[data-scroll-reveal] {
    opacity: 0;
    transform: translate3d(0, 60px, -30px) rotateX(4deg);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

[data-scroll-reveal].revealed {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateX(0deg);
}

/* ---- Stagger Delays ---- */
[data-scroll-reveal][data-stagger="1"] { transition-delay: 0.05s; }
[data-scroll-reveal][data-stagger="2"] { transition-delay: 0.1s; }
[data-scroll-reveal][data-stagger="3"] { transition-delay: 0.15s; }
[data-scroll-reveal][data-stagger="4"] { transition-delay: 0.2s; }
[data-scroll-reveal][data-stagger="5"] { transition-delay: 0.25s; }
[data-scroll-reveal][data-stagger="6"] { transition-delay: 0.3s; }
[data-scroll-reveal][data-stagger="7"] { transition-delay: 0.35s; }
[data-scroll-reveal][data-stagger="8"] { transition-delay: 0.4s; }

/* ---- Direction Variants ---- */
[data-scroll-reveal="left"] {
    transform: translate3d(-50px, 30px, -20px) rotateY(3deg);
}
[data-scroll-reveal="left"].revealed {
    transform: translate3d(0, 0, 0) rotateY(0deg);
}

[data-scroll-reveal="right"] {
    transform: translate3d(50px, 30px, -20px) rotateY(-3deg);
}
[data-scroll-reveal="right"].revealed {
    transform: translate3d(0, 0, 0) rotateY(0deg);
}

[data-scroll-reveal="scale"] {
    transform: translate3d(0, 40px, -50px) scale(0.92);
}
[data-scroll-reveal="scale"].revealed {
    transform: translate3d(0, 0, 0) scale(1);
}

[data-scroll-reveal="fade"] {
    transform: translate3d(0, 20px, 0);
}
[data-scroll-reveal="fade"].revealed {
    transform: translate3d(0, 0, 0);
}

/* ---- Parallax Depth Layers ---- */
[data-depth="1"] {
    --parallax-speed: 0.03;
}
[data-depth="2"] {
    --parallax-speed: 0.06;
}
[data-depth="3"] {
    --parallax-speed: 0.09;
}

/* ---- Hero Parallax ---- */
.hero {
    perspective: 1000px;
}

.hero-bg {
    will-change: transform;
    transition: transform 0.1s linear;
}

.hero-content {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* ---- Gradient Shimmer on gradient-text ---- */
@keyframes gradientShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.gradient-text {
    background-size: 200% auto;
    animation: gradientShimmer 4s ease-in-out infinite;
}

/* ---- Scroll-linked Section Separator ---- */
.section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(108, 60, 233, 0.15) 20%,
        rgba(139, 92, 246, 0.2) 50%,
        rgba(232, 93, 44, 0.15) 80%,
        transparent 100%);
    opacity: 0.5;
    pointer-events: none;
}

body:not(.light-mode) .section::after {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 240, 255, 0.1) 20%,
        rgba(139, 92, 246, 0.12) 50%,
        rgba(255, 0, 170, 0.1) 80%,
        transparent 100%);
}

/* ---- Magnetic Hover for Buttons ---- */
.btn {
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.3s ease;
}

/* ---- Sound Wave Upgrade ---- */
.sound-bar {
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.sound-bar:nth-child(1) { animation-duration: 0.8s !important; }
.sound-bar:nth-child(2) { animation-duration: 0.6s !important; }
.sound-bar:nth-child(3) { animation-duration: 0.9s !important; }
.sound-bar:nth-child(4) { animation-duration: 0.5s !important; }
.sound-bar:nth-child(5) { animation-duration: 0.7s !important; }
.sound-bar:nth-child(6) { animation-duration: 1.0s !important; }
.sound-bar:nth-child(7) { animation-duration: 0.65s !important; }

/* ---- Back to Top Button ---- */
.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-main);
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 4px 20px rgba(108, 60, 233, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.back-to-top:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 30px rgba(108, 60, 233, 0.5);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
    transition: transform 0.3s ease;
}

.back-to-top:hover svg {
    transform: translateY(-2px);
}

/* Progress ring around back-to-top */
.back-to-top .progress-ring {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 54px;
    height: 54px;
    transform: rotate(-90deg);
}

.back-to-top .progress-ring circle {
    fill: none;
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 2;
}

.back-to-top .progress-ring .progress-ring-fill {
    stroke: #ffffff;
    stroke-width: 2.5;
    stroke-dasharray: 150;
    stroke-dashoffset: 150;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    [data-scroll-reveal],
    [data-scroll-reveal].revealed {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .hero-bg,
    .hero-content {
        will-change: auto !important;
        transition: none !important;
    }

    .gradient-text {
        animation: none !important;
    }

    .back-to-top {
        transition: opacity 0.2s ease !important;
        transform: none !important;
    }
    
    .back-to-top.visible {
        transform: none !important;
    }
}

/* ---- Mobile Optimization ---- */
@media (max-width: 768px) {
    [data-scroll-reveal] {
        transform: translate3d(0, 30px, 0);
    }

    [data-scroll-reveal="left"],
    [data-scroll-reveal="right"] {
        transform: translate3d(0, 30px, 0);
    }

    .back-to-top {
        bottom: 20px;
        left: 20px;
        width: 42px;
        height: 42px;
    }

    .back-to-top .progress-ring {
        width: 48px;
        height: 48px;
    }
}
