/* -----------------------------------------------------------------------------
 * File: print.css
 * Purpose: @media print rules for PDF/paper export. Color/background flips to
 *          the light theme via tokens.css's print media-query overrides
 *          (loaded before this file); this file only handles LAYOUT changes:
 *          hide interactive chrome, force page breaks per chapter, expand any
 *          collapsed/interactive content so nothing is lost on paper.
 * Triggered by: the "Export PDF" button (window.print()) or Cmd/Ctrl+P.
 * -------------------------------------------------------------------------- */

@media print {
  @page {
    size: A4 landscape;
    margin: 14mm 12mm;
  }

  * {
    box-shadow: none !important;
    text-shadow: none !important;
    background-image: none !important;
    backdrop-filter: none !important;
  }

  html, body {
    background: #ffffff !important;
    color: var(--c-text-primary);
    height: auto;
    overflow: visible;
  }

  /* ---- Hide interactive / navigational chrome ---- */
  .site-header,
  .chapter-nav,
  .header-actions,
  .btn,
  .skip-link,
  .scroll-top,
  [data-print-hide] {
    display: none !important;
  }

  /* ---- Shell reflows to a single full-width column ---- */
  .layout-shell {
    display: block;
    max-width: none;
    padding: 0;
    margin: 0;
  }

  .layout-main {
    padding: 0;
  }

  .container,
  .chapter-content {
    max-width: none;
    padding-inline: 0;
  }

  /* ---- Chapters: one page-break context each ---- */
  .chapter {
    border-bottom: none;
    padding-block: 0 8mm;
    break-after: page;
    page-break-after: always;
  }

  .chapter:last-of-type {
    break-after: auto;
    page-break-after: auto;
  }

  .hero {
    min-height: 0;
    padding-block: 0 8mm;
    border-bottom: none;
  }

  .hero::before,
  .hero::after {
    display: none;
  }

  /* ---- Avoid breaking components mid-element ---- */
  .stat-card,
  .feature-row,
  .diagram-panel,
  .flow-step,
  table,
  tr,
  .callout,
  figure {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .section-title,
  .subsection-title,
  .chapter-title,
  h1, h2, h3, h4 {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* ---- Expand anything collapsed for on-screen presentation ---- */
  [hidden],
  .is-collapsed,
  details:not([open]) {
    display: block !important;
  }

  details > summary {
    display: none;
  }

  /* ---- Links: readable on paper, no dangling underlines ---- */
  a {
    color: var(--c-accent);
    text-decoration: none;
  }

  /* Show the destination for external reference links, skip in-page anchors */
  a[href^="http"]:not([href*="aura.roderickc.com/presentation"])::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
    color: var(--c-text-muted);
  }

  /* ---- Diagrams: ensure inline SVG text stays crisp/selectable ---- */
  svg text {
    fill: var(--c-text-primary) !important;
  }

  .diagram-panel {
    background: var(--c-bg-secondary) !important;
    border: 1px solid var(--c-border);
  }

  /* ---- Stat numbers: keep the accent for scannability on paper ---- */
  .stat-number {
    color: var(--c-accent);
  }

  /* ---- Footer: compact, no border waste ---- */
  .site-footer {
    border-top: none;
    padding-block: 4mm 0;
  }
}
