/* Systole user guide — print-friendly readable web style */

/* Pandoc's standalone template emits a <header> with a duplicate title H1
   above the body. We already have an H1 in each markdown source, so hide
   pandoc's. */
header#title-block-header { display: none; }


:root {
    --text:        #1a1a1a;
    --muted:       #555;
    --link:        #1f5fa8;
    --link-hover:  #0d3a78;
    --rule:        #e1e4e8;
    --code-bg:     #f5f5f5;
    --table-stripe:#f9f9f9;
    --quote-bg:    #f6f8fa;
    --quote-bar:   #d0d7de;
}

html { box-sizing: border-box; }
*, *:before, *:after { box-sizing: inherit; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    max-width: 820px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
    background: #fff;
}

h1, h2, h3, h4 {
    line-height: 1.25;
    margin-top: 2rem;
    margin-bottom: 0.6rem;
}
h1 { font-size: 2rem;   border-bottom: 1px solid var(--rule); padding-bottom: 0.4rem; }
h2 { font-size: 1.5rem; margin-top: 2.2rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; color: var(--muted); }

p { margin: 0.75rem 0; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border: 1px solid var(--rule);
    border-radius: 4px;
}

code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.92em;
    background: var(--code-bg);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}
pre {
    background: var(--code-bg);
    padding: 0.85rem 1rem;
    border-radius: 4px;
    overflow-x: auto;
}
pre code { background: transparent; padding: 0; }

table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    font-size: 0.95em;
}
th, td {
    border: 1px solid var(--rule);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}
th { background: var(--code-bg); font-weight: 600; }
tr:nth-child(even) td { background: var(--table-stripe); }

blockquote {
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    background: var(--quote-bg);
    border-left: 3px solid var(--quote-bar);
    color: var(--muted);
}

hr {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 1.5rem 0;
}

/* Nav lines (Prev · Home · Next) at the top and bottom of each page render
   as a single paragraph of links separated by middle dots. The discriminator
   is that they always contain a link back to index.html — so we only apply
   nav styling to first/last paragraphs that match. This keeps the index page
   (which has no nav lines, only the intro paragraph and the last TOC entry)
   from getting accidentally center-aligned. */
body > p:first-of-type:has(> a[href="index.html"]),
body > p:last-of-type:has(> a[href="index.html"]) {
    color: var(--muted);
    font-size: 0.95em;
    text-align: center;
}
body > p:first-of-type:has(> a[href="index.html"]) a,
body > p:last-of-type:has(> a[href="index.html"]) a { font-weight: 500; }

ul, ol { padding-left: 1.5rem; }
li { margin: 0.2rem 0; }

@media print {
    body { max-width: none; padding: 0; }
    a { color: var(--text); text-decoration: none; }
    img { break-inside: avoid; }
}
