/* Games & Software page (games.php) */
/* While a tab or view slides in or out (js/games.js), nothing shows past the content column */
.catalog-panels.catalog-sliding { overflow-x: clip; }
.catalog-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.catalog-tabs { display: flex; gap: 0.5rem; }
.catalog-tabs .catalog-tab { margin: 0; }
/* Unselected tabs and view buttons are grey (the Cancel button colours) */
.catalog-tab[aria-selected="false"], .catalog-view[aria-pressed="false"] { background-color: var(--btn-cancel); --surface: var(--btn-cancel); color: var(--btn-cancel-text); }
.catalog-tab[aria-selected="false"]:hover, .catalog-view[aria-pressed="false"]:hover { background-color: var(--btn-cancel-hover); --surface: var(--btn-cancel-hover); }
.catalog-find { display: flex; align-items: center; gap: 0.5rem; flex: 0 1 24rem; }
#catalog-search { width: 100%; }
/* List / tile view buttons */
.catalog-views { display: flex; gap: 0.4rem; flex: none; }
.catalog-views .catalog-view { margin: 0; padding: 0.5rem; }
.catalog-view svg { width: 1rem; height: 1rem; display: block; fill: currentColor; }

.catalog-table { table-layout: auto; }
.catalog-table th .catalog-sort {
    all: unset;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.catalog-table th .catalog-sort:focus-visible { outline: var(--px) solid var(--focus-ring); }
.catalog-table th[aria-sort="ascending"] .catalog-sort::after { content: " \25B2"; }
.catalog-table th[aria-sort="descending"] .catalog-sort::after { content: " \25BC"; }

.catalog-name { display: flex; align-items: center; gap: 0.6rem; }
/* Every entry: a triangle that turns down when its server types' buttons are open */
.catalog-expandable { cursor: pointer; }
.catalog-toggle {
    all: unset;
    width: 1rem;
    flex: none;
    cursor: pointer;
    color: var(--text-primary);
    text-align: center;
}
.catalog-toggle::before { content: "\25B6"; display: inline-block; transition: transform 0.15s ease; }
.catalog-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.catalog-toggle:focus-visible { outline: var(--px) solid var(--focus-ring); }
/* The server types slide open (js/games.js adds .open; keep REVEAL_MS there equal to the 0.2s here) */
.catalog-types td { background: var(--bg-light); padding: 0; }
.catalog-type-reveal {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.2s ease, opacity 0.2s ease;
}
.catalog-types.open .catalog-type-reveal { grid-template-rows: 1fr; opacity: 1; }
.catalog-type-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 0;
    overflow: hidden;
    padding: 0 10px 0 calc(10px + 1.6rem);
    transition: padding 0.2s ease;
}
.catalog-types.open .catalog-type-buttons { padding-top: 10px; padding-bottom: 10px; }
.catalog-type-buttons .btn { margin: 0; padding: 0.3rem 0.6rem; }
@media (prefers-reduced-motion: reduce) {
    .catalog-toggle::before, .catalog-type-reveal, .catalog-type-buttons, .catalog-tile { transition: none; }
}
.catalog-icon { width: 32px; height: 32px; flex: none; object-fit: contain; image-rendering: pixelated; }
/* One line of buttons; the column is as wide as its widest row (the table scrolls on phones) */
.catalog-links { display: flex; gap: 0.4rem; padding: 0.5rem 0.4rem 0 0; } /* room for the badges */
.catalog-links .btn, .catalog-host { margin: 0; padding: 0.3rem 0.45rem; white-space: nowrap; }
.catalog-link { position: relative; }
.catalog-links .catalog-link:has(.deal-badge) { padding-right: 2.6rem; }
.catalog-table .catalog-price { white-space: nowrap; text-align: right; }
/* Store buttons in the stores' colours */
.catalog-link-steam { --brand: #1d5681; --brand-hover: #174767; --brand-text: #ffffff; }
.catalog-link-g2a { --brand: #ff7800; --brand-hover: #e66c00; --brand-text: #090335; }
.catalog-link-kinguin { --brand: #ffde00; --brand-hover: #e6c800; --brand-text: #090335; }
.catalog-link-steam, .catalog-link-g2a, .catalog-link-kinguin { background-color: var(--brand); --surface: var(--brand); color: var(--brand-text); }
.catalog-link-steam:hover, .catalog-link-g2a:hover, .catalog-link-kinguin:hover { background-color: var(--brand-hover); --surface: var(--brand-hover); }
/* The discount, in the button's top-right corner */
.deal-badge {
    position: absolute;
    top: -0.5rem;
    right: -0.45rem;
    padding: 0 0.25rem;
    background: var(--status-failed);
    color: var(--white);
    font-size: var(--fs-xs);
    line-height: 1.3;
    box-shadow: var(--pixel-shadow);
}
.catalog-empty { margin: 1rem 0; }

/* Tile view: picture and name */
.catalog-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 1rem;
    margin-top: 0.8rem;
}
.catalog-tiles[hidden] { display: none; }
.catalog-tile[hidden] { display: none; }
.catalog-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 0.6rem 0.8rem;
    background: var(--bg-modal);
    box-shadow: var(--pixel-shadow), var(--pixel-shadow-inset);
    color: var(--text-primary);
    text-decoration: none;
    text-align: center;
    transition: transform 0.15s ease, background-color 0.15s ease;
}
.catalog-tile:hover { background-color: var(--bg-hover); transform: translateY(calc(var(--px) * -1)); }
.catalog-tile:focus-visible { outline: var(--px) solid var(--focus-ring); outline-offset: var(--px); }
.catalog-tile img, .catalog-tile-blank { width: 96px; height: 96px; object-fit: contain; }
/* A thin dark edge, so white logos (ARK, Arma) show on the light tile too */
.catalog-tile img, .catalog-icon { filter: drop-shadow(0 0 1px rgba(9, 3, 53, 0.9)) drop-shadow(0 0 2px rgba(9, 3, 53, 0.4)); }
/* No picture: the first letter */
.catalog-tile-blank {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    color: var(--text-secondary);
    font-family: var(--f-pixel);
    font-size: var(--fs-3xl);
}
.catalog-tile-name { font-size: var(--fs-sm); overflow-wrap: anywhere; }

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

@media (max-width: 600px) {
    .catalog-tools { flex-direction: column; align-items: stretch; }
    .catalog-find { flex-basis: auto; }
}
