/* ==========================================================================
   EZRRC print.

   A dataset page is a reference document. People print the record layout and
   the code lookups and take them to a desk, so paper gets the schema table,
   the joins, the codes and the provenance -- and nothing else. Navigation,
   ads, the rail and every call to action are dropped, because none of them
   can be acted on from a sheet of paper.
   ========================================================================== */

@media print {
    /* Force the light token set. A dark page prints as a black rectangle. */
    :root,
    :root[data-theme="dark"] {
        color-scheme: light;
        --color-paper: 255 255 255;
        --color-canvas: 255 255 255;
        --color-canvas-sunk: 245 245 245;
        --color-canvas-raised: 255 255 255;
        --color-ink: 0 0 0;
        --color-text: 26 26 26;
        --color-muted: 82 82 82;
        --color-faint: 120 120 120;
        --color-accent: 0 0 0;
        --color-accent-strong: 0 0 0;
        --color-accent-soft: 255 255 255;
        --color-accent-line: 170 170 170;
        --color-marker: 90 70 10;
        --color-marker-bright: 140 110 20;
        --color-marker-soft: 255 255 255;
        --color-fresh: 40 40 40;
        --color-fresh-soft: 255 255 255;
        --color-caution: 60 60 60;
        --color-caution-soft: 255 255 255;
        --color-danger: 40 40 40;
        --color-danger-soft: 255 255 255;
        --color-line: 190 190 190;
        --color-line-strong: 140 140 140;
        --shadow-1: none;
        --shadow-2: none;
        --shadow-pop: none;
    }

    @page {
        margin: 16mm 14mm;
    }

    html,
    body {
        background-color: rgb(var(--color-paper));
        color: rgb(var(--color-text));
        font-size: 10.5pt;
        line-height: 1.42;
    }

    /* ── Dropped entirely ────────────────────────────────────────────────── */

    .site-header,
    .site-nav,
    .site-actions,
    .skip-link,
    .band,
    .layout__rail,
    .ad-slot,
    .funnel,
    .site-footer__grid,
    .download,
    .download__form,
    .download__preview,
    .search-form,
    .facets,
    .results-bar__sorts,
    .pagination,
    .account-nav,
    .cart-line-actions,
    .option-actions,
    .options-footer,
    .checkout-form,
    .cart-actions,
    .ready-links,
    .order-links,
    .error-page__actions,
    .codeblock__copy,
    .theme-toggle,
    .map,
    .hero__actions,
    form {
        display: none !important;
    }

    /* ── Layout ──────────────────────────────────────────────────────────── */

    .layout,
    .layout--rail {
        display: block;
    }

    .shell {
        max-width: none;
        padding-inline: 0;
    }

    .page__body {
        padding-block: 0;
    }

    /* A printed dataset page needs to say what it is and where it came from,
       which the header would otherwise have carried. */
    .page-header::before {
        content: "EZRRC — ezrrc.com — unofficial mirror of Texas Railroad Commission data";
        display: block;
        margin-block-end: 6pt;
        padding-block-end: 4pt;
        border-block-end: 0.5pt solid rgb(var(--color-line-strong));
        font-family: var(--font-mono);
        font-size: 7.5pt;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: rgb(var(--color-muted));
    }

    /* ── Type ────────────────────────────────────────────────────────────── */

    h1 {
        font-size: 19pt;
    }

    h2 {
        font-size: 14pt;
    }

    h3 {
        font-size: 11.5pt;
    }

    h2,
    h3,
    h4,
    caption,
    .section__heading,
    .schema__heading,
    .code-set__heading {
        break-after: avoid;
        page-break-after: avoid;
    }

    p,
    li,
    tr,
    .join,
    .code-set,
    .dataset-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    section,
    .schema,
    .code-set {
        break-inside: auto;
    }

    /* Links are useless without their target on paper, so print it. Internal
       and anchor links are left alone: the reader already has the page. */
    a[href^="http"]::after {
        content: " <" attr(href) ">";
        font-family: var(--font-mono);
        font-size: 8pt;
        font-weight: 400;
        color: rgb(var(--color-muted));
        word-break: break-all;
    }

    a {
        color: inherit;
        text-decoration: underline;
    }

    /* ── Tables ──────────────────────────────────────────────────────────── */

    /* The whole point of printing a schema is seeing every column, so the
       scroll container becomes a plain block and the table wraps instead. */
    .table-scroll {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background-image: none;
    }

    .table,
    .data-table,
    .checkout-table,
    .order-table {
        width: 100%;
        font-size: 8.5pt;
        border: 0.5pt solid rgb(var(--color-line-strong));
    }

    .table th,
    .table td {
        padding: 3pt 4pt;
        border: 0.5pt solid rgb(var(--color-line));
        white-space: normal;
        max-width: none;
        overflow: visible;
        text-overflow: clip;
    }

    .table thead {
        display: table-header-group;
    }

    .table thead th {
        position: static;
        background-color: rgb(var(--color-canvas-sunk));
        color: rgb(var(--color-ink));
    }

    /* The sort control is inert on paper; its arrow is just a smudge. */
    .table th .sort-button {
        display: inline;
    }

    .table th .sort-button::after {
        display: none;
    }

    .table tbody tr:nth-child(even) {
        background-color: transparent;
    }

    .table--preview td,
    .table--preview th {
        white-space: normal;
        max-width: none;
    }

    /* ── Blocks ──────────────────────────────────────────────────────────── */

    .panel,
    .sidebar-block,
    .account-section,
    .callout,
    .notice,
    .join,
    .cart-line,
    .option-card,
    .ready-file,
    .card,
    .dataset-card {
        border: 0.5pt solid rgb(var(--color-line-strong));
        border-radius: 0;
        box-shadow: none;
        background: none;
    }

    .badge,
    .tag,
    .status-pill,
    .filter-chip {
        border: 0.5pt solid rgb(var(--color-line-strong));
        background: none;
        color: rgb(var(--color-text));
    }

    pre {
        border: 0.5pt solid rgb(var(--color-line-strong));
        white-space: pre-wrap;
        word-break: break-word;
        overflow: visible;
    }

    .rule {
        height: 0;
        background-image: none;
        border-block-start: 0.5pt solid rgb(var(--color-line-strong));
    }

    .disclaimer {
        border-inline-start: 1.5pt solid rgb(var(--color-marker-bright));
        background: none;
    }

    /* The footer disclaimer is the one piece of chrome that must survive:
       an EZRRC print-out is not an official RRC publication and has to say so
       on the sheet itself. */
    .site-footer {
        border-block-start: 0.5pt solid rgb(var(--color-line-strong));
        background: none;
    }

    .site-footer__disclaimer {
        background: none;
        border: 0;
        padding-block: 6pt 0;
    }

    .site-footer__legal {
        border: 0;
        padding-block: 4pt 0;
        font-size: 7.5pt;
    }

    .site-footer__brand svg {
        display: none;
    }
}
