﻿/* ============================================
   LOADER
============================================ */

#site-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient( ellipse at 50% 40%, rgba(185, 119, 53, 0.10), transparent 42% ), linear-gradient( 180deg, #0D0907 0%, #080605 100% );
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}


/* ============================================
   BACKGROUND
============================================ */

.loader-scene {
    position: absolute;
    inset: -10%;
    pointer-events: none;
    background: radial-gradient( ellipse at center, rgba(185, 119, 53, 0.065), rgba(185, 119, 53, 0.018) 38%, transparent 68% );
    animation: loaderSceneBreath 3.8s ease-in-out infinite;
}


@keyframes loaderSceneBreath {

    0%, 100% {
        opacity: 0.65;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.035);
    }
}


/* ============================================
   CINEMATIC LIGHT
============================================ */

.loader-light {
    position: absolute;
    top: -50%;
    left: -45%;
    width: 60%;
    height: 200%;
    pointer-events: none;
    background: linear-gradient( 110deg, transparent 20%, rgba(210, 154, 93, 0.02) 38%, rgba(210, 154, 93, 0.08) 50%, rgba(210, 154, 93, 0.02) 62%, transparent 80% );
    transform: rotate(8deg);
    animation: loaderLightSweep 4.2s ease-in-out infinite;
}


@keyframes loaderLightSweep {

    0% {
        transform: translateX(-20%) rotate(8deg);
    }

    60%, 100% {
        transform: translateX(190%) rotate(8deg);
    }
}


/* ============================================
   CONTENT
============================================ */

/*
   DO NOT animate this container.
   This avoids the Edge rectangular artefact.
*/

.loader-content {
    position: relative;
    z-index: 2;
    width: min( 760px, calc(100% - 44px) );
    text-align: center;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
}


/* ============================================
   TITLE
============================================ */

.loader-title {
    margin: 0;
    padding: 0;
    color: #F0E6D8;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(48px, 7vw, 80px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -2px;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(12px);
    animation: loaderTitleReveal 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}


    .loader-title span {
        color: #D29A5D;
        background: transparent !important;
    }


@keyframes loaderTitleReveal {

    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ============================================
   SUBTITLE
============================================ */

.loader-subtitle {
    margin: 20px 0 35px;
    padding: 0;
    color: #BBAA95;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.6px;
    opacity: 0;
    transform: translateY(7px);
    animation: loaderSubtitleReveal 0.52s ease 0.10s forwards;
}


@keyframes loaderSubtitleReveal {

    from {
        opacity: 0;
        transform: translateY(7px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ============================================
   PROGRESS CONTAINER
============================================ */

.loader-progress-container {
    width: min(340px, 100%);
    margin: 0 auto;
    opacity: 0;
    animation: loaderProgressReveal 0.42s ease 0.18s forwards;
    transition: opacity 0.22s ease;
}


@keyframes loaderProgressReveal {

    to {
        opacity: 1;
    }
}


/* ============================================
   TRACK
============================================ */

.loader-track {
    position: relative;
    width: 100%;
    height: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(185, 119, 53, 0.16);
    border-radius: 2px;
}


/* ============================================
   MOVING PROGRESS
============================================ */

.loader-progress {
    position: absolute;
    top: 0;
    left: -42%;
    width: 42%;
    height: 100%;
    border-radius: 2px;
    /*
       Glow is created by the gradient itself.
       Nothing bleeds outside the track.
    */
    background: linear-gradient( 90deg, transparent 0%, rgba(185, 119, 53, 0.18) 15%, rgba(185, 119, 53, 0.65) 38%, #DDA15F 50%, rgba(185, 119, 53, 0.65) 62%, rgba(185, 119, 53, 0.18) 85%, transparent 100% );
    box-shadow: inset 0 0 3px rgba(255, 215, 165, 0.20);
    animation: loaderIndeterminate 1.25s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}


@keyframes loaderIndeterminate {

    from {
        left: -42%;
    }

    to {
        left: 110%;
    }
}


/* ============================================
   BAR COMPLETES WHEN APP IS READY
============================================ */

#site-loader.ready
.loader-progress {
    left: 0;
    width: 100%;
    animation: none;
    background: linear-gradient( 90deg, #A96B30, #C98540, #DDA15F );
    box-shadow: inset 0 0 3px rgba(255, 215, 165, 0.16);
    transition: left 0.18s ease, width 0.22s ease;
}


/* ============================================
   STAGE 1 - BAR FADES
============================================ */

#site-loader.progress-finished
.loader-progress-container {
    opacity: 0;
    transition: opacity 0.20s ease;
}


/* ============================================
   STAGE 2 - TITLE FADES
============================================ */

#site-loader.title-exit
.loader-title {
    opacity: 0;
    transform: translateY(-7px);
    transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}


#site-loader.title-exit
.loader-subtitle {
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 0.22s ease, transform 0.30s ease;
}


/* ============================================
   STAGE 3 - BACKGROUND FADES
============================================ */

#site-loader.exiting {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease;
}


/* ============================================
   RETRY
============================================ */

#loader-retry {
    display: inline-block;
    margin-top: 22px;
    color: #D29A5D;
    background: transparent;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 13px;
    text-decoration: none;
    border: none;
    border-bottom: 1px solid rgba(210, 154, 93, 0.35);
    outline: none;
}


    #loader-retry[hidden] {
        display: none;
    }


/* ============================================
   MOBILE
============================================ */

@media (max-width: 600px) {

    .loader-content {
        width: calc(100% - 30px);
    }

    .loader-title {
        font-size: clamp(34px, 10.5vw, 54px);
        letter-spacing: -1px;
        white-space: nowrap;
    }

    .loader-subtitle {
        margin-bottom: 30px;
        font-size: 13px;
    }

    .loader-progress-container {
        width: min(300px, 100%);
    }
}
