/*
 * Third Slip - the design system.
 *
 * One idea: a night Test seen from the hill. A navy sky runs behind every page
 * with a green outfield rising off the bottom edge, and everything above it is
 * a wash of light on that ground rather than a separate dark plate. It is the
 * app icon at page scale, and it is why the marketing page and the privacy
 * policy read as one site.
 *
 * Colour has three jobs and no others:
 *   blue   the brand, links, and anything selected
 *   red    the ball: a match happening now, and nothing else
 *   green  the outfield, and a confirmed good thing
 * Everything else is one of three text neutrals. If a new colour is needed, the
 * answer is almost always a different neutral.
 *
 * Loaded first on every page. home.css builds on it and owns no colour, radius
 * or spacing value of its own.
 */

:root {
    --bg: #0A0E17;
    --ground: linear-gradient(168deg, #0A0E17 0%, #101828 38%, #16263F 68%, #1B3352 100%);
    --field: radial-gradient(150% 34% at 50% 100%, rgba(46, 140, 58, 0.32) 0%, rgba(46, 140, 58, 0.10) 45%, transparent 78%);

    /* Surfaces, in steps of light over that ground. A panel sits on the page, a
       row sits in a panel, a hovered row sits above that. Nothing skips a step,
       which is what makes depth legible without a single shadow. */
    --bg-soft: rgba(255, 255, 255, 0.03);
    --surface: rgba(255, 255, 255, 0.05);
    --surface-2: rgba(255, 255, 255, 0.08);
    --surface-3: rgba(255, 255, 255, 0.13);
    --line: rgba(255, 255, 255, 0.11);
    --line-2: rgba(255, 255, 255, 0.22);

    /* Text, in three weights of attention. */
    --text: #F2F6FB;
    --text-dim: #B6C6DA;
    --text-mute: #8497AC;

    /* The app's brand blue, unchanged. Links, the mark, the active state. */
    --brand: #92BDFF;
    --brand-bright: #BFD8FF;
    --brand-deep: #3E6FB8;
    --brand-wash: rgba(146, 189, 255, 0.12);
    --brand-edge: rgba(146, 189, 255, 0.32);
    --on-brand: #06101F;

    /* The ball. A match in play, and nothing else. */
    --live: #EE5D55;
    --live-wash: rgba(238, 93, 85, 0.14);
    --live-edge: rgba(238, 93, 85, 0.42);

    /* The outfield. A tick, a confirmation, the thing that is already true. */
    --turf: #57C356;
    --turf-wash: rgba(87, 195, 86, 0.13);
    --turf-edge: rgba(87, 195, 86, 0.30);

    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;
    --r-card: 22px;
    --r-pill: 999px;

    --gap-1: 0.25rem;
    --gap-2: 0.5rem;
    --gap-3: 0.75rem;
    --gap-4: 1rem;
    --gap-5: 1.5rem;
    --gap-6: 2rem;
    --gap-7: 3rem;

    --page: 1160px;
    --gutter: 1.25rem;
    --bar: 3.5rem;

    /* Display, not Text. SF ships two optical cuts and the Text one is drawn
       for small sizes: wider, rounder, looser. At heading sizes it is the
       difference sixagain.app's pages already make, and it is what "rounded"
       looked like here. */
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;

    --shadow-bar: 0 1px 0 var(--line);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    font-family: var(--font);
    /* Scores are the content here, so figures line up by default. */
    font-variant-numeric: tabular-nums;
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* The ground is a fixed layer rather than a body background: a background is
   sized to the document, so the same gradient would read as a tight wash on a
   short page and as an imperceptible drift down the privacy policy.
   Body must therefore stay transparent - a negative z-index child paints below
   its parent's own background, so an opaque body hides this entirely. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: var(--field), var(--ground);
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--text);
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

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

.skip-link {
    position: absolute;
    top: -3rem;
    left: var(--gutter);
    z-index: 60;
    padding: 0.5rem 0.9rem;
    border-radius: var(--r-sm);
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 700;
}

.skip-link:focus {
    top: 0.5rem;
    color: var(--on-brand);
}

/* ------------------------------------------------------------------- the bar */

.app-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(10, 14, 23, 0.82);
    backdrop-filter: saturate(150%) blur(14px);
    -webkit-backdrop-filter: saturate(150%) blur(14px);
    box-shadow: var(--shadow-bar);
}

.app-bar-inner {
    display: flex;
    align-items: center;
    gap: var(--gap-5);
    max-width: var(--page);
    height: var(--bar);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.02rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: var(--text);
    white-space: nowrap;
}

.brand img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}

.brand:hover {
    color: var(--text);
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin-right: auto;
    overflow-x: auto;
    scrollbar-width: none;
}

.app-nav::-webkit-scrollbar {
    display: none;
}

.app-nav a {
    position: relative;
    padding: 0.45rem 0.7rem;
    border-radius: var(--r-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim);
    white-space: nowrap;
}

.app-nav a:hover {
    background: var(--surface-2);
    color: var(--text);
}

.app-nav a[aria-current] {
    color: var(--text);
}

.app-nav a[aria-current]::after {
    content: "";
    position: absolute;
    left: 0.7rem;
    right: 0.7rem;
    bottom: -0.35rem;
    height: 2px;
    border-radius: 2px;
    background: var(--brand);
}

.app-cta {
    padding: 0.45rem 0.9rem;
    border-radius: var(--r-pill);
    background: var(--brand);
    color: var(--on-brand);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.app-cta:hover {
    background: var(--brand-bright);
    color: var(--on-brand);
}

/* ------------------------------------------------------------------- layout */

main {
    max-width: var(--page);
    margin: 0 auto;
    padding: var(--gap-5) var(--gutter) var(--gap-7);
}

/* -------------------------------------------------------------------- type */

h1 {
    font-size: clamp(1.65rem, 3.2vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: var(--gap-3);
    /* Even lines rather than a long one and an orphan. A max-width can only
       pick the break for one viewport; this picks it for every viewport. */
    text-wrap: balance;
}

h2 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.015em;
}

h3 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ------------------------------------------------------- the document pages */

/* Privacy and anything else that is prose first. A reading measure, and every
   heading given air above it rather than a rule. */
.doc {
    max-width: 74ch;
    margin: 0 auto;
    font-variant-numeric: normal;
}

.doc h1 {
    margin-bottom: var(--gap-2);
}

.doc h2 {
    margin: var(--gap-6) 0 var(--gap-3);
    font-size: 1.2rem;
}

.doc p,
.doc li {
    color: var(--text-dim);
    margin-bottom: var(--gap-3);
}

.doc ul {
    margin: 0 0 var(--gap-4) 1.1rem;
}

.doc li {
    margin-bottom: var(--gap-2);
    padding-left: 0.2rem;
}

.doc li::marker {
    color: var(--text-mute);
}

.doc strong {
    color: var(--text);
    font-weight: 650;
}

.doc-meta {
    margin-bottom: var(--gap-6);
    color: var(--text-mute);
    font-size: 0.88rem;
}

.doc-lede {
    padding: var(--gap-4) var(--gap-5);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--text-dim);
}

.doc-lede p:last-child {
    margin-bottom: 0;
}

/* ------------------------------------------------------------------ footer */

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
    margin-top: var(--gap-7);
}

.site-footer > * {
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.footer-nav {
    display: grid;
    grid-template-columns: 1.4fr repeat(2, minmax(0, 1fr));
    gap: var(--gap-6);
    padding-top: var(--gap-6);
    padding-bottom: var(--gap-6);
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: var(--gap-3);
    align-items: flex-start;
}

.footer-brand p {
    max-width: 34ch;
    color: var(--text-mute);
    font-size: 0.88rem;
}

.footer-group h2 {
    margin: 0 0 var(--gap-3);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.footer-group ul {
    display: grid;
    gap: var(--gap-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-group a {
    display: inline-block;
    padding: 0.12rem 0;
    font-size: 0.92rem;
}

.footer-legal {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-2) var(--gap-4);
    padding-top: var(--gap-4);
    padding-bottom: var(--gap-5);
    border-top: 1px solid var(--line);
    font-size: 0.82rem;
    color: var(--text-mute);
}

.site-footer a {
    color: var(--text-dim);
}

.site-footer a:hover {
    color: var(--text);
}

@media (max-width: 720px) {
    .app-bar-inner {
        gap: var(--gap-3);
    }

    .brand span {
        display: none;
    }

    main {
        padding-top: var(--gap-4);
    }

    .footer-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--gap-5) var(--gap-4);
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

/* Below this the bar cannot hold the nav and the call to action at once, and
   the nav loses: every destination in it is an anchor further down this page. */
@media (max-width: 620px) {
    .app-nav {
        display: none;
    }

    .brand span {
        display: inline;
    }

    /* The nav carried the margin that pushed the call to action right. */
    .app-cta {
        margin-left: auto;
    }
}

@media (max-width: 440px) {
    .footer-nav {
        grid-template-columns: 1fr;
    }
}
