@page {
    font-family: "Roboto", sans-serif;
    font-size: 9pt;

    @bottom-center {
        content: "RhYMe User Manual — v0.9.0";
        font-size: 8pt;
        font-family: "Roboto", sans-serif;
        color: #666;
    }
}

@media print {
    table { border-spacing: 0; break-inside: avoid; }
    th, td { padding: 1px 4px; line-height: 1.2; }

    /* The theme lets a wide table scroll sideways, which on paper cuts off its right side.
       Printed, a table takes the page width and wraps its cells to fit instead. The cell rules
       repeat the theme's selectors so they win over its larger padding and over the minimum
       width it gives every header cell, which alone makes a table of many columns too wide. */
    .md-typeset__scrollwrap,
    .md-typeset__table {
        overflow: visible;
    }

    .md-typeset table:not([class]) {
        display: table;
        width: 100%;
        max-width: 100%;
    }

    .md-typeset table:not([class]) th,
    .md-typeset table:not([class]) td {
        min-width: 0;
        padding: 0.5em 0.8em;
        overflow-wrap: break-word;
    }

    h1, h2, h3 { break-after: avoid; }

    /* Make links black like body text */
    a {
        color: #000;
        text-decoration: none;
    }
}

th, td { padding: 1px 4px; }

/* Title page — large centered text */
@media print {
    #title-page {
        text-align: center;
        page-break-after: always;
    }

    #title-page h1 {
        font-size: 6em;
        font-weight: 700;
        margin-top: 25%;
        margin-bottom: 0.3em;
        break-before: avoid;
        border-bottom: none;
        letter-spacing: -0.02em;
    }

    #title-page h2 {
        font-size: 3em;
        font-weight: 700;
        margin-top: 0;
        margin-bottom: 0.2em;
        break-before: avoid;
        border-bottom: none;
        letter-spacing: -0.02em;
    }

    #title-page blockquote {
        font-size: 1.8em;
        font-weight: 300;
        color: #555;
        border-left: none;
        padding-left: 0;
        margin-bottom: 2em;
    }

    /* The edition line (e.g. "PC Edition (Windows / Linux)" / "macOS Edition") is the
       second blockquote line; render it smaller than the version above it. */
    #title-page blockquote p:last-child {
        font-size: 0.6em;
    }

    #title-page p {
        font-size: 1.4em;
        font-style: italic;
        color: #777;
        max-width: 60%;
        margin-left: auto;
        margin-right: auto;
    }

    /* Section numbering — Title Page, Notation, and TOC unnumbered, Introduction starts at 1 */
    #print-site-page {
        counter-reset: section-counter;
    }
    #print-site-page .print-page h1 {
        counter-increment: section-counter;
    }
    #print-site-page .print-page h1::before {
        content: counter(section-counter) '. ';
    }

    /* Title page, notation page, and table of contents should not show or increment the counter */
    #title-page h1, #notation h1, #table-of-contents h1,
    #title-page h2, #table-of-contents h2 {
        counter-increment: none !important;
    }
    /* The glossary's terms are headings, so each has an entry in the browser editions' table of
       contents, but on paper they are labels of a list rather than numbered sections. */
    #glossary h2 {
        counter-increment: none !important;
        font-size: 1em;
        font-weight: 700;
        margin-top: 1em;
        margin-bottom: 0;
    }
    #glossary h2 + p {
        margin-top: 0.2em;
    }
    #title-page h1::before,
    #title-page h2::before,
    #glossary h2::before,
    #notation h1::before,
    #table-of-contents h1::before,
    #table-of-contents h2::before {
        content: none !important;
    }

    /* TOC items should show their manual numbering, not list markers */
    #table-of-contents ul,
    #table-of-contents ol {
        list-style-type: none;
        padding-left: 0;
    }

    /* Sub-heading numbering (h2, h3) using nested counters */
    #print-site-page .print-page {
        counter-reset: h2-counter;
    }
    #print-site-page .print-page h2 {
        counter-increment: h2-counter;
        counter-reset: h3-counter;
    }
    #print-site-page .print-page h2::before {
        content: counter(section-counter) '.' counter(h2-counter) ' ';
    }
    #print-site-page .print-page h3 {
        counter-increment: h3-counter;
    }
    #print-site-page .print-page h3::before {
        content: counter(section-counter) '.' counter(h2-counter) '.' counter(h3-counter) ' ';
    }
}

/* Screenshots: rendered at 4x with transparent right-padding.
   Always stretched to full page width for consistent sizing. */
img[src*="screenshots/"] {
    width: 100%;
    height: auto;
}



/* The logo heading the title page, in place of the written name. It is pixel art, staged four
   times its own size and drawn without smoothing, so each of its pixels stays a sharp square. It
   stands on a slightly rounded dark box, the background it is drawn for. */
.md-typeset img.document-logo {
    display: block;
    box-sizing: border-box;
    width: 12cm;
    margin: 0 auto;
    padding: 0.6cm;
    border-radius: 0.3cm;
    background-color: #000020;
    image-rendering: pixelated;
}

/* On a beta, a BETA badge stands over the bottom right corner of the logo, as it does over the
   logo on the application's toolbars, in the logo's own colors. The logo's paragraph is as wide as
   the logo, so the badge is placed against the logo's corner, and centered as the logo is. */
.md-typeset p:has(> img.document-logo) {
    position: relative;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.md-typeset .beta-badge {
    position: absolute;
    right: 0.6cm;
    bottom: 0.6cm;
    padding: 0.05cm 0.25cm;
    border-radius: 0.1cm;
    background-color: #FF77CC;
    color: #000024;
    font-size: 18pt;
    font-weight: 700;
    font-style: normal;
    line-height: 1.2;
    letter-spacing: 0.05em;
}

/* The logo spells the name, so the written name under it is not shown, on paper or in the browser
   editions' sites. It stays in the page as its heading, so the page is not given a heading of its
   own in its place. */
.md-typeset p:has(> img.document-logo) + h1 {
    display: none;
}

@media print {
    #title-page p:has(> img.document-logo) {
        max-width: none;
        margin-top: 20%;
    }

    #title-page p:has(> img.document-logo) + h1 + h2 {
        margin-top: 0.5em;
    }
}
