/* ==========================================================================
   L2Vex page loader
   Shown while the browser fetches the next page. Self-contained: it defines
   its own colours and font fallbacks so it looks identical on the public,
   auth and dashboard layouts, which load three different stylesheets.
   ========================================================================== */

.vex-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 46%, rgba(224, 162, 63, .11) 0%, rgba(224, 162, 63, .04) 26%, rgba(0, 0, 0, 0) 58%),
        #131714;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .45s ease, visibility 0s linear .45s;
}

/* Visible state. Re-adding this class restarts the failsafe animation below. */
.vex-loader.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .25s ease, visibility 0s;
    /* Failsafe: if the load event never arrives (script error, stalled asset),
       the overlay still gets out of the way instead of sealing the site. */
    animation: vexLoaderFailsafe 0s 8s forwards;
}

.vex-loader__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateY(-4vh);
}

.vex-loader__mark {
    width: clamp(72px, 9vw, 116px);
    height: auto;
    filter: drop-shadow(0 0 14px rgba(224, 162, 63, .45)) drop-shadow(0 0 42px rgba(224, 162, 63, .18));
    animation: vexLoaderPulse 2.4s ease-in-out infinite;
}

.vex-loader__text {
    margin: 30px 0 0;
    font-family: TrajanSansPro-Semibold, Cinzel, Georgia, 'Times New Roman', serif;
    font-size: 13px;
    letter-spacing: .42em;
    text-indent: .42em; /* keeps the tracked text optically centred */
    text-transform: uppercase;
    color: #E2A94F;
    white-space: nowrap;
}

.vex-loader__dots {
    display: inline-block;
    width: 2.1em;
    text-align: left;
    animation: vexLoaderDots 1.4s steps(4, end) infinite;
    vertical-align: bottom;
}

.vex-loader__bar {
    position: relative;
    width: clamp(180px, 26vw, 340px);
    height: 2px;
    margin-top: 26px;
    background: rgba(226, 169, 79, .16);
    overflow: hidden;
}

.vex-loader__fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 40%;
    background: linear-gradient(90deg, rgba(226, 169, 79, 0) 0%, #F0C87A 50%, rgba(226, 169, 79, 0) 100%);
    animation: vexLoaderSweep 1.5s ease-in-out infinite;
}

@keyframes vexLoaderPulse {
    0%, 100% { opacity: .82; transform: scale(.985); }
    50%      { opacity: 1;   transform: scale(1.015); }
}

/* Fixed width + clip keeps the tracked word from shifting as the dots appear. */
@keyframes vexLoaderDots {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0 0 0); }
}

@keyframes vexLoaderSweep {
    0%   { left: -42%; }
    100% { left: 100%; }
}

@keyframes vexLoaderFailsafe {
    to { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* Motion-sensitive visitors keep the overlay, lose the movement. */
@media (prefers-reduced-motion: reduce) {
    .vex-loader,
    .vex-loader.is-active { transition: none; }
    .vex-loader__mark,
    .vex-loader__dots,
    .vex-loader__fill { animation: none; }
    .vex-loader__fill { width: 100%; opacity: .5; }
}
