/* Bare element styles: headings, links, table, dl, details.
   Element-first — every table on this site is a stat table, so a bare <table>
   simply looks right; a class marks only deliberate deviation.
   The register is editorial: Fraunces headings over heavy section rules, agate
   tables ruled top and bottom like a printed scorecard, no header-row fill —
   ink, not chrome. See docs/agents/styling.md. */

@layer base {
    body {
        background: var(--bg);
        color: var(--text);
        font-family: var(--font-sans);
        font-size: var(--text-body);
    }

    /* --- Hierarchy --- */
    h1,
    h2,
    h3 {
        font-family: var(--font-display);
        font-weight: 700;
        line-height: 1.15;
        text-wrap: balance;
    }

    h1 {
        font-size: var(--text-h1);
        margin-block: var(--space-lg) var(--space-md);
    }

    /* Sections open under a heavy rule, the way a broadsheet section does. */
    h2 {
        border-block-start: 2px solid var(--border-strong);
        font-size: var(--text-h2);
        margin-block: var(--space-xl) var(--space-sm);
        padding-block-start: var(--space-xs);
    }

    h3 {
        font-size: var(--text-h3);
        margin-block: var(--space-md) var(--space-xs);
    }

    p {
        margin-block: var(--space-sm);
    }

    ul,
    ol {
        margin-block: var(--space-sm);
        padding-inline-start: var(--space-lg);
    }

    a {
        color: var(--link);
        text-decoration-thickness: from-font;
        text-underline-offset: 0.15em;
    }

    :focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

    h1:focus {
        outline: none;
    }

    /* --- Stat tables: the agate scorecard --- */
    table {
        border-collapse: separate;
        border-spacing: 0;
        font-size: var(--text-stat);
        font-variant-numeric: tabular-nums;
        line-height: 1.2;
        margin-block: var(--space-sm);
    }

    th,
    td {
        border-block-end: 1px solid var(--border);
        padding: var(--space-3xs) var(--space-xs);
        text-align: start;
        white-space: nowrap;
    }

    /* No fill — a printed header row is ink and a rule, nothing else. The
       opaque background the sticky column needs is applied in components.css,
       where stickiness itself lives. */
    thead th {
        border-block-end: 3px double var(--border-strong);
        font-weight: 700;
    }

    /* The scorecard closes with a firmer rule than it uses between rows. */
    tbody tr:last-child td {
        border-block-end: 2px solid var(--border-strong);
    }

    /* League-leading values: the accent's one appearance inside a table. */
    td strong {
        color: var(--accent);
    }

    /* --- Stat legend --- */
    details {
        margin-block: var(--space-md);
    }

    summary {
        color: var(--text-muted);
        cursor: pointer;
        font-size: var(--text-sm);
    }

    dl {
        display: grid;
        gap: var(--space-3xs) var(--space-sm);
        grid-template-columns: max-content 1fr;
        font-size: var(--text-sm);
        margin-block: var(--space-xs);
        max-inline-size: 60ch;
    }

    dt {
        font-weight: 600;
    }

    dd {
        color: var(--text-muted);
        margin: 0;
    }
}
