/* =============================================
   ENTRANCE.CSS — Gothic Door + Cosmic Title Reveal
   Doors open OUTWARD (toward viewer), revealing site
   ============================================= */

.entrance-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-entrance);
    background: #020408;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background 2.5s ease;
}

/* When doors open, fade the dark backdrop to reveal website behind */
.entrance-overlay.phase-open {
    background: rgba(2, 4, 8, 0);
}

/* Ambient light — warm torchlight from above illuminating wooden doors */
.entrance-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 100%;
    background:
        radial-gradient(ellipse 60% 40% at 50% 15%, rgba(160, 130, 80, 0.30) 0%, transparent 60%),
        radial-gradient(ellipse 80% 60% at 50% 45%, rgba(70, 55, 30, 0.25) 0%, transparent 65%),
        radial-gradient(ellipse 40% 30% at 50% 50%, rgba(200, 160, 60, 0.08) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
    transition: opacity 2s ease;
}
.entrance-overlay.phase-open::before {
    opacity: 0;
}

.entrance-scene {
    position: absolute;
    inset: 0;
    width: 100vw;
    height: 100vh;
    perspective: 1200px;
    -webkit-perspective: 1200px;
    perspective-origin: 50% 45%;
    -webkit-perspective-origin: 50% 45%;
}

/* --- Doors --- */
.door {
    position: absolute;
    top: -2%;
    width: 49.7%;
    height: 104%;
    z-index: 2;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    /* Add shadow for 3D depth when doors come toward viewer */
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.8));
}
.door svg,
.door img,
.door picture {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}
.door picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.door-left {
    left: 0;
    transform-origin: left center;
    -webkit-transform-origin: left center;
    transform: rotateY(0deg);
    -webkit-transform: rotateY(0deg);
    will-change: transform;
    /* No CSS transition — GSAP handles animation for reliable mobile support */
}
/* Pin left door's RIGHT edge (the seam side) so crest aligns at center */
.door-left img {
    object-position: right center;
}
.door-right {
    right: 0;
    transform-origin: right center;
    -webkit-transform-origin: right center;
    transform: rotateY(0deg);
    -webkit-transform: rotateY(0deg);
    will-change: transform;
}
/* Pin right door's LEFT edge (the seam side) so crest aligns at center */
.door-right img {
    object-position: left center;
}

/* Fallback for phase-open (GSAP overrides these via inline styles) */
.entrance-overlay.phase-open .door-left {
    filter: drop-shadow(10px 0 40px rgba(0, 0, 0, 0.9));
}
.entrance-overlay.phase-open .door-right {
    filter: drop-shadow(-10px 0 40px rgba(0, 0, 0, 0.9));
}

/* --- Door Seam Glow — shimmering light creeping through crack --- */
.door-seam {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 80%;
    z-index: 3;
    overflow: visible;
    /* Bright golden base */
    background: linear-gradient(
        to bottom,
        rgba(255, 220, 100, 0.0) 0%,
        rgba(255, 230, 120, 0.70) 10%,
        rgba(255, 240, 140, 0.85) 30%,
        rgba(255, 220, 100, 0.60) 50%,
        rgba(255, 235, 130, 0.80) 70%,
        rgba(255, 220, 100, 0.65) 90%,
        rgba(255, 220, 100, 0.0) 100%
    );
    box-shadow:
        0 0 10px rgba(255, 210, 80, 0.45),
        0 0 25px rgba(255, 200, 60, 0.25),
        0 0 50px rgba(200, 160, 60, 0.12);
    animation: seamPulse 2.5s ease-in-out infinite, seamFlicker 0.15s ease-in-out infinite;
    transition: opacity 0.6s ease;
}
/* Traveling light hotspot that moves up the seam */
.door-seam::before {
    content: '';
    position: absolute;
    left: -6px;
    width: 18px;
    height: 30%;
    background: radial-gradient(ellipse at center,
        rgba(255, 245, 180, 0.9) 0%,
        rgba(255, 220, 100, 0.5) 35%,
        transparent 70%
    );
    filter: blur(3px);
    animation: seamTravel 3.5s ease-in-out infinite;
}
/* Second hotspot traveling opposite direction */
.door-seam::after {
    content: '';
    position: absolute;
    left: -5px;
    width: 16px;
    height: 20%;
    background: radial-gradient(ellipse at center,
        rgba(255, 250, 200, 0.7) 0%,
        rgba(255, 210, 80, 0.3) 45%,
        transparent 70%
    );
    filter: blur(2px);
    animation: seamTravel 2.4s ease-in-out infinite reverse;
    animation-delay: -1s;
}
@keyframes seamPulse {
    0%, 100% { opacity: 0.85; box-shadow: 0 0 8px rgba(255, 210, 80, 0.35), 0 0 20px rgba(255, 200, 60, 0.15); }
    50% { opacity: 1; box-shadow: 0 0 14px rgba(255, 220, 100, 0.50), 0 0 35px rgba(255, 200, 60, 0.25), 0 0 60px rgba(200, 160, 60, 0.10); }
}
@keyframes seamFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.92; }
}
@keyframes seamTravel {
    0% { top: -30%; }
    100% { top: 100%; }
}

/* --- Gold Burst Sparks (created dynamically by JS) --- */
.gold-spark {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffe08a, #c8a03c);
    box-shadow: 0 0 8px rgba(232, 213, 160, 0.8), 0 0 20px rgba(200, 160, 60, 0.5);
    z-index: 5;
    pointer-events: none;
}
.gold-streak {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 20px;
    border-radius: 2px;
    background: linear-gradient(to bottom, rgba(255, 224, 138, 0.9), transparent);
    z-index: 5;
    pointer-events: none;
}

/* --- Light Beam --- */
.entrance-light {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(200, 160, 60, 0.20), transparent 70%);
    z-index: 1;
    opacity: 0;
    transition: all 2s ease;
}
.entrance-overlay.phase-open .entrance-light {
    width: 150%;
    opacity: 1;
}

/* --- Dust Motes --- */
.entrance-dust {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    pointer-events: none;
}

.dust-mote {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--gold-bright);
    opacity: 0;
    box-shadow: 0 0 8px rgba(232, 213, 160, 0.7);
}
.entrance-overlay.phase-open .dust-mote {
    animation: dustFloat var(--dur) ease-out var(--delay) forwards;
}

@keyframes dustFloat {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.5);
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx), var(--dy)) scale(0);
    }
}

/* --- Smoke Particles --- */
.entrance-smoke {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
}

.smoke-particle {
    position: absolute;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 160, 60, 0.10), transparent 70%);
    opacity: 0;
    filter: blur(35px);
}
.smoke-particle:nth-child(1) { left: -200px; top: -100px; }
.smoke-particle:nth-child(2) { left: 100px; top: -150px; }
.smoke-particle:nth-child(3) { left: -100px; top: 50px; }
.smoke-particle:nth-child(4) { left: 150px; top: 100px; }
.smoke-particle:nth-child(5) { left: -250px; top: -50px; }
.smoke-particle:nth-child(6) { left: 200px; top: -30px; }

.entrance-overlay.phase-open .smoke-particle {
    animation: smokeReveal 3s ease-out forwards;
}
.entrance-overlay.phase-open .smoke-particle:nth-child(2) { animation-delay: 0.15s; }
.entrance-overlay.phase-open .smoke-particle:nth-child(3) { animation-delay: 0.3s; }
.entrance-overlay.phase-open .smoke-particle:nth-child(4) { animation-delay: 0.45s; }
.entrance-overlay.phase-open .smoke-particle:nth-child(5) { animation-delay: 0.1s; }
.entrance-overlay.phase-open .smoke-particle:nth-child(6) { animation-delay: 0.25s; }

@keyframes smokeReveal {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    30% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: scale(2.5) translate(var(--dx, 50px), var(--dy, -80px));
    }
}

/* --- Title Reveal (hidden — website is the reveal now) --- */
.entrance-title {
    display: none;
}

/* --- Fade Out Phase --- */
.entrance-overlay.phase-fadeout {
    animation: entranceFadeOut 2s ease forwards;
}

@keyframes entranceFadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

/* --- Pulsing Rune Glow (legacy, kept for compatibility) --- */
.rune-pulse {
    animation: runePulse 3s ease-in-out infinite;
}
@keyframes runePulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* --- Door face shadow (adds depth when doors are closed) --- */
.door::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0) 0%,
        rgba(0,0,0,0.15) 30%,
        rgba(0,0,0,0.05) 50%,
        rgba(0,0,0,0.25) 100%
    );
    pointer-events: none;
    z-index: 3;
}

/* --- Skip Entrance --- */
.entrance-overlay.skip {
    display: none;
}
