/* ============================================================
   HARVEST · PRINT STYLESHEET
   Optimized for letter-size PDF / paper administration
   ============================================================ */

@page {
  size: letter;
  margin: 0.5in;
}

@media print {
  /* Reset for print */
  html, body {
    background: white !important;
    color: black !important;
    font-size: 11pt;
    line-height: 1.5;
  }

  /* A focus ring is for the screen. The app focuses <main> whenever it mounts a screen, and after
     keyboard use that ring is :focus-visible, so a report printed then carried the bottom edge of
     a gold frame under its last line (seen 2026-10-19). */
  *:focus,
  *:focus-visible { outline: none !important; }

  /* Hide UI chrome */
  .atmosphere,
  .app-header .header-controls,
  .progress-strip,
  .app-footer,
  .proctor-banner,
  .modal-root,
  .toast-root,
  .recorder,
  .skip-link,
  .a11y-panel,
  button:not(.print-keep),
  .btn,
  .print-hide {
    display: none !important;
  }

  /* Layout. The screen layout gives the app and the stage a minimum height (100vh, 60vh); on
     paper a minimum height is just blank space that can push a one-page report onto two. */
  .app {
    max-width: 100%;
    padding: 0;
    margin: 0;
    min-height: 0 !important;
  }
  .stage {
    box-shadow: none !important;
    border: none !important;
    background: white !important;
    padding: 0 !important;
    max-width: 100% !important;
    min-height: 0 !important;
  }
  .stage::before { display: none !important; }
  .app-header {
    background: white !important;
    box-shadow: none !important;
    border-bottom: 2pt solid #1F3526;
    padding: 0 0 10pt 0 !important;
    margin-bottom: 16pt !important;
    page-break-after: avoid;
  }
  .brand-name { color: #1F3526 !important; }
  .brand-tagline { color: #5A6E60 !important; }

  /* Typography */
  h1 { font-size: 18pt; color: #1F3526 !important; }
  h2 { font-size: 14pt; color: #1F3526 !important; page-break-after: avoid; }
  h3 { font-size: 12pt; color: #2C5F3D !important; page-break-after: avoid; }
  p, li { color: black !important; orphans: 3; widows: 3; }

  /* Cards / sections */
  .card,
  .intake-section,
  .narrative-box,
  .report-section {
    background: white !important;
    border: 1pt solid #5A6E60 !important;
    border-radius: 4pt !important;
    box-shadow: none !important;
    padding: 8pt !important;
    margin-bottom: 10pt !important;
    page-break-inside: avoid;
  }

  /* Signatures */
  .signature-block {
    border-top: 1pt solid black !important;
    margin-top: 24pt;
    page-break-inside: avoid;
  }
  .sig-line { border-bottom: 0.5pt solid black !important; }

  /* Page breaks */
  .page-break-before { page-break-before: always; }
  .page-break-after { page-break-after: always; }
  .keep-together { page-break-inside: avoid; }

  /* Force backgrounds for color cells */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* The session line at the end of a report. It used to be position: fixed, which on paper
     repeats on every page AND sits on top of the last lines of each one; it now prints once,
     after the report. */
  .print-footer {
    position: static;
    margin-top: 8pt;
    font-size: 7.5pt;
    color: #5A6E60 !important;
    text-align: center;
    border-top: 0.5pt solid #B9C3BC;
    padding-top: 3pt;
  }

  /* Form elements for printable administration */
  .form-input,
  .form-select,
  .form-textarea {
    border: 1pt solid black !important;
    background: white !important;
    padding: 4pt !important;
    border-radius: 0 !important;
  }
  .form-textarea { min-height: 60pt !important; }
  .choice {
    border: 0.5pt solid black !important;
    background: white !important;
  }
  .choice input[type="checkbox"]::after,
  .choice input[type="radio"]::after { content: '☐'; font-size: 12pt; }

  /* Special: printable mode adds bubble sheet markers */
  .printable-bubble {
    display: inline-block;
    width: 16pt;
    height: 16pt;
    border: 1pt solid black;
    border-radius: 50%;
    margin: 0 4pt;
    vertical-align: middle;
  }

  /* Hide tabs/badges that don't print well */
  .badge { border: 0.5pt solid #1F3526 !important; background: white !important; color: black !important; }

  /* ══════════════════════════════════════════════════════════
     THE PLACEMENT REPORT (2026-10-19)

     The Parent Summary must print to ONE Letter page with normal settings. An outside review
     (2026-10-18) saw the old one take two. The rules below hold it to one by construction rather
     than by luck: every size on the summary is set in points (so it does not swing with the
     root font size), the app's own header gives way to the summary's own head, the start of each
     bar is written beside it instead of in a flag above it, the four lists flow down two balanced
     columns, the guidance and "how sure" sit side by side, and a list longer than three items
     per subject is cut there with "and N more" (report.js marks the extra items .ps-extra).
     Checked by Harvest/tests/report-check.mjs, which prints the heaviest case it can build (both
     subjects, every list long, every confidence reason firing), with fonts loaded and blocked,
     and counts the pages of a real Letter PDF.
     ══════════════════════════════════════════════════════════ */
  .app:has(.report) .app-header { display: none !important; }
  .report { max-width: none !important; margin: 0 !important; }
  .report-parent-view .writing-review,
  .report-parent-view .print-footer { display: none !important; }
  .report .print-only { display: block !important; }
  .report li.print-only { display: list-item !important; }
  .report span.print-only { display: inline !important; }
  .ps-extra { display: none !important; }

  .parent-summary {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: white !important;
    font-size: 8pt;
  }
  .parent-summary p,
  .parent-summary li { orphans: 1; widows: 1; }
  .parent-summary-head {
    padding-bottom: 3pt !important;
    margin-bottom: 6pt !important;
    border-bottom: 1.5pt solid #C8860A !important;
  }
  .ps-brand { font-size: 6.5pt !important; margin-bottom: 0 !important; }
  .parent-summary-head h1 { font-size: 15pt !important; }
  .parent-summary-meta { font-size: 8pt !important; margin-top: 1pt !important; line-height: 1.3 !important; color: #4A3520 !important; }
  .ps-rescored { font-size: 7pt !important; margin-top: 1pt !important; }

  /* Headline cards: white on paper, the subject's colour as a border. */
  .ps-headlines { gap: 6pt !important; margin-bottom: 6pt !important; }
  .ps-headlines.is-two { grid-template-columns: 1fr 1fr !important; }
  .parent-headline,
  .parent-headline.is-floor,
  .parent-headline.is-none {
    background: white !important;
    color: black !important;
    border: 1.25pt solid #2D5016 !important;
    border-radius: 4pt !important;
    padding: 4pt 7pt !important;
    break-inside: avoid;
  }
  .parent-headline.is-floor { border-color: #7B3F00 !important; border-style: dashed !important; }
  .parent-headline.is-none { border: 1pt dashed #7A6A55 !important; }
  .parent-headline-label { font-size: 6.5pt !important; color: #7B3F00 !important; margin-bottom: 1pt !important; }
  .parent-headline .parent-headline-value { font-size: 12.5pt !important; line-height: 1.15 !important; color: #1E3A0E !important; margin-bottom: 1pt !important; }
  .parent-headline .parent-headline-sub,
  .parent-headline .parent-headline-note { font-size: 8pt !important; line-height: 1.28 !important; color: black !important; }
  .parent-headline .parent-headline-note { margin-top: 2pt !important; padding-top: 2pt !important; border-top: 0.5pt solid #B9C3BC !important; }
  .parent-headline .parent-headline-flag { font-size: 7pt !important; line-height: 1.3 !important; background: #F5DDD9 !important; color: #A83236 !important; margin-top: 2pt !important; padding: 0 5pt !important; }

  /* The start on the K-5 books: the start is written under each subject's name, so no flag needs
     a line of its own. */
  .grade-meter { margin-bottom: 4pt !important; break-inside: avoid; }
  .grade-meter h3 { font-size: 8.5pt !important; margin-bottom: 1pt !important; }
  .start-bar { grid-template-columns: 58pt 1fr !important; gap: 6pt !important; padding-top: 0 !important; margin-bottom: 1pt !important; align-items: center !important; }
  .start-bar-label { font-size: 7.5pt !important; padding-bottom: 0 !important; line-height: 1.1 !important; }
  .start-bar-start { display: block !important; font-size: 6.5pt !important; font-weight: 700; color: #7B3F00 !important; }
  .start-bar-flag { display: none !important; }
  .start-bar-segs { height: 7pt !important; }
  .start-bar-tick { font-size: 6pt !important; margin-top: 0 !important; line-height: 1.2 !important; }
  .grade-meter-key { font-size: 6.5pt !important; margin-top: 1pt !important; line-height: 1.2 !important; }
  .ps-growth { font-size: 8pt !important; line-height: 1.3 !important; padding: 2pt 6pt !important; margin-bottom: 5pt !important; background: white !important; border: 0.75pt solid #B8CFA8 !important; }
  .ps-aloud { font-size: 8pt !important; line-height: 1.3 !important; padding: 2pt 6pt !important; margin-bottom: 5pt !important; background: white !important; border: 0.75pt solid #B9CDE0 !important; border-radius: 4pt !important; }

  /* The four lists flow down two balanced columns, each list kept whole, in reading order (Ready,
     First things to teach, Keep practicing, Not checked). A 2 x 2 grid wastes the height of the
     shorter list in each row; balanced columns do not. Then "Starting guidance" and "How sure is
     this?" sit side by side. */
  .ps-lists { display: block !important; columns: 2; column-gap: 6pt; margin-bottom: 0 !important; }
  .ps-list {
    display: block !important;
    padding: 3pt 7pt !important;
    margin: 0 0 5pt !important;
    border-radius: 4pt !important;
    background: white !important;
    border: 0.75pt solid #E8DEC5 !important;
    border-left-width: 3pt !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .ps-list-ready { border-left-color: #4A7C2F !important; }
  .ps-list-teach { border-left-color: #C8860A !important; }
  .ps-list-keep { border-left-color: #3D6B8F !important; }
  .ps-list-not-checked { border-left-style: dashed !important; border-left-color: #7A6A55 !important; }
  .ps-list .ps-list-title { font-size: 8.5pt !important; margin-bottom: 0 !important; color: #1E3A0E !important; }
  .ps-list-hint { display: none !important; }
  .ps-list-not-checked .ps-list-hint { display: block !important; font-size: 6.5pt !important; margin-bottom: 1pt !important; line-height: 1.2 !important; }
  .ps-group + .ps-group { margin-top: 1pt !important; }
  .ps-group-title { font-size: 6pt !important; margin-bottom: 0 !important; line-height: 1.3 !important; }
  .ps-item { font-size: 8pt !important; line-height: 1.22 !important; padding: 0.5pt 0 0.5pt 8pt !important; }
  .ps-item::before { top: 0.5em !important; width: 3pt !important; height: 3pt !important; }
  .ps-tag { font-size: 6pt !important; padding: 0 3pt !important; margin-left: 3pt !important; }
  .ps-more { font-size: 7pt !important; line-height: 1.2 !important; color: #7A6A55 !important; font-style: italic; padding-left: 8pt !important; }
  .ps-credited,
  .ps-empty { font-size: 7pt !important; line-height: 1.2 !important; margin-top: 0 !important; }

  .ps-closing { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6pt; align-items: start; }
  .ps-guidance,
  .parent-stoplight {
    background: white !important;
    border: 0.75pt solid #E8DEC5 !important;
    border-left: 3pt solid #2D5016 !important;
    border-radius: 4pt !important;
    padding: 3pt 7pt !important;
    margin: 0 !important;
    break-inside: avoid;
  }
  .ps-guidance-list,
  .stoplight-reasons { padding-left: 0.9em !important; margin-bottom: 0 !important; }
  .ps-guidance h3,
  .stoplight-text h3 { font-size: 8.5pt !important; margin-bottom: 0 !important; }
  .ps-guidance-list li,
  .ps-recheck,
  .stoplight-text p,
  .stoplight-reasons li { font-size: 7.5pt !important; line-height: 1.25 !important; }
  .ps-guidance-list li + li { margin-top: 0 !important; }
  .ps-recheck { margin-top: 2pt !important; padding-top: 2pt !important; }
  .stoplight-icon { width: 11pt !important; height: 11pt !important; margin-top: 1pt !important; }
  .parent-stoplight { gap: 5pt !important; }
  .stoplight-advice { margin-top: 1pt !important; }
  .stoplight-note { font-size: 6.5pt !important; margin-top: 1pt !important; }

  .parent-signature { margin-top: 7pt !important; padding-top: 0 !important; gap: 14pt !important; break-inside: avoid; }
  .parent-signature .sig-line { height: 13pt !important; margin-bottom: 1pt !important; }
  .parent-signature .sig-label { font-size: 6pt !important; }
  .parent-footer { font-size: 6.5pt !important; line-height: 1.25 !important; margin-top: 3pt !important; }

  /* Educator Detail on paper: sections may break across pages where they are long (a skill
     table), and keep together where they are short. */
  .report-section.is-long { page-break-inside: auto !important; break-inside: auto !important; }
  .report-section h2 { font-size: 13pt !important; padding-bottom: 3pt !important; margin-bottom: 6pt !important; }
  .report-section h3 { font-size: 10.5pt !important; margin-top: 6pt !important; }
  .report-section p,
  .report-section li { font-size: 9pt !important; }
  .report-section-num { width: 18pt !important; height: 18pt !important; font-size: 9pt !important; }
  .ed-path .start-bar { max-width: 5.5in; margin: 3pt 0 7pt !important; }
  .ed-table-wrap { overflow: visible !important; }
  .ed-table { font-size: 8.5pt !important; }
  .ed-table th,
  .ed-table td { padding: 2pt 5pt !important; border-bottom: 0.5pt solid #B9C3BC !important; }
  .ed-table thead th { background: #DCEAD8 !important; color: black !important; font-size: 7.5pt !important; }
  .ed-table thead { display: table-header-group; }
  .ed-table tr { page-break-inside: avoid; break-inside: avoid; }
  .ed-kv { background: white !important; padding: 2pt 6pt !important; }
  .ed-kv dt,
  .ed-kv dd { padding: 2pt 0 !important; font-size: 8.5pt !important; }
  .report-educator-view .writing-review {
    box-shadow: none !important;
    border: 1pt solid #5A6E60 !important;
    padding: 8pt !important;
    margin-top: 10pt !important;
  }
  .wr-item { break-inside: avoid; background: white !important; }
  .wr-drawing { max-height: 160pt !important; }

  /* Atmosphere */
  .report-cover { border-bottom: 2pt double black !important; padding: 8pt 0 !important; margin-bottom: 10pt !important; }
}

/* Print-only mode toggle (the entire app rendered as print preview for paper) */
.print-mode {
  background: white !important;
  font-family: Georgia, 'Iowan Old Style', serif !important;
  color: black !important;
  padding: 0.5in !important;
  max-width: 8.5in !important;
  margin: 0 auto !important;
}
.print-mode .atmosphere,
.print-mode .header-controls,
.print-mode .proctor-banner,
.print-mode .progress-strip,
.print-mode button:not(.print-keep) {
  display: none !important;
}
.print-mode .stage {
  background: white !important;
  box-shadow: none !important;
  padding: 0 !important;
}
