/* Chăm Chỉ · print layer (WeasyPrint). Built on tokens.css; load both: tokens.css, then print.css.
   Rules: guide/print.md in this folder (the source; the Design System artifact is synced from it).
   Two modes from one sheet: black and white is the default (the centre prints mostly B&W);
   add class "print-colour" on <html> for the colour version. Never write colours in a page: use these classes.
   Frozen Recipe Edition (gs-print-v2-candidate) is not edited: builders load this file as a layer beside it, as booster_print/render.py does. */

@page { size: A4; margin: 12mm 12mm 12mm 14mm; }
@page :left { margin: 12mm 14mm 12mm 12mm; }
@page a5 { size: A5; margin: 10mm; }

:root {
  /* print values: millimetres and points */
  --p-line: 0.75pt;           /* one rule weight for lines, boxes and answer lines */
  --p-hair: 0.5pt;            /* table rules */
  --p-radius: 1.5mm;          /* the print form of the 12px corner */
  --p-gap: 4mm;
  --p-body: 10pt;
  --p-small: 7pt;
  --p-h1: 24pt;               /* Fraunces, the page or sheet title */
  --p-h2: 18pt;               /* Fraunces, a section title (headings below 18pt use Be Vietnam Pro bold) */
  --p-answer-writing: 8mm;
  --p-answer-kids: 11mm;
  --p-qr: 22mm;
  /* black and white (default): every colour becomes ink, grey or paper */
  --p-ink: #111111;
  --p-muted: #5a5a5a;
  --p-rule: #c8c8c8;
  --p-field: #f1f1f1;         /* the grey of wash */
  --p-accent: #d4d4d4;        /* honey prints as a 20% grey field under bold ink */
  --p-heart: #111111;         /* the heart prints as ink (the mono mark) */
  --p-ground: #ffffff;
}
html.print-colour {
  --p-ink: var(--ink);
  --p-muted: var(--muted);
  --p-rule: var(--line);
  --p-field: var(--wash);
  --p-accent: var(--honey);
  --p-heart: var(--heart);
  --p-ground: var(--paper);
}

body.p-page { font-family: var(--font-sans); font-size: var(--p-body); line-height: 1.5; color: var(--p-ink); background: var(--p-ground); }
.p-h1 { font-family: var(--font-display); font-variation-settings: 'SOFT' 100, 'WONK' 0; font-weight: 700; font-size: var(--p-h1); line-height: 1.15; margin: 0 0 2mm; }
.p-h2 { font-family: var(--font-display); font-variation-settings: 'SOFT' 100, 'WONK' 0; font-weight: 700; font-size: var(--p-h2); line-height: 1.2; margin: 5mm 0 2mm; }
.p-h3 { font-family: var(--font-sans); font-weight: 700; font-size: 12pt; margin: 4mm 0 1.5mm; }
.p-en { font-family: var(--font-display); font-style: italic; font-weight: 400; color: var(--p-muted); font-variation-settings: 'SOFT' 100, 'WONK' 0; }
.p-muted { color: var(--p-muted); }

/* Print header: the logo as a 22mm icon square on the left (owner 11/11), name, then class · date · ID on one line; one QR size on the right.
   The logo holds two images: .p-header__logo-bw (chamchi-mark-mono.svg, on the 20 % grey of honey) and .p-header__logo-c (chamchi-icon.svg, shown in colour). */
.p-header { display: flex; align-items: flex-start; gap: var(--p-gap); padding-bottom: 3mm; border-bottom: var(--p-line) solid var(--p-ink); margin-bottom: 5mm; }
.p-header__logo { flex: none; width: var(--p-qr); height: var(--p-qr); border-radius: var(--p-radius); background: var(--p-accent); overflow: hidden; }
.p-header__logo img { display: block; box-sizing: border-box; width: var(--p-qr); height: var(--p-qr); }
.p-header__logo-bw { padding: 3.2mm; }
.p-header__logo-c { display: none; }
html.print-colour .p-header__logo-c { display: block; }
html.print-colour .p-header__logo-bw { display: none; }
.p-header__who { flex: 1; }
.p-header__name { font-weight: 700; font-size: 16pt; line-height: 1.2; }
.p-header__meta { font-size: 9pt; color: var(--p-muted); }
.p-header__qr { width: var(--p-qr); height: var(--p-qr); flex: none; }

/* Answer line: one weight, two heights */
.p-answer { border-bottom: var(--p-line) solid var(--p-ink); height: var(--p-answer-writing); }
.p-answer--kids { height: var(--p-answer-kids); }

/* Tick box and letter box */
.p-tick { display: inline-block; width: 6mm; height: 6mm; border: var(--p-line) solid var(--p-ink); border-radius: var(--p-radius); vertical-align: middle; }
.p-letter { display: inline-block; width: 8mm; height: 9mm; border: var(--p-line) solid var(--p-ink); border-radius: var(--p-radius); }

/* Table: header row on the field grey, hair rules, numbers right */
.p-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.p-table th { background: var(--p-field); text-align: left; font-weight: 700; padding: 1.8mm 2.5mm; border-bottom: var(--p-hair) solid var(--p-rule); }
.p-table td { padding: 1.8mm 2.5mm; border-bottom: var(--p-hair) solid var(--p-rule); }
.p-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Score: the number, a word and a sign. No colour, in either mode */
.p-score { display: inline-flex; align-items: baseline; gap: 2mm; }
.p-score__n { font-weight: 800; font-size: 14pt; font-variant-numeric: tabular-nums; }
.p-score__word { font-weight: 700; }

/* Highlight: the one accent field (honey in colour, 20% grey in B&W), text always ink */
.p-hl { background: var(--p-accent); color: var(--p-ink); border-radius: 0.8mm; padding: 0 0.8mm; }
.p-field { background: var(--p-field); border-radius: var(--p-radius); padding: 3mm 4mm; }

/* Footer: mono mark, sheet code, OmniScan line, 7pt muted */
.p-footer { display: flex; align-items: center; gap: 3mm; margin-top: 6mm; padding-top: 2mm; border-top: var(--p-hair) solid var(--p-rule); font-size: var(--p-small); color: var(--p-muted); }
.p-footer__mark { width: 4mm; height: 4mm; }
.p-footer__code { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.p-footer__scan { margin-left: auto; }
