/* =====================================================================
   STUDY DOCUMENTS (analyses, articles, chapter notes, solutions)
   Loaded after exam-booklet.css by private/templates/doc-booklet/page.php.
   Same A5 pages, bands and covers as the papers, with a roomier text page:
   bigger type, more line spacing and wider margins. Every rule is scoped
   to .eb-doc, so the papers are not affected.

   Blocks a document can use (top level of its content):
     h2 (.no for its number), h3, p, ul, ol
     .tbl-wrap > table        tables; td.hl highlights a cell, .c centres, .n right-aligns numbers
     .doc-box                 a note; its first <b> is the label
     .doc-cols                two columns side by side (kept on one page)
     .doc-lead                larger opening paragraph
     hr.eb-break              start a new page
   ===================================================================== */
.eb-doc {
  --doc-blue: var(--lam-blue); --doc-navy: var(--lam-navy);
  --doc-sky: var(--lam-sky); --doc-line: var(--lam-sky-line);
  --doc-hl: #fff3cf;
}
.eb-doc > .page:not(.cover) { font-size: 13.5px; line-height: 1.62; }
.eb-doc > .page:not(.cover) .page-main { padding: 7mm 12mm 4mm; }
.eb-doc .page-body { gap: 9px; }
.eb-doc .foot { display: none; }                  /* the band shows the page number */

/* before the script pages it (and without the script): one long sheet */
.eb-flow {
  width: var(--page-w); max-width: 100%; box-sizing: border-box;
  background: var(--paper); color: var(--ink);
  padding: 9mm 12mm; display: flex; flex-direction: column; gap: 9px;
  font-size: 13.5px; line-height: 1.62;
}

/* title block on the first page */
.eb-doc .doc-head { display: flex; flex-direction: column; gap: 5px; padding-bottom: 9px; margin-bottom: 4px; border-bottom: 2px solid var(--doc-blue); }
.eb-doc .doc-kicker { font: 700 9px/1.3 var(--f-brand); letter-spacing: .14em; text-transform: uppercase; color: var(--doc-blue); }
.eb-doc .doc-head h1 { margin: 0; font: 800 23px/1.15 var(--f-brand); letter-spacing: -.015em; color: var(--doc-navy); text-wrap: balance; }
.eb-doc .doc-sub { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* headings */
.eb-doc h2 { margin: 10px 0 0; font: 800 16px/1.3 var(--f-brand); color: var(--doc-navy); text-wrap: balance; }
.eb-doc h2 .no { color: var(--doc-blue); margin-right: 5px; }
.eb-doc h3 { margin: 4px 0 0; font: 700 13.5px/1.35 var(--f-brand); color: var(--ink); }
.eb-doc h2 + *, .eb-doc h3 + * { margin-top: -3px; }

/* text */
.eb-doc p { margin: 0; text-align: justify; hyphens: auto; }
/* the source line stays at the foot of every page, however short the page is */
.eb-doc .page-body > .eb-src { margin: auto 0 0; padding-top: 6px; text-align: center; hyphens: manual; }
.eb-doc .doc-lead { font-size: 14.5px; line-height: 1.6; color: var(--ink); }
.eb-doc ul, .eb-doc ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.eb-doc li { text-align: justify; padding-left: 2px; }
.eb-doc li::marker { color: var(--doc-blue); font-weight: 700; }
.eb-doc .muted { color: var(--muted); font-size: 12px; }

/* tables: light rules, wrapping cells, a tinted header */
.eb-doc .tbl-wrap { margin: 2px 0; border: 1px solid var(--doc-line); border-radius: 2mm; overflow: hidden; }
.eb-doc .tbl-wrap table { font-size: 12px; line-height: 1.42; min-width: 0; width: 100%; }
.eb-doc .tbl-wrap td, .eb-doc .tbl-wrap th { border: 0; border-bottom: 1px solid var(--doc-sky); padding: 5px 7px; white-space: normal; vertical-align: top; }
.eb-doc .tbl-wrap tr:last-child td { border-bottom: 0; }
.eb-doc .tbl-wrap th { background: var(--doc-sky); color: var(--doc-navy); font: 700 9px/1.3 var(--f-brand); letter-spacing: .08em; text-transform: uppercase; }
.eb-doc .tbl-wrap td.y { font: 800 11.5px/1.42 var(--f-brand); color: var(--doc-navy); white-space: nowrap; }
.eb-doc .tbl-wrap .c { text-align: center; }
.eb-doc .tbl-wrap .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.eb-doc .tbl-wrap td.hl { background: var(--doc-hl); }
.eb-doc .tick { color: var(--doc-blue); font-weight: 800; }

/* a note */
.eb-doc .doc-box { background: var(--doc-sky); border-left: 3px solid var(--doc-blue); border-radius: 0 2mm 2mm 0; padding: 7px 10px; font-size: 12.5px; line-height: 1.55; }
.eb-doc .doc-box > b:first-child { display: block; margin-bottom: 2px; font: 700 8.6px/1.3 var(--f-brand); letter-spacing: .1em; text-transform: uppercase; color: var(--doc-blue); }

/* two columns */
.eb-doc .doc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.eb-doc .doc-cols > div { min-width: 0; display: flex; flex-direction: column; gap: 5px; }

/* links under the booklet (screen only) */
.doc-related { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: var(--page-w); margin: 22px auto 0; font-family: var(--f-brand); }
.doc-related a { padding: 6px 12px; border-radius: 999px; background: var(--lam-blue); color: #fff; font-size: 12.5px; font-weight: 700; text-decoration: none; }
.doc-related a:nth-child(even) { background: #7c3aed; }
.doc-related a:hover, .doc-related a:focus-visible { background: var(--lam-navy); }
@media print { .doc-related { display: none !important; } }

/* ---------------------------------------------------------------------
   Question analyses (private/includes/doc-booklet/analysis.php)
   --------------------------------------------------------------------- */
/* a year's question, as printed on the paper */
.eb-doc .doc-year { margin-top: 2px; font-size: 14.5px; color: var(--doc-navy); }
.eb-doc .doc-paper { border: 1px solid var(--rule); border-radius: 1.5mm; padding: 9px 11px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.eb-doc .doc-paper .subs { gap: 7px; }
.eb-doc .doc-paper .sp > div { text-align: left; }

/* a solution */
.eb-doc .doc-sol {
  display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: baseline;
  margin: 0; padding: 7px 10px; background: var(--doc-sky); border-radius: 1.5mm;
  font: 400 13.5px/1.5 var(--f-body); color: var(--ink);
}
.eb-doc .doc-sol-no { font: 800 12px/1.5 var(--f-brand); color: var(--doc-blue); white-space: nowrap; }
.eb-doc .doc-stmt { font-style: italic; }
.eb-doc .doc-stmt b { font-style: normal; color: var(--doc-navy); }
.eb-doc .doc-steps { gap: 4px; }
.eb-doc .doc-steps li { text-align: left; }
.eb-doc .doc-steps .why { color: #4f7df0; font-size: 11.5px; font-style: normal; }
.eb-doc .doc-qed { display: block; text-align: right; font-weight: 700; color: var(--doc-navy); }

/* a figure, drawn from the measurements (geometry.php) */
.eb-doc .doc-fig { margin: 2px 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.eb-doc .doc-fig svg { max-width: 100%; height: auto; display: block; }
.eb-doc .doc-fig figcaption { font: 600 9px/1.3 var(--f-brand); color: var(--muted); letter-spacing: .02em; }
/* a long reference table kept on one page (the paper's format) */
.eb-doc .tbl-compact table { font-size: 10.5px; line-height: 1.25; }
.eb-doc .tbl-compact td, .eb-doc .tbl-compact th { padding: 2.5px 7px; }
.eb-doc .tbl-compact td.y { font-size: 10.5px; line-height: 1.25; }
/* figure beside "Given / To prove / Construction" in a proof */
.eb-doc .doc-beside { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.eb-doc .doc-beside > div { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.eb-doc .doc-beside .doc-fig { margin: 0; max-width: 46mm; }
.eb-doc .doc-check { font-size: 12.5px; }
