#home {
    height: 300vh !important;
    padding: 0 !important;
    position: relative;
    overflow: visible;
}

#canvas-container {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    overflow: hidden;
}

#hero-lightpass {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    will-change: opacity, visibility;
    transition: opacity 0.1s ease-in, visibility 0.1s;
}

#canvas-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    color: var(--amber);
    /* using variable from style.css */
    font-family: "Share Tech Mono", monospace;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--amber);
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.home-sticky-wrapper {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 70px 18px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

/* glitch*/
@keyframes crt-glitch {
    0% {
        transform: scale(1);
        filter: brightness(1) contrast(1);
    }

    10% {
        transform: scale(1.02) skewX(2deg);
        filter: brightness(1.5) contrast(1.2) hue-rotate(90deg);
        opacity: 0.8;
    }

    20% {
        transform: scale(0.98) skewX(-2deg);
        filter: brightness(0.5) contrast(2) invert(0.2);
    }

    30% {
        transform: translateX(-10px) skewX(5deg);
        filter: brightness(1.2);
    }

    40% {
        transform: translateX(10px) skewX(-5deg);
        filter: brightness(0.8) sepia(0.5);
    }

    50% {
        transform: scale(1.05) translateY(-5px);
        filter: brightness(2) contrast(1.5);
        opacity: 0.5;
    }

    60% {
        transform: scale(0.95) translateY(5px);
        filter: brightness(0.3);
    }

    70% {
        text-shadow: 2px 0 red, -2px 0 blue;
        transform: skewX(1deg);
        opacity: 0.7;
    }

    80% {
        text-shadow: none;
        transform: scaleY(0.1);
        filter: brightness(3) contrast(3);
    }

    90% {
        transform: scaleY(0);
        opacity: 0.2;
    }

    100% {
        transform: scaleY(0);
        opacity: 0;
        filter: brightness(0);
    }
}

.glitching {
    animation: crt-glitch 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    pointer-events: none;
}

.home-hidden-permanently {
    display: none !important;
}

/* Mobile view (disable canvas, show normal home content, hide bg box) */
@media (max-width: 767px) {
    #home {
        height: auto !important;
        /* Remove 300vh scroll spacer */
        min-height: calc(100vh - 70px) !important;
    }

    #canvas-container {
        display: none !important;
        /* Hide 3D animation completely */
    }

    .home-sticky-wrapper {
        position: relative !important;
        /* Re-enable natural page flow */
        height: auto !important;
    }

    /* glitch for mobile that doesn't shrink or disappear */
    .glitching {
        animation: mobile-crt-glitch 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
    }
}

@keyframes mobile-crt-glitch {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    20% {
        transform: scale(1.02) skewX(2deg);
        filter: brightness(1.5) hue-rotate(90deg);
    }

    40% {
        transform: translateX(-5px) skewX(-2deg);
        filter: brightness(0.8) invert(0.2);
    }

    60% {
        transform: scale(0.98) translateY(2px);
        filter: brightness(1.2) sepia(0.5);
    }

    80% {
        text-shadow: 2px 0 red, -2px 0 blue;
        transform: skewX(1deg);
    }

    100% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
        text-shadow: none;
    }
}

/* Desktop view (show canvas, hide duplicate home content) */
@media (min-width: 768px) {
    .home-sticky-wrapper {
        margin-top: -100vh;
    }

    #hero-lightpass.visible {
        opacity: 1;
        visibility: visible;
    }
}
