/*
   ASAP v2 - shared base
   Reset, scale tokens, theme plumbing, reveal system,
   and the data-viz primitives.

   The Print Room palette and type layer on top in
   css/dir-c.css.
*/

/* 8px scale */
:root {
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 48px;
    --space-6: 64px;
    --space-7: 96px;
    --space-8: 128px;
    --space-9: 176px;

    --max: 1320px;
    --gutter: clamp(20px, 4.5vw, 64px);

    /* Marketing register easing. No overshoot anywhere in this build. */
    --e-out: cubic-bezier(0.16, 1, 0.3, 1);
    --e-in-out: cubic-bezier(0.65, 0, 0.35, 1);

    /* What is left of the data-viz tokens. The site has no charts. The
       two-hue chart palette was flag red
       and flag green, and green left the site with ASAP's style guide,
       which is reds only. Two reds are told apart by lightness, not hue,
       so a chart added later needs its palette built and validated from
       scratch, not this value reused. */
    --series-1: #ca0013;

    --grid-line: rgba(56, 0, 0, 0.14);
    --tick-ink: rgba(56, 0, 0, 0.55);
}

/* Dark steps for the sequential ramp: more-is-lighter against a dark
   surface, so magnitude still reads as "more ink". Declared under both
   scopes so the toggle wins in either direction. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --grid-line: rgba(255, 245, 225, 0.16);
        --tick-ink: rgba(255, 245, 225, 0.62);
    }
}
:root[data-theme="dark"] {
    --grid-line: rgba(255, 245, 225, 0.16);
    --tick-ink: rgba(255, 245, 225, 0.62);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: clamp(72px, 9vw, 104px);
}

body {
    margin: 0;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

img, svg, canvas { max-width: 100%; display: block; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.wrap {
    width: 100%;
    max-width: var(--max);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: var(--space-2);
    top: -60px;
    z-index: 200;
    padding: 12px 20px;
    background: var(--c-accent);
    color: #fff;
    font-weight: 600;
    transition: top 0.2s var(--e-out);
}
.skip-link:focus { top: var(--space-2); }

/* Focus ring */
:focus-visible {
    outline: 3px solid var(--c-focus, var(--c-accent));
    outline-offset: 3px;
}

/* Reveals */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s var(--e-out), transform 0.7s var(--e-out);
    transition-delay: var(--d, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

/* Curtain wipe, used for the full-bleed section transitions */
.wipe { clip-path: inset(0 100% 0 0); transition: clip-path 0.9s var(--e-out); }
.wipe.is-in { clip-path: inset(0 0 0 0); }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    transition: background 0.25s var(--e-out), color 0.25s var(--e-out);
}
.theme-toggle:hover { background: currentColor; }
.theme-toggle:hover .theme-toggle__txt { color: var(--c-bg); }
.theme-toggle svg { width: 15px; height: 15px; flex: none; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* UI marks
   What is left of the chart primitives. The site has no charts: the
   network is a map, and the headline counts are set in running copy.
   --series-1 stays because the flag mark uses it.
*/

.figure__flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border: 1px solid var(--grid-line);
    border-radius: 3px;
    font-size: 0.64rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.figure__flag::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--series-1);
}


/* Tooltip: an HTML chart is interactive, so ship the hover layer */
.viz-tip {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 120;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -120%);
    padding: 8px 11px;
    background: var(--c-ink);
    color: var(--c-bg);
    font-size: 0.76rem;
    line-height: 1.35;
    border-radius: 4px;
    white-space: nowrap;
    transition: opacity 0.14s linear;
}
.viz-tip.is-on { display: block; opacity: 1; }
.viz-tip b { font-variant-numeric: tabular-nums; }
/* A chart tip is one number and stays on one line. A map tip names every
   campus in the city, and London has twelve, so that one has to wrap. */
.viz-tip.is-wrap { white-space: normal; width: max-content; max-width: min(260px, 70vw); }

/* Footer link addresses are long enough to overflow a narrow column */
.ftr li a, .ftr li { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    html { scroll-behavior: auto !important; }
    .reveal { opacity: 1 !important; transform: none !important; }
    .wipe { clip-path: inset(0 0 0 0) !important; }
}
