/* ---------- Custom properties ---------- */
:root {
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-muted: #4b4b4b;
    --color-accent: #1d4ed8;
    --color-accent-contrast: #ffffff;
    --color-border: #cccccc;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #121212;
        --color-text: #f0f0f0;
        --color-muted: #b8b8b8;
        --color-accent: #7fa8ff;
        --color-accent-contrast: #0b1220;
        --color-border: #4a4a4a;
    }
}

/* ---------- Reset / base ---------- */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 1.5rem;
    max-width: 40rem;
    margin-inline: auto;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.6;
}

h1, h2 {
    line-height: 1.25;
}

a {
    color: var(--color-accent);
}

/* ---------- Skip link ---------- */
.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(-100%);
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    padding: 0.75rem 1.25rem;
    z-index: 100;
    text-decoration: none;
    border-radius: 0 0 0.25rem 0;
    transition: transform 0.15s ease-in-out;
}

.skip-link:focus {
    transform: translateY(0);
}

/* ---------- Focus visibility ---------- */
/* Never suppress the browser's own focus indicator — only enhance it. */
a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* ---------- Lists marked role="list" ---------- */
/* Every <ul> across the templates that's semantically a list of records
   (games, developers, filter checkboxes, resource links, pagination) but
   not meant to look like a bulleted list carries an explicit role="list" --
   that's there because Safari/VoiceOver strips list semantics from a <ul>
   the moment list-style is removed via CSS, so the ARIA role is the
   accessibility insurance for exactly this reset. Targeting the attribute
   directly (rather than a class) keeps every such list covered by one rule
   instead of relying on remembering to add a class each time. Margin is
   deliberately left alone here so more specific rules (e.g. nav ul below)
   can still control vertical spacing without this rule fighting them. */
[role="list"] {
    list-style: none;
    padding: 0;
}

/* Short, plain lists of link-only items (game detail page's "Where to
   Play"/"Resources" sections) are the traditional bulleted-list case --
   a heading sits above the whole list, but each item itself has no
   heading, checkbox, or other visual marker of its own the way game/
   developer cards or filter checkboxes do. A bullet is genuinely useful
   here to visually separate stacked one-line links. This has no bearing
   on screen readers either way -- role="list" is what drives "list, N
   items" announcements, independent of whether a bullet is visible --
   so this is purely a sighted-user legibility call, not an accessibility
   trade-off. Combined with [role="list"] (rather than .link-list alone)
   so this reliably wins over the generic reset above regardless of
   source order in this file. */
[role="list"].link-list {
    list-style: disc;
    padding-inline-start: 1.5rem;
}

/* ---------- Game filters fieldset ---------- */
/* The game-filters form's <fieldset>/<legend> exists purely for the
   semantic grouping (a formal "group" in the accessibility tree, named
   by the legend, wrapping the four filter <details> elements) -- not
   for the default browser border-box look, which would be the only
   boxed/bordered content on an otherwise flat, borderless site. Strip
   the visual chrome, keep the markup. */
.game-filters fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

.game-filters legend {
    padding: 0;
    font-weight: bold;
}

/* ---------- Nav ---------- */
nav ul {
    list-style-type: "";
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 0;
    margin: 0 0 1rem 0;
}

nav strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ---------- Account status line ---------- */
.account-status {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.account-status p {
    margin: 0 0 0.5rem 0;
}

/* ---------- Buttons ---------- */
.btn-link {
    background: transparent;
    border: none;
    color: var(--color-accent);
    text-decoration: underline;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

/* ---------- htmx loading state ---------- */
.htmx-request#game-results,
.htmx-request #game-results {
    opacity: 0.6;
}

/* ---------- Footer ---------- */
footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* ---------- Messages (e.g. "Your sign-in didn't complete") ---------- */
/* Same look as accounts' message box. */
.messages {
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.messages ul {
    margin: 0.25rem 0 0 0;
    padding-left: 1.25rem;
}
