/* ==========================================================================
   stats-page.css — "By the numbers"  ·  v2.0
   Loaded last on stats.html + ar/stats.html.

   v2 REWRITE — what changed and why
     v1 was competent and forgettable: 44px line icons, cards that faded up,
     a tick field that faded in. Nothing an agency template couldn't produce.

     v2 spends the whole graphics budget on ONE idea, the one MANAGE actually
     sells: scattered work brought under control.
       · the tick field scatters and SNAPS into a grid (js sets the vectors)
       · every card mark DRAWS ITSELF — strokes trace, parts land in sequence
       · the hero carries a figure rail with a pulse travelling its length
     Marks are 88px, not 44px, and each is bespoke to its statistic rather
     than a generic icon.

   Logical properties throughout — the Arabic mirror needs no separate rules.
   Every animation is gated behind prefers-reduced-motion at the foot of the
   file.
   ========================================================================== */

:root {
    --st-r:       16px;
    --st-r-lg:    22px;
    --st-shadow:  0 18px 50px -18px rgba(11, 36, 69, 0.28);
    --st-ease:    cubic-bezier(0.16, 1, 0.3, 1);
    --st-snap:    cubic-bezier(0.22, 1.4, 0.36, 1);   /* slight overshoot */
}

/* ==========================================================================
   1 · HERO
   ========================================================================== */
.st-hero {
    position: relative;
    overflow: hidden;
    background-color: var(--midnight);
    background-image:
        radial-gradient(900px 520px at 50% -12%, rgba(51, 116, 186, 0.34), transparent 70%),
        linear-gradient(rgba(127, 185, 225, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 185, 225, 0.05) 1px, transparent 1px);
    background-size: auto, 56px 56px, 56px 56px;
    padding-block: clamp(84px, 13vh, 150px) clamp(64px, 9vh, 108px);
    color: var(--white);
    text-align: center;
}
.st-hero__inner { max-width: 940px; margin-inline: auto; }

.st-kicker {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--cerulean-light);
    margin-bottom: 22px;
}

/* --- kinetic headline: each line rises out from behind a mask ----------- */
.st-hero__title {
    font-size: clamp(2.3rem, 6.2vw, 4.5rem);
    font-weight: 900;
    line-height: 1.04;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    text-wrap: balance;
    margin: 0 0 24px;
}
.st-hero__title .ln {
    display: block;
    overflow: hidden;      /* the mask. safe: no observed children inside */
    padding-block: 0.04em; /* stop descenders being clipped by the mask */
}
.st-hero__title .ln > span {
    display: block;
    transform: translateY(115%);
    animation: st-rise 900ms var(--st-ease) forwards;
}
.st-hero__title .ln:nth-child(2) > span { animation-delay: 130ms; }
.st-hero__title .ln em { font-style: normal; color: var(--cerulean-light); }
@keyframes st-rise { to { transform: none; } }

.st-hero__lead {
    font-size: clamp(1rem, 1.35vw, 1.16rem);
    line-height: 1.72;
    color: rgba(255, 255, 255, 0.78);
    max-width: 660px;
    margin-inline: auto;
}
.st-hero__basis {
    margin-top: 26px;
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.5);
}

/* --- the figure rail: five nodes on a line, pulse travelling it --------- */
.st-rail {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    max-width: 860px;
    margin: clamp(40px, 6vh, 64px) auto 0;
    padding-top: 26px;
}
/* the line itself */
.st-rail::before {
    content: "";
    position: absolute;
    top: 5px;
    inset-inline: 6%;
    height: 1px;
    background: rgba(127, 185, 225, 0.28);
}
/* the pulse — a bright segment sweeping the line, once every 6s */
.st-rail::after {
    content: "";
    position: absolute;
    top: 4px;
    inset-inline-start: 6%;
    width: 22%;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, var(--cerulean-light), transparent);
    animation: st-pulse 6s var(--st-ease) infinite;
}
@keyframes st-pulse {
    0%          { transform: translateX(0);    opacity: 0; }
    12%         { opacity: 1; }
    72%, 100%   { transform: translateX(355%); opacity: 0; }
}
[dir="rtl"] .st-rail::after { animation-name: st-pulse-rtl; }
@keyframes st-pulse-rtl {
    0%          { transform: translateX(0);     opacity: 0; }
    12%         { opacity: 1; }
    72%, 100%   { transform: translateX(-355%); opacity: 0; }
}

.st-rail__node {
    position: relative;
    flex: 1 1 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.62);
    transition: color 0.3s var(--st-ease);
}
.st-rail__node::before {          /* the node dot, sitting on the line */
    content: "";
    position: absolute;
    top: -26px;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--midnight);
    box-shadow: 0 0 0 2px var(--cerulean-light);
    transition: box-shadow 0.3s var(--st-ease), background 0.3s var(--st-ease);
}
.st-rail__node:hover { color: var(--white); }
.st-rail__node:hover::before { background: var(--cerulean-light); }
.st-rail__node b {
    display: block;
    direction: ltr;
    font-size: clamp(0.95rem, 1.5vw, 1.22rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--white);
    font-variant-numeric: tabular-nums;
}
.st-rail__node span {
    display: block;
    margin-top: 4px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

/* ==========================================================================
   2 · FIGURES
   ========================================================================== */
.st-figures {
    background:
        radial-gradient(820px 460px at 88% -8%, rgba(51, 116, 186, 0.09), transparent 70%),
        linear-gradient(180deg, var(--icefield), #ffffff 62%);
    padding-block: clamp(72px, 10vh, 122px);
}

.st-value {
    display: flex;
    direction: ltr;            /* keeps "1.5M+" from being bidi-reordered */
    align-items: baseline;
    gap: 2px;
    font-weight: 900;
    letter-spacing: -0.035em;
    line-height: 1;
    color: var(--midnight);
    font-variant-numeric: tabular-nums;
}
.st-value .u,
.st-value .p { color: var(--cerulean); }
/* direction:ltr pins the run left on the Arabic page while its label sits
   right — push it to the inline end so number and label share an edge. */
[dir="rtl"] .st-value { justify-content: flex-end; }

.st-label { font-weight: 800; letter-spacing: 0.03em; color: var(--raven); }
.st-note  { color: rgba(11, 36, 69, 0.66); line-height: 1.6; }

/* --- feature figure ----------------------------------------------------- */
.st-feature {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: clamp(24px, 4vw, 56px);
    border: 1.5px solid var(--ice);
    border-radius: var(--st-r-lg);
    padding: clamp(30px, 4vw, 56px);
    box-shadow: var(--st-shadow);
    margin-bottom: clamp(16px, 2vw, 22px);
    /* seam as a background layer, so no overflow clipping is needed and the
       reveal observers on descendants are never starved — see README */
    background-color: var(--white);
    background-image: linear-gradient(90deg, var(--cerulean), var(--cerulean-light));
    background-size: 100% 4px;
    background-repeat: no-repeat;
    background-position: top center;
}
.st-feature .st-value { font-size: clamp(3.2rem, 9vw, 6.4rem); }
.st-feature .st-label { font-size: clamp(1.05rem, 1.7vw, 1.4rem); margin-top: 14px; }
.st-feature .st-note  { font-size: 0.95rem; margin-top: 10px; max-width: 46ch; }

/* --- supporting figures -------------------------------------------------- */
.st-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(14px, 1.6vw, 22px);
}
.st-card {
    position: relative;
    overflow: hidden;
    background: var(--white);
    border: 1.5px solid var(--ice);
    border-radius: var(--st-r);
    padding: clamp(24px, 2.6vw, 34px);
    transition: transform 0.35s var(--st-ease),
                box-shadow 0.35s var(--st-ease),
                border-color 0.35s var(--st-ease);
}
.st-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--st-shadow);
    border-color: var(--cerulean);
}
.st-card::before {
    content: "";
    position: absolute;
    top: 0; inset-inline: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--cerulean), var(--cerulean-light));
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.5s var(--st-ease);
}
.st-card:hover::before { transform: scaleX(1); }

.st-card__viz { display: block; margin-bottom: 20px; }
.st-card .st-value { font-size: clamp(2.1rem, 3.4vw, 2.9rem); }
.st-card .st-label { font-size: 0.94rem; margin-top: 12px; }
.st-card .st-note  { font-size: 0.84rem; margin-top: 8px; }

/* ==========================================================================
   2b · THE MARKS — bespoke per statistic, and they draw themselves.
   Every stroke uses pathLength="1" in the markup, so dasharray:1 traces any
   path regardless of its real length. Nothing here needs JS.
   ========================================================================== */
.st-viz { color: var(--cerulean); overflow: visible; }
.st-viz .s {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}
.st-viz .f { fill: var(--ice); }
.st-viz .d { fill: var(--cerulean-light); }
.st-viz .p { transform-box: fill-box; transform-origin: center; transform: scale(0); }

/* trigger: the card's own [data-reveal] resolution */
[data-reveal].is-in .st-viz .s { animation: st-draw 1000ms var(--st-ease) forwards; }
[data-reveal].is-in .st-viz .p { animation: st-pop 520ms var(--st-snap) forwards; }
@keyframes st-draw { to { stroke-dashoffset: 0; } }
@keyframes st-pop  { to { transform: none; } }

/* per-element cascade — parts land in sequence, not all at once */
.st-viz [data-o="1"] { animation-delay: 90ms;  }
.st-viz [data-o="2"] { animation-delay: 200ms; }
.st-viz [data-o="3"] { animation-delay: 310ms; }
.st-viz [data-o="4"] { animation-delay: 420ms; }
.st-viz [data-o="5"] { animation-delay: 530ms; }
.st-viz [data-o="6"] { animation-delay: 640ms; }
.st-viz [data-o="7"] { animation-delay: 750ms; }

/* the feature mark gets a scan line sweeping its sheets */
.st-feature__viz { flex: 0 0 auto; }
.st-viz .scan {
    fill: var(--cerulean-light);
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
}
[data-reveal].is-in .st-viz .scan { animation: st-scan 2200ms var(--st-ease) 700ms forwards; }
@keyframes st-scan {
    0%   { opacity: 0;    transform: translateY(-32px); }
    18%  { opacity: 0.85; }
    82%  { opacity: 0.85; }
    100% { opacity: 0;    transform: translateY(34px); }
}

/* ==========================================================================
   3 · SCALE — the signature. Scattered records snapping into control.
   ========================================================================== */
.st-scale {
    position: relative;
    overflow: hidden;
    background-color: var(--midnight);
    background-image:
        radial-gradient(760px 480px at 12% -10%, rgba(51, 116, 186, 0.3), transparent 70%),
        linear-gradient(rgba(127, 185, 225, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 185, 225, 0.05) 1px, transparent 1px);
    background-size: auto, 56px 56px, 56px 56px;
    padding-block: clamp(72px, 10vh, 122px);
    color: var(--white);
}
.st-scale__head { max-width: 760px; margin-bottom: clamp(30px, 4vh, 48px); }
.st-scale__title {
    font-size: clamp(1.7rem, 3.6vw, 2.9rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    margin: 0 0 16px;
}
.st-scale__title span { color: var(--cerulean-light); }
.st-scale__lead { color: rgba(255, 255, 255, 0.76); line-height: 1.7; max-width: 62ch; }

.st-ticks {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--st-cols, 40), 1fr);
    gap: clamp(3px, 0.45vw, 6px);
    padding: clamp(18px, 2.4vw, 28px);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(127, 185, 225, 0.18);
    border-radius: var(--st-r);
}

/* at rest: scattered, rotated, small, invisible. JS supplies the vectors. */
.st-tick {
    aspect-ratio: 1 / 1;
    border-radius: 2px;
    background: var(--cerulean-light);
    opacity: 0;
    transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--rot, 0deg)) scale(0.35);
    will-change: transform, opacity;
}
/* resolved: every square exactly on its grid cell */
.st-ticks.is-settled .st-tick {
    animation: st-settle 780ms var(--st-snap) forwards;
    animation-delay: calc(var(--i, 0) * 6ms);
}
@keyframes st-settle {
    40%  { opacity: 0.9; }
    100% { opacity: 0.88; transform: translate(0, 0) rotate(0deg) scale(1); }
}
.st-tick--mark { background: var(--white); }

/* one confirmation sweep once the field has landed */
.st-ticks::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--st-r);
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.16) 50%, transparent 58%);
}
.st-ticks.is-scanned::after { animation: st-sweep 1500ms var(--st-ease) forwards; }
@keyframes st-sweep {
    0%   { opacity: 0; transform: translateX(-38%); }
    22%  { opacity: 1; }
    100% { opacity: 0; transform: translateX(38%); }
}

.st-ticks__legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 22px;
    margin-top: 20px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.62);
}
.st-ticks__key { display: inline-flex; align-items: center; gap: 9px; }
.st-ticks__swatch {
    width: 12px; height: 12px;
    border-radius: 2px;
    background: var(--cerulean-light);
    flex: 0 0 auto;
}
.st-ticks__swatch--mark { background: var(--white); }

/* ==========================================================================
   4 · CREDENTIALS
   ========================================================================== */
.st-cred { background: var(--icefield); padding-block: clamp(66px, 9vh, 112px); }
.st-cred__head { text-align: center; margin-bottom: clamp(28px, 4vh, 44px); }
.st-cred__title {
    font-size: clamp(1.5rem, 3vw, 2.3rem);
    font-weight: 900;
    letter-spacing: -0.015em;
    text-transform: uppercase;
    color: var(--midnight);
    margin: 0;
}
.st-cred__title span { color: var(--cerulean); }

.st-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(14px, 1.6vw, 22px);
    margin-bottom: clamp(20px, 3vh, 30px);
}
.st-mini {
    background: var(--white);
    border: 1.5px solid var(--ice);
    border-radius: var(--st-r);
    padding: clamp(22px, 2.4vw, 30px);
    text-align: center;
}
.st-mini .st-value { justify-content: center; font-size: clamp(1.9rem, 3vw, 2.5rem); }
.st-mini .st-label { font-size: 0.88rem; margin-top: 10px; }

.st-iso { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.st-iso__chip {
    background: var(--white);
    border: 1.5px solid var(--ice);
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--deep-sky);
    transition: border-color 0.3s var(--st-ease), color 0.3s var(--st-ease);
}
.st-iso__chip:hover { border-color: var(--cerulean); color: var(--cerulean); }

/* ==========================================================================
   5 · CLOSING CTA
   ========================================================================== */
.st-cta {
    position: relative;
    overflow: hidden;
    background-color: var(--navy, #081C38);
    background-image:
        radial-gradient(700px 420px at 50% 120%, rgba(51, 116, 186, 0.34), transparent 70%),
        linear-gradient(rgba(127, 185, 225, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 185, 225, 0.05) 1px, transparent 1px);
    background-size: auto, 56px 56px, 56px 56px;
    padding-block: clamp(72px, 10vh, 118px);
    color: var(--white);
    text-align: center;
}
.st-cta__title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    margin: 0 0 18px;
    text-wrap: balance;
}
.st-cta__title span { color: var(--cerulean-light); }
.st-cta__lead {
    color: rgba(255, 255, 255, 0.76);
    max-width: 58ch;
    margin: 0 auto 30px;
    line-height: 1.7;
}
.st-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--cerulean);
    color: var(--white);
    border-radius: 999px;
    padding: 15px 34px;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    transition: background 0.3s var(--st-ease), transform 0.3s var(--st-ease);
}
.st-cta__btn:hover { background: var(--cerulean-light); transform: translateY(-2px); }
.st-cta__btn svg { width: 16px; height: 16px; }
[dir="rtl"] .st-cta__btn svg { transform: scaleX(-1); }

/* ==========================================================================
   6 · RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .st-grid { grid-template-columns: repeat(2, 1fr); }
    .st-feature { grid-template-columns: 1fr; }
    .st-feature__viz { display: none; }
    .st-ticks { --st-cols: 20; }
}
@media (max-width: 760px) {
    .st-rail { flex-wrap: wrap; gap: 22px 10px; padding-top: 0; }
    .st-rail::before, .st-rail::after { display: none; }
    .st-rail__node { flex: 1 1 30%; }
    .st-rail__node::before { display: none; }
    .st-mini-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .st-grid { grid-template-columns: 1fr; }
    .st-ticks { --st-cols: 10; }
}

/* ==========================================================================
   7 · REDUCED MOTION — every animation above is switched off here.
   The page keeps all its content and every mark stays fully drawn.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .st-hero__title .ln > span { transform: none; animation: none; }
    .st-rail::after { display: none; }
    .st-viz .s { stroke-dashoffset: 0; animation: none !important; }
    .st-viz .p { transform: none; animation: none !important; }
    .st-viz .scan { display: none; }
    .st-tick { opacity: 0.88; transform: none; }
    .st-ticks.is-settled .st-tick { animation: none; }
    .st-ticks::after, .st-ticks.is-scanned::after { animation: none; opacity: 0; }
    .st-card, .st-card::before, .st-cta__btn, .st-iso__chip { transition: none !important; }
    .st-card:hover, .st-cta__btn:hover { transform: none !important; }
}
