/* ============================================================
   Frameskip Games — shared stylesheet

   Type: Instrument Serif (display) + Schibsted Grotesk (UI).
   Colour: warm dark by default, warm paper as the light theme.
   Flat fills only — no gradients, no shadows, no blur.
   ============================================================ */

/* --- Tokens ----------------------------------------------- */

:root {
    color-scheme: dark;

    --bg: #0f0f11;
    --surface: #17171a;
    --surface-hover: #1e1e22;
    --line: #2a2a2f;
    --line-strong: #3a3a41;

    --text: #f4f4f5;
    --muted: #a1a1aa;
    --faint: #8a8a93;
    --accent: #ffd60a;
    --on-accent: #111113;

    --display: 'Instrument Serif', 'Iowan Old Style', Georgia,
        'Times New Roman', serif;
    --sans: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system,
        'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    /* Card art panels are dark in BOTH themes, so they always take the
       vivid brand yellow rather than the light theme's deep gold.
       Deliberately not overridden in [data-theme='light'].
       Contrast on the four tones: 9.7:1 to 11.1:1. */
    --art-ink: #ffd60a;
    --tone-1: #232329;
    --tone-2: #2b2b22;
    --tone-3: #2e2530;
    --tone-4: #23302b;

    --measure: 52rem;
    --gutter: 2rem;
    --radius: 4px;
}

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

    --bg: #f8f8f7;
    --surface: #ffffff;
    --surface-hover: #f0f0ef;
    --line: #e3e3e1;
    --line-strong: #cfcfcd;

    --text: #111113;
    --muted: #62626b;
    --faint: #6e6e77;
    /* Deep gold rather than yellow — #ffd60a on cream is 1.33:1. */
    --accent: #7a5c00;
    --on-accent: #ffffff;
}

/* --- Reset ------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-wrap: break-word;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 400;
    letter-spacing: -0.015em;
    line-height: 1.15;
}

p {
    margin: 0;
}

ul,
ol {
    margin: 0;
    padding: 0;
}

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

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

::selection {
    background: var(--accent);
    color: var(--on-accent);
}

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

/* --- Layout ------------------------------------------------ */

/* Flex column so the footer can sit at the bottom on short pages. */
.shell {
    width: 100%;
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--gutter);
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.rule {
    height: 1px;
    border: 0;
    margin: 0;
    background: var(--line);
}

/* --- Top bar ----------------------------------------------- */

.site-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 0 1.25rem;
}

.wordmark {
    margin-right: auto;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wordmark:hover {
    color: var(--accent);
}

.theme-toggle {
    flex: none;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* Inline text link — mailto addresses on the legal pages */
.link {
    color: var(--accent);
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease;
}

.link:hover {
    border-bottom-color: var(--accent);
}

/* --- Hero --------------------------------------------------- */

.hero {
    padding: clamp(2.5rem, 8vw, 5rem) 0 clamp(2.5rem, 6vw, 4rem);
}

.eyebrow,
.section-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
}

.hero-title {
    margin-top: 1.25rem;
    font-family: var(--display);
    font-size: clamp(2.75rem, 8vw, 5rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
}

.hero-subtext {
    margin-top: 1.25rem;
    max-width: 34ch;
    font-size: clamp(1.0625rem, 2.4vw, 1.25rem);
    color: var(--muted);
}

/* --- Games -------------------------------------------------- */

.games {
    padding-bottom: clamp(3rem, 8vw, 5rem);
}

.section-label {
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
}

/* auto-fill means 1 card, 3 cards or 12 all lay out with no CSS change. */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15.625rem, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
}

.card-art {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--tone-1);
    overflow: hidden;
}

.card-art--1 { background: var(--tone-1); }
.card-art--2 { background: var(--tone-2); }
.card-art--3 { background: var(--tone-3); }
.card-art--4 { background: var(--tone-4); }

.card-art img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Sits behind the <img>; revealed when the image 404s and is removed. */
.card-art-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--display);
    font-size: 3.5rem;
    letter-spacing: 0.02em;
    color: var(--art-ink);
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
    flex: 1;
}

.card-title {
    font-family: var(--display);
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

.card-desc {
    color: var(--muted);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.card-meta {
    margin-top: auto;
    padding-top: 0.875rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 2px;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.tag-accent {
    color: var(--accent);
    border-color: var(--accent);
}

/* Placeholder card so the grid never looks broken with one title.
   Mirrors the real card's structure — empty art block plus body —
   so it reads as a slot waiting to be filled. */
.card--empty {
    border-style: dashed;
    background: none;
}

.card--empty:hover {
    transform: none;
}

.card--empty .card-art {
    background: none;
    border-bottom: 1px dashed var(--line);
}

.card--empty .card-art-fallback {
    display: none;
}

.card--empty .card-title,
.card--empty .card-desc {
    color: var(--faint);
}

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

.site-foot {
    margin-top: auto;
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
    border-top: 1px solid var(--line);
}

.foot-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.15s ease, border-color 0.15s ease,
        background-color 0.15s ease;
}

.btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.foot-meta {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.foot-meta a {
    border-bottom: 1px solid var(--line);
}

.foot-meta a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.foot-copy {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--faint);
}

/* --- Legal pages --------------------------------------------- */

.page-head {
    padding: clamp(2rem, 6vw, 3.5rem) 0 clamp(1.5rem, 4vw, 2.5rem);
}

.back-link {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.15s ease;
}

.back-link:hover {
    color: var(--accent);
}

.page-title {
    margin-top: 1.5rem;
    font-family: var(--display);
    font-size: clamp(2.25rem, 7vw, 3.5rem);
    letter-spacing: -0.02em;
}

.page-updated {
    margin-top: 0.75rem;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

/* Contents list is built by site.js and hidden without JS */
.toc {
    margin-top: 2.5rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.toc-label {
    display: block;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
}

.toc ol {
    margin-top: 1rem;
    list-style: none;
    columns: 2;
    column-gap: 2rem;
    font-size: 0.875rem;
    line-height: 2;
}

.toc li {
    break-inside: avoid;
}

.toc a {
    color: var(--muted);
    transition: color 0.15s ease;
}

.toc a:hover {
    color: var(--accent);
}

/* Prose */

.prose {
    padding-top: clamp(2rem, 5vw, 3rem);
    padding-bottom: 1rem;
}

.prose section {
    padding-bottom: 2rem;
}

.prose h2 {
    display: flex;
    gap: 0.85rem;
    align-items: baseline;
    font-family: var(--display);
    font-size: 1.375rem;
    scroll-margin-top: 2rem;
}

.prose h2 .num {
    flex: none;
    font-family: var(--sans);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--accent);
}

.prose p {
    margin-top: 0.9rem;
    max-width: 40rem;
    color: var(--muted);
    line-height: 1.75;
}

.prose ul {
    margin-top: 0.9rem;
    max-width: 40rem;
    color: var(--muted);
    line-height: 1.75;
}

.prose li {
    position: relative;
    padding-left: 1.1rem;
    margin-top: 0.35rem;
}

.prose li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.75em;
    width: 0.4rem;
    height: 1px;
    background: var(--line-strong);
}

.prose strong {
    color: var(--text);
    font-weight: 500;
}

/* --- 404 ------------------------------------------------------ */

.notfound {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    max-width: var(--measure);
    margin: 0 auto;
    padding: var(--gutter);
}

.notfound-code {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.notfound-title {
    margin-top: 1rem;
    font-family: var(--display);
    font-size: clamp(2.5rem, 9vw, 4.5rem);
    letter-spacing: -0.02em;
}

.notfound-body {
    margin-top: 0.75rem;
    color: var(--muted);
}

.notfound .btn {
    margin-top: 2rem;
}

/* --- Small screens -------------------------------------------- */

@media (max-width: 620px) {
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    }
}

@media (max-width: 560px) {
    :root {
        --gutter: 1.25rem;
    }

    .toc ol {
        columns: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
    }
}
