/* =============================================
   CROWN EFFECTS — Intro, Floating Crowns, Particles
   ============================================= */

/* ---- 3D CROWN INTRO OVERLAY ---- */
.crown-intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: radial-gradient(ellipse at center, #1a0f2e 0%, #0a0618 40%, #000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.crown-intro.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.crown-intro-inner {
    position: relative;
    perspective: 800px;
}

/* The big 3D rotating crown */
.crown-3d {
    width: 250px;
    height: 210px;
    filter: drop-shadow(0 0 30px rgba(240, 168, 48, 0.5)) drop-shadow(0 0 60px rgba(240, 168, 48, 0.25));
    animation: crown3dSpin 3s ease-in-out infinite, crownPulse 2s ease-in-out infinite alternate;
    transform-style: preserve-3d;
}

@keyframes crown3dSpin {
    0% { transform: rotateY(-15deg) rotateX(5deg) scale(1); }
    25% { transform: rotateY(15deg) rotateX(-3deg) scale(1.05); }
    50% { transform: rotateY(-10deg) rotateX(5deg) scale(1); }
    75% { transform: rotateY(20deg) rotateX(-5deg) scale(1.03); }
    100% { transform: rotateY(-15deg) rotateX(5deg) scale(1); }
}

@keyframes crownPulse {
    0% {
        filter: drop-shadow(0 0 30px rgba(240, 168, 48, 0.5)) drop-shadow(0 0 60px rgba(240, 168, 48, 0.25));
    }
    100% {
        filter: drop-shadow(0 0 50px rgba(240, 168, 48, 0.8)) drop-shadow(0 0 100px rgba(240, 168, 48, 0.4)) drop-shadow(0 0 150px rgba(255, 165, 0, 0.15));
    }
}

/* Gold particles around the intro crown */
.crown-intro-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    margin-top: -150px;
    margin-left: -150px;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: #f0a830;
    border-radius: 50%;
    animation: particleOrbit 4s linear infinite;
    box-shadow: 0 0 6px rgba(240, 168, 48, 0.4);
}

.particle:nth-child(1) { top: 0; left: 50%; animation-delay: 0s; }
.particle:nth-child(2) { top: 15%; left: 90%; animation-delay: -0.5s; width: 3px; height: 3px; }
.particle:nth-child(3) { top: 50%; left: 100%; animation-delay: -1s; }
.particle:nth-child(4) { top: 85%; left: 90%; animation-delay: -1.5s; width: 3px; height: 3px; background: #ffd06b; }
.particle:nth-child(5) { top: 100%; left: 50%; animation-delay: -2s; }
.particle:nth-child(6) { top: 85%; left: 10%; animation-delay: -2.5s; width: 3px; height: 3px; }
.particle:nth-child(7) { top: 50%; left: 0; animation-delay: -3s; background: #ffd06b; }
.particle:nth-child(8) { top: 15%; left: 10%; animation-delay: -3.5s; width: 3px; height: 3px; }

@keyframes particleOrbit {
    0% { opacity: 0; transform: scale(0) translateY(0); }
    20% { opacity: 1; transform: scale(1) translateY(-10px); }
    80% { opacity: 0.6; transform: scale(0.8) translateY(-30px); }
    100% { opacity: 0; transform: scale(0) translateY(-50px); }
}

/* ---- FLOATING DECORATIVE CROWNS ---- */
.floating-crown {
    position: absolute;
    z-index: 0;
    pointer-events: none;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

.fc-1 { width: 80px; top: 10%; left: 5%; animation: floatCrown1 12s infinite; }
.fc-2 { width: 50px; top: 70%; right: 8%; left: auto; animation: floatCrown2 15s infinite; }
.fc-3 { width: 65px; top: 35%; right: 3%; left: auto; animation: floatCrown3 18s infinite; }
.fc-4 { width: 100px; bottom: 15%; left: 10%; top: auto; animation: floatCrown4 20s infinite; }
.fc-5 { width: 45px; top: 20%; left: 40%; animation: floatCrown5 14s infinite; }

@keyframes floatCrown1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, -30px) rotate(10deg); }
    50% { transform: translate(-10px, -15px) rotate(-5deg); }
    75% { transform: translate(15px, 10px) rotate(8deg); }
}

@keyframes floatCrown2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-25px, -20px) rotate(-12deg); }
    66% { transform: translate(15px, -35px) rotate(8deg); }
}

@keyframes floatCrown3 {
    0%, 100% { transform: translate(0, 0) rotate(5deg); }
    25% { transform: translate(-30px, 15px) rotate(-10deg); }
    50% { transform: translate(10px, 30px) rotate(15deg); }
    75% { transform: translate(-20px, -10px) rotate(-5deg); }
}

@keyframes floatCrown4 {
    0%, 100% { transform: translate(0, 0) rotate(-3deg); }
    50% { transform: translate(25px, -40px) rotate(12deg); }
}

@keyframes floatCrown5 {
    0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
    33% { transform: translate(-15px, -20px) rotate(-8deg) scale(1.1); }
    66% { transform: translate(20px, 10px) rotate(12deg) scale(0.9); }
}

/* ---- SECTION CROWN DECORATORS ---- */
.section-title {
    position: relative;
}

/* ---- CROWN RAIN — Continuous falling crowns ---- */
.crown-rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.rain-crown {
    position: absolute;
    top: -80px;
    pointer-events: none;
    animation: crownFall linear forwards;
}

.rain-crown svg {
    width: 100%;
    height: 100%;
    opacity: inherit;
}

@keyframes crownFall {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
    5% { opacity: var(--crown-opacity, 0.04); }
    85% { opacity: var(--crown-opacity, 0.04); }
    100% { transform: translateY(calc(100vh + 100px)) translateX(var(--drift, 0px)) rotate(var(--rotation, 15deg)); opacity: 0; }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .crown-3d {
        width: 180px;
        height: 150px;
    }

    .floating-crown {
        display: none;
    }

    .fc-1, .fc-3 {
        display: block;
        width: 40px;
        opacity: 0.5;
    }

    .crown-rain-container {
        display: none;
    }
}