/* =====================================================================
   EXAM BOOKLET — shared styles for every previous-year paper
   (pyq/<board>/<exam>/<subject>/<year>/index.html).
   Paper-specific data lives in each page's EB_PAPER block; brand data
   in assests/js/exam-booklet-config.js. Nothing here is paper-specific.
   Every page is a fixed A5 sheet; narrow screens zoom the whole booklet.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. DESIGN TOKENS
   Paper stays white in both themes (it is a printed sheet); the desk
   around the pages and the toolbar follow the viewer's theme.
   --------------------------------------------------------------------- */
:root {
  /* desk + toolbar */
  --desk: #000;
  --desk-ink: #a8adb5;
  --bar-bg: #f4f5f7;
  --bar-ink: #1d2128;
  --bar-line: #b9bdc4;
  --focus: #1f5fbf;
  /* paper */
  --paper: #fdfdfb;
  --ink: #141414;
  --rule: #2a2a2a;
  --muted: #555;
  --shadow: rgba(20, 24, 32, .28);
  /* type */
  --f-body: "Tinos", "Times New Roman", Times, serif;
  /* page (A5 = 148 × 210 mm) */
  --page-w: 148mm;
  --page-h: 210mm;
  --band-head-h: 20mm;            /* header band */
  --band-foot-h: 15mm;            /* footer band */
  /* The Laminars brand (overwritten at runtime from EB_CONFIG.theme) */
  --lam-blue: #2456e6;
  --lam-navy: #0d2a66;
  --lam-sky: #e8efff;
  --lam-sky-line: #c3d4fb;
  --lam-white: #ffffff;
  --f-brand: "Plus Jakarta Sans", "Noto Sans Bengali", "Noto Sans Devanagari", "Segoe UI", Arial, sans-serif;
  --f-script: "Caveat Brush", "Comic Sans MS", cursive;
  --f-deva: "Noto Sans Devanagari", "Nirmala UI", "Mangal", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #000; --desk-ink: #a8adb5;
    --bar-bg: #24272d; --bar-ink: #e6e8eb; --bar-line: #3a3e46; --focus: #7fb0ff;
    --shadow: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #000; --desk-ink: #a8adb5;
  --bar-bg: #24272d; --bar-ink: #e6e8eb; --bar-line: #3a3e46; --focus: #7fb0ff;
  --shadow: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------------------------------------------------------------------
   2. BASE
   --------------------------------------------------------------------- */
html, body { margin: 0; }
/* visually hidden, for search engines and screen readers (page <h1>) */
.eb-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
body {
  background: var(--desk);
  color: var(--ink);
  font-family: var(--f-body);
}
.deva { font-family: var(--f-deva); }
/* Bengali / Hindi booklets: Tinos keeps Latin letters and digits, the
   Noto serif supplies the script. Covers and bands keep --f-brand. */
.eb-booklet[lang="bn"] { font-family: "Tinos", "Noto Serif Bengali", "Times New Roman", serif; }
.eb-booklet[lang="hi"] { font-family: "Tinos", "Noto Serif Devanagari", "Times New Roman", serif; }
.eb-booklet[lang="ur"] { font-family: "Tinos", "Noto Naskh Arabic", "Times New Roman", serif; }
.eb-booklet[dir="rtl"] .opts { margin: 6px 6px 2px 0; }
/* English branding (bands, page footer, source line) stays left-to-right in an RTL paper */
.eb-booklet[dir="rtl"] .band, .eb-booklet[dir="rtl"] .foot, .eb-booklet[dir="rtl"] .eb-src { direction: ltr; }

/* ---------------------------------------------------------------------
   3. TOOLBAR (above page 1), markup in private/includes/exam-booklet/head.php
   home · ‹ previous year · next year › ·········· language · print
   --------------------------------------------------------------------- */
.eb-controls-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
.eb-controls {
  width: 100%; max-width: max(var(--page-w), calc(var(--page-w) * var(--eb-scale, 1)));
  display: flex; flex-direction: column; gap: 8px;
  font-family: var(--f-brand);
}
.eb-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.eb-row-end { display: flex; align-items: center; gap: 6px; margin-left: auto; position: relative; }
.eb-select {
  font: 600 13px/1.2 var(--f-brand);
  color: var(--bar-ink); background: var(--bar-bg);
  border: 1px solid var(--bar-line); border-radius: 4px;
  padding: 4px 8px; height: 36px; min-width: 0; cursor: pointer;
}
.eb-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; padding: 0;
  color: var(--bar-ink); background: var(--bar-bg);
  border: 1px solid var(--bar-line); border-radius: 4px; cursor: pointer;
}
.eb-btn svg { width: 18px; height: 18px; }
a.eb-btn:hover, button.eb-btn:hover, .eb-select:hover { border-color: var(--bar-ink); }
.eb-btn[aria-disabled="true"] { opacity: .35; cursor: default; }
.eb-step { width: auto; gap: 4px; padding: 0 10px; font: 700 13px/1 var(--f-brand); text-decoration: none; font-variant-numeric: tabular-nums; white-space: nowrap; }   /* "2026 Sem 4" on one line */
.eb-step svg { width: 16px; height: 16px; }
.eb-select:focus-visible, .eb-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.eb-msg { margin: 0; font: 600 12.5px/1.4 var(--f-brand); color: var(--bar-ink); }

/* Printing goes through the print button (daily limit). Any other print
   (browser menu) shows only this note instead of the paper. */
.eb-print-note { display: none; }

/* ---------------------------------------------------------------------
   4. DESK, BOOKLET AND PAGE
   --------------------------------------------------------------------- */
.eb-desk {
  padding-block: 16px 48px;
  padding-left: max(6px, env(safe-area-inset-left, 0px));
  padding-right: max(6px, env(safe-area-inset-right, 0px));
}
/* --eb-scale is set by the script so the fixed A5 pages fit narrow
   screens (1 = actual size). The pages themselves never change size. */
.eb-booklet {
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  zoom: var(--eb-scale, 1);
}
/* Opening: the pages stay hidden until covers, bands and maths are built (no blank white sheets),
   then the cover rises in from below. html.eb-js is set at the top of <head>, html.eb-ready by the
   script; without the script nothing is hidden. */
html.eb-js:not(.eb-ready) .eb-booklet, html.eb-js:not(.eb-ready) .eb-missing { visibility: hidden; }
html.eb-js:not(.eb-ready) .eb-desk::before {
  content: ""; position: fixed; left: 50%; top: 45vh; width: 34px; height: 34px; margin-left: -17px;
  border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: #7fa6ff; animation: eb-spin .8s linear infinite;
}
@keyframes eb-spin { to { transform: rotate(360deg); } }
/* only the first page (the cover) rises in from below, overshoots a little and settles;
   the other pages simply appear */
html.eb-ready .eb-booklet > .page:first-of-type { z-index: 1; animation: eb-rise 1s ease-in-out both; }
@keyframes eb-rise {
  0%   { transform: translateY(100%); }
  75%  { transform: translateY(-20px); }
  100% { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  html.eb-ready .eb-booklet > .page:first-of-type { animation: eb-fade-in .3s ease both; }
  @keyframes eb-fade-in { from { opacity: 0; } }
}
html.eb-capturing .eb-booklet > .page { animation: none !important; transform: none !important; clip-path: none !important; }   /* PDF copy: no half-open page */
/* only the chosen language is shown (display:flex above would override [hidden]) */
.eb-booklet[hidden] { display: none; }
/* Layout of every page:  [band-head] [.page-main] [band-foot]
   The script wraps existing content into .page-main and adds the bands. */
.page {
  width: var(--page-w); height: var(--page-h); flex-shrink: 0;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 1px 2px var(--shadow), 0 10px 28px var(--shadow);
  display: flex; flex-direction: column;
  font-size: 13px; line-height: 1.5;
  position: relative; overflow: hidden;
}
.page-main {
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  padding: 4mm 10mm 2.5mm;
  display: flex; flex-direction: column;
}
.page-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* Overflow warning (screen only): set by the script when a page's
   content does not fit. Fix by moving the last block to the next page. */
@media screen {
  .page.eb-overflow { outline: 3px dashed #d4380d; outline-offset: 4px; }
  .page.eb-overflow::after {
    content: "Content overflows this page: move the last block to the next page";
    position: absolute; left: 0; right: 0; bottom: var(--band-foot-h);
    background: #d4380d; color: #fff; font: 700 10px/1.4 var(--f-brand);
    padding: 1mm 3mm; text-align: center;
  }
}

/* ---------------------------------------------------------------------
   4b. HEADER + FOOTER BANDS (on every page, built by the script)
   --------------------------------------------------------------------- */
.band {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 6mm;
  padding: 0 9mm; color: var(--lam-white);
  font-family: var(--f-brand);
}
.band-head { height: var(--band-head-h); background: linear-gradient(90deg, var(--lam-blue), var(--lam-navy)); }
.band-foot {
  height: var(--band-foot-h); background: var(--lam-navy);
  flex-direction: column; justify-content: center; align-items: stretch; gap: 1.2mm;
}
.band-brand { display: flex; align-items: center; gap: 3mm; color: inherit; text-decoration: none; }
.band-logo { width: 9mm; height: 9mm; flex: none; }
.band-brand-text { display: flex; flex-direction: column; gap: .4mm; }
.band-brand-text b { font-weight: 800; font-size: 15px; line-height: 1.1; letter-spacing: -.005em; }
.band-brand-text small { font-size: 8px; font-weight: 500; opacity: .85; }
.band-title { display: flex; flex-direction: column; align-items: flex-end; gap: .6mm; text-align: right; }
.band-title small { font-size: 7.6px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.band-title b { font-size: 13px; font-weight: 800; line-height: 1.1; }
.band-row { display: flex; justify-content: space-between; align-items: baseline; gap: 4mm; }
.band-note { font-size: 7.8px; line-height: 1.3; opacity: .95; }
.band-copy { font-size: 7px; line-height: 1.3; opacity: .72; }
.band-pg { font-size: 8px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.band a { color: inherit; font-weight: 700; text-decoration: none; }

/* ---------------------------------------------------------------------
   4c. COVER PAGES (front + back, built by the script from config)
   One idea per cover: title, illustration, one call to action.
   --------------------------------------------------------------------- */
.cover .page-main {
  padding: 10mm 11mm 8mm;
  background:
    radial-gradient(110mm 80mm at 50% 66%, var(--lam-sky) 0%, rgba(232, 239, 255, 0) 72%),
    var(--lam-white);
  font-family: var(--f-brand); color: var(--lam-navy);
}
.cover .page-body { gap: 0; }
.cv-kicker {
  display: flex; align-items: center; gap: 2.5mm;
  font-size: 8.4px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--lam-blue);
}
.cv-kicker::before { content: ""; width: 7mm; height: 1.5px; background: currentColor; flex: none; }
.cv-subject {
  margin: 4mm 0 0; font-size: 30px; font-weight: 800; line-height: 1.05;
  letter-spacing: -.015em; text-wrap: balance;
}
.cv-year {
  font-size: 60px; font-weight: 800; line-height: .95; letter-spacing: -.04em;
  color: var(--lam-blue); font-variant-numeric: tabular-nums;
}
.cv-meta { margin-top: 3.5mm; font-size: 12px; font-weight: 700; color: var(--lam-blue); letter-spacing: .02em; }
.cv-hero {
  flex: 1 1 0; min-height: 0; margin: 3mm 0;
  display: flex; align-items: center; justify-content: center;
}
.cv-hero img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.cv-card {
  display: flex; align-items: center; gap: 4.5mm;
  padding: 4mm 4.5mm; background: var(--lam-white);
  border: 1px solid var(--lam-sky-line); border-radius: 3mm;
}
.cv-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1.2mm; }
.cv-badge {
  align-self: flex-start; background: var(--lam-blue); color: var(--lam-white);
  font-size: 7.4px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  border-radius: 999px; padding: .5mm 2.4mm;
}
.cv-card-title { font-size: 12px; font-weight: 800; line-height: 1.25; }
.cv-card-note { font-size: 8.8px; line-height: 1.4; opacity: .8; }
.cv-card-note b { font-weight: 800; opacity: 1; }
.cv-link { font-size: 8.2px; font-weight: 700; color: var(--lam-blue); text-decoration: none; word-break: break-all; }
.cv-qr { width: 21mm; height: 21mm; flex: none; display: grid; place-items: center; }
.cv-qr svg { width: 100%; height: 100%; display: block; }

/* "not available yet" page (private/includes/exam-booklet/missing.php) */
.eb-missing { display: flex; justify-content: center; zoom: var(--eb-scale, 1); }
.cv-badge--muted { background: var(--lam-sky); color: var(--lam-navy); }
.cv-actions { display: flex; flex-wrap: wrap; gap: 2mm; margin-top: 1.5mm; }
.cv-btn {
  display: inline-flex; align-items: center; min-height: 8mm; padding: 0 4mm;
  border: 1.5px solid var(--lam-blue); border-radius: 999px;
  background: var(--lam-blue); color: var(--lam-white);
  font: 800 10px/1 var(--f-brand); text-decoration: none;
}
.cv-btn:hover { background: var(--lam-navy); border-color: var(--lam-navy); }
.cv-btn--line { background: var(--lam-white); color: var(--lam-blue); }
.cv-btn--line:hover { background: var(--lam-sky); color: var(--lam-navy); border-color: var(--lam-blue); }
.cv-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* back cover */
.bk-brand {
  margin: 4mm 0 0; font-size: 32px; font-weight: 800; line-height: 1.05;
  letter-spacing: -.02em; color: var(--lam-blue);
}
.bk-sub { margin-top: 2mm; font-size: 10px; font-weight: 600; opacity: .75; }
.cv-tags { display: flex; flex-wrap: wrap; gap: 1.6mm; margin-top: 4mm; }
.cv-tag {
  font-size: 8.6px; font-weight: 700; line-height: 1.5;
  padding: .5mm 2.6mm; border-radius: 999px;
  background: var(--lam-sky); color: var(--lam-navy);
}
.cv-tag--strong { background: var(--lam-navy); color: var(--lam-white); }
.cv-script { font-family: var(--f-script); color: var(--lam-blue); font-size: 17px; line-height: 1.1; }
.cv-phone { font-size: 13px; font-weight: 800; }
.cv-phone small { font-size: 8.4px; font-weight: 600; opacity: .7; margin-right: 1.5mm; }

/* ---------------------------------------------------------------------
   5. PAPER HEAD (page 1, built by the script from EB_PAPER)
   --------------------------------------------------------------------- */
.year { text-align: center; font-weight: 700; font-size: 20px; letter-spacing: .04em; }
.subject { text-align: center; font-weight: 700; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; }
.time { text-align: center; font-weight: 700; font-size: 13px; }
.time small { display: block; font-size: 12px; }
.fullmarks { display: flex; justify-content: center; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; margin: 4px 0; flex-wrap: wrap; }
.brace { font-size: 34px; font-weight: 400; line-height: 1; transform: scaleX(.6); }
.fm-lines { display: flex; flex-direction: column; }
.credit { text-align: center; font-style: italic; font-size: 12.5px; }
.instr { font-style: italic; font-size: 11.5px; line-height: 1.38; text-align: justify; margin: 0; }
.sect-title { text-align: center; font-weight: 700; font-size: 17px; margin: 2px 0 4px; }
.alt-title { text-align: center; font-weight: 700; font-size: 14px; margin: 8px 0 2px; }

/* ---------------------------------------------------------------------
   6. QUESTIONS
   .q      heading row: number | text | marks
   .subs   list of sub-parts; .sp one sub-part "(i) text"
   .opts   MCQ options (2 columns)
   --------------------------------------------------------------------- */
.q { display: grid; grid-template-columns: 26px 1fr auto; column-gap: 6px; align-items: baseline; }
.q .qt { min-width: 0; }
.q .mk { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.subs { display: flex; flex-direction: column; gap: 5px; margin-left: 20px; min-width: 0; }
/* --sn-w: the number column; the script widens it for a list whose labels are longer, e.g. (2.1.1) */
.sp { display: grid; grid-template-columns: var(--sn-w, 30px) 1fr; column-gap: 2px; align-items: baseline; }
.sp > div { min-width: 0; text-align: justify; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin: 6px 0 2px 6px; }
.opt { display: flex; gap: 8px; align-items: center; }
.blank { display: inline-block; width: 64px; border-bottom: 1px solid var(--ink); transform: translateY(-3px); }
.display-math { overflow-x: auto; overflow-y: hidden; }
b.em { font-style: italic; }
/* figure cropped from the scan (or an exact SVG redraw) */
.fig { display: flex; justify-content: center; margin: 6px 0 2px; }
.fig img, .fig svg { display: block; max-width: 100%; max-height: 70mm; height: auto; }
/* figures that are MCQ options (e.g. four graphs) stay small, as printed */
.opts .fig { justify-content: flex-start; margin: 2px 0 0; }
.opts .fig img { max-height: 22mm; }
/* text that could not be read or is ambiguous: must be resolved before publishing */
.eb-unclear { background: #ffe58f; color: #a8071a; font-weight: 700; padding: 0 2px; }
/* auto-fit steps (exam-booklet.js checkOverflow) */
.page.eb-nofoot .foot,
.page.eb-nofoot > .band-foot { display: none; }
.page.eb-nofoot.eb-overflow::after { bottom: 0; }
/* step 2 also shrinks the text ~7% (zoom scales text, math and tables alike) */
.page.eb-nofoot .page-body { zoom: .93; }

/* Small dialogs: "Before you print" and "Daily print limit reached" (built by the script; screen only) */
.eb-modal {
  /* centred, but a popup taller than the window scrolls instead of being cut off top and bottom */
  position: fixed; inset: 0; z-index: 1000; display: flex; padding: 12px; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(10, 16, 32, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: eb-fade .16s ease-out both;
}
.eb-modal-card {
  margin: auto; box-sizing: border-box; width: min(340px, 100%); padding: 22px 22px 18px; border-radius: 16px;
  background: var(--bar-bg); color: var(--bar-ink); border: 1px solid var(--bar-line);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5); font-family: var(--f-brand);
  animation: eb-pop .2s cubic-bezier(.2, .8, .3, 1) both;
}
.eb-modal-card h2 { margin: 0 0 10px; font: 800 17px/1.3 var(--f-brand); letter-spacing: -.01em; }
.eb-modal-text { margin: 0 0 6px; font: 500 14.5px/1.6 var(--f-brand); }
.eb-modal-note { margin: 0 0 16px; font: 500 12.5px/1.5 var(--f-brand); opacity: .65; }
.eb-hl {
  padding: 1px 7px; border-radius: 6px; font-weight: 800; white-space: nowrap;
  background: rgba(36, 86, 230, .18); color: var(--bar-ink);
}
:root[data-theme="dark"] .eb-hl { background: rgba(127, 176, 255, .3); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .eb-hl { background: rgba(127, 176, 255, .3); color: #fff; } }
.eb-modal-check { display: flex; gap: 8px; align-items: center; margin: 0 0 16px; font: 500 12.5px/1.3 var(--f-brand); opacity: .8; cursor: pointer; }
.eb-modal-check input { width: 15px; height: 15px; accent-color: var(--lam-blue); }
.eb-modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.eb-modal-btn {
  padding: 9px 18px; border-radius: 999px; cursor: pointer; font: 700 13.5px/1 var(--f-brand);
  background: transparent; color: var(--bar-ink); border: 1px solid var(--bar-line);
}
a.eb-modal-btn { display: inline-block; text-decoration: none; text-align: center; }
.eb-modal-btn:hover { border-color: var(--bar-ink); }
.eb-modal-btn--go { background: var(--lam-blue); border-color: var(--lam-blue); color: #fff; }
.eb-modal-btn--go:hover { filter: brightness(1.08); border-color: var(--lam-blue); }
.eb-modal-btn:focus-visible, .eb-modal-check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* light look whatever the theme (the loader and the limit dialog) */
.eb-modal--light { --bar-bg: #fff; --bar-ink: #0d2a66; --bar-line: #c3d4fb; background: rgba(13, 42, 102, .32); }
.eb-modal--light .eb-modal-card { background: #fff; color: #0d2a66; border-color: #dbe5ff; box-shadow: 0 24px 60px -24px rgba(13, 42, 102, .45); }
html .eb-modal.eb-modal--light .eb-hl { background: #e8efff; color: #0d2a66; }
.eb-modal-center { text-align: center; }
.eb-modal-actions--tight { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; justify-content: stretch; }
.eb-modal-actions--tight .eb-modal-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 6px; font-size: 12.5px; }
.eb-modal-btn--wa svg { color: #1fa855; }
.eb-modal--light .eb-modal-btn:not(.eb-modal-btn--go) { color: #0d2a66; border-color: #c3d4fb; }
.eb-modal--light .eb-modal-card:has(.eb-lim-icon) h2 { text-align: center; }
.eb-modal-card:has(.eb-lim-icon) { padding: 28px 24px 22px; }
.eb-modal-card:has(.eb-lim-icon) h2 { margin-bottom: 14px; font-size: 16px; }
.eb-lim-used { margin: 0 !important; font-size: 13.5px !important; }
.eb-lim-note { margin: 0 0 22px !important; padding: 9px 14px; border-radius: 10px; background: #eef3ff; font-size: 12.5px !important; font-weight: 700 !important; opacity: 1 !important; color: #2456e6 !important; }
.eb-lim-icon { position: relative; width: 64px; height: 64px; margin: 2px auto 10px; border-radius: 50%; display: grid; place-items: center; color: #2456e6; background: linear-gradient(160deg, #e8efff, #d6e3ff); }
.eb-lim-pulse { position: absolute; inset: 0; border-radius: 50%; border: 2px solid #2456e6; opacity: 0; animation: eb-pulse 2.4s ease-out infinite; }
.eb-lim-glass { animation: eb-flip 3.6s cubic-bezier(.6, 0, .3, 1) infinite; }
.eb-lim-dots { display: flex; justify-content: center; gap: 7px; margin: 0 0 14px; }
.eb-lim-dots span { width: 9px; height: 9px; border-radius: 50%; background: #2456e6; transform: scale(0); animation: eb-dot .35s cubic-bezier(.3, 1.5, .5, 1) forwards; }
.eb-lim-share-head { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font: 700 11px/1 var(--f-brand); letter-spacing: .06em; text-transform: uppercase; color: #6b7ba3; }
.eb-lim-share-head::after { content: ""; flex: 1; height: 1px; background: #dbe5ff; }
@keyframes eb-pulse { 0% { transform: scale(.9); opacity: .55; } 80%, 100% { transform: scale(1.35); opacity: 0; } }
@keyframes eb-flip { 0%, 55% { transform: rotate(0); } 80%, 100% { transform: rotate(180deg); } }
@keyframes eb-dot { to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .eb-lim-pulse, .eb-lim-glass { animation: none; } .eb-lim-dots span { animation-duration: 1ms; } }
@keyframes eb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes eb-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .eb-modal, .eb-modal-card { animation: none; } }
@media print { .eb-modal { display: none !important; } }

/* PDF download dialog: title and ring side by side (70:30), our programme (or an ad) below */
.eb-modal--wide .eb-modal-card { width: min(380px, 100%); padding: 28px 24px 22px; }
.eb-gen-head { display: flex; flex-direction: column-reverse; align-items: center; gap: 14px; text-align: center; }
.eb-gen-head > div:first-child { display: grid; gap: 4px; }
.eb-gen-head h2 { margin: 0; font-size: 16px; }
.eb-gen-head p { margin: 0; font: 500 13px/1.5 var(--f-brand); color: #5a6b94; }
.eb-ring { position: relative; width: 48px; height: 48px; margin: 0 auto; }
.eb-ring svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.eb-ring circle { fill: none; stroke-width: 4; }
.eb-ring .eb-ring-track { stroke: #dbe5ff; }
.eb-ring .eb-ring-arc { stroke: var(--lam-blue); stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 119.4; }
.eb-promos { margin-top: 22px; padding-top: 22px; border-top: 1px solid #e1e9ff; }
/* finished: a green tick drawn in place of the ring, the message in green, a Done button */
.eb-tick { width: 48px; height: 48px; margin: 0 auto; }
.eb-tick svg { display: block; width: 100%; height: 100%; fill: none; stroke: #1fa855; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.eb-tick circle { stroke-dasharray: 145; stroke-dashoffset: 145; animation: eb-draw .45s ease-out forwards; }
.eb-tick path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: eb-draw .3s .4s ease-out forwards; }
@keyframes eb-draw { to { stroke-dashoffset: 0; } }
.eb-gen-head p.eb-gen-ok { color: #12873f; font-weight: 700; }
.eb-modal-card .eb-modal-btn.eb-gen-done { display: block; width: 100%; margin-top: 22px; }
@media (prefers-reduced-motion: reduce) { .eb-tick circle, .eb-tick path { animation: none; stroke-dashoffset: 0; } }
.eb-ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 13px/1 var(--f-brand); color: var(--lam-navy); font-variant-numeric: tabular-nums; }

/* PDF download "capture mode": exam-booklet-pdf.js adds .eb-capturing to the copy of the page that
   html2canvas draws. It cannot draw CSS zoom, so the zoom steps are turned into the same thing
   with a transform: the narrow-screen zoom of the booklet is dropped (pages are always drawn at
   their real A5 size) and the 7% text shrink of a tight page becomes scale(.93) on a box made wider
   by the same factor, so every line breaks where it does on screen. html2canvas skips ::before, so
   the watermark is added as a real element (.eb-wm-real) when it is switched on; the screen-only
   overflow banner is left out. */
html.eb-capturing .eb-booklet { zoom: 1 !important; }
html.eb-capturing .page.eb-nofoot .page-body { zoom: 1; transform: scale(.93); transform-origin: 0 0; width: calc(100% / .93); }
html.eb-capturing .eb-wm-real {
  position: absolute; left: 50%; top: 50%; z-index: 5; transform: translate(-50%, -50%) rotate(-35deg);
  font: 800 30px/1 var(--f-brand); letter-spacing: .04em; white-space: nowrap;
  color: var(--lam-blue); opacity: .07; pointer-events: none;
}
html.eb-capturing .page.eb-overflow::after { display: none; }

/* Source line, added by the server to the end of every question page (eb_brand_pages()).
   The print button refuses to print if it, or the bands, have been removed. */
.eb-src {
  margin: auto 0 0; padding-top: 4px; text-align: center;
  font: 500 8px/1.3 var(--f-brand); letter-spacing: .02em; color: var(--muted);
}
.eb-src a { color: inherit; font-weight: 700; text-decoration: none; }

/* Watermark (EB_WATERMARK in config → data-eb-watermark on <html>; its wording is
   EB_TEXT['watermark'] → --eb-wm-text): the site address and date across each question page, in print only ('print') or on screen too ('always').
   The rule always exists so the print check can confirm it was not removed. */
html[data-eb-watermark] .page:not(.cover)::before {
  content: var(--eb-wm-text, "www.thelaminars.com") var(--eb-wm-date, "");
  display: none; position: absolute; left: 50%; top: 50%; z-index: 5;
  transform: translate(-50%, -50%) rotate(-35deg);
  font: 800 30px/1 var(--f-brand); letter-spacing: .04em; white-space: nowrap;
  color: var(--lam-blue); opacity: .07; pointer-events: none;
}
html[data-eb-watermark="always"] .page:not(.cover)::before { display: block; }

/* Denser text, set by the script on a whole language version only when a page
   would still overflow at the normal size (eb-dense-2 is close to the printed paper). */
.eb-dense-1 > .page:not(.cover) { font-size: 12.25px; line-height: 1.45; }
.eb-dense-1 .page-body { gap: 5px; }
.eb-dense-1 .subs { gap: 4px; }
.eb-dense-1 .opts { gap: 4px 18px; margin: 4px 0 2px 6px; }
.eb-dense-2 > .page:not(.cover) { font-size: 11.5px; line-height: 1.4; }
.eb-dense-2 .page-body { gap: 4px; }
.eb-dense-2 .instr { font-size: 10.5px; line-height: 1.35; }
.eb-dense-2 .sect-title { font-size: 14px; margin: 1px 0 2px; }
.eb-dense-2 .alt-title { font-size: 12.5px; margin: 5px 0 1px; }
.eb-dense-2 .q .mk { font-size: 11px; }
.eb-dense-2 .subs { gap: 3px; }
.eb-dense-2 .opts { gap: 2px 16px; margin: 3px 0 1px 6px; }
.foot {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 6px; font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------
   7. TABLES (frequency distributions)
   --------------------------------------------------------------------- */
.tbl-wrap { overflow-x: auto; margin: 6px 0 2px; scrollbar-width: none; }
.tbl-wrap::-webkit-scrollbar { display: none; }   /* fallback: never show a scrollbar */
/* wide table (set by exam-booklet.js): smaller text, tighter cells, words may wrap */
.tbl-wrap.tbl-fit table { font-size: 11px; }
.tbl-wrap.tbl-fit td, .tbl-wrap.tbl-fit th { padding: 3px 4px; white-space: normal; }
.tbl-wrap table { border-collapse: collapse; font-size: 12.5px; min-width: 100%; font-variant-numeric: tabular-nums; }
.tbl-wrap td, .tbl-wrap th { border: 1px solid var(--rule); padding: 4px 6px; text-align: left; white-space: nowrap; }
.tbl-wrap th { font-weight: 400; text-align: left; }

/* MathJax output inherits the ink colour */
mjx-container { color: var(--ink); }
mjx-container[jax="SVG"][display="false"] { vertical-align: middle; }
/* Chrome draws MathJax's zero-width strokes as hairlines when printing,
   which makes math look bold in PDFs. Glyphs are filled shapes, so
   removing the stroke keeps the normal weight. */
mjx-container[jax="SVG"] svg,
mjx-container[jax="SVG"] svg g,
mjx-container[jax="SVG"] svg path { stroke: none !important; stroke-width: 0 !important; }

/* ---------------------------------------------------------------------
   8. AD SLOTS — inserted between pages by the script, hidden for now.
   To enable later: remove display:none here, or add .ad-slot--on
   to an individual slot.
   --------------------------------------------------------------------- */
.ad-slot { display: none; width: 100%; max-width: var(--page-w); min-height: 90px; }
.ad-slot.ad-slot--on { display: block; }

/* ---------------------------------------------------------------------
   9. BREAKPOINTS
   Page layout is identical on every device (fixed A5); only the zoom
   (--eb-scale) changes. Wider screens just get more desk space.
   --------------------------------------------------------------------- */
@media (min-width: 601px) {
  .eb-desk { padding-block: 20px 64px; }
}

/* ---------------------------------------------------------------------
   10. PRINT / SAVE AS PDF — one booklet page per A5 sheet
   --------------------------------------------------------------------- */
@page { size: A5 portrait; margin: 0; }
@media print {
  :root { --paper: #fff; }
  html, body { background: #fff !important; }
  .eb-desk { padding: 0 !important; }
  .eb-booklet { display: block !important; gap: 0; zoom: 1 !important; }
  .eb-booklet > .page { animation: none !important; transform: none !important; clip-path: none !important; opacity: 1 !important; }
  .eb-booklet[hidden], .eb-controls-wrap, .ad-slot { display: none !important; }
  html:not(.eb-print-ok) .eb-booklet { display: none !important; }
  html:not(.eb-print-ok) .eb-print-note {
    display: block; margin: 40mm 15mm; font: 600 16px/1.5 var(--f-brand); color: #000; text-align: center;
  }
  .page {
    width: 148mm !important; height: 210mm !important; min-height: 0 !important;
    box-shadow: none !important; overflow: hidden;
    break-after: page; page-break-after: always;
  }
  .page:last-of-type { break-after: auto; page-break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html[data-eb-watermark].eb-print-ok .page:not(.cover)::before { display: block; }
}

/* ---------------------------------------------------------------------
   Madhyamik 2027 link strip under the toolbar (Madhyamik papers, screen only).
   One highlighted line; the links slide sideways like a news ticker, and pause on hover or focus.
   Markup: m27_paper_ticker() in private/includes/madhyamik2027.php (the list is there twice
   so the slide loops without a gap). To slide the other way, set --eb-tick-dir to reverse.
   --------------------------------------------------------------------- */
.eb-related {
  --eb-tick-dir: normal; --eb-tick-time: 30s;
  display: flex; align-items: center;
  width: 100%; max-width: var(--page-w); margin: 0 auto 14px; padding: 4px 0;
  background: none; font-family: var(--f-brand);
}
.eb-rel-view {
  flex: 1; min-width: 0; display: flex; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.eb-rel-track {
  flex: none; display: flex; margin: 0; padding: 0; list-style: none;
  animation: eb-tick var(--eb-tick-time) linear infinite var(--eb-tick-dir);
}
.eb-rel-track li { flex: none; display: flex; align-items: center; padding-right: 8px; }
/* every item (the tag included) is the same chip; they alternate blue and purple */
.eb-rel-chip {
  --k: #1d4ed8; --kd: #1e3a8a;
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 14px;
  background: var(--k); border: 1px solid var(--k); border-radius: 999px;
  color: #fff; font: 700 13px/1.5 var(--f-brand); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.eb-rel-chip::after { content: "\203A"; font-size: 18px; line-height: 1; transition: transform .15s ease; }
.eb-rel-chip:hover, .eb-rel-chip:focus-visible { background: var(--kd); border-color: var(--kd); color: #fff; text-decoration: none; }
.eb-rel-chip:hover::after, .eb-rel-chip:focus-visible::after { transform: translateX(3px); }
.eb-rel-chip:active { transform: scale(.97); }
.eb-rel-b { --k: #7c3aed; --kd: #5b21b6; }
.eb-related:hover .eb-rel-track, .eb-related:focus-within .eb-rel-track { animation-play-state: paused; }
@keyframes eb-tick { from { transform: translateX(0); } to { transform: translateX(-100%); } }
/* reduced motion: no sliding; the line scrolls by hand and the copy of the list is not shown */
@media (prefers-reduced-motion: reduce) {
  .eb-rel-view { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .eb-rel-track { animation: none; }
  .eb-rel-track[aria-hidden="true"] { display: none; }
}
@media (max-width: 480px) { .eb-rel-chip { font-size: 12.5px; padding: 3px 7px 3px 12px; } }
@media print { .eb-related { display: none !important; } }

/* "[solution]" after a question that has a worked solution on the site (doc_paper_solution_links()).
   Kept in print and in the PDF, so students know the solution is on the site. */
.eb-sol { color: #2456e6; font: 700 .82em/1 var(--f-brand); text-decoration: none; white-space: nowrap; }
.eb-sol:hover, .eb-sol:focus-visible { text-decoration: underline; }

/* "Also in: …": the paper's other language versions (each its own page), under the toolbar */
.eb-versions { margin: 6px 0 0; font: 600 12px/1.4 var(--f-brand); color: var(--bar-ink); opacity: .85; }
.eb-versions a { color: var(--focus); font-weight: 700; text-decoration: none; }
.eb-versions a:hover, .eb-versions a:focus-visible { text-decoration: underline; }
