/* Chemistry references only. Preserve every section and existing anchors. */
@media screen and (min-width: 701px) {
  #tr-sheet.tr-chapter .tr-grid { grid-template-columns: minmax(0, 1fr); }
  #tr-sheet.tr-chapter .tr-card { padding: 28px 32px; scroll-margin-top: 100px; }
  #tr-sheet.tr-chapter .tr-card p, #tr-sheet.tr-chapter .tr-card li { font-size: 16px; line-height: 1.75; }
  #tr-sheet.tr-chapter .tr-card > ul { max-width: 90ch; }
  #tr-sheet.tr-chapter .tr-card h3 { font-size: 24px; }
  #tr-sheet.tr-chapter .tr-card h4 { font-size: 18px; line-height: 1.5; margin: 28px 0 14px; color: #49357c; }
  #tr-sheet.tr-chapter .cc-reference table, #tr-sheet.tr-chapter .tr-compare { font-size: 15px; line-height: 1.6; }
  #tr-sheet.tr-chapter .cc-reference th, #tr-sheet.tr-chapter .cc-reference td { padding: 12px; }
  #tr-sheet.tr-chapter .cc-reference svg { max-width: 680px; margin: 20px auto; }
  #tr-sheet.tr-chapter .cc-reference + .cc-reference { border-top: 1px solid #e2e8f0; margin-top: 28px; padding-top: 8px; }
}
@media print {
  #tr-sheet.tr-chapter .tr-grid { display: block; columns: auto; }
  #tr-sheet.tr-chapter .tr-card { display: block; break-inside: auto; }
  #tr-sheet.tr-chapter h3, #tr-sheet.tr-chapter h4, #tr-sheet.tr-chapter caption { break-after: avoid; }
  #tr-sheet.tr-chapter tr, #tr-sheet.tr-chapter svg { break-inside: avoid; }
  #tr-sheet.tr-chapter thead { display: table-header-group; }
}

/* Match the interactive lessons: calm sans-serif headings and readable formulae. */
#tr-sheet.tr-chapter h2, #tr-sheet.tr-chapter h3, #tr-sheet.tr-chapter h4,
#tr-sheet.tr-chapter .tr-expression { font-family: 'DM Sans', system-ui, sans-serif !important; font-weight: 600; }
#tr-sheet.tr-chapter h2 { font-size: 28px; }
#tr-sheet.tr-chapter .tr-section-title { font-size: 22px; line-height: 1.4; }
#tr-sheet.tr-chapter .tr-expression { font-size: 20px !important; line-height: 1.6; }
#tr-sheet.tr-chapter .tr-key-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
#tr-sheet.tr-chapter .tr-scope, #tr-sheet.tr-chapter .tr-kicker { font-family: 'DM Sans', system-ui, sans-serif; }
@media print { #tr-sheet.tr-chapter .tr-expression { font-size: 12pt !important; } }

/* Formula summaries use the same white and purple language as worked sections. */
#tr-sheet.tr-chapter .tr-key-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 24px; }
#tr-sheet.tr-chapter .tr-key-card .tr-expression { background: #f2effa; border-radius: 8px; color: #49357c !important; }
#tr-sheet.tr-chapter .tr-key-label { font-size: 16px; }
#tr-sheet.tr-chapter .tr-symbols, #tr-sheet.tr-chapter .tr-use { font-size: 15px; line-height: 1.7; }

/* A4 output: keep section labels with their first representation. */
@media print {
  #tr-sheet.tr-chapter .tr-key-grid { columns: 1; }
  #tr-sheet.tr-chapter .tr-key-card { display: block; padding: 12pt; margin-bottom: 10pt; }
  #tr-sheet.tr-chapter .tr-key-label { font-size: 11pt; margin-bottom: 6pt; }
  #tr-sheet.tr-chapter .tr-symbols, #tr-sheet.tr-chapter .tr-use { font-size: 10pt; line-height: 1.55; margin: 6pt 0; }
  #tr-sheet.tr-chapter .tr-card > .tr-scope { display: block; width: fit-content; break-after: avoid; }
  #tr-sheet.tr-chapter .tr-card > h3 { break-after: avoid; }
  #tr-sheet.tr-chapter .tr-recall { break-after: avoid; }
  #tr-sheet.tr-chapter footer { break-before: avoid; }
}
