/* ============================================================
   REVEAL — Scroll-driven text fill for the page hero headline
   Progressive enhancement: without animation-timeline support
   (Firefox, Safari) the headline renders normally, fully legible.
   ============================================================ */

@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {

        .page-hero h1 {
            /* Three stacked layers, painted through the glyphs:
               1. leading accent edge
               2. filled text behind it
               3. the unfilled base tone                       */
            background-image:
                linear-gradient(90deg, transparent calc(100% - 6ch), var(--accent) calc(100% - 6ch)),
                linear-gradient(90deg, var(--text), var(--text)),
                linear-gradient(90deg, var(--reveal-base), var(--reveal-base));
            background-size:
                var(--reveal-sweep-width) 100%,
                var(--reveal-sweep-width) 100%,
                100% 100%;
            background-repeat: no-repeat;
            background-position-y: 0;
            background-position-x:
                calc(var(--reveal-sweep-width) * -1),
                calc(var(--reveal-sweep-width) * -1),
                0;
            background-clip: text;
            -webkit-background-clip: text;
            color: transparent;

            animation-name: reveal-fill;
            animation-fill-mode: both;
            animation-timing-function: linear;
            animation-timeline: view();
            animation-range: entry 90% cover 40%;
        }

        /* The .highlight span keeps its accent color and underline,
           so it is excluded from the sweep and stays solid.        */
        .page-hero h1 .highlight {
            background: none;
            -webkit-background-clip: border-box;
            background-clip: border-box;
            color: var(--accent);
        }

        @keyframes reveal-fill {
            to {
                background-position-x: 0, 0, 0;
            }
        }

    }
}