/*
 * A4 print stylesheet (LAU-302, blueprint dev-decision D5). Grassroots venues
 * routinely have no reliable connectivity, so team sheets, draws/fixtures,
 * results and the organiser's day schedule must come off the browser print
 * dialog as clean paper — no site chrome, no interactive controls, no colour
 * dependence.
 *
 * The contract with the views is three classes:
 *   .print-sheet    a printable region; page-breaks are taken between siblings
 *   .print-hide     chrome/controls that must never reach paper
 *   .print-only     text that appears ONLY on paper (headers, signature lines)
 *
 * Youth safety: nothing here re-styles hidden data into view. Printed output
 * carries names, squad numbers and match facts only — never a date of birth,
 * contact detail or availability note (asserted in test/integration/print_and_export_test.rb).
 */

.print-only { display: none; }

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

  /* Landscape suits the field x timeslot grid and wide fixture tables. */
  .print-landscape { page-break-before: auto; }

  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }

  /* Site chrome: sidebar, mobile header, flashes, banners, nav and every
     control. Anything a printer cannot action has no business on paper. */
  .print-hide,
  nav,
  aside,
  [data-controller="sidebar"] > header,
  form button,
  button,
  input[type="submit"],
  .turbo-progress-bar {
    display: none !important;
  }

  /* The app shell collapses to a single full-width column. */
  main,
  main > div,
  main > div > div {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  /* The desktop shell caps the window at 100dvh and scrolls #page-scroll
     instead of the document; paper has no window, so the pane un-clips or
     only the first screenful would ever print. */
  [data-controller="sidebar"],
  main,
  #page-scroll {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .print-only { display: block; }

  .print-sheet {
    border: 0 !important;
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-sheet + .print-sheet {
    break-before: page;
    page-break-before: always;
  }

  /* A print-sheet can hold more than one table (per-division standings,
     LAU-566) — the sheet-level break-inside above only protects a
     single-table sheet, so each division's heading + table needs its own
     break protection or a heading can orphan at a page foot. */
  .division-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .division-block h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* Grids stack: two team-sheet cards become two pages, not two columns. */
  .grid {
    display: block !important;
  }

  /* Tables read as tables, with repeated headers across pages. */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  thead { display: table-header-group; }
  tr { break-inside: avoid; page-break-inside: avoid; }

  th, td {
    border: 1px solid #999 !important;
    padding: 3pt 5pt !important;
    color: #000 !important;
    background: transparent !important;
  }

  /* Badges and pills lose their fills so they stay legible in mono. */
  .rounded-full {
    border: 1px solid #999 !important;
    background: transparent !important;
    color: #000 !important;
  }

  /* Links print as plain text — a URL on paper helps nobody at a ground. */
  a { text-decoration: none !important; color: #000 !important; }
}
