/**
 * Navesa Loader - Three.js Scenic Loading Screen
 * Beautiful 3D landscape with mountains, meadow, campfire, and time-of-day themes
 * v1.0.0
 */

/* ==================== BASE CONTAINER ==================== */
#navesa-loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    background: #1a1a2e;
    overflow: hidden;
}

#navesa-loader-container.hidden {
    display: none;
}

#navesa-loader-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ==================== CINEMATIC VIGNETTE ==================== */
.navesa-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    background: radial-gradient(ellipse at center,
        transparent 0%,
        transparent 45%,
        rgba(0,0,0,0.25) 75%,
        rgba(0,0,0,0.6) 100%
    );
}

/* ==================== FLOATING PARTICLES ==================== */
#navesa-particles-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 6;
    pointer-events: none;
    overflow: hidden;
}

.navesa-ember {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, #ffaa44 0%, #ff6622 50%, transparent 100%);
    border-radius: 50%;
    filter: blur(1px);
    animation: navesa-float-ember 8s ease-in-out infinite;
    opacity: 0;
}

@keyframes navesa-float-ember {
    0%, 100% {
        opacity: 0;
        transform: translateY(100vh) scale(0.5);
    }
    10% { opacity: 0.8; }
    90% { opacity: 0.6; }
    100% {
        opacity: 0;
        transform: translateY(-20vh) scale(1.2);
    }
}

.navesa-dust {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 220, 180, 0.4);
    border-radius: 50%;
    animation: navesa-float-dust 15s linear infinite;
}

@keyframes navesa-float-dust {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.3; }
    100% { transform: translate(50px, -100vh) rotate(360deg); opacity: 0; }
}

/* ==================== OVERLAY ==================== */
#navesa-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.navesa-logo-container {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

/* ==================== RUNE CIRCLE ==================== */
.navesa-rune-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 260px;
    height: 260px;
    pointer-events: none;
}

.navesa-rune-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--navesa-rune-color, rgba(255, 180, 100, 0.3));
    animation: navesa-rotate-ring 30s linear infinite;
}

.navesa-rune-ring:nth-child(2) {
    width: 88%;
    height: 88%;
    top: 6%;
    left: 6%;
    animation: navesa-rotate-ring 25s linear infinite reverse;
    border-style: dashed;
}

.navesa-rune-ring:nth-child(3) {
    width: 112%;
    height: 112%;
    top: -6%;
    left: -6%;
    animation: navesa-rotate-ring 35s linear infinite;
    border: 2px solid var(--navesa-rune-color, rgba(255, 180, 100, 0.15));
}

@keyframes navesa-rotate-ring {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== RUNE SYMBOLS ==================== */
.navesa-rune-symbols {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    animation: navesa-rotate-ring 40s linear infinite;
}

.navesa-rune {
    position: absolute;
    font-family: 'Cinzel', serif;
    font-size: 16px;
    color: var(--navesa-rune-glow, rgba(255, 180, 100, 0.6));
    text-shadow: 0 0 10px var(--navesa-rune-glow, rgba(255, 150, 50, 0.8));
    animation: navesa-rune-pulse 3s ease-in-out infinite;
}

.navesa-rune:nth-child(1) { top: 0; left: 50%; transform: translate(-50%, -50%); animation-delay: 0s; }
.navesa-rune:nth-child(2) { top: 14.6%; left: 85.4%; transform: translate(-50%, -50%); animation-delay: 0.3s; }
.navesa-rune:nth-child(3) { top: 50%; left: 100%; transform: translate(-50%, -50%); animation-delay: 0.6s; }
.navesa-rune:nth-child(4) { top: 85.4%; left: 85.4%; transform: translate(-50%, -50%); animation-delay: 0.9s; }
.navesa-rune:nth-child(5) { top: 100%; left: 50%; transform: translate(-50%, -50%); animation-delay: 1.2s; }
.navesa-rune:nth-child(6) { top: 85.4%; left: 14.6%; transform: translate(-50%, -50%); animation-delay: 1.5s; }
.navesa-rune:nth-child(7) { top: 50%; left: 0; transform: translate(-50%, -50%); animation-delay: 1.8s; }
.navesa-rune:nth-child(8) { top: 14.6%; left: 14.6%; transform: translate(-50%, -50%); animation-delay: 2.1s; }

@keyframes navesa-rune-pulse {
    0%, 100% { opacity: 0.4; filter: blur(0px); }
    50% { opacity: 1; filter: blur(1px); }
}

/* ==================== FIRE ICON ==================== */
.navesa-fire-wrapper {
    position: relative;
    display: inline-block;
}

.navesa-fire-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    background: radial-gradient(circle,
        rgba(255, 150, 50, 0.4) 0%,
        rgba(255, 100, 30, 0.2) 30%,
        transparent 70%
    );
    border-radius: 50%;
    animation: navesa-fire-glow-pulse 2s ease-in-out infinite;
    filter: blur(15px);
}

@keyframes navesa-fire-glow-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

.navesa-fire-icon {
    position: relative;
    width: 90px;
    height: 90px;
    margin-bottom: 15px;
    filter: drop-shadow(0 5px 25px rgba(255, 120, 50, 0.5));
    z-index: 2;
}

.navesa-flame {
    animation: navesa-flicker 0.3s ease-in-out infinite alternate;
    transform-origin: bottom center;
}

.navesa-flame-outer { animation-delay: 0.1s; }
.navesa-flame-inner { animation-delay: 0.05s; }

@keyframes navesa-flicker {
    0% { transform: scaleY(1) scaleX(1); }
    100% { transform: scaleY(1.03) scaleX(0.98); }
}

/* ==================== LOGO TEXT ==================== */
.navesa-logo-text {
    font-family: 'Satisfy', cursive;
    font-size: clamp(2.8rem, 11vw, 5rem);
    font-weight: 400;
    color: var(--navesa-text-color, #4a3425);
    text-shadow:
        0 2px 0 rgba(255,255,255,0.8),
        0 4px 15px rgba(90, 61, 43, 0.25),
        0 6px 30px rgba(255, 140, 50, 0.2);
    letter-spacing: 0.02em;
    transition: color 0.5s;
    position: relative;
    z-index: 2;
    margin: 0;
}

.navesa-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.8rem, 2.4vw, 1rem);
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--navesa-subtitle-color, #4a3a2a);
    margin-top: 10px;
    padding: 6px 16px;
    text-transform: uppercase;
    transition: all 0.5s;
    background: var(--navesa-subtitle-bg, rgba(255,255,255,0.35));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 20px;
    border: 1px solid var(--navesa-subtitle-border, rgba(255,255,255,0.25));
    text-shadow: var(--navesa-subtitle-shadow, 0 1px 1px rgba(255,255,255,0.4));
}

.navesa-time-badge {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--navesa-badge-color, rgba(74, 52, 37, 0.9));
    margin-top: 12px;
    padding: 5px 14px;
    border-radius: 12px;
    background: var(--navesa-badge-bg, rgba(255,255,255,0.4));
    text-transform: uppercase;
    text-shadow: var(--navesa-text-shadow-light, 0 1px 1px rgba(255,255,255,0.4));
    border: 1px solid var(--navesa-badge-border, rgba(255,255,255,0.2));
}

/* ==================== LOADER CONTAINER ==================== */
.navesa-loader-box {
    width: min(280px, 75vw);
    text-align: center;
    background: var(--navesa-loader-bg, rgba(255, 255, 255, 0.35));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 22px 28px;
    border-radius: 16px;
    border: 1px solid var(--navesa-loader-border, rgba(255, 255, 255, 0.5));
    box-shadow: 0 8px 32px rgba(100, 70, 40, 0.12);
    transition: background 0.5s, border-color 0.5s;
    position: relative;
    overflow: hidden;
}

.navesa-loader-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--navesa-shine-color, rgba(255, 180, 100, 0.5)), transparent);
    animation: navesa-loader-shine 3s linear infinite;
}

@keyframes navesa-loader-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ==================== ORNAMENTAL CORNERS ==================== */
.navesa-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: var(--navesa-corner-color, rgba(255, 180, 100, 0.4));
    border-style: solid;
    border-width: 0;
}

.navesa-corner-tl { top: 5px; left: 5px; border-top-width: 2px; border-left-width: 2px; }
.navesa-corner-tr { top: 5px; right: 5px; border-top-width: 2px; border-right-width: 2px; }
.navesa-corner-bl { bottom: 5px; left: 5px; border-bottom-width: 2px; border-left-width: 2px; }
.navesa-corner-br { bottom: 5px; right: 5px; border-bottom-width: 2px; border-right-width: 2px; }

/* ==================== LOADER BAR ==================== */
.navesa-loader-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--navesa-bar-bg, rgba(74, 52, 37, 0.12));
    border-radius: 6px;
    overflow: hidden;
}

.navesa-loader-bar {
    height: 100%;
    width: 0%;
    background: var(--navesa-bar-gradient, linear-gradient(90deg, #e07830, #f4a460, #e07830));
    background-size: 200% 100%;
    border-radius: 6px;
    animation: navesa-shimmer 2s linear infinite;
    transition: width 0.25s ease-out;
    box-shadow: 0 0 12px var(--navesa-bar-glow, rgba(224, 120, 48, 0.4));
}

@keyframes navesa-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.navesa-loader-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--navesa-loader-text, rgba(74, 52, 37, 0.9));
    margin-top: 14px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-shadow: var(--navesa-text-shadow-subtle, 0 1px 1px rgba(255,255,255,0.3));
}

.navesa-loader-percent {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navesa-text-color, #4a3425);
    margin-top: 4px;
    text-shadow: var(--navesa-text-shadow-light, 0 1px 2px rgba(255,255,255,0.4));
}

/* ==================== LOADING TIP ==================== */
.navesa-loading-tip {
    position: fixed;
    bottom: 35px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-weight: 500;
    font-style: italic;
    text-shadow: var(--navesa-tip-shadow, 0 1px 3px rgba(0,0,0,0.3), 0 0 8px rgba(0,0,0,0.15));
    color: var(--navesa-tip-color, rgba(74, 52, 37, 0.6));
    text-align: center;
    max-width: 85%;
    z-index: 10;
    opacity: 0;
    animation: navesa-tip-fade 5s ease-in-out infinite;
}

@keyframes navesa-tip-fade {
    0%, 100% { opacity: 0; }
    15%, 85% { opacity: 1; }
}

/* ==================== FADE OUT ==================== */
.navesa-fade-out {
    animation: navesa-fadeOut 1.5s ease-out forwards;
}

@keyframes navesa-fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

/* ==================== NIGHT MODE ==================== */
#navesa-loader-container.night-mode .navesa-logo-text {
    text-shadow:
        0 2px 0 rgba(0,0,0,0.3),
        0 4px 15px rgba(255, 200, 100, 0.3),
        0 6px 30px rgba(255, 140, 50, 0.4);
}

#navesa-loader-container.night-mode .navesa-fire-glow {
    background: radial-gradient(circle,
        rgba(255, 120, 40, 0.5) 0%,
        rgba(255, 80, 20, 0.3) 30%,
        transparent 70%
    );
}
