/* ════════════════════════════════════════════════════════════
   Page-transition loader — favicon fill-up (#E30613)
   ════════════════════════════════════════════════════════════ */

#pageLoader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#pageLoader.pl-out {
    opacity: 0;
    visibility: hidden;
}

.loader-stage {
    --icon-size: 52px;
    --fill-cycle: 1.6s;

    width: var(--icon-size);
    height: var(--icon-size);
}

.loader-icon {
    position: relative;
    width: var(--icon-size);
    height: var(--icon-size);
}

/* Faint full icon — almost transparent */
.loader-icon-ghost {
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0.12;
    object-fit: contain;
}

/*
 * Rising clip reveals the same favicon image from bottom to top.
 * Both imgs share one src (injected by index.php) so they stay aligned.
 */
.loader-icon-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0%;
    overflow: hidden;
    animation: pl-icon-fill var(--fill-cycle) cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loader-icon-fill img {
    position: absolute;
    left: 0;
    bottom: 0;
    width: var(--icon-size);
    height: var(--icon-size);
    display: block;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(13%) sepia(99%) saturate(7495%) hue-rotate(353deg) brightness(93%) contrast(101%);
}

@keyframes pl-icon-fill {
    0%   { height: 0%; }
    45%  { height: 100%; }
    60%  { height: 100%; }
    100% { height: 0%; }
}

@media (max-width: 768px) {
    .loader-stage {
        --icon-size: 44px;
        --fill-cycle: 1.45s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .loader-icon-fill {
        height: 100%;
        animation: none;
    }
}
