/* handout-print.css — paged-media CSS for WeasyPrint PDF render
 * AND for browser print preview. Keeps page-break-aware rules in
 * one stylesheet so PDF + browser-printed handouts look the same.
 *
 * Loaded by browsers via media="print"; loaded unconditionally by
 * WeasyPrint when render.py invokes write_pdf with this stylesheet.
 *
 * License: (c) 2026 Virtus Cyber Academy; license TBD.
 */

@page {
  size: letter;
  margin: 1in 0.85in 1in 0.85in;
  @bottom-right {
    content: "Virtus Cyber Academy · " counter(page) " of " counter(pages);
    font-size: 9pt;
    color: #555;
    font-family: "Geist Sans", system-ui, sans-serif;
  }
  @bottom-left {
    content: "virtuscyberacademy.org";
    font-size: 9pt;
    color: #555;
    font-family: "Geist Sans", system-ui, sans-serif;
  }
  @top-left {
    content: string(handout-title);
    font-size: 9pt;
    color: #555;
    font-family: "Geist Sans", system-ui, sans-serif;
  }
}

/* First page is the title page; suppress running header so the H1
 * has visual primacy. */
@page :first {
  @top-left { content: ""; }
}

/* Force light-on-light for print readability across both
 * browser-print AND WeasyPrint. */
html, body {
  background: white !important;
  color: black !important;
  font-family: "Geist Sans", system-ui, -apple-system, sans-serif !important;
  font-size: 11pt;
  line-height: 1.55;
}

/* Hide screen-only chrome */
.va-handout-downloads,
.va-handout-home,
.va-handout-footer nav,
.va-handout-meta .va-handout-track {
  display: none !important;
}

.va-handout-header {
  border-bottom: 1px solid #999;
  padding: 0 0 0.4in;
  margin-bottom: 0.3in;
  max-width: none;
}
.va-handout-title {
  margin: 0 0 0.15in;
  font-size: 22pt;
  line-height: 1.2;
  color: black !important;
  string-set: handout-title content();
  page-break-after: avoid;
  break-after: avoid;
}
.va-handout-meta {
  font-size: 9pt;
  color: #555;
  gap: 0.5em;
}
.va-handout-meta .va-handout-version,
.va-handout-meta .va-handout-stats {
  color: #555;
}

.va-handout-body {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* heading hierarchy + page-break discipline */
.va-handout-body h1,
.va-handout-body h2,
.va-handout-body h3,
.va-handout-body h4,
.va-handout-body h5,
.va-handout-body h6 {
  page-break-after: avoid;
  break-after: avoid;
  page-break-inside: avoid;
  break-inside: avoid;
  color: black !important;
  font-weight: 700;
}
.va-handout-body h1 { font-size: 18pt; margin: 18pt 0 6pt; border-bottom: 1px solid #999; padding-bottom: 4pt; }
.va-handout-body h2 { font-size: 14pt; margin: 16pt 0 6pt; color: #5a3700 !important; }
.va-handout-body h3 { font-size: 12pt; margin: 14pt 0 4pt; color: #1f5f1f !important; }
.va-handout-body h4 { font-size: 10.5pt; margin: 12pt 0 3pt; text-transform: uppercase; letter-spacing: 0.05em; }

.va-handout-body p,
.va-handout-body li {
  orphans: 3;
  widows: 3;
}

.va-handout-body p {
  margin: 0.5em 0;
}

.va-handout-body ul,
.va-handout-body ol {
  padding-left: 1.4em;
  margin: 0.5em 0;
}
.va-handout-body li { margin: 0.25em 0; }

/* code: keep blocks together if reasonable; allow break if too tall */
.va-handout-body code,
.va-handout-body pre code {
  font-family: "Geist Mono", "Courier New", monospace;
  font-size: 9.5pt;
  color: #1f1f1f !important;
  background: #f3f3f3 !important;
  border: 0 !important;
  padding: 0.05em 0.25em;
}
.va-handout-body pre {
  background: #f3f3f3 !important;
  border: 1px solid #ccc !important;
  border-radius: 3pt;
  padding: 6pt 8pt;
  margin: 8pt 0;
  page-break-inside: avoid;
  break-inside: avoid;
  font-size: 9pt;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  /* If the block is taller than a printed page, allow a break */
  max-height: 9in;
}
.va-handout-body pre code {
  background: transparent !important;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Disable Pygments dark-theme colors for print; use grayscale */
.codehilite,
.codehilite * {
  color: #1f1f1f !important;
  background: transparent !important;
}
.codehilite .k, .codehilite .kn, .codehilite .kd, .codehilite .kr,
.codehilite .nf, .codehilite .nc { color: #5a1f5a !important; font-weight: 600; }
.codehilite .s, .codehilite .s1, .codehilite .s2, .codehilite .sb { color: #1f5a1f !important; }
.codehilite .c, .codehilite .c1, .codehilite .cm { color: #777 !important; font-style: italic; }
.codehilite .mi, .codehilite .mf { color: #5a3700 !important; }

/* tables */
.va-handout-body table {
  page-break-inside: avoid;
  break-inside: avoid;
  border-collapse: collapse;
  margin: 8pt 0;
  font-size: 9.5pt;
  width: 100%;
  display: table; /* override screen `display: block` so PDF renders proper table */
}
.va-handout-body table caption,
.va-handout-body table thead {
  page-break-after: avoid;
  break-after: avoid;
}
.va-handout-body table th {
  background: #efefef !important;
  color: black !important;
  border: 1px solid #999 !important;
  padding: 4pt 6pt;
  font-weight: 600;
  text-align: left;
}
.va-handout-body table td {
  border: 1px solid #999 !important;
  padding: 4pt 6pt;
  vertical-align: top;
}
.va-handout-body table tbody tr:nth-child(even) td {
  background: #f7f7f7 !important;
}

/* blockquotes */
.va-handout-body blockquote {
  border-left: 3pt solid #d09000;
  background: #fdf6e3 !important;
  color: #1f1f1f !important;
  margin: 8pt 0;
  padding: 4pt 8pt;
  page-break-inside: avoid;
  break-inside: avoid;
}

/* horizontal rule */
.va-handout-body hr {
  border: 0;
  border-top: 1px solid #ccc;
  margin: 16pt 0;
}

/* links */
.va-handout-body a {
  color: #0044aa !important;
  text-decoration: underline;
}

/* show URL after external links so paper readers can copy */
.va-handout-body a[href^="http"]::after {
  content: " (" attr(href) ")";
  font-size: 8pt;
  color: #555;
  word-break: break-all;
}
/* but suppress the URL hint for links whose text already contains the URL */
.va-handout-body a[href^="http"].no-url-hint::after { content: ""; }

/* images + figures */
.va-handout-body img,
.va-handout-body figure {
  page-break-inside: avoid;
  break-inside: avoid;
  max-width: 100%;
}

/* footnotes (mdit_py_plugins.footnote) */
.va-handout-body .footnotes {
  margin-top: 0.4in;
  padding-top: 6pt;
  border-top: 1px solid #999;
  font-size: 9pt;
  color: #1f1f1f !important;
  page-break-before: auto;
}

/* license footer hint at end */
.va-handout-license {
  margin-top: 0.4in;
  padding-top: 6pt;
  border-top: 1px solid #ccc;
  font-size: 8pt;
  color: #555 !important;
}
