/* statistics-section.css — the homepage figures ticker.
 *
 * Page-scoped and pushed from components/uowa/index/statistics.blade.php, so one
 * file serves both locales. It replaces an inline <style> block in the component
 * and a Swiper carousel with pagination dots.
 *
 * The section now sits directly under the hero and runs as a continuous strip:
 * eleven figures slide past on their own, with no dots, arrows or page count.
 * Nothing is hidden behind a control, which is the whole reason the dots went.
 *
 * ── The seam ──────────────────────────────────────────────────────────────
 * The figures are printed TWICE and the track is translated by exactly half its
 * width, so the second copy arrives where the first began and the loop is
 * invisible. That only holds if half the track is exactly one copy — which is
 * why the spacing is `margin-inline-end` on every cell rather than `gap`. With
 * `gap`, a 2N-cell track is 2N cells plus (2N-1) gaps, so half of it lands half
 * a gap short and the strip visibly jumps once per lap.
 *
 * Direction comes from logical properties, and the travel direction flips with
 * `dir` — see --sf-shift.
 */

.ul-stats {
    --sf-ease: cubic-bezier(.22, 1, .36, 1);
    --sf-line: #e6eaf1;
    --sf-gap: 1px;
    --sf-lap: 46s;

    position: relative;
    background: #fff;
    padding-block: clamp(40px, 4.6vw, 64px);
}

.ul-stats-head {
    text-align: center;
    margin-bottom: clamp(26px, 3vw, 40px);
}

.ul-stats .ul-stats-title {
    margin: 0;
    line-height: 1.25;
}

.ul-stats .ul-stats-title::after {
    content: "";
    display: block;
    width: 54px;
    height: 4px;
    border-radius: 2px;
    background: var(--ul-c3);
    margin: 14px auto 0;
}

/* ───────────────────────────────────────────────────────────── the rail */

/* Full-bleed: the strip runs edge to edge so figures slide in from off-screen
   rather than appearing at a container boundary. */
.ul-stats-rail {
    position: relative;
    overflow: hidden;
    border-block: 1px solid var(--sf-line);
    background: var(--sf-line);

    /* Softens both ends so cells fade out instead of being clipped mid-word. */
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.ul-stats-track {
    --sf-shift: -50%;

    display: flex;
    width: max-content;
    animation: ul-stats-marquee var(--sf-lap) linear infinite;
}

/* In RTL the flex row starts at the right, so the track has to travel the other
   way for the figures to arrive in reading order. */
[dir="rtl"] .ul-stats-track {
    --sf-shift: 50%;
}

@keyframes ul-stats-marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(var(--sf-shift)); }
}

/* Pausing has to out-specify the rule that sets `animation`, not merely follow
   it: `animation` is a shorthand and resets animation-play-state to running
   every time it matches. (0,2,0) over (0,1,0). */
.ul-stats-rail:hover .ul-stats-track,
.ul-stats-rail:focus-within .ul-stats-track {
    animation-play-state: paused;
}

/* ───────────────────────────────────────────────────────────── the cell */

.ul-stats-cell {
    position: relative;
    flex: 0 0 auto;
    width: clamp(168px, 15vw, 210px);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 5px;
    padding: clamp(18px, 2vw, 26px) 14px;
    background: #fff;
    /* NOT `gap` on the track — see the seam note at the top of this file. */
    margin-inline-end: var(--sf-gap);
    transition: background-color .35s var(--sf-ease);
}

.ul-stats-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    margin-bottom: 2px;
}

.ul-stats-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: .55;
    transition: opacity .35s var(--sf-ease), transform .45s var(--sf-ease);
}

.ul-stats-icon i {
    font-size: 19px;
    color: var(--ul-primary);
    opacity: .55;
    transition: opacity .35s var(--sf-ease), transform .45s var(--sf-ease);
}

/* Navy on white is 15.1:1. tabular-nums so the digits do not shuffle sideways
   while the counter in main.js runs. */
.ul-stats .ul-stat-number {
    /* size, weight and leading: stat role, typography.css */
    color: var(--ul-primary);
    font-variant-numeric: tabular-nums;
    margin: 0;
    transition: transform .4s var(--sf-ease);
}

/* --ul-gray3 would be 3.46:1 here, under the floor for 13px text. */
.ul-stats-label {
    /* label role, regular */
    font-size: var(--t-label);
    font-weight: 400;
    line-height: var(--lh-ui);
    color: var(--ul-gray2);
    transition: color .35s var(--sf-ease);
}

/* The hover: a gold rule grows out from under the figure.
 *
 * Deliberately not a lift. These cells sit in a continuous strip divided by
 * hairlines; raising one out of the strip breaks the rules either side of it,
 * and on a moving track a lifted cell slides away from the pointer. Drawing a
 * rule underneath marks the cell without moving it. */
.ul-stats-rule {
    position: absolute;
    inset-block-end: 0;
    inset-inline-start: 0;
    width: 0;
    height: 3px;
    background: var(--ul-c3);
    transition: width .42s var(--sf-ease);
}

.ul-stats-cell:hover {
    background: #f7f9fc;
}

.ul-stats-cell:hover .ul-stats-rule {
    width: 100%;
}

.ul-stats-cell:hover .ul-stat-number {
    transform: scale(1.06);
}

.ul-stats-cell:hover .ul-stats-icon img,
.ul-stats-cell:hover .ul-stats-icon i {
    opacity: 1;
    transform: translateY(-3px);
}

.ul-stats-cell:hover .ul-stats-label {
    color: var(--ul-primary);
}

/* ─────────────────────────────────────────────────────────────── touch */

/* No hover means no way to pause moving content, which WCAG 2.2.2 requires of
   anything that animates for more than five seconds. So on touch the marquee
   stops being a marquee: the same strip becomes a finger-driven scroll rail,
   moving only when the visitor moves it. The duplicate copy is hidden there —
   it exists only to hide the loop seam, and in a scroll rail it would just be
   eleven figures printed twice. */
@media (hover: none) {
    .ul-stats-rail {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .ul-stats-rail::-webkit-scrollbar {
        display: none;
    }

    .ul-stats-track {
        animation: none;
        transform: none;
    }

    .ul-stats-cell[data-clone] {
        display: none;
    }

    .ul-stats-cell {
        scroll-snap-align: center;
    }
}
