/*
 * Base layer for the rebuilt UI: reset, page backdrop, type, and the small set
 * of primitives every page is made of (container, section, panel, button, tag,
 * footer). Tokens live in tokens.css, which must load first.
 */

/* The pixel font's @font-face is declared in the UiHead partial, where the
   file URL can carry the release version like every other asset. */

/* Page-to-page navigation cross-fades where the browser supports it.

   The whole page fades as one picture, the dock included. Nothing is given a
   layer of its own (no view-transition-name): the browser blends the old and
   new pictures so that anything identical in both, which is the whole dock
   apart from the ring around the current page, does not change at all. A
   separate layer for the dock looked like a good way to hold it still, but
   its glass is see-through, so two copies on top of each other showed as a
   flash across every button, and a layer loses its backdrop blur while it
   animates. */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.18s;
}

@layer reset {
    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
        scrollbar-color: var(--line-strong) transparent;
        scrollbar-width: thin;
        /* keep the scrollbar's room whether or not the page scrolls, so
           nothing shifts sideways between a short page and a long one, or
           when the About gate lets the page scroll again */
        scrollbar-gutter: stable;
        overflow-x: clip;
    }

    body,
    h1,
    h2,
    h3,
    h4,
    p,
    ul,
    ol,
    figure,
    blockquote {
        margin: 0;
    }

    ul[class],
    ol[class] {
        padding: 0;
        list-style: none;
    }

    img,
    svg,
    video,
    canvas {
        display: block;
        max-width: 100%;
    }

    img {
        height: auto;
        -webkit-user-drag: none;
        user-select: none;
    }

    button,
    input,
    select,
    textarea {
        font: inherit;
        color: inherit;
    }

    button {
        border: 0;
        background: none;
        padding: 0;
        cursor: pointer;
    }

    a {
        color: inherit;
        text-decoration: none;
    }

    [hidden] {
        display: none !important;
    }
}

@layer base {
    /* The page colour belongs to <html>, and <body> has none of its own. The
       backdrop layers below sit behind the content (z-index -1); a background
       on <body> would be painted over them and hide them. */
    html {
        background: var(--bg);
        scroll-behavior: smooth;
        scroll-padding-top: var(--s-7);
    }

    body {
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        font-family: var(--font-sans);
        font-size: var(--text-md);
        line-height: 1.6;
        color: var(--ink-soft);
        background: none;
        -webkit-font-smoothing: antialiased;
        text-rendering: optimizeLegibility;
        overflow-x: clip;
    }

    /* The backdrop: a sapphire glow from above, a scatter of single-pixel
       stars, and ginkgo leaves drifting down (the leaves are .leaves, further
       down; ui.js adds them). Fixed, behind everything, never interactive. */
    body::before,
    body::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: -1;
        pointer-events: none;
    }

    body::before {
        background:
            radial-gradient(120% 80% at 75% -10%, rgb(9 95 143 / 0.36), transparent 62%),
            radial-gradient(60% 50% at 0% 100%, rgb(86 15 10 / 0.22), transparent 70%),
            var(--bg);
    }

    body::after {
        inset: 0 auto auto 0;
        width: 2px;
        height: 2px;
        opacity: 0.55;
        animation: ui-twinkle 7s steps(2, jump-none) infinite;
        box-shadow: 663px 970px 0 0 #73a9ce, 808px 666px 0 0 #f5d470, 148px 840px 0 0 #f1ecdc, 192px 374px 0 0 #f1ecdc, 118px 931px 0 0 #f1ecdc, 439px 38px 0 0 #f5d470, 888px 428px 0 0 #f5d470, 492px 92px 0 0 #f1ecdc, 869px 60px 0 0 #f1ecdc, 253px 970px 0 0 #73a9ce, 1291px 642px 0 0 #f1ecdc, 126px 590px 0 0 #f1ecdc, 812px 50px 0 0 #73a9ce, 95px 570px 0 0 #73a9ce, 593px 429px 0 0 #73a9ce, 1107px 120px 0 0 #f1ecdc, 631px 573px 0 0 #73a9ce, 211px 595px 0 0 #f1ecdc, 1308px 192px 0 0 #f1ecdc, 199px 560px 0 0 #f5d470, 1155px 61px 0 0 #f1ecdc, 421px 508px 0 0 #f1ecdc, 875px 795px 0 0 #f1ecdc, 953px 599px 0 0 #73a9ce, 740px 306px 0 0 #73a9ce, 368px 715px 0 0 #73a9ce, 167px 588px 0 0 #f1ecdc, 1075px 506px 0 0 #f1ecdc, 1493px 459px 0 0 #f1ecdc, 1247px 74px 0 0 #f5d470, 1048px 428px 0 0 #73a9ce, 1550px 350px 0 0 #73a9ce, 1001px 431px 0 0 #f5d470, 1368px 79px 0 0 #f1ecdc, 1173px 808px 0 0 #f1ecdc, 696px 711px 0 0 #f1ecdc, 1217px 508px 0 0 #f1ecdc, 934px 70px 0 0 #f5d470, 552px 485px 0 0 #f5d470, 124px 748px 0 0 #f1ecdc, 1325px 591px 0 0 #73a9ce, 582px 733px 0 0 #73a9ce, 1369px 355px 0 0 #f5d470, 945px 363px 0 0 #73a9ce, 1251px 119px 0 0 #73a9ce, 120px 223px 0 0 #f1ecdc, 264px 756px 0 0 #73a9ce, 814px 400px 0 0 #73a9ce, 165px 170px 0 0 #73a9ce, 822px 562px 0 0 #f1ecdc, 280px 838px 0 0 #73a9ce, 1126px 285px 0 0 #73a9ce, 734px 699px 0 0 #73a9ce, 472px 154px 0 0 #f5d470, 360px 154px 0 0 #73a9ce, 1348px 238px 0 0 #f5d470, 993px 851px 0 0 #f1ecdc, 373px 269px 0 0 #f1ecdc, 8px 149px 0 0 #73a9ce, 1094px 378px 0 0 #f1ecdc, 1159px 326px 0 0 #73a9ce, 1414px 879px 0 0 #f1ecdc, 1264px 670px 0 0 #f5d470, 935px 921px 0 0 #f1ecdc, 803px 407px 0 0 #73a9ce, 807px 106px 0 0 #73a9ce, 1299px 410px 0 0 #f5d470, 390px 68px 0 0 #73a9ce, 902px 166px 0 0 #f5d470, 696px 615px 0 0 #f5d470;
    }

    @keyframes ui-twinkle {
        0%,
        100% {
            opacity: 0.55;
        }
        50% {
            opacity: 0.25;
        }
    }

    /* Ginkgo leaves, falling slowly behind the page. They sit at z-index -1,
       so every panel, button and line of text is in front of them and they
       only show in the open space between things. Each <i> is one leaf: it
       starts above the screen at --x, falls for --t seconds, turning as it
       goes, and sways from side to side. The numbers are scattered by hand
       so no two fall together. Only transforms are animated, which the
       browser can do without redrawing the page. */
    .leaves {
        position: fixed;
        inset: 0;
        z-index: -1;
        overflow: hidden;
        pointer-events: none;
    }

    .leaves i {
        position: absolute;
        top: -6vh;
        left: var(--x, 50%);
        width: var(--s, 11px);
        height: var(--s, 11px);
        border-radius: 85% 0 85% 0;
        background: var(--c, #e6b84f);
        opacity: 0;
        animation:
            leaf-fall var(--t, 20s) linear var(--d, 0s) infinite,
            leaf-sway calc(var(--t, 20s) / 4) ease-in-out var(--d, 0s) infinite alternate;
    }

    .leaves i:nth-child(1) { --x: 7%; --t: 23s; --d: -3s; --s: 11px; }
    .leaves i:nth-child(2) { --x: 18%; --t: 31s; --d: -14s; --s: 8px; --c: #cfa23d; }
    .leaves i:nth-child(3) { --x: 29%; --t: 21s; --d: -8s; --s: 12px; }
    .leaves i:nth-child(4) { --x: 41%; --t: 28s; --d: -19s; --s: 9px; --c: #cfa23d; }
    .leaves i:nth-child(5) { --x: 53%; --t: 34s; --d: -5s; --s: 7px; }
    .leaves i:nth-child(6) { --x: 64%; --t: 25s; --d: -22s; --s: 12px; }
    .leaves i:nth-child(7) { --x: 75%; --t: 20s; --d: -11s; --s: 10px; --c: #cfa23d; }
    .leaves i:nth-child(8) { --x: 84%; --t: 32s; --d: -1s; --s: 8px; }
    .leaves i:nth-child(9) { --x: 92%; --t: 24s; --d: -16s; --s: 11px; }
    .leaves i:nth-child(10) { --x: 47%; --t: 36s; --d: -27s; --s: 7px; --c: #cfa23d; }

    @keyframes leaf-fall {
        0% {
            translate: 0 0;
            rotate: 0deg;
            opacity: 0;
        }
        8% {
            opacity: 0.6;
        }
        90% {
            opacity: 0.45;
        }
        100% {
            translate: 0 112vh;
            rotate: 540deg;
            opacity: 0;
        }
    }

    @keyframes leaf-sway {
        from {
            transform: translateX(-4vw);
        }
        to {
            transform: translateX(4vw);
        }
    }

    ::selection {
        background: var(--gold);
        color: var(--gold-ink);
    }

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

    h1,
    h2,
    h3,
    h4 {
        color: var(--ink);
        font-weight: 750;
        line-height: 1.12;
        letter-spacing: -0.02em;
        text-wrap: balance;
    }

    h2 {
        font-size: var(--text-xl);
    }

    h3 {
        font-size: var(--text-lg);
        letter-spacing: -0.01em;
    }

    p {
        text-wrap: pretty;
    }

    /* Pixel art is drawn at integer scale and never smoothed. */
    .px {
        image-rendering: pixelated;
        image-rendering: crisp-edges;
    }

    /* Art drawn with a black outline (the Hresh wordmark, the GG mark) is
       invisible on a dark page. This gives it the same one-pixel gold outline
       every menu icon already has. */
    .px-outline {
        filter: drop-shadow(var(--px) 0 0 var(--gold)) drop-shadow(calc(var(--px) * -1) 0 0 var(--gold))
            drop-shadow(0 var(--px) 0 var(--gold)) drop-shadow(0 calc(var(--px) * -1) 0 var(--gold));
    }

    /* a word that differs by input: "click" with a mouse, "tap" on a touch screen */
    .on-touch {
        display: none;
    }

    @media (hover: none) and (pointer: coarse) {
        .on-pointer {
            display: none;
        }

        .on-touch {
            display: inline;
        }
    }

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

@layer components {
    /* ---------- layout ---------- */

    /* The page column. On wide screens it leaves room on the left for the
       dock; on phones the dock is a bottom bar and the room moves below. */
    .shell {
        /* the room kept clear for the dock: beside the page on a wide
           screen, under it on a phone */
        --dock-left: calc(var(--dock-size) + var(--dock-gap) * 2);
        --dock-bottom: 0px;
        flex: 1 0 auto;
        display: flex;
        flex-direction: column;
        padding-left: var(--dock-left);
        padding-bottom: var(--dock-bottom);
    }

    .container {
        width: min(100% - var(--gutter) * 2, var(--container));
        margin-inline: auto;
    }

    .section {
        padding-block: clamp(48px, 7vw, 104px);
    }

    .section__head {
        display: grid;
        gap: var(--s-3);
        margin-bottom: var(--s-7);
        max-width: 44rem;
    }

    /* The small pixel-font line above a heading. */
    .kicker {
        font-family: var(--font-pixel);
        font-size: 10px;
        line-height: 1.6;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--gold);
    }

    .lede {
        font-size: var(--text-lg);
        line-height: 1.55;
        color: var(--ink-soft);
        max-width: 38rem;
    }

    .muted {
        color: var(--muted);
    }

    /* ---------- panel ---------- */

    /* A surface with a pixel frame: four offset shadows draw the edges and
       leave the corners open, which is how a rounded corner looks at one
       pixel. */
    .panel {
        --frame: var(--line-strong);
        position: relative;
        background: linear-gradient(180deg, var(--panel-hi), var(--panel));
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--frame),
            0 var(--px) 0 0 var(--frame),
            calc(var(--px) * -1) 0 0 0 var(--frame),
            var(--px) 0 0 0 var(--frame),
            var(--shadow);
        padding: var(--s-6);
    }

    .panel--gold {
        --frame: var(--gold);
    }

    .panel--paper {
        --frame: var(--gold-deep);
        background: var(--paper);
        color: var(--paper-ink);
    }

    /* ---------- buttons ---------- */

    .btn {
        --btn-bg: var(--panel-hi);
        --btn-ink: var(--ink);
        --btn-edge: var(--line-strong);
        --btn-drop: #05070c;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--s-3);
        min-height: 44px;
        padding: 0 var(--s-5);
        font-family: var(--font-pixel);
        font-size: 11px;
        line-height: 1;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        white-space: nowrap;
        color: var(--btn-ink);
        background: var(--btn-bg);
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--btn-edge),
            0 var(--px) 0 0 var(--btn-edge),
            calc(var(--px) * -1) 0 0 0 var(--btn-edge),
            var(--px) 0 0 0 var(--btn-edge),
            0 6px 0 0 var(--btn-drop);
        transition:
            transform var(--fast) var(--ease),
            box-shadow var(--fast) var(--ease),
            background-color var(--fast) var(--ease);
    }

    .btn:hover {
        transform: translateY(-2px);
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--btn-edge),
            0 var(--px) 0 0 var(--btn-edge),
            calc(var(--px) * -1) 0 0 0 var(--btn-edge),
            var(--px) 0 0 0 var(--btn-edge),
            0 8px 0 0 var(--btn-drop);
    }

    .btn:active {
        transform: translateY(4px);
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--btn-edge),
            0 var(--px) 0 0 var(--btn-edge),
            calc(var(--px) * -1) 0 0 0 var(--btn-edge),
            var(--px) 0 0 0 var(--btn-edge),
            0 2px 0 0 var(--btn-drop);
    }

    .btn--primary {
        --btn-bg: var(--accent);
        --btn-ink: var(--accent-ink);
        --btn-edge: var(--accent-hi);
        --btn-drop: color-mix(in oklab, var(--accent) 45%, black);
    }

    .btn--sapphire {
        --btn-bg: var(--sapphire);
        --btn-ink: #eaf6ff;
        --btn-edge: var(--sapphire-hi);
        --btn-drop: #002a49;
    }

    .btn--blood {
        --btn-bg: var(--blood);
        --btn-ink: #fff1ec;
        --btn-edge: var(--blood-hi);
        --btn-drop: #3a0a07;
    }

    .btn--ghost {
        --btn-bg: transparent;
        --btn-edge: var(--line-strong);
        --btn-drop: transparent;
    }

    .btn--ghost:hover {
        --btn-edge: var(--gold);
        --btn-ink: var(--gold);
    }

    .btn-row {
        display: flex;
        flex-wrap: wrap;
        gap: var(--s-5) var(--s-4);
    }

    /* A plain text link with an arrow that nudges on hover. */
    .link {
        color: var(--gold);
        font-weight: 600;
        text-decoration: underline;
        text-decoration-color: rgb(245 212 112 / 0.35);
        text-underline-offset: 4px;
        transition: text-decoration-color var(--fast);
    }

    .link:hover {
        text-decoration-color: var(--gold);
    }

    /* ---------- a note behind a small "?" ----------

       One look and one behaviour for every note on the three sites:
       Leaderboard rewards, the Battle Pass, the Play modes, the Store, and
       the sign-in timer. The class names differ because each page's script
       finds its own; they are grouped here, not renamed.

       A note opens three ways, so it works with a mouse, a finger and a
       keyboard alike:
         - the pointer rests on the "?"            (:hover, where there is one)
         - the "?" is clicked or tapped             (.tooltip-open, set by script)
         - the "?" is reached with the Tab key      (:focus-visible)
    */
    :is(.rewards-info-wrap, .pass-info-wrap, .mode-info-wrap, .store-info-wrap, .auth-help-wrap) {
        position: relative;
        flex: none;
        display: inline-flex;
        vertical-align: middle;
    }

    /* the "?": a 25px circle. An odd width and one dot of padding put the
       pixel-font mark dead centre (client.css, "Text in the pixel font").
       Buttons only: the results pages also have a block called
       .rewards-info, which is a list of stats and not a "?". */
    button:is(.rewards-info, .pass-info, .mode-info, .auth-help) {
        display: grid;
        place-items: center;
        width: 25px;
        height: 25px;
        padding: 1px 0 0 1px;
        border-radius: 50%;
        font-family: var(--font-pixel);
        font-size: 8px;
        font-weight: 400;
        line-height: 1;
        letter-spacing: 0;
        text-shadow: none;
        color: var(--gold);
        box-shadow: 0 0 0 1px var(--gold-deep);
        transition:
            color var(--fast),
            background-color var(--fast);
    }

    button:is(.rewards-info, .pass-info, .mode-info, .auth-help):focus-visible,
    .tooltip-open > button:is(.rewards-info, .pass-info, .mode-info, .auth-help) {
        color: var(--gold-ink);
        background: var(--gold);
    }

    /* the note itself */
    :is(.rewards-tooltip, .pass-tooltip, .mode-tooltip, .store-tooltip, .auth-help-tooltip) {
        position: absolute;
        left: 0;
        top: calc(100% + 10px);
        z-index: 20;
        width: min(320px, 78vw);
        padding: var(--s-3) var(--s-4);
        font-family: var(--font-sans);
        font-size: var(--text-xs);
        font-weight: 400;
        line-height: 1.55;
        letter-spacing: 0;
        text-align: left;
        text-transform: none;
        text-shadow: none;
        white-space: normal;
        color: var(--ink-soft);
        background: var(--bg-deep);
        box-shadow:
            0 0 0 2px var(--gold),
            var(--shadow);
        /* ui.js slides a note sideways by this much when it would otherwise
           run off the edge of the screen (a "?" near the right of a phone) */
        translate: var(--note-shift, 0px) 0;
        visibility: hidden;
        opacity: 0;
        transition: opacity var(--fast);
    }

    :is(.rewards-tooltip, .pass-tooltip, .mode-tooltip, .store-tooltip, .auth-help-tooltip) strong {
        color: var(--gold);
    }

    .tooltip-open > :is(.rewards-tooltip, .pass-tooltip, .mode-tooltip, .store-tooltip, .auth-help-tooltip),
    button:is(.rewards-info, .pass-info, .mode-info, .store-info, .auth-help):focus-visible + :is(.rewards-tooltip, .pass-tooltip, .mode-tooltip, .store-tooltip, .auth-help-tooltip) {
        visibility: visible;
        opacity: 1;
    }

    /* Only where a pointer can rest: on a touch screen "hover" sticks after a
       tap, which would leave a note open that a second tap had closed. */
    @media (hover: hover) {
        :is(.rewards-info-wrap, .pass-info-wrap, .mode-info-wrap, .store-info-wrap, .auth-help-wrap):hover > :is(.rewards-tooltip, .pass-tooltip, .mode-tooltip, .store-tooltip, .auth-help-tooltip) {
            visibility: visible;
            opacity: 1;
        }

        button:is(.rewards-info, .pass-info, .mode-info, .auth-help):hover {
            color: var(--gold-ink);
            background: var(--gold);
        }
    }

    /* On a touch screen the 25px circle is a small thing to hit: its tap
       area reaches 8px past it on every side, and the circle looks the same. */
    @media (pointer: coarse) {
        button:is(.rewards-info, .pass-info, .mode-info, .auth-help) {
            position: relative;
        }

        button:is(.rewards-info, .pass-info, .mode-info, .auth-help)::before {
            content: "";
            position: absolute;
            inset: -8px;
        }
    }

    /* ---------- tag ---------- */

    .tag {
        display: inline-flex;
        align-items: center;
        gap: var(--s-2);
        padding: 6px 10px;
        font-family: var(--font-pixel);
        font-size: 8px;
        line-height: 1;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--sapphire-pale);
        background: rgb(9 95 143 / 0.22);
        box-shadow: 0 0 0 1px rgb(115 169 206 / 0.35);
    }

    .tag::before {
        content: "";
        width: 6px;
        height: 6px;
        background: currentColor;
        animation: ui-blink 1.6s steps(2, jump-none) infinite;
    }

    @keyframes ui-blink {
        50% {
            opacity: 0.25;
        }
    }

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

    /* The footer runs the full width of the screen and to its very bottom:
       it reaches back out through the room the shell keeps for the dock, and
       pads itself by the same amount so its contents stay lined up with the
       page. Otherwise the page would end in a strip that stops short of the
       edge. */
    .site-footer {
        margin-top: auto;
        margin-left: calc(var(--dock-left) * -1);
        margin-bottom: calc(var(--dock-bottom) * -1);
        padding-left: var(--dock-left);
        padding-bottom: var(--dock-bottom);
        border-top: 1px solid var(--line);
        background: rgb(7 9 16 / 0.6);
        font-size: var(--text-xs);
        color: var(--muted);
    }

    .site-footer__inner {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--s-4) var(--s-6);
        padding-block: var(--s-5);
    }

    .site-footer__legal {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--s-2) var(--s-5);
    }

    /* on a touch screen the two links are as tall as the icons beside them */
    @media (pointer: coarse) {
        .site-footer__legal a {
            display: inline-flex;
            align-items: center;
            min-height: 40px;
        }
    }

    .site-footer a {
        transition: color var(--fast);
    }

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

    .site-footer__social {
        display: flex;
        gap: var(--s-2);
    }

    .site-footer__social a {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        color: var(--muted);
    }

    .site-footer__social svg {
        width: 22px;
        height: 22px;
        fill: currentColor;
    }

    /* ---------- an ordinary page: heading, then content ---------- */

    /* a page with no dock (maintenance): give the left edge back, and the
       bottom band a phone keeps for its bar (two classes, so this outweighs
       the narrow-screen .shell rule further down) */
    .shell.shell--bare {
        --dock-left: 0px;
        --dock-bottom: 0px;
    }

    .page {
        padding-block: clamp(40px, 7vw, 96px);
    }

    /* A tall window (a big monitor): the page starts a little lower, a
       quarter of the height beyond 900px, so a short page sits in the upper
       third instead of against the top with a field of empty space under it.
       It depends only on the window, never on what the page holds, so the
       heading is in the same place on every page and nothing shifts when a
       list loads.

       The extra room goes above whatever comes first: the page itself, or,
       where a page has a row of tabs over it, the tabs (client.css), so the
       tabs stay with the content they switch. To try it without: set
       --tall-top to 0px here. */
    :root {
        --tall-top: 0px;
    }

    @media (min-height: 901px) {
        :root {
            --tall-top: calc((100dvh - 900px) * 0.25);
        }
    }

    .page {
        padding-top: calc(clamp(40px, 7vw, 96px) + var(--tall-top));
    }

    .page--narrow {
        --container: 46rem;
    }

    .page-head {
        display: grid;
        gap: var(--s-4);
        margin-bottom: var(--s-7);
    }

    .page-head h1,
    .title-pixel {
        font-family: var(--font-pixel);
        font-weight: 400;
        font-size: clamp(18px, 0.7rem + 1.2vw, 28px);
        line-height: 1.6;
        letter-spacing: 0;
        text-shadow: 3px 3px 0 var(--sapphire-deep);
    }

    /* The Grigorian Games wordmark used as a page heading. Its near-black
       outline gets a one-pixel pale edge so it reads on the dark page. */
    .brand-mark {
        width: 450px;
        filter: drop-shadow(1px 0 0 var(--sapphire-pale)) drop-shadow(-1px 0 0 var(--sapphire-pale))
            drop-shadow(0 1px 0 var(--sapphire-pale)) drop-shadow(0 -1px 0 var(--sapphire-pale));
    }

    /* pixel art: its drawn size, or exactly half where that does not fit */
    @media (max-width: 520px) {
        .brand-mark {
            width: 225px;
        }
    }

    /* ---------- long-form text ---------- */

    .prose {
        max-width: 44rem;
        font-size: var(--text-md);
        line-height: 1.75;
        color: var(--ink-soft);
    }

    .prose > * + *,
    .prose section > * + * {
        margin-top: var(--s-4);
    }

    .prose section + section,
    .prose > h2 {
        margin-top: var(--s-7);
    }

    .prose h2 {
        font-size: 1.35rem;
        letter-spacing: -0.01em;
        padding-bottom: var(--s-3);
        border-bottom: 1px solid var(--line);
    }

    .prose h3 {
        font-size: 1.05rem;
        margin-top: var(--s-5);
    }

    .prose ul,
    .prose ol {
        padding-left: 1.25rem;
        display: grid;
        gap: var(--s-2);
    }

    .prose li::marker {
        color: var(--gold);
    }

    .prose a {
        color: var(--gold);
        text-decoration: underline;
        text-decoration-color: rgb(245 212 112 / 0.4);
        text-underline-offset: 3px;
    }

    .prose a:hover {
        text-decoration-color: var(--gold);
    }

    .prose strong {
        color: var(--ink);
        font-weight: 650;
    }

    .prose .last-updated {
        font-family: var(--font-pixel);
        font-size: 8px;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: var(--dim);
    }

    /* the story: set in the serif, a little larger */
    .prose--story {
        max-width: 40rem;
        font-family: var(--font-serif);
        font-size: 1.2rem;
        line-height: 1.85;
    }

    .prose--story > p + p {
        margin-top: var(--s-5);
    }

    /* ---------- a page that is one message (not found, maintenance) ---------- */

    .status {
        flex: 1;
        display: grid;
        place-content: center;
        justify-items: center;
        gap: var(--s-5);
        padding: var(--s-8) var(--gutter);
        text-align: center;
    }

    .status__art {
        width: 150px;
    }

    /* Shen, the size he is everywhere else (the Armory and Marketplace
       doors), and standing over the middle of the words below him.

       He is not in the middle of his own picture: in both of these something
       is drawn to his right (a wave and "Bye!", a toolbox), so centring the
       picture left him off to one side. Each is moved right by the distance
       between the picture's middle and his own, measured from the files:
         shen_bye.png  500px wide, Shen's middle at 192  -> at half size, 29px
         shen_wip.png  300px wide, Shen's middle at 93   -> as drawn, 57px
       The two files are drawn at different scales (he is 320px wide in one
       and 160px in the other), which is why one is shown at half size and
       the other as drawn: on screen he comes out the same size in both. */
    .status__art--bye {
        width: 250px;
        height: auto;
        translate: 29px 0;
    }

    .status__art--wip {
        width: 300px;
        height: auto;
        translate: 57px 0;
    }

    /* the toolbox would run off a narrow phone: half size there */
    @media (max-width: 480px) {
        .status__art--wip {
            width: 150px;
            translate: 28px 0;
        }
    }

    .status__brand {
        width: 200px;
    }

    .status p {
        max-width: 30rem;
    }

    /* the maintenance page (both grigoriangames.com and hresh.io show one) */

    .maintenance-info {
        display: grid;
        gap: var(--s-2);
        padding: var(--s-5) var(--s-6);
        font-size: var(--text-sm);
    }

    .maintenance-title {
        color: var(--muted);
    }

    #countdown {
        font-family: var(--font-pixel);
        font-size: 10px;
        line-height: 1.8;
        color: var(--gold);
    }

    /* ---------- reveal on scroll ---------- */

    /* Blocks marked data-reveal settle into place once. The hidden state only
       applies when JS has said it is running (html.js), so the page is whole
       without it. */
    html.js [data-reveal] {
        opacity: 0;
        transform: translateY(16px);
        transition:
            opacity var(--slow) var(--ease),
            transform var(--slow) var(--ease);
    }

    html.js [data-reveal].is-in {
        opacity: 1;
        transform: none;
    }

    /* data-reveal="wipe": a section's heading block. Its pixel-font label
       types in a letter at a time, its title is unveiled from left to right
       behind a soft edge as it drifts into place, and the line under it fades
       up just behind. The hidden starting states apply only where motion is
       welcome; with reduced motion, or without JS, the block is simply
       there. */
    html.js [data-reveal="wipe"] {
        opacity: 1;
        transform: none;
    }

    /* The label and the title are as wide as their letters: each of the
       label's steps is then one letter, and the title's soft edge spends its
       whole sweep crossing words rather than the empty space after them. */
    html.js [data-reveal="wipe"] > :is(.kicker, h1, h2, h3) {
        justify-self: start;
    }

    @media (prefers-reduced-motion: no-preference) {
        html.js [data-reveal="wipe"]:not(.is-in) > :is(.kicker, h1, h2, h3) {
            opacity: 0;
        }

        /* The pixel font is monospaced, so one step shows exactly one more
           letter; the clip stops 1px short, inside the gap after a letter, so
           no sliver of the next one shows. */
        html.js [data-reveal="wipe"].is-in > .kicker {
            animation: kicker-type calc(var(--chars, 12) * 30ms) steps(var(--chars, 12), end) backwards;
        }

        /* a gentler curve than --ease, so the soft edge is seen crossing the
           words rather than flicked past them */
        html.js [data-reveal="wipe"].is-in > :is(h1, h2, h3) {
            animation: title-unveil 900ms cubic-bezier(0.25, 0.46, 0.45, 0.94) 60ms backwards;
        }

        html.js [data-reveal="wipe"] > .lede {
            opacity: 0;
            transform: translateY(6px);
            transition:
                opacity 520ms var(--ease) 360ms,
                transform 520ms var(--ease) 360ms;
        }

        html.js [data-reveal="wipe"].is-in > .lede {
            opacity: 1;
            transform: none;
        }
    }

    @keyframes kicker-type {
        from {
            clip-path: inset(0 calc(100% + 1px) 0 0);
        }
        to {
            clip-path: inset(0 1px 0 0);
        }
    }

    /* The title's mask is a gradient two and a half times its width: solid,
       then a soft edge half the title's width, then clear. Sliding it from
       right to left unveils the words behind that edge, the first letter
       starting to show at once and the last finishing as the slide ends. The
       mask lives only in the animation, so once the title is in it is plain
       text again. */
    @keyframes title-unveil {
        from {
            -webkit-mask-image: linear-gradient(90deg, #000 40%, transparent 60%);
            mask-image: linear-gradient(90deg, #000 40%, transparent 60%);
            -webkit-mask-size: 250% 100%;
            mask-size: 250% 100%;
            -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
            -webkit-mask-position: 100% 0;
            mask-position: 100% 0;
            translate: -10px 0;
        }
        to {
            -webkit-mask-image: linear-gradient(90deg, #000 40%, transparent 60%);
            mask-image: linear-gradient(90deg, #000 40%, transparent 60%);
            -webkit-mask-size: 250% 100%;
            mask-size: 250% 100%;
            -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
            -webkit-mask-position: 0 0;
            mask-position: 0 0;
            translate: 0 0;
        }
    }
}

/* ---------- small screens: the dock is a bottom bar ---------- */

@media (max-width: 767px), (hover: none) and (pointer: coarse) {
    @layer base {
        /* a narrow screen gets half the leaves */
        .leaves i:nth-child(even) {
            display: none;
        }
    }

    @layer components {
        .shell {
            --dock-left: 0px;
            --dock-bottom: calc(var(--dock-size) + var(--dock-gap) * 2 + env(safe-area-inset-bottom, 0px));
        }
    }
}

@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.js [data-reveal] {
        opacity: 1;
        transform: none;
        clip-path: none;
    }

    .leaves {
        display: none;
    }

    @view-transition {
        navigation: none;
    }
}
