/**
 * Page-specific styles for /printable-rules.
 *
 * Companion to /css/entry/content.css, which provides article
 * typography (headings, tables, lists, figures rendered inside each
 * .pr-card__body). This file owns the surrounding layout — header,
 * sticky controls, quick-nav grid, game cards, and the single-game
 * print mode.
 *
 * Selectors use the .pr- page namespace to avoid colliding with the
 * sibling chrome/pages/*.css files (brain-games, mahjong-games,
 * library, all-games, all-guides), all of which use bare
 * .filter-btn / .game-card / .page-header / etc. selectors. Keeping
 * this page namespaced means it doesn't add to the Phase-5 cleanup
 * backlog and doesn't increment .css-audit-budget.json totalDupes.
 */

body.content-page-body {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
    background: #f7f8fa;
    color: #1a1a1a;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
}

.pr-header {
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pr-header h1 {
    font-size: 2rem;
    margin: 0 0 0.5rem;
    font-weight: 700;
    color: #fff;
}

.pr-header h1 i {
    margin-right: 0.5rem;
}

.pr-header p {
    font-size: 1.1rem;
    opacity: 0.95;
    margin: 0;
}

.pr-controls {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: center;
}

.pr-search input {
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    border: 1px solid #d0d5db;
    border-radius: 6px;
    background: #fbfcfd;
    box-sizing: border-box;
}

.pr-search input:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.15);
}

.pr-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pr-filter {
    padding: 0.45rem 0.9rem;
    background: #fff;
    border: 1px solid #d0d5db;
    border-radius: 999px;
    font-size: 0.85rem;
    color: #444;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pr-filter:hover {
    background: #f0f4f7;
    border-color: #2e7d32;
}

.pr-filter--active {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
}

.pr-stats {
    font-size: 0.85rem;
    color: #666;
}

.pr-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pr-toc {
    background: #fff;
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.pr-toc h2 {
    font-size: 1.1rem;
    margin: 0 0 1rem;
    color: #2e7d32;
    font-weight: 700;
}

.pr-toc h2 i {
    margin-right: 0.35rem;
}

.pr-toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.3rem;
}

.pr-toc-link {
    padding: 0.4rem 0.65rem;
    font-size: 0.85rem;
    color: #1565c0;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.15s ease, color 0.15s ease;
}

.pr-toc-link:hover {
    background: #e8f5e9;
    color: #2e7d32;
}

.pr-games {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pr-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    font-size: 1rem;
    background: #fff;
    border-radius: 8px;
}

.pr-loading i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #2e7d32;
    animation: pr-spin 1s linear infinite;
}

@keyframes pr-spin {
    to { transform: rotate(360deg); }
}

.pr-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    scroll-margin-top: 1rem;
}

.pr-card.pr-hidden {
    display: none;
}

.pr-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    gap: 1rem;
}

.pr-card__header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1a1a1a;
}

.pr-card__print {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    background: #2e7d32;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.pr-card__print:hover {
    background: #1b5e20;
}

.pr-card__desc {
    font-style: italic;
    color: #555;
    margin: 0 0 1rem;
    font-size: 0.95rem;
}

.pr-card__body {
    line-height: 1.6;
}

.pr-card__body img,
.pr-card__body figure {
    max-width: 100%;
}

.pr-card__footer {
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e0e0e0;
    font-size: 0.8rem;
    color: #888;
    text-align: center;
}

.pr-card__footer a {
    color: #2e7d32;
    text-decoration: none;
    font-weight: 600;
}

.pr-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    color: #555;
    font-size: 0.9rem;
}

.pr-footer a {
    color: #2e7d32;
    text-decoration: none;
    font-weight: 600;
}

.pr-footer a:hover {
    text-decoration: underline;
}

@media (min-width: 720px) {
    .pr-controls {
        grid-template-columns: minmax(240px, 1fr) auto auto;
    }

    .pr-stats {
        white-space: nowrap;
        text-align: right;
    }
}

@media (max-width: 600px) {
    body.content-page-body {
        padding: 0.5rem 0.75rem 2rem;
    }

    .pr-header {
        padding: 1.5rem 1rem;
    }

    .pr-header h1 {
        font-size: 1.5rem;
    }

    .pr-header p {
        font-size: 0.95rem;
    }

    .pr-card {
        padding: 1rem 1.25rem;
    }

    .pr-card__header {
        flex-direction: column;
        align-items: stretch;
    }

    .pr-card__header h2 {
        font-size: 1.2rem;
    }

    .pr-card__print {
        align-self: flex-end;
    }
}

@media print {
    body.content-page-body {
        background: #fff;
        padding: 0;
        max-width: none;
        color: #000;
    }

    .pr-header,
    .pr-controls,
    .pr-toc,
    .pr-footer,
    .pr-card__print {
        display: none !important;
    }

    .pr-card {
        page-break-after: always;
        page-break-inside: avoid;
        box-shadow: none;
        border: none;
        padding: 0.5rem;
    }

    .pr-card:last-child {
        page-break-after: auto;
    }

    body.pr-printing-single .pr-card {
        display: none !important;
    }

    body.pr-printing-single .pr-card.pr-print-target {
        display: block !important;
        page-break-after: auto;
    }
}
