/*
 * Printable set checklists (/checklist, /checklist/{code}).
 *
 * The sheets themselves are PNGs drawn server-side (app/lib/set_checklist.php);
 * this file only lays out the set index, the page previews and the print view.
 * The logo tile is deliberately dark in both themes: it previews the black
 * header band the logos sit on in the printed sheet.
 */

/* —— Set index —— */
.cl-sets {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-5);
}

.cl-set {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform .2s var(--ease-out), border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.cl-set:hover,
.cl-set:focus-visible {
    transform: translateY(-2px);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-md);
}

.cl-set__logo {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 7;
    padding: var(--space-4) var(--space-5);
    background: #0b0b10;
}
/* Absolutely placed so a square logo (30th Celebration) cannot stretch the
   tile: max-height against an aspect-ratio box does not constrain it. */
.cl-set__logo img {
    position: absolute;
    inset: var(--space-4) var(--space-5);
    width: calc(100% - 2 * var(--space-5));
    height: calc(100% - 2 * var(--space-4));
    object-fit: contain;
}
.cl-set__logo-text {
    color: #fff;
    font-weight: 800;
    font-size: var(--step-1);
    text-align: center;
    line-height: var(--leading-tight);
}

.cl-set__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3) var(--space-4) var(--space-4);
}
.cl-set__name { font-weight: 700; }
.cl-set__meta { color: var(--text-secondary); font-size: var(--step--1); }

/* —— One set —— */
.cl-note {
    margin: 0 0 var(--space-6);
    color: var(--text-secondary);
    max-width: 80ch;
}
.cl-note strong { color: var(--text-primary); }

.cl-sheets {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: var(--space-6);
}
/* A single page is the whole checklist: show it large enough to read. */
.cl-sheets:has(> .cl-sheet:only-child) {
    grid-template-columns: minmax(0, 760px);
    justify-content: center;
}

.cl-sheet { margin: 0; }

.cl-sheet__paper {
    display: block;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-md);
    transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.cl-sheet__paper:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.cl-sheet__paper img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2480 / 3508;
}

.cl-sheet__bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-2);
    font-size: var(--step--1);
    color: var(--text-secondary);
}
.cl-sheet__bar a { font-weight: 600; }

.cl-back { margin: var(--space-8) 0 0; text-align: center; }

@media (max-width: 700.98px) {
    .cl-sets { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-3); }
    .cl-set__body { padding: var(--space-2) var(--space-3) var(--space-3); }
    .page-hero__actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* —— Print: just the sheets, one per A4 page —— */
@media print {
    @page { size: A4; margin: 0; }

    html, body, .site-main { background: #fff !important; margin: 0 !important; padding: 0 !important; }
    body.app-body > :not(.site-main),
    .page-hero,
    .cl-note,
    .cl-sheet__bar,
    .cl-back { display: none !important; }

    .site-main > .page-content { padding: 0 !important; margin: 0 !important; max-width: none !important; }
    .cl-sheets { display: block; }
    .cl-sheet { break-after: page; }
    .cl-sheet:last-child { break-after: auto; }
    .cl-sheet__paper { border: 0; border-radius: 0; box-shadow: none; transform: none; }
    .cl-sheet__paper img { width: 210mm; height: 297mm; aspect-ratio: auto; }
}

/* /sets — game tabs, then language tabs */
.sets-tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }
.sets-tab {
    padding: var(--space-2) var(--space-3); border-radius: 999px;
    border: 1px solid var(--border-default);
    color: var(--text-secondary); text-decoration: none; font-weight: 600; font-size: var(--step--1);
}
.sets-tab:hover, .sets-tab:focus-visible { color: var(--text-primary); }
.sets-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sets-tab__count { opacity: .7; font-weight: 500; margin-left: .25em; }
.sets-tabs--games { margin-bottom: var(--space-3); }
.sets-langs { display: flex; gap: var(--space-4); border-bottom: 1px solid var(--border-default); margin-bottom: var(--space-5); }
.sets-lang {
    padding: var(--space-2) 0; margin-bottom: -1px; border-bottom: 2px solid transparent;
    color: var(--text-secondary); text-decoration: none; font-weight: 600;
}
.sets-lang:hover, .sets-lang:focus-visible { color: var(--text-primary); }
.sets-lang.is-active { color: var(--text-primary); border-bottom-color: var(--accent); }
