/* ==========================================================================
   AUTOSIAL // CINEMATIC PRELOADER & RECONSTRUCTION SPLASH SCREEN
   Autosial Dealership Design System (ADDS) - Fiat / Stellantis
   ========================================================================== */

#autosial-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 40%, #0F141C 0%, #07090D 65%, #040507 100%);
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.8s;
}

#autosial-preloader.preloader-dismiss {
    opacity: 0 !important;
    transform: scale(1.06) !important;
    filter: blur(12px) !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Ambient Cyber Grid & Telemetry Lines */
.preloader-grid-bg {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    background-position: center center;
    opacity: 0.6;
    pointer-events: none;
}

.preloader-ambient-glow {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.08) 0%, rgba(0, 210, 255, 0.04) 40%, transparent 70%);
    filter: blur(60px);
    pointer-events: none;
    animation: ambientBreathe 4s ease-in-out infinite alternate;
}

@keyframes ambientBreathe {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

/* ─── 1. TOP LOGO EMBLEM & ORBITAL RINGS ─── */
.preloader-logo-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preloader-orbital-ring {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2px dashed rgba(245, 158, 11, 0.35);
    animation: orbitRotate 14s linear infinite;
    pointer-events: none;
}

.preloader-orbital-ring-reverse {
    position: absolute;
    inset: -22px;
    border-radius: 50%;
    border: 1px dotted rgba(0, 210, 255, 0.3);
    animation: orbitRotateReverse 20s linear infinite;
    pointer-events: none;
}

@keyframes orbitRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes orbitRotateReverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

.preloader-emblem-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.25), 0 0 70px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 2;
    animation: emblemPulse 3s ease-in-out infinite;
}

@keyframes emblemPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.3)); }
    50% { transform: scale(1.04); filter: drop-shadow(0 0 35px rgba(245, 158, 11, 0.6)); }
}

/* ─── 2. RECONSTRUCTION VECTOR WORDMARK (AUTOSIAL) ─── */
.preloader-reconstruct-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2.5rem;
}

.reconstruct-svg-wordmark {
    width: 480px;
    max-width: 90vw;
    height: auto;
    overflow: visible;
}

/* Stroke blueprint drawing animation for each letter */
.reconstruct-char {
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: transparent;
    stroke-dasharray: 450;
    stroke-dashoffset: 450;
    animation: drawAndFillChar 2.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Stagger drawing per character */
.reconstruct-char.c-1 { animation-delay: 0.1s; }
.reconstruct-char.c-2 { animation-delay: 0.25s; }
.reconstruct-char.c-3 { animation-delay: 0.4s; }
.reconstruct-char.c-4 { animation-delay: 0.55s; }
.reconstruct-char.c-5 { animation-delay: 0.7s; }
.reconstruct-char.c-6 { animation-delay: 0.85s; }
.reconstruct-char.c-7 { animation-delay: 1.0s; }
.reconstruct-char.c-8 { animation-delay: 1.15s; }

@keyframes drawAndFillChar {
    0% {
        stroke-dashoffset: 450;
        stroke: #F59E0B;
        fill: transparent;
        filter: drop-shadow(0 0 8px #F59E0B);
    }
    55% {
        stroke-dashoffset: 0;
        stroke: #00D2FF;
        fill: rgba(255, 255, 255, 0.1);
        filter: drop-shadow(0 0 14px #00D2FF);
    }
    85%, 100% {
        stroke-dashoffset: 0;
        stroke: #FFFFFF;
        fill: #FFFFFF;
        filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
    }
}

/* Laser sweep beam */
.laser-scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.6), rgba(255, 255, 255, 0.9), rgba(0, 210, 255, 0.6), transparent);
    filter: blur(4px);
    opacity: 0.85;
    pointer-events: none;
    animation: laserScan 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes laserScan {
    0% { transform: translateX(-50px); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateX(520px); opacity: 0; }
}

/* Sub-badge below wordmark */
.preloader-brand-sub {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 1rem;
    padding: 6px 18px;
    border-radius: 50px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #F59E0B;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
    opacity: 0;
    animation: fadeInSub 0.8s ease 0.9s forwards;
}

@keyframes fadeInSub {
    to { opacity: 1; transform: translateY(0); }
    from { opacity: 0; transform: translateY(8px); }
}

.preloader-tricolor-dots {
    display: inline-flex;
    gap: 4px;
}
.preloader-tricolor-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.preloader-tricolor-dots span.dot-green { background: #009246; box-shadow: 0 0 8px #009246; }
.preloader-tricolor-dots span.dot-white { background: #FFFFFF; box-shadow: 0 0 8px #FFFFFF; }
.preloader-tricolor-dots span.dot-red   { background: #CE2B37; box-shadow: 0 0 8px #CE2B37; }

/* ─── 3. TELEMETRY PROGRESS BAR & HUD ─── */
.preloader-telemetry-hud {
    width: 360px;
    max-width: 85vw;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preloader-progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.preloader-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #FF2E63, #FFC000, #00D2FF, #00C853);
    border-radius: 4px;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.8);
    transition: width 0.15s ease-out;
}

.preloader-hud-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #94A3B8;
}

.preloader-status-text {
    letter-spacing: 0.05em;
    color: #CBD5E1;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.preloader-percent-num {
    font-weight: 800;
    color: #F59E0B;
}

/* Mobile Responsiveness */
@media (max-width: 576px) {
    .preloader-logo-wrapper { width: 110px; height: 110px; margin-bottom: 1.5rem; }
    .preloader-emblem-img { width: 95px; height: 95px; }
    .reconstruct-svg-wordmark { width: 320px; }
    .preloader-brand-sub { font-size: 0.6rem; letter-spacing: 0.15em; padding: 4px 12px; }
    .preloader-telemetry-hud { width: 280px; }
}
