/* ============================================================================
   Print — clean black-on-white study handouts.
   ========================================================================== */

@media print {
  :root {
    color-scheme: light;
    --md-sys-color-surface: #ffffff;
    --md-sys-color-on-surface: #000000;
    --md-sys-color-on-surface-variant: #333333;
    --md-sys-color-surface-container-lowest: #ffffff;
    --md-sys-color-surface-container-low: #ffffff;
    --md-sys-color-surface-container: #ffffff;
    --md-sys-color-surface-container-high: #f2f2f2;
    --md-sys-color-surface-container-highest: #eaeaea;
    --md-sys-color-outline: #999999;
    --md-sys-color-outline-variant: #cccccc;
    --md-sys-color-primary: #000000;
    --md-sys-color-primary-container: #ffffff;
    --md-sys-color-on-primary-container: #000000;
    --md-sys-color-secondary-container: #f2f2f2;
    --md-sys-color-on-secondary-container: #000000;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
    line-height: 1.5;
  }

  /* hide application chrome */
  .sidebar,
  .bottom-nav,
  .topbar,
  .reading-progress-bar,
  .scrim,
  .calc-drawer,
  .cmd-backdrop,
  .toast,
  .chart-lightbox,
  .skip-link,
  .no-print,
  #chartLightbox {
    display: none !important;
  }

  .shell,
  .main-column,
  #app {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  #app.view-enter > * { animation: none !important; }

  a { color: #000000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; }

  h1, h2, h3, h4 { color: #000 !important; page-break-after: avoid; }
  h1 { font-size: 20pt; }
  h2 { font-size: 15pt; }
  h3 { font-size: 12.5pt; }

  .card,
  .method,
  .notice,
  .callout,
  .summary-box,
  .memory-box,
  .warning-box,
  .example,
  .formula,
  .formula-item,
  .answer,
  .t-account-card,
  .hero-theory-card,
  .hero-task-card {
    background: #ffffff !important;
    border: 1px solid #bbbbbb !important;
    box-shadow: none !important;
    color: #000 !important;
  }

  .badge, .chip, .pill, .streak-badge, .btn {
    border: 1px solid #999 !important;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
  }

  .bar { background: #dddddd !important; }
  .bar > span { background: #444444 !important; }

  table { border-collapse: collapse; }
  th, td { border: 1px solid #bbbbbb !important; background: #fff !important; color: #000 !important; }
  th { background: #f0f0f0 !important; }

  img { max-width: 100% !important; page-break-inside: avoid; }

  /* Expand every collapsible detail so the handout is complete */
  details { display: block !important; }
  details > summary { list-style: none; font-weight: 600; }
  details > *:not(summary) { display: block !important; }
  details[open] > summary ~ * { display: block !important; }

  /* Keep logical blocks together */
  .card,
  .method,
  .notice,
  .formula-item,
  .table-wrap,
  .chart-card,
  .t-account-card,
  .plan-day,
  .method-grid,
  .quiz-card {
    page-break-inside: avoid;
  }

  .page-break { page-break-before: always; }

  /* Tidy links inside content: don't print URLs for in-app anchors */
  a[href^="#"]::after { content: ""; }

  /* Formulas and math bigger enough to read on paper */
  .math, .katex { color: #000 !important; }
  .formula-eq .katex { font-size: 1.15em; }

  @page {
    margin: 16mm 14mm;
  }
}
