/* Print & PDF/A rendering: docs/ui.md §12, ADR-008.
 *
 * Two uses:
 *  1. Browser printing of report-like pages (loaded with media="print" after the screen CSS).
 *  2. The Gotenberg readiness packet. The exporter uploads index.html, the CSS files and the
 *     font (as Roboto.woff2) side by side, and index.html links them relatively
 *     (web/routes/exports.py PACKET_ASSETS). This file holds no raw colors (Gate 3); every
 *     color is var(--…) from tokens.css.
 * No remote fetches. The first src resolves in the Gotenberg upload; the second is the app's
 * own copy, for browser printing.
 */
@font-face {
  font-family: 'Roboto';
  src: url("Roboto.woff2") format("woff2"), url("../fonts/Roboto%5Bwght%5D.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
}

@page { size: auto; margin: 18mm; }

@media print {
  html, body { background: var(--white); color: var(--tiag-text); }
  body { font-family: var(--font-sans); font-size: 10.5pt; line-height: 1.5; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Hide chrome and interactive controls */
  .tiag-nav, .app-sidebar, .sidebar-mobile, .skip-link, .footer-links, .page-actions,
  .btn, .copy-btn, .tiag-logout, .tiag-menu, .user-menu, .pagination, .tabs,
  .flash-region, .hp-field, form, dialog, .progress-indeterminate { display: none !important; }

  .tiag-main { padding: 0; min-height: 0; }
  .app-shell { display: block; max-width: none; padding: 0; }
  .container, .container-app { max-width: none; padding: 0; }

  .card, .kpi, .codeblock, .table tr, .fieldset { break-inside: avoid; page-break-inside: avoid; }
  .card { box-shadow: none; }
  h1, h2, h3 { break-after: avoid; page-break-after: avoid; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Animations off; the wordmark prints without the streak */
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tiag-brand::before, .tiag-brand::after { display: none !important; }
  .fade-up, .rotator-item:first-child { opacity: 1 !important; }

  /* Evidence and other disclosures print expanded where the template marks them open */
  details.evidence > summary { color: var(--tiag-muted); }

  /* External links print their URL */
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: var(--tiag-muted); word-break: break-all; }
  a.tiag-brand::after, .no-print-url::after { content: none !important; }

  .codeblock pre { white-space: pre-wrap; overflow: visible; }
  .codeblock code { white-space: pre-wrap; }
  .table-wrap { overflow: visible; }

  /* Readiness-packet cover and running footer */
  .packet-cover { break-after: page; page-break-after: always; padding-top: 30mm; }
  .packet-cover .brand-word { font-size: 2.6rem; }
  .packet-meta { font-family: var(--font-mono); font-size: 9pt; color: var(--tiag-muted); word-break: break-all; }
  .packet-footer { position: fixed; bottom: 0; left: 0; right: 0; text-align: center; font-size: 8pt; color: var(--tiag-muted); }
  .tiag-footer { background: none; border: 0; padding: 1rem 0 0; }
}

/* Readiness packet body (Gotenberg): the template has no app chrome. */
@media print {
  body.packet { padding: 0; }
  .packet h1 { font-size: 1.6rem; font-weight: 400; margin: 1rem 0 .5rem; }
  .packet h2 { font-size: 1.15rem; margin: 1.25rem 0 .5rem; }
  .packet .table { width: 100%; font-size: 8.5pt; }
  .packet-meta { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; }
  .packet-meta dd { margin: 0; }
  .packet-endpoint { break-before: page; page-break-before: always; }
  /* PDF/A conversion flattens translucent fills to solid: outline grade chips instead. */
  .packet .grade { background: var(--white); border: 1px solid currentColor; }
}
