/*
 * Modern-medieval theme inspired by Thronefall: night-blue skies, parchment, royal gold and crimson banners,
 * castle silhouettes. Self-hosted variable fonts (assets/fonts/, SIL Open Font License): Cinzel for display,
 * EB Garamond for reading text, Inter for the interface.
 */

/*
 * Latin subsets, named apart so a locally installed copy can never replace them. EB Garamond and Inter come from
 * Fontsource 5.3.0. Cinzel, only used bold, is a static instance of google/fonts Cinzel[wght].ttf built with
 * `fonttools varLib.instancer wght=700 --remove-overlaps` then `pyftsubset` to the same range: the variable font draws
 * its letters with overlapping contours, which -webkit-text-stroke outlines show as stray lines inside the glyphs.
 */
@font-face {
    font-family: 'Cinzel Bold';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/cinzel/cinzel-latin-700-normal-zjomyly.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
        U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'EB Garamond Variable';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../fonts/eb-garamond/eb-garamond-latin-wght-normal-Zebcnzy.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
        U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter Variable';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter/inter-latin-wght-normal-Gz7AlRl.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
        U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --color-night-deep: #0f1424;
    --color-night-abyss: #0a0e1a;
    --color-night: #1b2236;
    --color-dusk: #c8743a;
    --color-star: rgb(255 244 214 / 0.85);
    --color-parchment: #f4ecd8;
    --color-parchment-light: #fbf6ea;
    --color-parchment-dark: #e6d8b5;
    --color-text: #2b2118;
    --color-muted: #6b5a45;
    --color-on-dark: #f4ecd8;
    --color-on-dark-muted: #c9bfa8;
    --color-line-on-dark: rgb(244 236 216 / 0.12);
    --color-glass-on-dark: rgb(244 236 216 / 0.05);
    --color-glass-on-dark-strong: rgb(244 236 216 / 0.08);
    --color-gold-haze: rgb(232 199 102 / 0.12);
    --color-gold-faint: rgb(232 199 102 / 0.28);
    --color-overlay-glass: rgb(15 20 36 / 0.45);
    --color-overlay-border: rgb(244 236 216 / 0.1);
    --color-shadow: rgb(15 20 36 / 0.35);
    --color-thronefall: #f5b82e;
    --color-craaghelm: #ec7a2c;
    --color-gold: #c9a227;
    --color-gold-light: #e8c766;
    --color-primary: #8b2a1e;
    --color-primary-dark: #5e1a12;
    --color-primary-contrast: #fbf6ea;
    --color-focus: #1a5fb4;
    --color-focus-on-dark: #e8c766;
    --color-page-transition: #606060;
    --color-page-transition-lightning: #f7cf2e;

    /*
     * Theme colours, as light-dark(day, night): the page follows the visitor's system unless <html data-theme>
     * forces a theme (see the settings panel in the header).
     */
    --color-page-bg: light-dark(var(--color-parchment), var(--color-night-abyss));
    --color-page-glow: light-dark(var(--color-parchment-light), var(--color-night-deep));
    --color-page-text: light-dark(var(--color-text), var(--color-on-dark));
    --color-page-muted: light-dark(var(--color-muted), var(--color-on-dark-muted));
    --color-link: light-dark(var(--color-primary), var(--color-gold-light));
    --color-link-hover: light-dark(var(--color-primary-dark), var(--color-parchment-light));
    --color-focus-ring: light-dark(var(--color-focus), var(--color-focus-on-dark));
    --color-panel-hover: light-dark(var(--color-parchment-dark), var(--color-glass-on-dark-strong));

    /* Header, footer and settings panel: parchment cards by day, night-blue cards by night. */
    --color-chrome-bg: light-dark(var(--color-parchment-light), var(--color-night));
    --color-chrome-text: light-dark(var(--color-text), var(--color-on-dark));
    --color-chrome-muted: light-dark(var(--color-muted), var(--color-on-dark-muted));
    --color-chrome-line: light-dark(rgb(43 33 24 / 0.12), var(--color-line-on-dark));
    --color-chrome-glass: light-dark(rgb(43 33 24 / 0.03), var(--color-glass-on-dark));
    --color-chrome-glass-strong: light-dark(rgb(43 33 24 / 0.07), var(--color-glass-on-dark-strong));
    --color-chrome-accent: light-dark(var(--color-primary), var(--color-gold-light));
    --color-chrome-accent-contrast: light-dark(var(--color-primary-contrast), var(--color-night-deep));
    --color-chrome-haze: light-dark(rgb(201 162 39 / 0.1), var(--color-gold-haze));
    --color-chrome-wordmark: light-dark(rgb(201 162 39 / 0.5), var(--color-gold-faint));
    --color-chrome-overlay: light-dark(rgb(251 246 234 / 0.6), var(--color-overlay-glass));
    --color-chrome-overlay-border: light-dark(rgb(43 33 24 / 0.1), var(--color-overlay-border));
    --color-chrome-shadow: light-dark(rgb(43 33 24 / 0.08), transparent);

    /* The brand notch stands out from the bar: night-blue by day, parchment by night. */
    --color-notch-bg: light-dark(var(--color-night), var(--color-parchment-light));
    --color-notch-text: light-dark(var(--color-on-dark), var(--color-text));
    --color-notch-hover-bg: light-dark(rgb(27 34 54 / 0.08), var(--color-glass-on-dark-strong));

    color-scheme: light dark;
    --font-family-base: 'EB Garamond Variable', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
    --font-family-ui: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-family-display: 'Cinzel Bold', 'Trajan Pro', 'Palatino Linotype', Georgia, serif;
    --letter-spacing-display: 0.08em;
    --space-xs: 0.25rem;
    --space-s: 0.5rem;
    --space-m: 1rem;
    --space-l: 2rem;
    --space-xl: 4rem;
    --radius-l: 1rem;
    --radius-xl: 1.5rem;
    --frame-gap: 0.5rem;
    --header-height: 4.5rem;
    --header-max-width: 93.75rem;
    --header-inset: max(var(--frame-gap), calc((100% - var(--header-max-width)) / 2));
    --notch-width: 26rem;
    --notch-slant: 2.25rem;
    --settings-width: 3.5rem;
    --content-max-width: 72rem;
    --page-gutter: max(var(--space-m), calc((100% - var(--content-max-width)) / 2));
}

:root[data-theme='light'] {
    color-scheme: light;
}

:root[data-theme='dark'] {
    color-scheme: dark;
}

/* 1 in the light theme, 0 in the dark one: for differences light-dark() cannot express, such as positions. */
:root {
    --is-day: 0;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme='dark']) {
        --is-day: 1;
    }
}

:root[data-theme='light'] {
    --is-day: 1;
}

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

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-family-base);
    /* EB Garamond has a small x-height: 19px reads like 17px in most serifs. */
    font-size: 1.1875rem;
    line-height: 1.65;
    color: var(--color-page-text);
    background:
        radial-gradient(ellipse at top, var(--color-page-glow), transparent 70%),
        var(--color-page-bg);
}

main {
    flex: 1;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

h1,
h2,
h3 {
    font-family: var(--font-family-display);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: var(--letter-spacing-display);
    text-transform: uppercase;
}

a {
    color: var(--color-link);
    text-decoration-color: var(--color-gold);
    text-underline-offset: 0.2em;
}

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

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

:focus-visible {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    z-index: 10;
    left: var(--space-m);
    top: -10rem;
    padding: var(--space-s) var(--space-m);
    background-color: var(--color-parchment);
    color: var(--color-primary);
}

.skip-link:focus {
    top: var(--space-m);
}

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

/* The flag a player picked, beside their name: 4:3 like the flag icons. */
.country-flag {
    display: inline-flex;
    margin-inline-end: 0.5em;
    vertical-align: -0.1em;
}

.country-flag__icon {
    width: 1.33em;
    height: 1em;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 15%);
}

.page {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-l) var(--space-m);
}

/*
 * Header: a rounded card inset from the window edges (parchment by day, night-blue by night), with the brand in a
 * contrasting notch cut through its full height and the menu spread on both sides. On the home page it is laid over
 * the hero card.
 */
.site-header {
    --header-border-width: 0px;

    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr var(--notch-width) 1fr;
    align-items: center;
    min-height: var(--header-height);
    margin: var(--frame-gap) var(--header-inset) 0;
    padding: 0 var(--space-l);
    border-radius: var(--radius-l);
    background-color: var(--color-chrome-bg);
    box-shadow: 0 8px 24px var(--color-chrome-shadow);
    color: var(--color-chrome-text);
    font-family: var(--font-family-ui);
}

body:has(.home-hero) .site-header {
    position: absolute;
    top: var(--frame-gap);
    left: var(--header-inset);
    right: var(--header-inset);
    --header-border-width: 1px;

    margin: 0;
    border: var(--header-border-width) solid var(--color-chrome-overlay-border);
    background-color: var(--color-chrome-overlay);
    backdrop-filter: blur(16px) saturate(140%);
}

.site-header :focus-visible,
.site-footer :focus-visible,
.settings-panel :focus-visible {
    outline-color: var(--color-focus-ring);
}

.site-header__brand {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-s);
    padding-inline: var(--notch-slant);
    background-color: var(--color-notch-bg);
    clip-path: polygon(0 0, 100% 0, calc(100% - var(--notch-slant)) 100%, var(--notch-slant) 100%);
    color: var(--color-notch-text);
    font-family: var(--font-family-display);
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: var(--letter-spacing-display);
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

/* The whole notch reads as a button: hovering leaves a faint glass and gives the text the colour of the other links. */
.site-header__brand:hover {
    background-color: var(--color-notch-hover-bg);
    color: var(--color-chrome-accent);
}

.site-header__crown {
    width: 1.5em;
    height: 1.5em;
    color: var(--color-gold);
    /* Lowered with the brand name below so both still look level. */
    translate: 0 0.05em;
}

/*
 * Cinzel's ascent (0.976em) is much larger than its descent (0.372em), so centring the line box leaves the capitals
 * (0.7em) above the middle of the notch: move them down by the difference between the two centres. Exactly centred,
 * they still look high in the notch, so they go down a little further.
 */
.site-header__brand-name {
    translate: 0 calc((0.7em - (0.976em - 0.372em)) / 2 + 0.1em);
}

.site-nav {
    grid-column: 1 / -1;
    grid-row: 1;
    display: grid;
    grid-template-columns: subgrid;
}

.site-nav__list {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav__list--start {
    grid-column: 1;
}

.site-nav__list--end {
    grid-column: 3;
    padding-right: var(--settings-width);
}

.site-nav__link,
.site-nav__cta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-s) 0;
    color: var(--color-chrome-text);
    font-size: 1rem;
    letter-spacing: -0.01em;
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-nav__link:hover,
.site-nav__link[aria-current],
.site-nav__cta {
    color: var(--color-chrome-accent);
}

.site-nav__cta {
    font-weight: 600;
}

.site-nav__cta:hover,
.site-nav__cta[aria-current] {
    color: var(--color-chrome-text);
}

.site-nav__cta-icon {
    width: 1.125em;
    height: 1.125em;
    transition: transform 0.2s ease;
}

.site-nav__cta:hover .site-nav__cta-icon {
    transform: translate(2px, -2px);
}

.site-settings {
    position: absolute;
    top: 50%;
    right: var(--space-m);
    transform: translateY(-50%);
}

.site-settings__button {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--color-chrome-muted);
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.site-settings__button:hover {
    background-color: var(--color-chrome-glass-strong);
    color: var(--color-chrome-text);
}

.site-settings__icon {
    width: 1.375rem;
    height: 1.375rem;
    transition: rotate 0.4s ease;
}

.site-settings__button:hover .site-settings__icon {
    rotate: 60deg;
}

/*
 * Settings panel: a native popover (opened by the gear button, closed by Escape or a click outside, even without
 * JavaScript) pinned under the right end of the header. Languages are plain links; the theme choice needs the theme
 * controller, so it only shows once the controller is connected.
 */
.settings-panel {
    position: fixed;
    inset: calc(var(--frame-gap) + var(--header-height) + var(--space-s)) var(--header-inset) auto auto;
    width: min(20rem, 100vw - 2 * var(--frame-gap));
    margin: 0;
    padding: var(--space-m) 1.25rem 1.25rem;
    border: 1px solid var(--color-chrome-line);
    border-radius: var(--radius-l);
    background-color: var(--color-chrome-bg);
    box-shadow: 0 20px 50px var(--color-shadow);
    color: var(--color-chrome-text);
    font-family: var(--font-family-ui);
}

.settings-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-s);
}

.settings-panel__title {
    margin: 0;
    color: var(--color-chrome-accent);
    font-family: var(--font-family-ui);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.18em;
}

.settings-panel__close {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--color-chrome-muted);
    cursor: pointer;
}

.settings-panel__close:hover {
    background-color: var(--color-chrome-glass-strong);
    color: var(--color-chrome-text);
}

.settings-panel__close-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.settings-panel__section {
    min-inline-size: 0;
    margin: var(--space-m) 0 0;
    padding: 0;
    border: 0;
}

.settings-panel__label {
    margin: 0 0 var(--space-s);
    padding: 0;
    color: var(--color-chrome-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* Segmented control: one pill per option, the current one filled. */
.settings-panel__options {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: var(--space-xs);
    margin: 0;
    padding: var(--space-xs);
    border-radius: 999px;
    background-color: var(--color-chrome-glass-strong);
    list-style: none;
}

.settings-panel__option {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.5rem;
    padding: 0 0.75rem;
    border-radius: 999px;
    color: var(--color-chrome-text);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.settings-panel a.settings-panel__option:hover,
.settings-panel__option:hover {
    background-color: var(--color-chrome-glass-strong);
    color: var(--color-chrome-text);
}

.settings-panel a.settings-panel__option[aria-current],
.settings-panel__option:has(:checked) {
    background-color: var(--color-chrome-accent);
    color: var(--color-chrome-accent-contrast);
}

.settings-panel__option:has(:focus-visible) {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
}

.settings-panel__radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.settings-panel__option-icon {
    width: 1rem;
    height: 1rem;
}

.settings-panel__theme {
    display: none;
}

.settings-panel--enhanced .settings-panel__theme {
    display: block;
}

/* Hamburger drawn with borders: only shown once the disclosure controller can open the menu. */
.site-header__toggle {
    display: none;
    position: relative;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-chrome-text);
    cursor: pointer;
}

.site-header__toggle::before,
.site-header__toggle::after {
    content: '';
    position: absolute;
    left: 0.625rem;
    right: 0.625rem;
    height: 2px;
    background-color: currentColor;
    transition: transform 0.2s ease;
}

.site-header__toggle::before {
    top: calc(50% - 4px);
}

.site-header__toggle::after {
    top: calc(50% + 3px);
}

.site-header__toggle[aria-expanded='true']::before {
    transform: translateY(3.5px) rotate(45deg);
}

.site-header__toggle[aria-expanded='true']::after {
    transform: translateY(-3.5px) rotate(-45deg);
}

/* The focus frame looked heavy around the bars: keyboard focus colours the bars themselves instead. */
.site-header__toggle:focus-visible {
    outline: none;
    color: var(--color-focus-ring);
}

/* Narrower screens: brand notch on the left, settings and menu buttons on the right. */
@media (max-width: 75rem) {
    .site-header {
        grid-template-columns: auto 1fr auto auto;
        padding: 0 var(--space-s) 0 0;
    }

    /* The notch follows the rounded left corners of the bar. */
    .site-header__brand {
        --notch-radius: calc(var(--radius-l) - var(--header-border-width));

        grid-column: 1;
        padding-inline: var(--space-l) var(--notch-slant);
        border-radius: var(--notch-radius) 0 0 var(--notch-radius);
        clip-path: polygon(0 0, 100% 0, calc(100% - var(--notch-slant)) 100%, 0 100%);
        font-size: clamp(0.8125rem, 3.4vw, 1.0625rem);
    }

    .site-settings {
        position: static;
        grid-column: 3;
        grid-row: 1;
        transform: none;
    }

    .site-header__toggle {
        grid-column: 4;
        grid-row: 1;
    }

    .site-header--enhanced .site-header__toggle {
        display: block;
    }

    /* Without JavaScript the menu stays visible on a second row. */
    .site-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0 var(--space-l);
        padding-bottom: var(--space-s);
    }

    .site-nav__list {
        flex-wrap: wrap;
        gap: 0 var(--space-l);
    }

    .site-nav__list--end {
        padding-right: 0;
    }

    .site-header--enhanced .site-nav {
        display: none;
    }

    .site-header--enhanced.site-header--menu-open .site-nav {
        position: absolute;
        top: calc(100% + var(--frame-gap));
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: var(--space-m) var(--space-l);
        border-radius: var(--radius-l);
        background-color: var(--color-parchment-light);
        box-shadow: 0 12px 32px var(--color-shadow);
    }

    .site-header--menu-open .site-nav__list {
        flex-direction: column;
        align-items: stretch;
    }

    .site-header--menu-open .site-nav__link,
    .site-header--menu-open .site-nav__cta {
        display: flex;
        padding: var(--space-s) 0;
        color: var(--color-text);
        font-size: 1.125rem;
    }

    .site-header--menu-open .site-nav__link[aria-current],
    .site-header--menu-open .site-nav__cta {
        color: var(--color-primary);
    }
}

/* Phones: a tighter notch so the brand, settings and menu buttons share one row. */
@media (max-width: 30rem) {
    .site-header {
        --notch-slant: 1.5rem;
    }

    .site-header__brand {
        padding-left: var(--space-m);
        font-size: 0.75rem;
        letter-spacing: 0.04em;
    }
}

.record-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-m);
    margin: 0;
    padding: 0;
    list-style: none;
}

/*
 * Footer: a card inset from the window edges like the header, with the brand, the site map, the
 * community link and a giant engraved wordmark sinking into its bottom edge.
 */
.site-footer {
    position: relative;
    isolation: isolate;
    margin: var(--space-xl) var(--frame-gap) var(--frame-gap);
    padding: var(--space-xl) var(--page-gutter) 0;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background:
        radial-gradient(ellipse 60% 80% at 100% 0, var(--color-chrome-haze), transparent 70%),
        var(--color-chrome-bg);
    box-shadow: 0 8px 24px var(--color-chrome-shadow);
    color: var(--color-chrome-muted);
    font-family: var(--font-family-ui);
    font-size: 0.9375rem;
}

.site-footer a {
    color: var(--color-chrome-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.site-footer__top {
    display: grid;
    grid-template-columns: minmax(15rem, 1.2fr) 2fr minmax(13rem, 1fr);
    gap: var(--space-xl) var(--space-l);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--color-chrome-line);
}

.site-footer__logo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-m);
    font-family: var(--font-family-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: var(--letter-spacing-display);
    text-transform: uppercase;
}

.site-footer__crown {
    width: 1.5em;
    height: 1.5em;
    color: var(--color-gold);
}

.site-footer__tagline {
    max-width: 22rem;
    margin: var(--space-m) 0 var(--space-l);
    line-height: 1.6;
}

.site-footer__cta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-s);
    padding: 0.625rem 1.125rem;
    border: 1px solid var(--color-chrome-accent);
    border-radius: 999px;
    font-weight: 600;
}

.site-footer a.site-footer__cta {
    color: var(--color-chrome-accent);
}

.site-footer a.site-footer__cta:hover {
    background-color: var(--color-chrome-accent);
    color: var(--color-chrome-accent-contrast);
}

.site-footer__icon {
    width: 1.125em;
    height: 1.125em;
}

.site-footer__external {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.site-footer__nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: var(--space-l);
}

.site-footer__heading {
    margin: 0 0 var(--space-m);
    color: var(--color-chrome-accent);
    font-family: var(--font-family-ui);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.18em;
}

.site-footer__links {
    display: grid;
    gap: 0.625rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-footer__partner {
    display: flex;
    align-items: center;
    gap: var(--space-m);
    padding: 0.75rem var(--space-m) 0.75rem 0.75rem;
    border: 1px solid var(--color-chrome-line);
    border-radius: var(--radius-l);
    background-color: var(--color-chrome-glass);
    transition: border-color 0.2s ease;
}

.site-footer__partner:hover {
    border-color: var(--color-chrome-accent);
}

.site-footer__partner-logo {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    background: url("../images/webp/logo_nysux-contest-G7WIefB.webp") center / cover;
}

.site-footer__partner-name {
    flex: 1;
    font-weight: 600;
}

.site-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-s) var(--space-l);
    padding-block: var(--space-l);
    font-size: 0.8125rem;
}

.site-footer__bottom p {
    margin: 0;
}

.site-footer__disclaimer {
    max-width: 40rem;
}

.site-footer__wordmark {
    margin: 0 calc(-1 * var(--page-gutter)) -0.18em;
    color: transparent;
    font-family: var(--font-family-display);
    font-size: min(11vw, 13rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    -webkit-text-stroke: 1px var(--color-chrome-wordmark);
    user-select: none;
}

@media (max-width: 60rem) {
    .site-footer__top {
        grid-template-columns: 1fr;
        gap: var(--space-l);
    }
}

.button {
    display: inline-block;
    padding: var(--space-s) var(--space-m);
    border: 2px solid var(--color-gold);
    border-radius: 2px;
    background-color: var(--color-primary);
    color: var(--color-primary-contrast);
    font-family: var(--font-family-display);
    font-size: 0.875rem;
    letter-spacing: var(--letter-spacing-display);
    text-decoration: none;
    text-transform: uppercase;
}

.button:hover {
    background-color: var(--color-primary-dark);
    color: var(--color-primary-contrast);
}

.button--secondary {
    background-color: transparent;
    color: var(--color-link);
}

.button--secondary:hover {
    background-color: var(--color-panel-hover);
    color: var(--color-link-hover);
}

/*
 * Grey cover of the page transition (see templates/_partials/_page_transition.html.twig), painted with the page so that
 * nothing shows before the page-transition controller opens it, and shown again to leave the page. Should the
 * controller never start, the cover vanishes by itself after a few seconds rather than hiding the page for good.
 */
.page-transition {
    position: fixed;
    /* Above everything, the header included. */
    z-index: 100;
    inset: 0;
    /* Read by the controller for the lightning crackling through the grey. */
    color: var(--color-page-transition-lightning);
    background-color: var(--color-page-transition);
    animation: page-transition-safety-net 0s 4s forwards;
}

.page-transition--opening {
    animation: none;
}

/* The dust drawn on the canvas takes over from the grey of the cover. */
.page-transition--open {
    background-color: transparent;
    pointer-events: none;
}

.page-transition__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* The crown and the dust drawn on the canvas cover the page little by little, and no click goes through any more. */
.page-transition--leaving {
    background-color: transparent;
}

/*
 * Ready for the shake of the screen when the crown lands (page-transition controller): the elements it moves get layers
 * of their own as soon as the page is left, rather than at that very moment, which would make it stutter.
 */
body:has(> .page-transition--leaving) > * {
    will-change: transform;
}

/*
 * Lands on the middle of the bottom edge of the screen, where the dust rises from. Nearly as high as the screen, it is
 * wider than a portrait screen, which crops its sides. Centred with "translate", which the "transform" of its fall
 * leaves alone.
 */
.page-transition__crown {
    position: absolute;
    bottom: 0;
    left: 50%;
    height: 90vh;
    /* The viewBox of the Thronefall crown. */
    aspect-ratio: 245.5 / 180.8;
    translate: -50% 0;
    transform-origin: 50% 100%;
    /* The halo of the crowns of the game banners of the home page, sized for this far bigger crown. */
    filter: drop-shadow(0 0 2.5vh currentColor);
}

/* In the colour of its game, as on the game banners of the home page. */
.page-transition__crown--thronefall {
    color: var(--color-thronefall);
}

.page-transition__crown--craaghelm {
    aspect-ratio: 228.8 / 212.8;
    color: var(--color-craaghelm);
}

.page-transition__crown-icon {
    display: block;
    width: 100%;
    height: 100%;
}

/* Phones: a smaller crown, cropped less by the narrow screen. */
@media (max-width: 30rem) {
    .page-transition__crown {
        height: 75vh;
    }
}

@keyframes page-transition-safety-net {
    to {
        visibility: hidden;
    }
}

@media (scripting: none), (prefers-reduced-motion: reduce) {
    .page-transition {
        display: none;
    }
}

/*
 * Back-to-top link pinned in the bottom right corner, shown once the page is scrolled down (back-to-top controller):
 * a small glass card of the same family as the header, which turns gold like the main buttons when hovered.
 */
.back-to-top {
    position: fixed;
    /* Above the film grain of the home theme. */
    z-index: 5;
    right: max(var(--frame-gap) + var(--space-s), env(safe-area-inset-right));
    bottom: max(var(--frame-gap) + var(--space-s), env(safe-area-inset-bottom));
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--color-chrome-overlay-border);
    border-radius: var(--radius-l);
    background-color: var(--color-chrome-overlay);
    backdrop-filter: blur(16px) saturate(140%);
    box-shadow:
        inset 0 1px 0 var(--color-chrome-haze),
        0 8px 24px var(--color-chrome-shadow);
    color: var(--color-chrome-accent);
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.75rem) scale(0.9);
    transition:
        opacity 0.3s ease,
        transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0.3s,
        background-color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease,
        color 0.3s ease;
}

.back-to-top--visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.back-to-top:hover {
    border-color: var(--color-gold);
    background-color: var(--color-gold-light);
    box-shadow: 0 12px 32px -8px rgb(201 162 39 / 0.6);
    color: var(--color-night-deep);
}

.back-to-top--visible:hover {
    transform: translateY(-2px);
}

.back-to-top__icon {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.back-to-top:hover .back-to-top__icon {
    transform: translateY(-2px);
}

/*
 * Notifications of the last action (see templates/_partials/_toast.html.twig), pinned in the bottom right corner
 * above the back-to-top link: glass cards of the same family as the header, whose coloured edge and icon take the
 * accent of the site (crimson by day, gold by night) or the colour of an outcome. The region lets clicks through.
 */
.toasts {
    --toasts-inset: max(var(--frame-gap) + var(--space-s), env(safe-area-inset-right));

    position: fixed;
    /* Above the back-to-top link and the film grain of the home theme. */
    z-index: 6;
    right: var(--toasts-inset);
    bottom: max(var(--frame-gap) + var(--space-s), env(safe-area-inset-bottom));
    left: var(--toasts-inset);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-s);
    pointer-events: none;
    transition: translate 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Moved up above the back-to-top link (3rem high) while it shares the corner. */
body:has(.back-to-top--visible) .toasts {
    translate: 0 calc(-3rem - var(--space-s));
}

.toast {
    --toast-accent: var(--color-chrome-accent);

    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: min(100%, 24rem);
    padding: 0.875rem 0.625rem 0.875rem var(--space-m);
    border: 1px solid var(--color-chrome-overlay-border);
    border-left: 4px solid var(--toast-accent);
    border-radius: var(--radius-l);
    background-color: color-mix(in srgb, var(--color-chrome-bg) 88%, transparent);
    backdrop-filter: blur(16px) saturate(140%);
    box-shadow:
        inset 0 1px 0 var(--color-chrome-haze),
        0 12px 32px -8px var(--color-shadow);
    color: var(--color-chrome-text);
    font-family: var(--font-family-ui);
    font-size: 0.9375rem;
    line-height: 1.45;
    pointer-events: auto;
    animation: toast-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast__icon {
    flex-shrink: 0;
    width: 1.375rem;
    height: 1.375rem;
    margin-top: 0.0625rem;
    color: var(--toast-accent);
}

.toast__body {
    flex: 1;
    min-width: 0;
}

.toast__title {
    margin: 0 0 var(--space-xs);
    font-family: var(--font-family-display);
    letter-spacing: var(--letter-spacing-display);
}

.toast__text {
    margin: 0;
    color: var(--color-chrome-muted);
}

/* Without a title, the text is the message itself. */
.toast__text:only-child {
    color: var(--color-chrome-text);
    font-weight: 500;
}

.toast__close {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    margin-top: -0.125rem;
    padding: 0;
    border: 0;
    border-radius: 0.5rem;
    background: none;
    color: var(--color-chrome-muted);
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

/* "display: grid" would otherwise show the button the toast controller has not enabled yet. */
.toast__close[hidden] {
    display: none;
}

.toast__close:hover {
    background-color: var(--color-chrome-glass-strong);
    color: var(--color-chrome-text);
}

.toast__close-icon {
    width: 1rem;
    height: 1rem;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(0.75rem);
    }
}

/* Fading out by itself (toast controller), before it is removed. */
.toast--leaving {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(0.5rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top,
    .back-to-top__icon,
    .site-header__brand,
    .site-nav__link,
    .site-nav__cta,
    .site-nav__cta-icon,
    .site-header__toggle::before,
    .site-header__toggle::after,
    .site-settings__button,
    .site-settings__icon,
    .settings-panel__option,
    .site-footer a,
    .toasts,
    .toast__close {
        transition: none;
    }

    .toast,
    .toast--leaving {
        animation: none;
    }

    .back-to-top--visible:hover,
    .back-to-top:hover .back-to-top__icon,
    .site-nav__cta:hover .site-nav__cta-icon {
        transform: none;
    }

    .site-settings__button:hover .site-settings__icon {
        rotate: none;
    }
}
