/* page-loader.css - the home's loading scene (page-loader.js): the hero's sky over the page until its pictures are in; the RHAea logo and a line show only if that takes a while */

.page-loader { display: none; }

/* the same sky as the hero, so lifting it reads as the scene fading in */
html.is-loading .page-loader {
    position: fixed;
    inset: 0;
    /* over the navbar (200s) and the a11y widget (300), under the skip link (9999) */
    z-index: 1000;
    display: grid;
    place-items: center;
    background: linear-gradient(to bottom,
        var(--sky)      0%,
        var(--sky)     25%,
        var(--sky-warm) 80%);
    transition: opacity 0.45s ease;
}
html.loader-out .page-loader { opacity: 0; pointer-events: none; }

.page-loader-art {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.4rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s ease, transform 0.35s var(--apple-ease, ease);
}
html.loader-art .page-loader-art { opacity: 1; transform: none; }

/* ── the logo: joins the line once its file is in, then breathes ── */
.page-loader-logo {
    display: block;
    width: 104px;
    height: auto;
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.35s ease, transform 0.35s var(--apple-ease, ease);
}
html.loader-logo .page-loader-logo {
    opacity: 1;
    transform: none;
    animation: loader-breathe 1.8s ease-in-out 0.35s infinite;
}
@keyframes loader-breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}

/* ── the line: how near the cover is to lifting - the clock runs to the cap, the fill jumps ahead as the hero's files arrive (--p) ── */
.page-loader-line {
    width: 160px;
    height: 10px;
    overflow: visible;
}
.page-loader-line path {
    fill: none;
    stroke: var(--ink-title, #3d3028);
    stroke-width: 2.5;
    stroke-linecap: round;
}
.page-loader-track { opacity: 0.18; }
.page-loader-fill {
    stroke-dasharray: 1;
    stroke-dashoffset: calc(1 - var(--p, 0));
    transition: stroke-dashoffset 0.5s ease;
}
/* --clock-from and --clock-ms from page-loader.js: where the line stands when it shows, and the time left to the cap */
.page-loader-clock {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}
html.loader-art .page-loader-clock { animation: loader-clock var(--clock-ms, 4600ms) linear forwards; }
@keyframes loader-clock {
    from { stroke-dashoffset: var(--clock-from, 1); }
    to   { stroke-dashoffset: 0; }
}

/* ── reduce motion: the logo stays still ── */
html[data-reduce-motion] .page-loader-logo { animation: none; }
@media (prefers-reduced-motion: reduce) {
    html.loader-logo .page-loader-logo { animation: none; }
}
