/* ---------- Theme colors ----------
   Dark is the base; data-theme="light" on <html> switches to light. An
   inline script in <head> sets it before the page paints, from the saved
   choice (header toggle, localStorage) or else the device's light/dark
   setting. game-detail.css and price-chart.js use these too. */

:root {
    color-scheme: dark;
    --bg: #17181d;
    --surface: #1c1e24;
    --surface-hover: #2a2c34;
    --detail-bg: #14151a;
    --panel-bg: transparent;
    --cover-bg: #000000;
    --text: #f0f0ec;
    --muted: #8a8c94;          /* 5.3:1 on --bg, 5.0:1 on --surface */
    --muted-strong: #9a9ca3;
    --border: #23252c;
    --row-border: #1e2026;
    --border-strong: #2f323b;
    --link: #7aa2ff;
    --link-hover: #a9c2ff;
    --link-bg: rgba(122, 162, 255, 0.08);
    --link-border: rgba(122, 162, 255, 0.35);
    --toggle-border: #5a6fa8;  /* 3.6:1: the expand ring must read as a control */
    --control-border: #686a72; /* 3.3:1: edge of inputs and buttons (WCAG 1.4.11) */
    --on-link: #0e0f13;
    --focus-ring: #fff;
    --shadow: rgba(0, 0, 0, 0.45);
    --eshop-text: #b4b6bd;
    --eshop-bg: rgba(240, 240, 236, 0.04);
    --eshop-border: rgba(240, 240, 236, 0.18);
    --green: #35d488;
    --green-bg: rgba(53, 212, 136, 0.08);
    --green-border: rgba(53, 212, 136, 0.35);
    --red: #ff5a63;
    --red-bg: rgba(255, 90, 99, 0.08);
    --red-border: rgba(255, 90, 99, 0.4);
    --red-soft: #d97066;
    --red-soft-bg: rgba(214, 108, 100, 0.08);
    --red-soft-border: rgba(214, 108, 100, 0.4);
    --orange: #ff9500;
    --orange-bg: rgba(255, 149, 0, 0.08);
    --orange-border: rgba(255, 149, 0, 0.4);
    --yellow: #ffcc33;
    --yellow-bg: rgba(255, 204, 51, 0.08);
    --yellow-border: rgba(255, 204, 51, 0.4);
    --tooltip-bg: #23252c;
    --tooltip-border: #33363f;
    --tooltip-text: #e6e7eb;
    --tooltip-muted: #8b8d95;

    /* Type roles, in rem so they follow the visitor's font-size setting.
       One family (the system UI font); hierarchy comes from these steps
       plus weight. Same in both themes. */
    --font-ui: "Inter", system-ui, sans-serif;
    --text-label: 0.6875rem;     /* 11px: uppercase headers, badges */
    --text-meta: 0.75rem;        /* 12px: publisher, dates */
    --text-small: 0.8125rem;     /* 13px: secondary rows, pagination */
    --text-body: 0.875rem;       /* 14px: table rows, controls */
    --text-reading: 1rem;        /* 16px: info page prose, mobile inputs */
    --text-title: 1.125rem;      /* 18px: section headings */
    --text-headline-sm: 1.375rem;
    --text-headline: 1.75rem;    /* 28px: page titles, the wordmark */
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f6f6f3;
    --surface: #ffffff;
    --surface-hover: #efefea;
    --detail-bg: #efefea;
    --panel-bg: #ffffff;
    --cover-bg: #ffffff;
    --text: #17181d;
    --muted: #63666f;
    --muted-strong: #55575f;
    --border: #e2e2dc;
    --row-border: #ebebe6;
    --border-strong: #e2e2dc;
    --link: #2f5bd3;
    --link-hover: #1f45b0;
    --link-bg: rgba(47, 91, 211, 0.07);
    --link-border: rgba(47, 91, 211, 0.35);
    --toggle-border: #6f82bf;
    --control-border: #898b91;
    --on-link: #ffffff;
    --focus-ring: #17181d;
    --shadow: rgba(23, 24, 29, 0.12);
    --eshop-text: #55575f;
    --eshop-bg: rgba(23, 24, 29, 0.03);
    --eshop-border: rgba(23, 24, 29, 0.16);
    --green: #13854f;
    --green-bg: rgba(19, 133, 79, 0.08);
    --green-border: rgba(19, 133, 79, 0.35);
    --red: #c8323b;
    --red-bg: rgba(200, 50, 59, 0.07);
    --red-border: rgba(200, 50, 59, 0.4);
    --red-soft: #b8473e;
    --red-soft-bg: rgba(184, 71, 62, 0.07);
    --red-soft-border: rgba(184, 71, 62, 0.4);
    --orange: #b35c00;
    --orange-bg: rgba(179, 92, 0, 0.07);
    --orange-border: rgba(179, 92, 0, 0.4);
    --yellow: #8a5f00;
    --yellow-bg: rgba(154, 107, 0, 0.07);
    --yellow-border: rgba(154, 107, 0, 0.4);
    --tooltip-bg: #ffffff;
    --tooltip-border: #e2e2dc;
    --tooltip-text: #17181d;
    --tooltip-muted: #6b6e78;
}

/* ---------- Page shell (games.html) - same background as the table ---------- */

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    /* prices, dates and percentages line up down a column */
    font-variant-numeric: tabular-nums;
}

h1, h2, h3 {
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.site-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 0;
}

.site-header-inner {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
    padding-right: 4.25rem; /* room for the theme toggle: its 1.25rem inset + 2.25rem width + a gap */
}

/* Sun/moon button, top right of the header. Shows the theme you'd switch to. */
.theme-toggle {
    position: absolute;
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--control-border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted-strong);
    cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    border-color: var(--link);
    color: var(--text);
    outline: none;
}

.theme-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
}

.theme-toggle .icon-moon,
:root[data-theme="light"] .theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

/* News bell, left of the theme toggle - phones only (shown in the 600px
   block), where the news column is hidden. Opens the feed as a popup. */
.news-menu {
    display: none;
    position: absolute;
    top: 50%;
    right: 4rem; /* the toggle's 1.25rem inset + its 2.25rem width + a gap */
    transform: translateY(-50%);
    z-index: 30; /* the transform makes this the popup's stacking context, so it must sit above the list */
}

.news-menu > summary {
    list-style: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--control-border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted-strong);
    cursor: pointer;
}

.news-menu > summary::-webkit-details-marker {
    display: none;
}

.news-menu[open] > summary,
.news-menu > summary:hover,
.news-menu > summary:focus-visible {
    border-color: var(--link);
    color: var(--text);
    outline: none;
}

.news-menu > summary svg {
    width: 1.1rem;
    height: 1.1rem;
}

/* Unread news: newer than the last time the popup was opened */
.news-dot {
    position: absolute;
    top: 0.3rem;
    right: 0.35rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--link);
    box-shadow: 0 0 0 2px var(--surface);
}

.news-dot[hidden] {
    display: none;
}

/* Right edge lines up with the theme toggle's (2.75rem further right) */
.news-popup {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    right: -2.75rem;
    box-sizing: border-box;
    width: min(340px, calc(100vw - 2rem));
    max-height: 70vh;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    background: var(--surface); /* not --panel-bg: that's transparent in the dark theme */
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--shadow);
}

.news-popup h2 {
    font-size: var(--text-title);
    margin: 0.25rem 0 0.5rem;
}

.brand {
    font-size: var(--text-headline);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.tagline {
    margin: 0;
    color: var(--muted);
    font-size: var(--text-body);
}

/* Spel | Tillbehör, under the brand line */
.site-nav {
    display: flex;
    gap: 0.25rem;
    flex-basis: 100%;
}

.site-nav a {
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    color: var(--muted-strong);
    font-weight: 600;
    font-size: var(--text-body);
}

.site-nav a:hover {
    color: var(--text);
}

.site-nav a.active {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

/* Colour-variant groups on the accessory list. A thin blue ring, so dark
   colours (black, navy) stay visible on the dark theme. */
.swatch {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    border: 1px solid var(--link);
    vertical-align: middle;
}

.swatches {
    display: inline-flex;
    gap: 0.2rem;
    align-items: center;
}

.game-table .badge-colours {
    border-color: var(--link);
    color: var(--link);
}

.price-from {
    color: var(--muted);
    font-size: 0.8em;
}

/* A group's expand row, drawn as a tree under the group: a narrow first
   column holds the lines - a trunk from just under the group row's 112 px
   picture (thead's ::before), a branch into each variant, an elbow on the
   last one. The indent puts the trunk under that picture's centre. Written
   as .stores-table.variants-table because .stores-table's width: 100%
   comes later in this file and would win over a plain .variants-table. */
.stores-table.variants-table {
    margin-left: 3rem;
    width: calc(100% - 3rem);
    overflow: visible;   /* .stores-table clips; the trunk reaches up past the table */
}

.variants-table thead .variant-tree::before {
    content: "";
    position: absolute;
    left: 0.5rem;
    top: -1.35rem;       /* up through the detail cell's padding to the picture */
    bottom: 0;
    border-left: 2px solid var(--link-border);
}

.variants-table .variant-tree {
    position: relative;
    width: 1.5rem;
    min-width: 1.5rem;   /* empty cell: a tight table would squeeze it to 0 */
    padding: 0;
}

.variants-table tbody .variant-tree::before,
.variants-table tbody .variant-tree::after {
    content: "";
    position: absolute;
    left: 0.5rem;
    border-color: var(--link-border);
    border-style: solid;
    border-width: 0;
}

.variants-table tbody .variant-tree::before {   /* the trunk */
    top: 0;
    bottom: 0;
    border-left-width: 2px;
}

.variants-table tbody tr:last-child .variant-tree::before {
    bottom: 50%;                                 /* the elbow: stop at the last branch */
}

.variants-table tbody .variant-tree::after {    /* the branch */
    top: 50%;
    right: 0;
    border-top-width: 2px;
}

.variants-table .variant-img img {
    width: 4.5rem;
    height: 4.5rem;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

@media (max-width: 600px) {
    /* the phone layout's picture is 88 px, from x 8: trunk under its centre */
    .stores-table.variants-table {
        margin-left: 1.7rem;
        width: calc(100% - 1.7rem);
    }

    .variants-table .variant-tree {
        width: 1.25rem;
        min-width: 1.25rem;
    }

    .variants-table thead .variant-tree::before {
        top: -2.1rem;   /* the phone row has more padding under the picture */
    }

    /* tighter cells, so the indented table still fits the screen */
    .stores-table.variants-table th,
    .stores-table.variants-table td {
        padding-left: 6px;
        padding-right: 6px;
    }

    .stores-table.variants-table .variant-tree {
        padding: 0;
    }

    /* no room for "Lägsta pris": it's the first line of the store list anyway */
    .variants-table th:nth-child(4),
    .variants-table td:nth-child(4) {
        display: none;
    }

    .variants-table .variant-img img {
        width: 3.25rem;
        height: 3.25rem;
    }
}

/* every store under a colour: "Spelbutiken  329 kr" per line */
.variants-table .variant-stores {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: max-content max-content 1fr; /* store, price, stock */
    column-gap: 0.75rem;
    row-gap: 0.15rem;
    align-items: center;
}

.variants-table .variant-stores li {
    display: contents;
}

.variants-table .variant-store-price {
    color: var(--muted-strong);
    text-align: right;
}

.variants-table .variant-stores li.out-of-stock a,
.variants-table .variant-stores li.out-of-stock .variant-store-price {
    opacity: 0.55;
}

/* phones: no room for a third column (the badge squeezed into a red
   circle), so "Slut i lager" gets its own line under the store */
@media (max-width: 600px) {
    .variants-table .variant-stores {
        grid-template-columns: max-content max-content; /* store, price */
    }

    .variants-table .variant-store-stock {
        grid-column: 1 / -1;
        margin-bottom: 0.15rem;
    }

    .variants-table .variant-store-stock:empty {
        display: none;
    }
}

/* only the cheapest store per variant until "+N butiker" opens the rest */
.variants-table .variant-stores li.more-store {
    display: none;
}

.variants-table .variant-stores.show-all li.more-store {
    display: contents;
}

/* roomy enough to hit without catching the store link above it */
.more-stores-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    min-height: 28px;
    padding: 5px 8px 5px 12px;
    border: 1px solid var(--toggle-border);
    border-radius: 999px;
    background: none;
    color: var(--link);
    font: inherit;
    font-size: var(--text-label);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.more-stores-toggle:hover,
.more-stores-toggle:focus-visible {
    border-color: var(--link);
    color: var(--link-hover);
}

.more-stores-toggle .expand-arrow {
    width: 14px;
    height: 14px;
}

.more-stores-toggle[aria-expanded="true"] .expand-arrow {
    transform: rotate(180deg);
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
    padding-block: 1.5rem 3rem; /* side padding comes from .container */
}

.games-column {
    min-width: 0;
}

.news-column {
    min-width: 0;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.news-column h2 {
    font-size: var(--text-title);
    margin: 0 0 0.75rem;
}

.news-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* the post body is raw HTML (p, ul), so it takes its size from here */
.news-item {
    font-size: var(--text-small);
    line-height: 1.5;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-date {
    display: block;
    font-size: var(--text-meta);
    color: var(--muted);
    margin-bottom: 0.15rem;
}

.news-title {
    display: block;
    font-size: var(--text-body); /* same step as a game title: news is the side column */
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.news-excerpt {
    margin: 0;
    font-size: var(--text-small);
    color: var(--muted);
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

.filter-bar {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.filter-bar input[type="search"] {
    flex: 1;
    min-width: 0;
}

.filter-bar input[type="search"],
.filter-bar select {
    background: var(--surface);
    border: 1px solid var(--control-border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: var(--text-body);
    font-family: var(--font-ui);
}

.filter-bar input[type="search"]::placeholder {
    color: var(--muted);
}

.filter-bar input[type="search"]:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--link);
}

/* Filter popup (store + publisher) */
.filter-menu {
    position: relative;
}

.filter-menu > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    background: var(--surface);
    border: 1px solid var(--control-border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: var(--text-body);
    font-family: var(--font-ui);
    white-space: nowrap;
}

.filter-menu > summary::-webkit-details-marker {
    display: none;
}

.filter-menu[open] > summary,
.filter-menu > summary:focus-visible {
    outline: none;
    border-color: var(--link);
}

.filter-count {
    display: inline-block;
    min-width: 1.3em;
    margin-left: 0.4rem;
    padding: 0 0.35em;
    border-radius: 999px;
    background: var(--link);
    color: var(--on-link);
    font-size: var(--text-meta);
    font-weight: 600;
    text-align: center;
}

.filter-count[hidden] {
    display: none;
}

.filter-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    width: 280px;
    max-width: calc(100vw - 32px);
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: 0 8px 24px var(--shadow);
    font-family: var(--font-ui);
    font-size: var(--text-body);
    color: var(--text);
}

.filter-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--muted-strong);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-close:hover,
.filter-close:focus-visible {
    background: var(--surface-hover);
    color: var(--text);
}

.filter-close svg {
    width: 18px;
    height: 18px;
}

.filter-panel fieldset {
    border: 0;
    margin: 0 0 0.75rem;
    padding: 0;
}

.filter-panel legend {
    padding: 0;
    margin-bottom: 0.3rem;
    font-size: var(--text-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.filter-panel label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
    cursor: pointer;
}

.filter-panel label.filter-toggle {
    margin-top: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-strong);
}

.filter-panel label.disabled {
    opacity: 0.45;
    cursor: default;
}

.filter-scroll {
    max-height: 220px;
    overflow-y: auto;
}

.filter-clear {
    background: none;
    border: 0;
    padding: 0;
    color: var(--link);
    font: inherit;
    cursor: pointer;
}

.filter-clear:hover {
    text-decoration: underline;
}

.filter-more-toggle {
    margin-top: 0.3rem;
    font-size: var(--text-small);
}

.game-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-ui);
    font-size: var(--text-body);
    background: var(--bg);
    color: var(--text);
    border-radius: 12px;
    overflow: hidden;
}

.game-table thead th {
    text-align: left;
    font-size: var(--text-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.game-table tbody tr {
    border-bottom: 1px solid var(--row-border);
}

.game-table tbody tr:last-child {
    border-bottom: none;
}

.game-table tbody tr:hover {
    background: var(--surface);
}

.game-table td {
    padding: 8px 16px;
    vertical-align: middle;
}

/* the part that matters for "make smaller" */
.game-table td.cover {
    width: 56px;
    padding-right: 0;
}

.game-table .cover-img {
    width: 112px;
    height: 112px;
    object-fit: contain;
    border-radius: 0;
    /*box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);*/
    display: block;
}

.game-table .title-cell {
    line-height: 1.35;
    overflow: hidden;
}

.game-table .game-title {
    display: block;
    font-weight: 500;
    color: var(--text);
}

/* the cheapest price is what the row is for: one weight step above the title */
.game-table .price-stack > span:first-child {
    font-weight: 600;
}

.game-table .game-title:hover {
    text-decoration: underline;
}

.game-table .game-publisher {
    font-size: var(--text-meta);
    color: var(--muted);
    margin-top: 2px;
}

/* a store's own price beside the converted SEK one: "≈ 279 kr (24,99 €)" (fragments/store-price.html) */
.price-orig {
    margin-left: 0.3em;
    font-size: var(--text-meta);
    color: var(--muted);
    white-space: nowrap;
}

/* "+N butiker" under the cheapest store in the game and accessory lists */
.game-table .store-more {
    font-size: var(--text-meta);
    color: var(--muted);
    margin-top: 2px;
}

.game-table .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: var(--text-label);
    font-weight: 500;
    border: 1px solid transparent;
}

.game-table .badge-row {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* eShop price next to the format badge: physical is the main comparison,
   so it stays grey unless digital is actually cheaper */
.game-table .badge-eshop {
    background: var(--eshop-bg);
    border-color: var(--eshop-border);
    color: var(--eshop-text);
}

/* regular price while on sale, struck through after the sale price */
.game-table .badge-eshop s {
    font-weight: 400;
    color: var(--muted-strong); /* grey, not faded: opacity dropped it below 4.5:1 */
}

.game-table .badge-eshop.badge-eshop-cheaper {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
}

.game-table .badge-icon {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
}

/* not released yet: same yellow as "Förhandsboka" in the stores table */
.game-table .badge-upcoming {
    background: var(--yellow-bg);
    border-color: var(--yellow-border);
    color: var(--yellow);
}

.game-table .badge-keycard {
    background: var(--red-soft-bg);
    border-color: var(--red-soft-border);
    color: var(--red-soft);
}

/* made or officially licensed by Nintendo, same green as on the accessory page */
.game-table .badge-official {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
    cursor: help;
}

.game-table .badge-cart {
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
}

.game-table .badge-codebox {
    background: var(--orange-bg);
    border-color: var(--orange-border);
    color: var(--orange);
}

/* eShop only: the link blue, apart from the physical formats' colours */
.game-table .badge-digital {
    background: var(--link-bg);
    border-color: var(--link-border);
    color: var(--link);
}

.game-table .badge-discount {
    margin-left: 6px;
    background: var(--green-bg);
    border-color: var(--green-border);
    color: var(--green);
    white-space: nowrap;
    vertical-align: top;
}

/* price with the expand button centred under it */
.game-table .price-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    vertical-align: top;
}

/* keep the discount badge beside the price instead of wrapping under it
   when long titles squeeze the column */
.game-table td.price-cell {
    white-space: nowrap;
}

.game-table .no-price {
    color: var(--muted);
    font-style: italic;
}

/* a digital-only game's regular eShop price, struck through beside the sale price */
.game-table .price-cell .eshop-regular {
    margin-left: 6px;
    color: var(--muted);
    font-size: var(--text-meta);
}

.game-table a {
    color: var(--link);
    text-decoration: none;
}

.game-table a:hover {
    text-decoration: underline;
}

.game-table .empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--muted);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

.pagination-btn {
    background: var(--surface);
    border: 1px solid var(--control-border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.4rem 0.9rem;
    font-size: var(--text-small);
    font-family: var(--font-ui);
    cursor: pointer;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--link);
}

.pagination-btn:disabled {
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination-info {
    font-size: var(--text-small);
    color: var(--muted);
}

.expand-toggle {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--toggle-border);
    border-radius: 50%;
    background: none;
    color: var(--link);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.expand-toggle:hover,
.expand-toggle:focus-visible {
    border-color: var(--link);
    color: var(--link-hover);
}

.expand-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.15s ease;
}

.expand-toggle[aria-expanded="true"] .expand-arrow {
    transform: rotate(180deg);
}

.detail-row { display: none; }
.detail-row.open { display: table-row; }

.detail-row td { background: var(--detail-bg); padding: 0.75rem 1rem; }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.game-stores {
    font-family: var(--font-ui);
    font-size: var(--text-small);
    color: var(--text);
}

.game-stores .metacritic-link {
    display: inline-block;
    margin-bottom: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--yellow-bg);
    border: 1px solid var(--yellow-border);
    color: var(--yellow);
    font-size: var(--text-label);
    font-weight: 500;
    text-decoration: none;
}

.game-stores .metacritic-link:hover {
    text-decoration: underline;
}

.stores-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}

.stores-table thead th {
    text-align: left;
    font-size: var(--text-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.stores-table tbody tr {
    border-bottom: 1px solid var(--border);
}

.stores-table tbody tr:last-child {
    border-bottom: none;
}

.stores-table td {
    padding: 8px 12px;
    vertical-align: middle;
}

.stores-table a {
    color: var(--link);
    text-decoration: none;
}

.stores-table a:hover {
    text-decoration: underline;
}

.stores-table .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: var(--text-label);
    font-weight: 500;
    border: 1px solid transparent;
}

.stores-table .badge-in-stock {
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    color: var(--green);
}

.stores-table .badge-out-of-stock {
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    color: var(--red);
}

.stores-table .badge-preorder {
    background: var(--yellow-bg);
    border: 1px solid var(--yellow-border);
    color: var(--yellow);
}

.stores-table .empty-state {
    text-align: center;
    padding: 16px 12px;
    color: var(--muted);
}

/* ---------- Footer and info pages (fragments/site.html, about.html) ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 0 2rem;
    font-size: var(--text-body);
}

.site-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-footer-brand {
    color: var(--muted);
}

.site-footer-links {
    display: flex;
    gap: 1.25rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.25rem;
    color: var(--link);
    text-decoration: none;
    font-size: var(--text-body);
}

.back-link:hover {
    text-decoration: underline;
}

.info-page {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
    line-height: 1.6;
}

/* Left-aligned with the header, but with readable line lengths. */
.info-page > * {
    max-width: 65ch;
}

.info-page h1 {
    font-size: var(--text-headline);
    margin: 0 0 1rem;
}

.info-page h2 {
    font-size: var(--text-title);
    margin: 2rem 0 0.5rem;
}

.info-page p {
    margin: 0 0 0.75rem;
}

.info-stores {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.info-page .info-stores-note {
    margin-top: 0.9rem;
    font-size: var(--text-body);
    color: var(--muted);
}

.info-stores li {
    padding: 0.2rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: var(--text-small);
}

/* ---------- Mobile: title across the full width, price + store below it ---------- */

@media (max-width: 600px) {
    /* No news column on phones: the header's bell opens the feed instead. */
    .news-column {
        display: none;
    }

    .news-menu {
        display: block;
    }

    /* room for the bell as well as the theme toggle */
    .site-header-inner:has(.news-menu) {
        padding-right: 7rem;
    }

    /* The game list runs edge to edge on phones, so drop the container's
       side padding here and inset only the controls above it. */
    .layout {
        padding-inline: 0;
    }

    .filter-bar {
        flex-wrap: wrap;
        padding-inline: 1rem;
    }

    .filter-bar input[type="search"] {
        flex-basis: 100%;
    }

    /* 16px or larger, or iOS Safari zooms the page when the field gets focus */
    .filter-bar input[type="search"],
    .filter-bar select,
    .filter-menu > summary {
        font-size: var(--text-reading);
    }

    .filter-bar select {
        flex: 1;
    }

    .game-table,
    .game-table > tbody {
        display: block;
    }

    .game-table > thead {
        display: none;
    }

    .game-table .game-row {
        display: grid;
        grid-template-columns: auto auto 1fr;
        grid-template-areas:
            "cover title title"
            "cover price store";
        position: relative;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-strong);
    }

    .game-table .game-row > td {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .game-table td.cover { grid-area: cover; width: auto; padding-left: 8px; padding-right: 8px; }
    .game-table td.title-cell { grid-area: title; }
    .game-table td.price-cell { grid-area: price; padding-right: 16px; }
    .game-table td.store-cell { grid-area: store; padding-right: 56px; min-width: 0; align-items: flex-end; text-align: right; }
    /* a digital-only row has no expand button, so no room is kept for it */
    .game-table td.store-cell.store-cell-eshop { padding-right: 16px; }
    /* "eShop" alone fits beside a wide (16:9) eShop cover too */
    .game-table .store-cell-eshop .eshop-long { display: none; }

    /* price column only takes what it needs, so the store name fits on
       one line; very long names get an ellipsis instead of wrapping */
    .game-table td.store-cell > * {
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .game-table .game-publisher {
        display: none;
    }

    /* badge beside the price, not stacked under it */
    .game-table td.price-cell {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }

    .game-table .price-cell .badge-discount {
        margin: 0;
    }

    /* on phones the expand button sits at the row's right edge, level
       with the price, instead of under it */
    .game-table .price-stack {
        display: contents;
    }

    .game-table .price-cell .expand-toggle {
        position: absolute;
        right: 18px;
    }

    .game-table .title-cell .badge-row {
        margin-top: 4px;
    }


    /* width follows the cover's own (portrait) shape, so there's no
       letterbox space beside it */
    .game-table .cover-img {
        width: auto;
        height: 88px;
    }

    .detail-row.open,
    .detail-row.open > td,
    .game-table > tbody > tr:not(.game-row):not(.detail-row),
    .game-table > tbody > tr > .empty-state {
        display: block;
    }
}
