/* A document on paper: the on-screen preview (in a shadow root) and the print fallback. Always black on white, in
   both themes: the site's print palette (css/styles.css, @media print), so the site's figure styles draw in ink. */
:host, .ibd-print {
  --bg: #fff; --surface: #fff; --surface-2: #f4f4f4; --text: #000; --muted: #444; --border: #999;
  --primary: #000; --primary-soft: #e6e6e6; --coral: #000; --sky: #333; --mint: #333; --sun: #bbb;
  --diagram-fill: #e8e8e8; --gridline: rgba(0, 0, 0, .3); --chart-bar: #777; --fig-bg: #fff;
  --fig-c1: #4e79a7; --fig-c2: #f28e2b; --fig-c3: #59a14f; --fig-c4: #e15759; --fig-c5: #b07aa1;
  --font: 'Nunito', ui-rounded, system-ui, sans-serif;
  --paper-font: 'STIX Two Text', 'Times New Roman', Times, serif;
  display: block; color-scheme: light;
}
.ibd-print { margin: 0; background: #fff; color: #000; display: block; min-height: 0; }
.ibd-wrap { padding: 0; }
.ibd {
  font-family: var(--paper-font); font-size: 11.5pt; line-height: 1.45; color: #000; background: #fff;
  width: 100%; max-width: 210mm; margin: 0 auto; padding: 16mm 15mm 18mm; box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25), 0 6px 24px rgba(0, 0, 0, .12);
}
.ibd.letter { max-width: 216mm; }
.ibd * { box-sizing: border-box; }
.ibd p { margin: 0 0 .55em; }
.ibd h1 { font-size: 17pt; margin: 0 0 .15em; font-weight: 700; letter-spacing: 0; line-height: 1.2; }
.ibd h2 { font-size: 12pt; margin: 0 0 .4em; font-weight: 700; }
.ibd-head { border-bottom: 1.5px solid #000; padding-bottom: 4mm; margin-bottom: 6mm; }
.ibd-kind { text-transform: uppercase; letter-spacing: .08em; font-size: 9pt; margin: 0 0 1mm; }
.ibd-course { font-style: italic; margin: 0 0 2mm; }
.ibd-facts { display: flex; flex-wrap: wrap; gap: 2mm 8mm; margin: 0 0 3mm; }
.ibd-facts div { display: flex; gap: 2mm; }
.ibd-facts dt { font-weight: 700; }
.ibd-facts dd { margin: 0; }
.ibd-cand { display: flex; gap: 4mm; margin: 3mm 0; flex-wrap: wrap; }
.ibd-cand div { flex: 3 1 60mm; border: 1px solid #000; padding: 1.5mm 2mm 7mm; font-size: 9pt; }
.ibd-cand div.sm { flex: 1 1 35mm; }
.ibd-instr ul { margin: 0; padding-left: 5mm; }
.ibd-instr li { margin: 0 0 .2em; }
.ibd-sh { font-size: 13pt; border-bottom: 1px solid #000; padding-bottom: 1mm; margin-top: 4mm; }
.ibd-intro { font-style: italic; }
.ibd-item { display: grid; grid-template-columns: 9mm 1fr; gap: 0 2mm; margin: 0 0 6mm; break-inside: avoid-page; }
.ibd-n { font-weight: 700; }
.ibd-part { display: grid; grid-template-columns: 1fr auto; gap: 0 4mm; align-items: end; margin: 0 0 2.5mm; }
.ibd-part.lab { grid-template-columns: 8mm 1fr auto; }
.ibd-label { align-self: start; }
.ibd-blocks { min-width: 0; }
.ibd-blocks > :last-child { margin-bottom: 0; }
.ibd-pm, .ibd-total { font-weight: 700; white-space: nowrap; text-align: right; }
.ibd-total { margin-top: 1mm; }
.ibd-math { margin: .3em 0 .7em; overflow-x: auto; overflow-y: hidden; }
.ibd .katex { font-size: 1.08em; }
.ibd-fig { margin: 2mm 0 3mm; max-width: 100%; }
.ibd-fig svg.diagram { max-width: 100%; width: 100%; margin: 0; color: #000; }
.ibd-table { border-collapse: collapse; margin: 1mm 0 3mm; font-size: 10.5pt; }
.ibd-table td, .ibd-table th { border: 1px solid #000; padding: 1mm 2.5mm; text-align: center; }
.ibd-table th { font-weight: 700; background: #f0f0f0; }
.ibd-lines { margin: 2mm 0 1mm; }
.ibd-lines i { display: block; height: 8mm; border-bottom: 1px dotted #555; }
.ibd-space { border: 1px dashed #bbb; margin: 2mm 0; }
.ibd-mark { display: grid; grid-template-columns: 11mm 1fr; gap: 2mm; margin: 0 0 1.2mm; }
.ibd-code { font-weight: 700; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 10pt; }
.ibd-note { font-size: 10pt; font-style: italic; border-left: 2px solid #000; padding-left: 2.5mm; }
.ibd-steps { margin: 1mm 0 2mm; padding-left: 6mm; }
.ibd-steps li { margin: 0 0 1mm; }
.ibd-break { break-after: page; }
.ibd-bad { color: #b00; }
.ibd-markscheme .ibd-part { align-items: start; }
@media (max-width: 640px) {
  .ibd { padding: 7mm 5mm 9mm; font-size: 11pt; }
}
@media print {
  @page { size: auto; margin: 14mm 13mm 16mm; }
  .ibd { box-shadow: none; padding: 0; max-width: none; }
}
