/* TrailGoat — the print engine's document styles (see print.js).
 *
 * #print-doc is a clean, light, data-first "roadbook" built at print time from
 * the live plan. On screen it stays hidden; during print it is the ONLY thing
 * shown. Pagination belongs to the browser: rows never split (break-inside),
 * table headers repeat per page (table-header-group), and each major part
 * starts on its own page. No screenshots, no dark ink slabs, no mid-row cuts.
 *
 * body.tg-print-preview shows the document on screen for debugging/QA. */

#print-doc { display: none; }

/* ---- the document itself (shared by print and the on-screen preview) ---- */
#print-doc {
    background: #fff; color: #16211c;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    font-size: 10.5pt; line-height: 1.45;
}
#print-doc .pd-head { margin-bottom: 10pt; }
#print-doc h1 {
    font-family: Sora, Inter, sans-serif; font-weight: 800;
    font-size: 20pt; margin: 0 0 2pt; color: #10201a; letter-spacing: -0.01em;
}
#print-doc .pd-meta { color: #5b6a63; font-size: 10pt; margin: 0; }
#print-doc .pd-meta strong { color: #16211c; }
#print-doc .pd-brandline {
    display: flex; justify-content: space-between; align-items: baseline;
    border-bottom: 2.5pt solid #e8620c; padding-bottom: 6pt; margin-bottom: 10pt;
}
#print-doc .pd-brand { font-family: Sora, sans-serif; font-weight: 800; font-size: 10pt;
    color: #e8620c; letter-spacing: 0.08em; }

#print-doc h2 {
    font-family: Sora, Inter, sans-serif; font-weight: 700; font-size: 12.5pt;
    color: #b34a06; margin: 14pt 0 6pt; break-after: avoid;
}
#print-doc .pd-sub { color: #5b6a63; font-size: 9pt; margin: -4pt 0 6pt; }

/* Metric strip: per-hour + totals as a compact row of boxes. */
#print-doc .pd-metrics { display: flex; gap: 8pt; margin: 6pt 0 2pt; break-inside: avoid; }
#print-doc .pd-metric {
    flex: 1; border: 1pt solid #d8ded9; border-radius: 6pt; padding: 5pt 8pt;
}
#print-doc .pd-metric .l { font-size: 7.5pt; text-transform: uppercase; letter-spacing: 0.06em; color: #5b6a63; }
#print-doc .pd-metric .v { font-family: Sora, sans-serif; font-weight: 700; font-size: 11pt; }
#print-doc .pd-metric .v small { font-weight: 400; font-size: 8pt; color: #5b6a63; }

/* Tables — cloned from the live plan; restyle for paper. */
#print-doc table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
#print-doc thead { display: table-header-group; }   /* header repeats on every page */
#print-doc th {
    text-align: left; font-size: 7.5pt; text-transform: uppercase; letter-spacing: 0.06em;
    color: #5b6a63; border-bottom: 1.5pt solid #16211c; padding: 3pt 6pt;
}
#print-doc td { padding: 4pt 6pt; border-bottom: 0.75pt solid #dfe5e0; vertical-align: top; }
#print-doc tr { break-inside: avoid; }              /* a row never splits across pages */
#print-doc tbody tr:nth-child(even) td { background: #f4f6f4; }
/* Neutralise site colour classes that assume a dark ground. */
#print-doc .t-up, #print-doc .t-down, #print-doc .t-pace, #print-doc .t-sep, #print-doc .t-flat,
#print-doc .aid-badge { color: inherit !important; background: none !important; }

/* Elevation profile snapshot. */
#print-doc .pd-profile { width: 100%; border: 1pt solid #d8ded9; border-radius: 6pt; margin: 4pt 0; }

/* Checklists — the reason paper exists. */
#print-doc ul.pd-check { list-style: none; margin: 4pt 0; padding: 0;
    columns: 2; column-gap: 18pt; }
#print-doc ul.pd-check li { padding: 2pt 0 2pt 16pt; position: relative; break-inside: avoid; }
#print-doc ul.pd-check li::before {
    content: ''; position: absolute; left: 0; top: 3.5pt;
    width: 8pt; height: 8pt; border: 1.1pt solid #16211c; border-radius: 1.5pt;
}
#print-doc .pd-note { color: #5b6a63; font-size: 9pt; }

/* Major parts start on a fresh page. */
#print-doc .pd-page { break-before: page; }

/* Repeating footer: fixed repeats per printed page. */
#print-doc .pd-foot {
    position: fixed; bottom: 0; left: 0; right: 0;
    text-align: center; font-size: 7.5pt; color: #98a39c;
}

/* ---- switching ---- */
@page { margin: 14mm 12mm 18mm; }
@media print {
    body.tg-printing > *:not(#print-doc) { display: none !important; }
    body.tg-printing #print-doc { display: block; }
    body.tg-printing { background: #fff !important; height: auto !important;
        overflow: visible !important; display: block !important; }
}

/* On-screen preview for QA: same document, scrollable overlay. */
body.tg-print-preview #print-doc {
    display: block; position: fixed; inset: 0; z-index: 99999;
    overflow: auto; padding: 32px clamp(24px, 12vw, 220px);
}

/* OSM surface legend under the printed elevation profile (KRI-38) */
.pd-surf-legend { font-size: 9px; color: #555; margin: 2px 0 0; }
.pd-surf-legend span { display: inline-block; width: 14px; height: 7px; border-radius: 2px; vertical-align: middle; }
