/* ──────────────────────────────────────────────────────────────────────────
   Limpid · print stylesheet — A4 portrait clinic report.
   Targets the doctor.html page primarily; safe defaults for any page.

   Design choices:
     - High-contrast monochrome (medical handout — readable on cheap printers)
     - Tabular numerals everywhere; no glass / blur / aurora
     - Page breaks: panel cards stay intact (avoid mid-card splits)
     - Header (Limpid · clinic · patient) repeats on every page
     - Footer with QR-verify hint & signature on the LAST page only
   ────────────────────────────────────────────────────────────────────────── */

@page {
  size: A4 portrait;
  margin: 18mm 16mm 22mm 16mm;
}

@media print {
  /* Reset to monochrome, paper-friendly tokens */
  :root, :root[data-theme],
  :root[data-theme="slate"], :root[data-theme="rose"],
  :root[data-theme="forest"], :root[data-theme="indigo"] {
    --bg:           #ffffff;
    --bg-deep:      #ffffff;
    --bg-sheet:     #ffffff;
    --paper:        #ffffff;
    --ink:          #0a0a0a;
    --ink-2:        #2a2a2a;
    --ink-3:        #555555;
    --ink-4:        #888888;
    --accent:       #0a0a0a;
    --accent-2:     #0a0a0a;
    --accent-soft:  #f0f0f0;
    --accent-edge:  #cccccc;
    --live:         #b00020;
    --live-soft:    #fde7eb;
    --live-edge:    #b00020;
    --glass-bg:     #ffffff;
    --glass-bg-2:   #ffffff;
    --glass-edge:   #d0d0d0;
    --glass-edge-2: #aaaaaa;
    --aurora-1:     transparent;
    --aurora-2:     transparent;
    --aurora-3:     transparent;
    --ambient-1:    transparent;
    --ambient-2:    transparent;
    --sh-1:         none;
    --sh-2:         none;
    --sh-3:         none;
    --sh-glass:     none;
  }

  html, body {
    background: #ffffff !important;
    color: #0a0a0a !important;
    font-family: "Geist", "Inter", -apple-system, system-ui, sans-serif;
    font-size: 11pt;
    line-height: 1.45;
  }

  /* Strip ambient layers — they bleed into ink on most printers */
  .bg-layer, .bg-amb-1, .bg-amb-2, .bg-grain { display: none !important; }

  /* Hide controls / interactive surface — printed report is read-only */
  .tweaks, .doctor-banner, button, .icon-btn, .panel-action,
  .cta-row, .cta-pill, .cta-link, .panel .panel-action,
  .heatmap-legend, [role="button"] {
    display: none !important;
  }

  /* No backdrop blur in print — paper is opaque */
  .panel, .stat-tile, .ring-card, .pill {
    background: #ffffff !important;
    border: 1px solid #d0d0d0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Header — compact, single line, always visible at top of every page */
  header.app-header {
    padding: 0 0 6mm 0;
    border-bottom: 1.5pt solid #0a0a0a;
    margin-bottom: 6mm;
  }
  header.app-header .right { display: none; }

  /* Hero — paper-friendly: drop the orb illustration, keep numbers */
  .hero {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 0;
  }
  .orb-col, .orb-frame { display: none !important; }

  h1.hero-title .big {
    font-size: 28pt;
    font-weight: 300;
    letter-spacing: -0.02em;
  }
  h1.hero-title .of { font-size: 11pt; }
  .eyebrow { font-size: 9pt; }
  .hero-lede { font-size: 11pt; max-width: 100%; }

  /* Section titles tighter */
  h2 { font-size: 16pt; }
  .panel-title { font-size: 13pt; }
  .panel-eyebrow { font-size: 8pt; letter-spacing: 0.10em; }

  /* Two-column section row -> single column on print */
  .section-row, .stats-grid, .doctor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6mm;
  }

  /* Numerals tabular */
  .stat-big, .stat-sub, .act-time, .act-len,
  .meta-line strong, .ring-card .center .big {
    font-feature-settings: "tnum" 1;
  }

  /* Activity rows — readable as a printed table */
  .act-row {
    border-bottom: 0.5pt solid #cccccc;
    padding: 2mm 0;
  }
  .act-row:last-child { border-bottom: 0; }

  /* Photos — show placeholders sized for print */
  .photo-strip { grid-template-columns: repeat(4, 1fr); gap: 3mm; }
  .ph {
    border: 0.5pt solid #cccccc !important;
    background: #f8f8f8 !important;
    aspect-ratio: 3 / 4;
  }

  /* Heatmap stays — works in monochrome */
  .heatmap-day {
    border: 0.5pt solid #999999 !important;
  }
  .heatmap-day.met       { background: #1a1a1a !important; }
  .heatmap-day.soft-miss { background: #888888 !important; }
  .heatmap-day.miss      { background: #ffffff !important; border-color: #1a1a1a !important; }
  .heatmap-day.future    { background: #f0f0f0 !important; }

  /* Footer — appears at bottom of last page */
  .app-footer {
    margin-top: 8mm;
    padding-top: 4mm;
    border-top: 0.5pt solid #cccccc;
    font-size: 9pt;
    color: #555555;
  }

  /* Verification block — append manually via .print-verify if needed */
  .print-verify {
    margin-top: 8mm;
    padding: 4mm;
    border: 0.5pt dashed #888888;
    font-family: "Geist Mono", ui-monospace, monospace;
    font-size: 9pt;
    color: #2a2a2a;
    page-break-before: avoid;
    break-before: avoid;
  }
  .print-verify h4 { margin: 0 0 2mm; font-family: inherit; font-size: 10pt; }

  /* Avoid orphan rows in lists */
  ul, ol { orphans: 3; widows: 3; }
}
