/* ── Site Preloader & FOUC Prevention ── */

/* 1. Hide the main site wrapper until everything is parsed and painted */
html:not(.site-loaded) #site-wrapper,
html:not(.site-loaded) main,
html:not(.site-loaded) header,
html:not(.site-loaded) footer {
    opacity: 0 !important;
    visibility: hidden !important;
}

html.site-loaded #site-wrapper,
html.site-loaded main,
html.site-loaded header,
html.site-loaded footer {
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.4s ease-in-out;
}

/* 2. Preloader Container */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

.site-loaded #preloader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* 3. Loader Content & Animation (Dot Snake) */
.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.loader-logo {
    width: 180px;
    height: auto;
    animation: pulse-logo 2s infinite ease-in-out;
}

.dot-snake {
    display: flex;
    gap: 12px;
}

.dot-snake div {
    width: 12px;
    height: 12px;
    border: 2px solid #3f51b5;
    border-radius: 50%;
    position: relative;
}

.dot-snake div::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    width: 12px;
    height: 12px;
    background: #3f51b5;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    animation: dot-glow 1.4s infinite ease-in-out;
}

.dot-snake div:nth-child(1)::before { animation-delay: 0s; }
.dot-snake div:nth-child(2)::before { animation-delay: 0.2s; }
.dot-snake div:nth-child(3)::before { animation-delay: 0.4s; }
.dot-snake div:nth-child(4)::before { animation-delay: 0.6s; }
.dot-snake div:nth-child(5)::before { animation-delay: 0.8s; }
.dot-snake div:nth-child(6)::before { animation-delay: 1.0s; }
.dot-snake div:nth-child(7)::before { animation-delay: 1.2s; }

@keyframes dot-glow {
    0%, 100% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1.1); }
}

@keyframes pulse-logo {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}
