/* Spec 324: the classic games' rules pages. The same content in the landing's static frame for a guest
   (.guest-landing.rules-guest, with home-landing.css) and inside the app shell for a signed-in person
   (.rules-page--app, with components.css), so every rule the content needs lives here. */

.rules-page {
    width: min(860px, 100%);
    margin-inline: auto;
    padding: 1rem 0 2rem;
    color: var(--tt-ink);
    font-family: var(--tt-font-text);
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.rules-guest .rules-page {
    width: min(860px, 100% - 2rem);
}

.rules-page *,
.rules-page *::before,
.rules-page *::after {
    box-sizing: border-box;
}

.rules-page :is(h1, h2, h3) {
    font-family: var(--tt-font-display);
    line-height: 1.2;
    margin: 0 0 0.75rem;
}

.rules-page h1 {
    font-size: clamp(1.7rem, 5vw, 2.4rem);
}

.rules-page h2 {
    font-size: clamp(1.3rem, 3.6vw, 1.6rem);
}

.rules-page h3 {
    font-size: 1.15rem;
    margin-top: 1.25rem;
}

.rules-page :is(p, ul, ol, dl) {
    margin: 0 0 0.85rem;
}

.rules-page :is(p, ul, ol):last-child {
    margin-bottom: 0;
}

/* Rule 4 and the UI guidelines: each part on its own block, not divided by lines (the bevel: tabletop-screens.css). */
.rules-block {
    margin: 0 0 1rem;
    padding: 1.25rem 1.25rem 1.35rem;
    background: var(--tt-area);
    border-top: 3px solid var(--tt-rule);
}

.rules-back {
    display: flex;
    margin: 0 0 1rem;
}

/* The guest frame loads no components.css: the arrow's own shape (the cardboard comes from tabletop-pieces.css). */
.rules-page .page-back-btn {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid;
    text-decoration: none;
}

.rules-intro {
    color: var(--tt-muted);
    font-size: 1.05rem;
}

.rules-draft {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--tt-accent);
    color: var(--tt-accent);
    font-weight: 700;
}

.rules-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 0.75rem 1.25rem;
}

.rules-facts dt {
    color: var(--tt-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.rules-facts dd {
    margin: 0;
    font-weight: 700;
}

.rules-updated {
    color: var(--tt-muted);
    font-size: 0.85rem;
}

.rules-list,
.rules-steps,
.rules-toc ol {
    padding-left: 1.4rem;
}

.rules-list li + li,
.rules-steps li + li {
    margin-top: 0.35rem;
}

.rules-note {
    padding: 0.75rem 1rem;
    background: var(--tt-field);
    border-left: 3px solid var(--tt-accent);
}

/* Rule 7: a table wider than its block scrolls inside the block, never the page. */
.rules-table-wrap {
    max-width: 100%;
    margin: 0 0 0.85rem;
    overflow-x: auto;
}

.rules-table {
    min-width: 100%;
    border-collapse: collapse;
    overflow-wrap: normal;
}

.rules-table caption {
    caption-side: top;
    padding-bottom: 0.4rem;
    color: var(--tt-muted);
    font-size: 0.9rem;
    text-align: left;
}

/* About 7rem a column, so a three- or four-column table on a phone scrolls instead of squeezing its words. */
.rules-table--cols-3 {
    min-width: 21rem;
}

.rules-table--cols-4 {
    min-width: 28rem;
}

.rules-table :is(th, td) {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--tt-line);
    text-align: left;
    vertical-align: top;
}

.rules-table th {
    background: var(--tt-field);
    font-weight: 700;
}

.rules-variant + .rules-variant {
    margin-top: 1rem;
}

/* Rule 7: every tap target of the content is at least 44 px high. */
.rules-page a:not(.page-back-btn),
.rules-faq-item summary {
    min-height: 44px;
}

.rules-toc a {
    display: inline-flex;
    align-items: center;
    color: var(--tt-accent);
    font-weight: 600;
    text-decoration: none;
}

.rules-toc a:hover {
    color: var(--tt-ink);
}

.rules-faq-item + .rules-faq-item {
    margin-top: 0.5rem;
}

.rules-faq-item summary {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.6rem 2.25rem 0.6rem 0.85rem;
    background: var(--tt-field);
    cursor: pointer;
    list-style: none;
    font-weight: 700;
}

.rules-faq-item summary::-webkit-details-marker {
    display: none;
}

.rules-faq-item summary::after {
    content: "+";
    position: absolute;
    right: 0.85rem;
    color: var(--tt-accent);
    font-size: 1.3rem;
    line-height: 1;
}

.rules-faq-item[open] summary::after {
    content: "-";
}

.rules-faq-item p {
    padding: 0.75rem 0.85rem 0.25rem;
    color: var(--tt-ink);
}

.rules-faq-item summary:focus-visible,
.rules-page a:focus-visible {
    outline: 2px solid var(--tt-accent);
    outline-offset: 3px;
}

/* Rules 10 and 12: each game a framed row that opens its page. */
.rules-rows {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rules-row {
    display: grid;
    gap: 0.15rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--tt-line);
    background: var(--tt-field);
    color: var(--tt-ink);
    text-decoration: none;
}

.rules-row:hover {
    border-color: var(--tt-accent);
}

.rules-row-name {
    font-family: var(--tt-font-display);
    font-size: 1.1rem;
    font-weight: 700;
}

.rules-row-players {
    color: var(--tt-accent);
    font-size: 0.85rem;
    font-weight: 600;
}

.rules-row-summary {
    color: var(--tt-muted);
    font-size: 0.92rem;
}

.rules-others .rules-rows {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
}

.rules-others .rules-row {
    align-content: center;
}

.rules-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1rem;
}

/* The landing's button shape for the app frame too; the colours are the cardboard pieces' (tabletop-pieces.css). */
.rules-page .gl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.9rem;
    padding: 0.65rem 1.3rem;
    border: 1px solid;
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 480px) {
    .rules-block {
        padding: 1rem 0.9rem 1.1rem;
    }

    .rules-actions .gl-btn {
        flex: 1 1 100%;
    }
}
