:root {
    --z-webgl: 1;
    --z-css3d: 10;
    --z-company-name: 40;
    --z-slide-content: 10;
    --z-controls: 60;
    --z-nav-button: 50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    height: 100vh;
    width: 100vw;
    background: #000;
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "SimHei", sans-serif;
    overflow: hidden;
    position: relative;
}

/* WebGL background layer */
#webgl-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-webgl);
}

/* CSS3D carousel layer */
#css3d-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-css3d);
    pointer-events: none;
}

#css3d-container .slide-card {
    pointer-events: auto;
}

/* Company name */
.company-name {
    position: fixed;
    top: 5%;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    font-size: 12vw;
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8);
    text-align: center;
    letter-spacing: 0.2em;
    z-index: var(--z-company-name);
    opacity: 0;
    word-spacing: 0.5em;
    user-select: none;
    pointer-events: none;
    overflow: hidden;
    box-sizing: border-box;
}

/* Laser beam pseudo-element */
.company-name::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 34, 34, 0.2) 10%,
        #ff2222 40%,
        #ff4444 50%,
        #ff2222 60%,
        rgba(255, 34, 34, 0.2) 90%,
        transparent 100%
    );
    border-radius: 1px;
    box-shadow:
        0 0 4px 1px #ff2222,
        0 0 12px 2px rgba(255, 30, 30, 0.8),
        0 0 30px 4px rgba(255, 0, 0, 0.5),
        0 0 60px 8px rgba(255, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    /* Diagonal sweep: translate from top-left to bottom-right + rotate -45deg */
    /* --lp goes from 0 to 1 via GSAP */
    transform: translate(
        calc(var(--lp, 0) * 100% - 50%),
        calc(var(--lp, 0) * 80% - 40%)
    ) rotate(-45deg);
    transform-origin: center center;
}

/* When laser is active, make it visible */
.company-name.laser-active::after {
    opacity: 1;
}

/* Card styles (rendered by CSS3DRenderer) */
.slide-card {
    width: 700px;
    height: 500px;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    background: #111;
    transform-style: flat;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.slide-card .slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    filter: brightness(0.75);
}

.slide-card .slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.1) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

.slide-card .slide-content {
    position: absolute;
    bottom: 10%;
    left: 8%;
    right: 8%;
    color: white;
    z-index: var(--z-slide-content);
}

.slide-card .slide-title {
    font-size: clamp(1.2rem, 3.5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 0.8rem;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
    line-height: 1.1;
    opacity: 0;
    transform: translateY(40px);
}

.slide-card .slide-description {
    font-size: clamp(0.75rem, 1.4vw, 1.4rem);
    opacity: 0;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.7);
    max-width: 80%;
    line-height: 1.4;
    transform: translateY(40px);
}

.slide-card .slide-number {
    position: absolute;
    top: 8%;
    right: 8%;
    font-size: clamp(2rem, 5vw, 5rem);
    font-weight: 100;
    color: rgba(255, 255, 255, 0.25);
    font-family: 'Arial', sans-serif;
    user-select: none;
    pointer-events: none;
    opacity: 0;
}

/* Active card content animations (controlled by JS) */
.slide-card.active .slide-title {
    opacity: 1;
    transform: translateY(0);
}

.slide-card.active .slide-description {
    opacity: 0.9;
    transform: translateY(0);
}

.slide-card.active .slide-number {
    opacity: 1;
}

/* Controls */
.controls {
    position: fixed;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: var(--z-controls);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    border: none;
    padding: 0;
    display: block;
}

.dot:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.dot.active {
    background: white;
    transform: scale(1.4);
}

/* Nav buttons */
.nav-button {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    backdrop-filter: blur(10px);
    z-index: var(--z-nav-button);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-button iconify-icon {
    font-size: 28px;
    display: block;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
}

.nav-button:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.prev {
    left: 3%;
}

.next {
    right: 3%;
}

/* Responsive */
@media (max-width: 1024px) {
    .slide-card {
        border-radius: 12px;
    }
}

@media (max-width: 768px) {

    .company-name {
        font-size: 10vw;
        top: 3%;
    }

    .nav-button {
        width: 44px;
        height: 44px;
        backdrop-filter: blur(5px);
    }

    .nav-button iconify-icon {
        font-size: 22px;
    }

    .prev {
        left: 2%;
    }

    .next {
        right: 2%;
    }

    .controls {
        gap: 4px;
    }

    .dot {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {

    .slide-number {
        display: none;
    }

    .dot {
        width: 8px;
        height: 8px;
    }

    .controls {
        gap: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .dot {
        transition: none;
    }

    .nav-button {
        transition: none;
    }
}
