/* Version 9 loading screen — "Engraved seal".
   Self-contained: nothing here touches the site's own stylesheet. */

.loader {
    display: none;
}

.loader-on .loader {
    --seal: min(86vw, 62vh, 500px);
    --ink: #8a6a1c;
    --gold: #b8893a;
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: block;
    overflow: hidden;
    color: #3a2a10;
    font-family: var(--sans, "Avenir Next", "Helvetica Neue", Arial, sans-serif);
    line-height: 1;
    text-align: center;
}

/* ---------- Paper doors ---------- */

.loader-door {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50.1%;
    background: #f7f0e1;
}

.loader-door-left {
    left: 0;
    background: linear-gradient(90deg, #f1e8d5 0, #f8f2e5 55%, #faf5ea 100%);
}

.loader-door-right {
    right: 0;
    background: linear-gradient(270deg, #f1e8d5 0, #f8f2e5 55%, #faf5ea 100%);
}

.loader.is-leaving .loader-door-left {
    box-shadow: 14px 0 44px rgba(70, 48, 10, .22), inset -1px 0 0 rgba(154, 116, 36, .55);
}

.loader.is-leaving .loader-door-right {
    box-shadow: -14px 0 44px rgba(70, 48, 10, .22), inset 1px 0 0 rgba(154, 116, 36, .55);
}

.loader-stage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(14px, 3vh, 28px);
    padding-bottom: 3vh;
}

/* ---------- Seal ---------- */

.seal {
    position: relative;
    flex: none;
    width: var(--seal);
    height: var(--seal);
}

.seal-text,
.seal-wreath {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.seal-text {
    opacity: 0;
    transition: opacity 1s ease .1s;
    animation: seal-turn 70s linear infinite;
}

.is-armed .seal-text {
    opacity: 1;
}

.seal-text text {
    fill: var(--ink);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .3em;
    text-transform: uppercase;
}

.seal-stem {
    fill: none;
    stroke: var(--gold);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}

.seal-leaf {
    fill: var(--gold);
    transform: scale(0);
    transform-box: fill-box;
    transform-origin: 50% 100%;
    transition: transform .55s cubic-bezier(.2, .9, .3, 1.35);
}

.seal-leaf.is-on {
    transform: scale(1);
}

.seal-anchor,
.seal-real {
    position: absolute;
    top: 27%;
    left: 27%;
    width: 46%;
    height: 46%;
}

.seal-anchor {
    overflow: visible;
    transition: opacity .6s ease .15s;
}

.seal-line {
    fill: none;
    stroke: var(--ink);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}

.is-armed .seal-line {
    animation: seal-draw 1.7s cubic-bezier(.5, 0, .2, 1) forwards;
}

.is-armed .seal-line-inner {
    animation-duration: 1s;
    animation-delay: .8s;
}

/* The gold anchor pressed into the paper. */
.seal-real {
    display: block;
    object-fit: contain;
    opacity: 0;
    transform: scale(1.1);
    transition: opacity .55s ease, transform .9s cubic-bezier(.2, .8, .2, 1);
    filter: drop-shadow(0 10px 14px rgba(90, 60, 10, .28));
}

.is-complete .seal-real {
    opacity: 1;
    transform: none;
}

.is-complete .seal-anchor {
    opacity: 0;
}

/* ---------- Counter ---------- */

.loader-count {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .28em;
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transition: opacity .9s ease .6s;
}

.is-armed .loader-count {
    opacity: 1;
}

.loader-count::before,
.loader-count::after {
    width: 30px;
    height: 1px;
    content: "";
    background: rgba(154, 116, 36, .6);
}

.loader-count #loaderCount {
    min-width: 3ch;
    text-align: right;
}

.loader-count i {
    margin-left: -10px;
    font-style: normal;
}

/* ---------- Keyframes ---------- */

@keyframes seal-draw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes seal-turn {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- Reduced motion: nothing spins, scales or slides ---------- */

@media (prefers-reduced-motion: reduce) {
    html:not(.motion-full) .seal-text {
        animation: none;
    }

    html:not(.motion-full) .seal-leaf {
        opacity: 0;
        transform: none;
        transition: opacity .5s ease;
    }

    html:not(.motion-full) .seal-leaf.is-on {
        opacity: 1;
    }

    html:not(.motion-full) .seal-real {
        transform: none;
    }
}
