/* Player badges on the profile (playerinfo.php), laid out like a Steam inventory: a grid of badge tiles,
 * unlocked first and locked after, and a panel describing the selected badge. js/badge-inventory.js pages the
 * grid and fills the panel. Loaded after topfrag-theme.css and uses its tokens.
 * The previous badge view is kept in backup-2026-11-04/playerinfo.php. */

.bi {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
    align-items: start;
    margin-top: 6px;
    -webkit-user-select: none;
    user-select: none;
}

/* ---- the grid ---- */
.bi-main { min-width: 0; padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 13px; }
.bi-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin-bottom: 12px; }
.bi-filters { display: inline-flex; gap: 3px; padding: 3px; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 10px; }
.bi-filter {
    padding: 6px 12px;
    font: 600 12.5px/1.2 var(--font-body);
    color: var(--text-dim);
    cursor: pointer;
    background: transparent;
    border: 0;
    border-radius: 7px;
    transition: background 0.15s ease, color 0.15s ease;
}
.bi-filter span { margin-left: 4px; font-variant-numeric: tabular-nums; opacity: 0.75; }
.bi-filter:hover { color: var(--text-bright); }
.bi-filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bi-filter[aria-pressed="true"] { color: var(--text-bright); background: var(--panel-2); }
.bi-progress { display: inline-flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-dim); }
.bi-progress b { font-weight: 600; color: var(--text-bright); }
.bi-progress-bar { width: 110px; height: 6px; overflow: hidden; background: var(--panel-2); border-radius: 99px; }
.bi-progress-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* --bi-cols is read by the script: a page is 4 rows of this many tiles */
.bi-grid { --bi-cols: 6; display: grid; grid-template-columns: repeat(var(--bi-cols), minmax(0, 1fr)); gap: 8px; }
.bi-tile {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-width: 0;
    padding: 9%;
    cursor: pointer;
    background: radial-gradient(circle at 50% 42%, rgba(0, 245, 195, 0.07), transparent 70%), var(--panel-alt);
    border: 1px solid rgba(0, 245, 195, 0.32);
    border-radius: 8px;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.bi-tile[hidden] { display: none; }
.bi-tile img { display: block; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
.bi-tile:hover { border-color: rgba(0, 245, 195, 0.7); transform: translateY(-1px); }
.bi-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bi-tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background-color: var(--panel-2); }

/* exclusive badges: a quiet gold edge, a touch stronger when hovered or selected */
.bi-tile--exclusive { background: radial-gradient(circle at 50% 42%, rgba(245, 196, 81, 0.06), transparent 70%), var(--panel-alt); border-color: rgba(245, 196, 81, 0.22); }
.bi-tile--exclusive:hover { border-color: rgba(245, 196, 81, 0.42); }
.bi-tile--exclusive[aria-pressed="true"] { border-color: rgba(245, 196, 81, 0.55); box-shadow: none; }

.bi-tile--locked { background: var(--panel-alt); border-color: var(--border-soft); }
.bi-tile--locked img { filter: grayscale(1) brightness(0.8); opacity: 0.45; }
.bi-tile--locked:hover { border-color: var(--text-dim); }
.bi-tile--locked[aria-pressed="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.bi-tile--locked[aria-pressed="true"] img { opacity: 0.65; }
.bi-lock {
    position: absolute;
    right: 5px;
    bottom: 5px;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    background: var(--panel-2);
    border: 1px solid var(--border-soft);
    border-radius: 50%;
}
.bi-lock::before {
    content: "";
    width: 10px;
    height: 10px;
    background: var(--text-dim);
    -webkit-mask: url(../images/icons/mt-lock.svg) center / contain no-repeat;
    mask: url(../images/icons/mt-lock.svg) center / contain no-repeat;
}
/* what the panel shows for each tile; never displayed in the tile itself */
.bi-data { display: none; }

.bi-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.bi-pager[hidden] { display: none; }
.bi-pager button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 28px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-bright);
    cursor: pointer;
    background: var(--panel-alt);
    border: 1px solid var(--border-soft);
    border-radius: 7px;
}
.bi-pager button:hover:not(:disabled) { border-color: rgba(0, 245, 195, 0.5); }
.bi-pager button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bi-pager button:disabled { opacity: 0.35; cursor: default; }
.bi-page { min-width: 60px; font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; color: var(--text); }
.bi-empty { margin: 18px 4px; font-size: 13px; text-align: center; color: var(--text-dim); }

/* ---- the selected badge ---- */
.bi-panel {
    position: sticky;
    top: 16px;
    padding: 16px;
    background: linear-gradient(160deg, var(--panel-alt), var(--panel));
    border: 1px solid rgba(0, 245, 195, 0.5);
    border-radius: 13px;
    -webkit-user-select: text;
    user-select: text;
}
.bi-panel--exclusive { border-color: rgba(245, 196, 81, 0.3); }
.bi-panel--locked { border-color: var(--border-soft); }
.bi-art {
    display: grid;
    place-items: center;
    height: 220px;
    margin: -4px -4px 14px;
    padding-bottom: 14px;
    background: radial-gradient(circle at 50% 46%, rgba(0, 245, 195, 0.12), transparent 62%);
    border-bottom: 1px solid var(--border-soft);
}
.bi-panel--exclusive .bi-art { background: radial-gradient(circle at 50% 46%, rgba(245, 196, 81, 0.08), transparent 62%); }
.bi-panel--locked .bi-art { background: radial-gradient(circle at 50% 46%, rgba(112, 122, 158, 0.12), transparent 62%); }
.bi-art img { display: block; max-width: 200px; max-height: 200px; object-fit: contain; -webkit-user-drag: none; }
.bi-panel--locked .bi-art img { filter: grayscale(1) brightness(0.85); opacity: 0.55; }
.bi-name { margin: 0; font-family: var(--font-head); font-size: 21px; font-weight: 800; line-height: 1.2; color: var(--accent); }
.bi-panel--exclusive .bi-name { color: var(--gold); }
.bi-panel--locked .bi-name { color: var(--text-bright); }
.bi-source { display: flex; align-items: center; gap: 10px; margin: 10px 0 12px; }
.bi-source img { flex: none; width: 32px; height: 32px; object-fit: contain; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 7px; }
.bi-source b { display: block; font-size: 13px; font-weight: 600; color: var(--text-bright); }
.bi-source small { display: block; font-size: 12px; color: var(--text-dim); }
.bi-desc { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.bi-desc .highlight { font-weight: 600; color: var(--accent2); }
.bi-panel--exclusive .bi-desc .highlight { color: var(--gold); }
.bi-state { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; font-weight: 500; color: var(--text-bright); }
.bi-state::before {
    content: "";
    flex: none;
    width: 15px;
    height: 15px;
    background: var(--accent);
    -webkit-mask: url(../images/icons/pi-check.svg) center / contain no-repeat;
    mask: url(../images/icons/pi-check.svg) center / contain no-repeat;
}
.bi-panel--exclusive .bi-state::before { background: var(--gold); }
.bi-panel--locked .bi-state { color: var(--text-dim); }
.bi-panel--locked .bi-state::before { background: var(--text-dim); -webkit-mask-image: url(../images/icons/mt-lock.svg); mask-image: url(../images/icons/mt-lock.svg); }
.bi-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
    padding: 7px 12px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-bright);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.bi-link::before {
    content: "";
    width: 14px;
    height: 14px;
    background: currentColor;
    -webkit-mask: url(../images/icons/ml-users.svg) center / contain no-repeat;
    mask: url(../images/icons/ml-users.svg) center / contain no-repeat;
}
.bi-link:hover, .bi-link:focus-visible { color: var(--accent); background: rgba(0, 245, 195, 0.08); border-color: rgba(0, 245, 195, 0.4); outline: none; }
.bi-tags { margin: 14px 0 0; padding-top: 12px; font-size: 12px; line-height: 1.6; color: var(--text-dim); border-top: 1px solid var(--border); }

@media (max-width: 1280px) {
    .bi { grid-template-columns: minmax(0, 1fr) 300px; }
    .bi-grid { --bi-cols: 5; }
    .bi-art { height: 190px; }
    .bi-art img { max-width: 170px; max-height: 170px; }
}
/* one column: the selected badge first, the grid under it */
@media (max-width: 900px) {
    .bi { grid-template-columns: minmax(0, 1fr); }
    .bi-panel { position: static; order: -1; }
    .bi-grid { --bi-cols: 6; }
    .bi-art { height: 170px; }
    .bi-art img { max-width: 150px; max-height: 150px; }
}
@media (max-width: 560px) {
    .bi-main { padding: 10px 8px; }
    .bi-grid { --bi-cols: 4; gap: 6px; }
    .bi-filter { padding: 6px 9px; }
    .bi-progress-bar { width: 70px; }
}
@media (prefers-reduced-motion: reduce) {
    .bi-tile, .bi-filter, .bi-link { transition: none; }
    .bi-tile:hover { transform: none; }
}
