/* Print edition. On screen: a readable, branded preview. In @media print:
   plain black-on-white, no chrome, no colour fills (ink economy - the
   coloured chapter-heading bars are a screen-design choice, not something
   to reproduce with a home printer/photocopier), clean page breaks per
   chapter. */

:root {
  --pr-bg: var(--thx-color-white);
  --pr-text: var(--thx-color-grey-222);
  --pr-text-muted: var(--thx-color-grey-666);
  --pr-accent: var(--thx-color-orange-500);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--pr-bg); color: var(--pr-text); font-family: var(--thx-font-body); line-height: var(--thx-lh-body); }

.print-toolbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--thx-space-4) clamp(24px, 5vw, 64px);
  background: var(--pr-bg);
  box-shadow: var(--thx-shadow-dropdown);
}
.print-toolbar a { color: var(--pr-text-muted); font-size: var(--thx-fs-small); text-decoration: none; }
.print-toolbar a:hover { color: var(--pr-accent); }
.home-link {
  color: var(--pr-text) !important; background: var(--thx-color-grey-eee);
  padding: var(--thx-space-2) var(--thx-space-3); border-radius: var(--thx-radius-button);
  font-weight: var(--thx-fw-medium);
}
.home-link:hover { background: var(--pr-accent); color: #fff !important; }
#printBtn {
  border: none; background: var(--pr-accent); color: #fff;
  padding: var(--thx-space-3) var(--thx-space-6); border-radius: var(--thx-radius-button);
  font-size: var(--thx-fs-body); font-weight: var(--thx-fw-medium); cursor: pointer;
}
#printBtn:hover { background: var(--thx-color-orange-600); }

.print-page { max-width: 760px; margin: 0 auto; padding: var(--thx-space-8) clamp(24px, 5vw, 64px) var(--thx-space-9); }

.print-titlepage { text-align: center; padding: var(--thx-space-9) 0; }
.print-titlepage h1 { font-family: var(--thx-font-headline); font-size: var(--thx-fs-h1); margin: 0 0 var(--thx-space-3); }
.print-subtitle { font-family: var(--thx-font-mono); color: var(--pr-text-muted); margin: 0 0 var(--thx-space-5); }
.print-author { color: var(--pr-text-muted); margin: 0 0 var(--thx-space-6); }
.print-note { font-size: var(--thx-fs-small); color: var(--pr-text-muted); max-width: 440px; margin: 0 auto; }

/* the front-matter block (subtitle/byline/year/version) reuses build_site.py's
   style_front_matter() output as-is, same class names as the main site */
.title-page-subtitle, .title-page-byline, .title-page-yearversion { text-align: center; }
.title-page-subtitle { font-family: var(--thx-font-mono); }
.title-page-byline, .title-page-year { color: var(--pr-text-muted); }
.title-page-version { font-weight: var(--thx-fw-medium); }
.centered-statement { text-align: center; }

.print-chapter { margin-top: var(--thx-space-9); }
.print-chapter-title {
  font-family: var(--thx-font-headline); font-weight: var(--thx-fw-bold);
  font-size: var(--thx-fs-h2); text-align: center; margin: 0 0 var(--thx-space-6);
}
.print-chapter .chapter-body h2 { text-align: center; font-family: var(--thx-font-headline); font-weight: var(--thx-fw-semibold); font-size: var(--thx-fs-h3); margin: var(--thx-space-7) 0 var(--thx-space-4); }
.print-chapter .chapter-body h3 { text-align: center; font-family: var(--thx-font-headline); font-size: var(--thx-fs-h4); margin: var(--thx-space-6) 0 var(--thx-space-3); }
.print-chapter .chapter-body h4 { font-weight: var(--thx-fw-semibold); text-transform: uppercase; letter-spacing: 0.06em; font-size: var(--thx-fs-small); margin: var(--thx-space-5) 0 var(--thx-space-2); }
.print-chapter .chapter-body h5 { font-style: italic; color: var(--pr-text-muted); font-size: var(--thx-fs-small); margin: var(--thx-space-4) 0 var(--thx-space-2); }
.print-chapter .chapter-body p { margin: 0 0 var(--thx-space-5); }
.print-chapter .chapter-body img { display: block; max-width: 100%; height: auto; margin: var(--thx-space-6) auto; border-radius: var(--thx-radius-card); }

@media print {
  .print-toolbar { display: none; }
  html, body { background: #fff; color: #000; }
  .print-page { max-width: none; padding: 0; }
  .print-titlepage { page-break-after: always; }
  .print-chapter {
    margin-top: 0;
    page-break-before: always;
  }
  .print-chapter:first-of-type { page-break-before: avoid; }
  .print-chapter-title, .print-chapter .chapter-body h2, .print-chapter .chapter-body h3,
  .print-chapter .chapter-body h4, .print-chapter .chapter-body h5 {
    color: #000 !important; background: none !important; -webkit-print-color-adjust: economy;
  }
  .print-chapter .chapter-body h4 { color: #000 !important; }
  .print-chapter .chapter-body h5 { color: #333 !important; }
  a { color: #000; text-decoration: none; }
  .print-chapter .chapter-body img { page-break-inside: avoid; }
}
