/* OOP Trainer – exam sheet (mock exam document). Used on screen (paper preview), in print
 * (together with print.css) and inlined into the downloaded .html file.
 * Tokens come from :root in styles.css (the download inlines that block too; the self-hosted
 * font is not inlined there; the sheet uses an Arial stack anyway, only code falls back).
 * The sheet is always black on white: it is paper, in light and dark mode alike.
 */
.exam-preview {
  overflow-x: auto; background: var(--color-surface-2); padding: var(--space-5) var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-5);
}
.exam-preview[data-show="exam"] .exam-sheet[data-kind="solutions"],
.exam-preview[data-show="solutions"] .exam-sheet[data-kind="exam"] { display: none; }

.exam-sheet {
  --sheet-pad: 16mm;
  --sheet-rule: #222;
  --sheet-muted: #4a4a4a;
  background: var(--color-paper, #fff);
  color: var(--color-paper-text, #111);
  font: 10.5pt/1.45 var(--font-sheet, Arial, "Helvetica Neue", Helvetica, sans-serif);
  width: 100%; max-width: 210mm; margin: 0 auto; padding: var(--sheet-pad);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 2px 6px var(--color-shadow, rgba(0, 0, 0, .15));
  color-scheme: light;
}
:root[data-layout-effective="phone"] .exam-sheet { --sheet-pad: 6mm; font-size: 10pt; }
body.exam-standalone { background: #e4eaeb; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
body.exam-standalone .exam-sheet { margin: 0 auto; }

.exam-sheet h1, .exam-sheet h2, .exam-sheet h3 { color: inherit; }

.exam-sheet .rich p { margin: 0 0 .5em; }
.exam-sheet .rich code { background: #f1f1f1; box-shadow: inset 0 0 0 1px #d4d4d4; border-radius: 2px; padding: 0 3px; font-size: .92em; color: #111; }
.exam-sheet pre.code {
  background: #fafafa; color: #111; border: 1px solid #9a9a9a; border-radius: 2px;
  font-family: var(--font-mono, "Courier New", monospace);
  font-size: 9.5pt; line-height: 1.45; padding: 0; margin: 2mm 0 4mm;
  white-space: pre; overflow-x: auto;
}
.exam-sheet .code--numbered code::before, .exam-sheet .code--numbered code::after { height: 2mm; background: #efefef; box-shadow: 1px 0 #c8c8c8; }
.exam-sheet .code--numbered .code__line::before { color: #555; background: #efefef; box-shadow: 1px 0 #c8c8c8; }
.exam-sheet pre.code:not(.code--numbered) { padding: 2mm 3mm; }

/* Cover */
.exam-cover__kicker { margin: 0; font-size: 9.5pt; color: var(--sheet-muted); }
.exam-cover__title { font-size: 19pt; line-height: 1.2; margin: 1mm 0 5mm; padding-bottom: 3mm; border-bottom: 1.5pt solid var(--sheet-rule); }
.exam-cover__meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .5mm 6mm; margin: 0 0 6mm; }
.exam-cover__meta dt { font-weight: 700; }
.exam-cover__meta dd { margin: 0; }
.exam-cover__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 70mm), 1fr)); gap: 3mm 8mm; margin: 0 0 6mm; }
.exam-cover__field { display: flex; align-items: flex-end; gap: 3mm; }
.exam-cover__label { font-weight: 700; white-space: nowrap; }
.exam-cover__blank { flex: 1; border-bottom: 1px solid var(--sheet-rule); min-height: 8mm; }
.exam-cover__instructions h2 { font-size: 11.5pt; margin: 0 0 2mm; }
.exam-cover__instructions ul { margin: 0 0 6mm; padding-left: 1.1em; }
.exam-cover__instructions li { margin-bottom: .4mm; }
.exam-points { border-collapse: collapse; width: 100%; margin-top: 3mm; font-variant-numeric: tabular-nums; }
.exam-points th, .exam-points td { border: 1px solid var(--sheet-rule); padding: 1.2mm 2.5mm; text-align: left; vertical-align: top; }
.exam-points th { background: #ececec; font-weight: 700; }
.exam-points .num { text-align: right; width: 18mm; }
.exam-points__blank { width: 26mm; }
.exam-points tfoot td { font-weight: 700; border-top-width: 2px; }

/* Tasks */
.exam-task { margin-top: 10mm; padding-top: 6mm; border-top: 1px dashed #b5b5b5; }
.exam-runhead { display: flex; justify-content: space-between; gap: 12px; font-size: 8.5pt; color: var(--sheet-muted); border-bottom: .75pt solid #999; padding-bottom: 1.5mm; margin-bottom: 7mm; }
.exam-runhead__name { min-width: 60mm; }
.exam-task__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4mm; }
.exam-task__title { font-size: 13pt; margin: 0; }
.exam-task__points { font-weight: 700; white-space: nowrap; border: 1.25pt solid var(--sheet-rule); padding: .8mm 3mm; border-radius: 1.5mm; font-variant-numeric: tabular-nums; }
.exam-task__failed { color: #8a0000; font-style: italic; }
.exam-part { margin: 0 0 7mm; }
.exam-part__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2.5mm; align-items: baseline; }
.exam-part__label { font-weight: 700; }
.exam-part__text { min-width: 0; }
.exam-part__points { font-size: 9pt; color: var(--sheet-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Answer space: ruled lines for prose, a squared box for code and output (like the 5 mm paper) */
.answer-space { margin-top: 3mm; }
.answer-space__line { height: 8mm; border-bottom: .75pt solid var(--color-paper-line, #b9bec8); }
.answer-space--code, .answer-space--output {
  border: 1px solid #555; border-radius: 1mm; padding: 0;
  background-image: linear-gradient(#dcdcdc .5pt, transparent .5pt), linear-gradient(90deg, #dcdcdc .5pt, transparent .5pt);
  background-size: 5mm 5mm; background-position: -.5pt -.5pt;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.answer-space--code .answer-space__line, .answer-space--output .answer-space__line { height: 7mm; border-bottom: 0; }
.answer-table { border-collapse: collapse; width: 100%; margin-top: 3mm; }
.answer-table th, .answer-table td { border: 1px solid #555; padding: 1mm 2mm; font-size: 9.5pt; text-align: left; }
.answer-table th { background: #f0f0f0; }
.answer-table td { height: 8mm; }

/* Solutions */
.exam-solutions__head { margin-bottom: 6mm; }
.exam-task--solution { margin-top: 6mm; }
.exam-notes { border-left: 2pt solid #888; padding-left: 3mm; margin-top: 4mm; }
.exam-notes h3 { font-size: 10pt; margin: 0 0 1mm; }
