html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #f4f3f0;
    width: 100%;
}

/* Fix for mobile viewport height */
:root {
    --vh: 1vh;
}

/* Add loading state styles */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f4f3f0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 1s ease-out;
}

.loading.fade-out {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid hsl(0, 100%, 27%);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Base container styles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #f4f3f0;
    width: 100%;
}

.stage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
    cursor: pointer;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    background-color: #f4f3f0;
}

.stage.loaded {
    opacity: 1;
}

.video-container {
    position: relative;
    width: 100%;
    height: calc(100% - 80px);
    overflow: hidden;
}

video {
    position: absolute;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.5s ease;
    object-fit: contain;
}

video.active {
    opacity: 1;
}

/* Controls positioning */
.controls-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px; /* Fixed height for controls area */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigation buttons */
.nav-button {
    position: absolute;
    bottom: 30px;
    transform: translateY(0);
    background: rgba(139, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.8);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 30;
    opacity: 0.6;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(4px);
}

.nav-button:hover {
    background: rgba(139, 0, 0, 0.6);
    opacity: 0.9;
}

.prev-button {
    left: 20px;
}

.next-button {
    right: 20px;
}

/* Video dots indicator */
.video-dots {
    position: absolute;
    bottom: 35px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 30;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.dot.active {
    background: rgba(139, 0, 0, 0.8);
    transform: scale(1.2);
}

/* Mobile specific updates */
@media (max-width: 768px) {
    .stage {
        height: 100%;
        min-height: -webkit-fill-available;
    }

    .video-container {
        height: calc(100% - 70px);
    }

    video {
        width: 100%;
        height: 100%;
        object-fit: contain; /* Maintain aspect ratio */
    }

    .controls-container {
        height: 80px; /* Smaller control area on mobile */
    }

    .nav-button {
        bottom: 20px;
        width: 40px;
        height: 40px;
    }

    .video-dots {
        bottom: 25px;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .stage {
        height: -webkit-fill-available;
    }
    
    .video-container {
        height: calc(100% - 80px);
    }
}

/* Prevent overscroll bounce */
@media (max-width: 768px) {
    html {
        position: fixed;
        height: 100%;
        overflow: hidden;
    }
    
    body {
        overflow: hidden;
        overscroll-behavior-y: none;
        position: fixed;
        width: 100%;
        height: 100%;
    }
}

/* Curtain styles */
.curtain {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    z-index: 10;
    transition: transform 3s ease-in-out;
    overflow: hidden;
    font-size: 0;
    will-change: transform;
}

.left {
    left: 0;
}

.right {
    left: 50%;
}

.stage.open .left {
    animation: openLeft 2.5s ease-out forwards;
}

.stage.open .right {
    animation: openRight 2.5s ease-out forwards;
}

@keyframes openLeft {
    0% { transform: translateX(0); }
    80% { transform: translateX(-85%) scaleX(1.15); }
    100% { transform: translateX(-110%) scaleX(1.05); }
}

@keyframes openRight {
    0% { transform: translateX(0); }
    80% { transform: translateX(85%) scaleX(1.15); }
    100% { transform: translateX(110%) scaleX(1.05); }
}

/* Optional: Add a fade-out on open for polish */
.stage.open .curtain {
    opacity: 0.95;
    transition: transform 2.5s cubic-bezier(0.6, 0.04, 0.98, 0.335), opacity 2.5s ease-out;
}

/* Curtain units for realistic folds and texture */
.rnUnit {
    --accent: hsl(0, 80%, 50%);
    width: 10%;
    height: 100%;
    display: inline-block;
    transform-origin: 0 0;
    background-color: hsl(0, 100%, 27%);
    animation: rnUnit 6s ease-in-out infinite alternate;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.4);
    position: relative;
    background-blend-mode: overlay;
    opacity: 0.97;
    filter: contrast(1.1) brightness(0.95);
}

/* Move texture to ::before for independent rotation */
.rnUnit::before {
    content: '';
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background-image: url('./velvet-texture.png');
    opacity: 0.5;
    background-repeat: repeat;
    background-size: 100% 100%;
    z-index: -1;
    transform: rotate(0deg);
}

.rnUnit::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
    opacity: 0.95;
}

/* For the right curtain, reverse the gradient direction for symmetry */
.right .rnUnit {
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.4);
}

.right .rnUnit::after {
    background: linear-gradient(to left, transparent 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
}

@keyframes rnUnit {
    0%, 100% {
        transform: skewX(1.5deg);
    }
    50% {
        transform: skewX(-1.5deg);
    }
}

/* Stagger the animation for each unit */
.curtain .rnUnit:nth-child(1) { animation-delay: -0.2s; }
.curtain .rnUnit:nth-child(2) { animation-delay: -0.4s; }
.curtain .rnUnit:nth-child(3) { animation-delay: -0.6s; }
.curtain .rnUnit:nth-child(4) { animation-delay: -0.8s; }
.curtain .rnUnit:nth-child(5) { animation-delay: -1.0s; }
.curtain .rnUnit:nth-child(6) { animation-delay: -1.2s; }
.curtain .rnUnit:nth-child(7) { animation-delay: -1.4s; }
.curtain .rnUnit:nth-child(8) { animation-delay: -1.6s; }
.curtain .rnUnit:nth-child(9) { animation-delay: -1.8s; }
.curtain .rnUnit:nth-child(10) { animation-delay: -2.0s; }

/* Vary the texture angle for each unit */
.curtain .rnUnit:nth-child(1)::before { transform: rotate(-2.5deg); }
.curtain .rnUnit:nth-child(2)::before { transform: rotate(-1.8deg); }
.curtain .rnUnit:nth-child(3)::before { transform: rotate(-1deg); }
.curtain .rnUnit:nth-child(4)::before { transform: rotate(-0.5deg); }
.curtain .rnUnit:nth-child(5)::before { transform: rotate(0deg); }
.curtain .rnUnit:nth-child(6)::before { transform: rotate(0.5deg); }
.curtain .rnUnit:nth-child(7)::before { transform: rotate(1deg); }
.curtain .rnUnit:nth-child(8)::before { transform: rotate(1.5deg); }
.curtain .rnUnit:nth-child(9)::before { transform: rotate(2deg); }
.curtain .rnUnit:nth-child(10)::before { transform: rotate(2.5deg); }

/* Sparkle effect */
.curtain::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 2%, transparent 2%);
    background-size: 50px 50px;
    opacity: 0.1;
    pointer-events: none;
}

/* Responsive curtain adjustments */
@media (max-width: 768px) {
    .rnUnit {
        width: 20%;
    }
} 

/* Play button styles */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: rgba(139, 0, 0, 0.9);
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3),
                inset 0 0 15px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    animation: buttonFadeIn 1s ease-out forwards;
    animation-delay: 0.5s;
}

.play-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 20px 0 20px 35px;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.play-button::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.play-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(139, 0, 0, 1);
    box-shadow: 0 0 40px rgba(139, 0, 0, 0.4),
                inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.play-button:hover::before {
    border-color: transparent transparent transparent rgba(255, 255, 255, 1);
    transform: translate(-50%, -50%) scale(1.1);
}

@keyframes buttonFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.stage.open .play-button {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
    transition: all 0.5s ease;
} 