:root {
    --font-size: 12pt; /* Base font size for print */
}

@page {
    margin: 1in 0.75in 1in 0.75in; /* Set overall page margins */
    @bottom-center {
        content: "©2026 Shannan.dev Page " counter(page) "/" counter(pages); /* Add page numbers */
        font-size: 10pt;
    }
}

body {
    padding: 0;
    margin: 0;
    font-size: var(--font-size);
}

p,
li,
blockquote,
pre,
code,
h4 {
    font-size: var(--font-size) !important;
}

ol > li,
ul > li {
    margin-top: calc(var(--font-size) * 0.5);
    margin-bottom: calc(var(--font-size) * 0.5);
}

h3 {
    font-size: calc(var(--font-size) * 1.4) !important;
}

h2 {
    font-size: calc(var(--font-size) * 1.6) !important;
}

h1 {
    font-size: calc(var(--font-size) * 2) !important;
    margin-bottom: 0.2in; /* Extra space after main headings */
}

h1,
h2,
h3,
h4,
h5,
h6 {
    page-break-after: avoid;
    break-after: avoid; /* Modern syntax */
    orphans: 2; /* Ensure at least 2 lines of text follow the heading */
    widows: 2; /* Ensure at least 2 lines of heading text stay together */
}

/* Optional: Ensure paragraphs also have minimum lines on a page */
p,
ul,
ol,
li,
blockquote {
    orphans: 2;
    widows: 2;
}

pre,
code {
    white-space: pre-wrap; /* Allow code to wrap to avoid overflow */
}

hr {
    display: none;
    border: none;
    margin: 0;
    padding: 0;
    page-break-after: always;
    break-after: always; /* Modern syntax */
}
