/* Shared site chrome: fonts, design tokens, the global header (.sg-header) and footer (.sg-footer).
   Loaded by every public page. scripts/apply-site-header.mjs inserts the matching markup. */

@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/assets/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2-variations"),
         url("/assets/fonts/bricolage-grotesque-latin-wght-normal.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: "Bricolage Grotesque";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/assets/fonts/bricolage-grotesque-latin-ext-wght-normal.woff2") format("woff2-variations"),
         url("/assets/fonts/bricolage-grotesque-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --sg-font: "Bricolage Grotesque", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
    --sg-bg: #12100e;
    --sg-bg-2: #1a1714;
    --sg-bg-3: #24201c;
    --sg-line: rgba(240, 230, 214, 0.1);
    --sg-line-2: rgba(240, 230, 214, 0.18);
    --sg-ink: #f2ece3;
    --sg-ink-2: #c3b9ab;
    --sg-ink-3: #8c8275;
    --sg-accent: #f0b24a;
    --sg-accent-2: #ffc96b;
    --sg-accent-ink: #1c1407;
    --sg-header-h: 58px;
    --sg-z-header: 40;
    --sg-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Skip link ---------- */

.sg-skip {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: calc(var(--sg-z-header) + 1);
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--sg-accent);
    color: var(--sg-accent-ink);
    font: 600 15px/1.2 var(--sg-font);
    text-decoration: none;
    transition: top 0.18s var(--sg-ease);
}

.sg-skip:focus {
    top: 10px;
    outline: 2px solid var(--sg-ink);
    outline-offset: 2px;
}

.sg-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Header ---------- */

/* The header sits inside whatever body layout a page already has (flex-centred game pages, padded
   content pages). It stretches to the body's content box and paints its background edge to edge with
   a spread shadow clipped to the header's height, so it never causes horizontal scrolling. */
.sg-header {
    position: sticky;
    top: 0;
    z-index: var(--sg-z-header);
    display: block;
    box-sizing: border-box;
    align-self: stretch;
    width: auto;
    max-width: none;
    height: auto;
    margin: 0 0 1.25rem;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--sg-line);
    background: rgba(18, 16, 14, 0.94);
    box-shadow: 0 0 0 100vmax rgba(18, 16, 14, 0.94);
    clip-path: inset(-100vmax -100vmax 0 -100vmax);
    color: var(--sg-ink);
    font-family: var(--sg-font);
    font-size: 15px;
    line-height: 1.2;
    text-align: left;
    letter-spacing: normal;
    text-transform: none;
}

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

.sg-header__inner {
    --sg-pad: 20px;
    display: flex;
    align-items: center;
    gap: 28px;
    width: 100%;
    max-width: 1240px;
    height: var(--sg-header-h);
    margin: 0 auto;
    padding: 0 var(--sg-pad);
}

.sg-logo {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: none;
    color: var(--sg-ink);
    font-family: var(--sg-font);
    font-size: 19px;
    font-weight: 780;
    letter-spacing: -0.03em;
    text-decoration: none;
    background: none;
    -webkit-text-fill-color: currentColor;
}

.sg-logo__mark {
    width: 24px;
    height: 24px;
    flex: none;
    transition: transform 0.25s var(--sg-ease);
}

.sg-logo__mark rect {
    fill: var(--sg-accent);
}

.sg-logo__mark path {
    fill: none;
    stroke: var(--sg-accent-ink);
    stroke-width: 2.6;
    stroke-linecap: round;
}

.sg-logo:hover .sg-logo__mark {
    transform: rotate(-8deg);
}

.sg-nav {
    position: static;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: stretch;
    gap: 4px;
    width: auto;
    height: var(--sg-header-h);
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
}

.sg-header .sg-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: var(--sg-ink-2);
    font-family: var(--sg-font);
    font-size: 15px;
    font-weight: 540;
    letter-spacing: -0.005em;
    text-decoration: none;
    white-space: nowrap;
    background: none;
    border: 0;
    border-radius: 0;
    transition: color 0.18s var(--sg-ease);
}

.sg-header .sg-nav a::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--sg-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.22s var(--sg-ease);
}

.sg-header .sg-nav a:hover {
    color: var(--sg-ink);
}

.sg-header .sg-nav a:hover::after {
    transform: scaleX(0.45);
}

.sg-header .sg-nav a[aria-current] {
    color: var(--sg-ink);
    font-weight: 640;
}

.sg-header .sg-nav a[aria-current]::after {
    transform: scaleX(1);
}

.sg-header .sg-nav .sg-nav__search {
    display: none;
}

.sg-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 0 0 auto;
    padding: 0;
}

.sg-header .sg-search input {
    width: 230px;
    height: 36px;
    margin: 0;
    padding: 0 34px 0 36px;
    border: 1px solid var(--sg-line-2);
    border-radius: 9px;
    background: var(--sg-bg-2);
    color: var(--sg-ink);
    font: 450 14px/1 var(--sg-font);
    box-shadow: none;
    transition: border-color 0.18s var(--sg-ease), background-color 0.18s var(--sg-ease), width 0.25s var(--sg-ease);
    -webkit-appearance: none;
    appearance: none;
}

.sg-header .sg-search input::placeholder {
    color: var(--sg-ink-3);
    opacity: 1;
}

.sg-header .sg-search input:hover {
    border-color: rgba(240, 230, 214, 0.28);
}

.sg-header .sg-search input:focus {
    width: 280px;
    outline: none;
    border-color: var(--sg-accent);
    background: var(--sg-bg-3);
}

.sg-search__icon {
    position: absolute;
    left: 11px;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--sg-ink-3);
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}


.sg-header a:focus-visible,
.sg-header input:focus-visible {
    outline: 2px solid var(--sg-accent);
    outline-offset: 2px;
}

/* Game pages: the header scrolls away so it never covers the playfield. */
body.game-page > .sg-header,
body > .sg-header.sg-header--static {
    position: relative;
}

body.game-page > .sg-header {
    margin-bottom: 0.9rem;
}

/* Content pages whose old header used to reserve room for an absolutely positioned nav. */
.sg-header + header {
    padding-top: 2.4rem;
}

@media (max-width: 980px) {
    .sg-header__inner {
        gap: 14px;
    }

    .sg-header .sg-nav a {
        padding: 0 9px;
    }

    .sg-header .sg-nav a::after {
        left: 9px;
        right: 9px;
    }

    .sg-header .sg-search input,
    .sg-header .sg-search input:focus {
        width: 170px;
    }
}

@media (max-width: 760px) {
    .sg-header {
        position: relative;
    }

    .sg-header__inner {
        --sg-pad: 16px;
        flex-wrap: wrap;
        height: auto;
        padding: 10px var(--sg-pad) 0;
        row-gap: 4px;
    }

    /* Game pages already pad the body, so the header only needs a hairline of its own. */
    body.game-page > .sg-header .sg-header__inner {
        --sg-pad: 2px;
    }

    .sg-search {
        display: none;
    }

    .sg-nav {
        order: 3;
        flex: 1 0 100%;
        height: 42px;
        margin: 0 calc(-1 * var(--sg-pad));
        padding: 0 max(0px, calc(var(--sg-pad) - 10px));
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
        mask-image: linear-gradient(90deg, #000 85%, transparent);
    }

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

    .sg-header .sg-nav a {
        padding: 0 10px;
        font-size: 15px;
    }

    .sg-header .sg-nav .sg-nav__search {
        display: inline-flex;
    }
}

/* ---------- Footer ---------- */

.sg-footer {
    display: block;
    align-self: stretch;
    margin: 4rem 0 0;
    padding: 0;
    border-top: 1px solid var(--sg-line);
    background: var(--sg-bg);
    box-shadow: 0 0 0 100vmax var(--sg-bg);
    clip-path: inset(0 -100vmax -100vmax -100vmax);
    color: var(--sg-ink-2);
    font-family: var(--sg-font);
    font-size: 14.5px;
    line-height: 1.5;
    text-align: left;
}

.sg-footer__inner {
    display: grid;
    grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(0, 1fr));
    gap: 32px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 48px 20px 28px;
}

.sg-footer__brand p {
    max-width: 30ch;
    margin: 12px 0 18px;
    color: var(--sg-ink-3);
}

.sg-footer h2 {
    margin: 2px 0 12px;
    color: var(--sg-ink);
    font: 650 13px/1.2 var(--sg-font);
    letter-spacing: 0.02em;
}

.sg-footer ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sg-footer li + li {
    margin-top: 7px;
}

.sg-footer a {
    color: var(--sg-ink-2);
    text-decoration: none;
    transition: color 0.18s var(--sg-ease);
}

.sg-footer a:hover {
    color: var(--sg-accent-2);
}

.sg-footer a:focus-visible {
    outline: 2px solid var(--sg-accent);
    outline-offset: 2px;
    border-radius: 3px;
}

.sg-footer__support {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--sg-line-2);
    border-radius: 8px;
    color: var(--sg-ink);
    font-weight: 560;
}

.sg-footer .sg-footer__support:hover {
    border-color: var(--sg-accent);
    color: var(--sg-ink);
}

.sg-footer__support svg {
    width: 15px;
    height: 15px;
    fill: var(--sg-accent);
}

.sg-footer__legal {
    max-width: 1240px;
    margin: 0 auto;
    padding: 16px 20px 32px;
    border-top: 1px solid var(--sg-line);
    color: var(--sg-ink-3);
    font-size: 13px;
}

@media (max-width: 900px) {
    .sg-footer__inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sg-footer__brand {
        grid-column: 1 / -1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sg-header *,
    .sg-footer * {
        transition: none !important;
    }
}
