/* The exam paper.
 *
 * Modelled on the structure of a real IB script — cover sheet, session-number
 * header, gutter numbering, marks in square brackets, ruled answer space sized
 * by mark value — because a mock that reads like a web form does not rehearse
 * the thing a student is nervous about.
 *
 * Deliberately NOT a facsimile. The typeface, the palette, the logo and the
 * wording are ours. What is reproduced is the LAYOUT GRAMMAR that makes an exam
 * feel like an exam: formal serif body, a numbered gutter, right-aligned mark
 * allocations, and answer space you can measure your answer against. Copying
 * question text is a copyright problem; copying an organisation's trade dress
 * is a different one, and neither is worth having.
 */

/* The desk the paper sits on. */
.exam-desk {
    /* The sheet floats directly on the page ground — no desk rectangle. */
    margin: 0 0 0;
    padding: 8px 0 60px;
    min-height: 100%;
}

/* One sheet. Proportioned like a real script rather than a browser column:
   a fixed measure is what makes the line breaks and the ruling look right. */
.exam-sheet {
    max-width: 840px;
    margin: 0 auto 22px;
    background: #FFFEFB;
    border: 1px solid rgba(27, 58, 75, 0.14);
    box-shadow: 0 1px 3px rgba(27, 58, 75, 0.07), 0 10px 30px rgba(27, 58, 75, 0.05);
    padding: 46px 54px 52px;
    font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    color: #14181C;
    font-size: 15px;
    line-height: 1.62;
}

/* ── Running header: page marker centred, session number right ──────────── */
.exam-head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: baseline;
    margin: -14px 0 26px;
    font-size: 12px;
    letter-spacing: 0.02em;
    color: #4A5560;
}
.exam-head-page { grid-column: 2; }
.exam-head-session { grid-column: 3; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Cover sheet ────────────────────────────────────────────────────────── */
.exam-cover { text-align: left; }
.exam-cover-brand {
    display: flex; align-items: center; gap: 11px;
    padding-bottom: 22px; margin-bottom: 30px;
    border-bottom: 1.5px solid #14181C;
}
.exam-cover-brand img { width: 40px; height: 40px; }
.exam-cover-brand-name {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 17px; font-weight: 600; letter-spacing: 0.01em; color: #14181C;
}
.exam-cover-brand-sub {
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8B7B57;
}

/* The session-number boxes. Instantly readable as an exam script, and ours
   carries the mock id rather than a candidate number. */
.exam-session { margin-bottom: 34px; }
.exam-session-label {
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    font-size: 11px; letter-spacing: 0.05em; color: #4A5560; margin-bottom: 6px;
}
.exam-session-boxes { display: flex; gap: 3px; }
.exam-session-box {
    width: 21px; height: 27px;
    border: 1px solid #14181C;
    display: grid; place-items: center;
    font-size: 14px; font-variant-numeric: tabular-nums;
}
.exam-session-gap { width: 12px; }

.exam-title { margin: 40px 0 6px; }
.exam-title h1 {
    margin: 0; font-family: Georgia, serif; font-weight: 400;
    font-size: 30px; letter-spacing: 0.01em; color: #14181C;
}
.exam-title p { margin: 3px 0 0; font-size: 17px; color: #2C3640; }
.exam-duration {
    margin-top: 30px; font-size: 17px;
}

.exam-instructions { margin-top: 40px; }
.exam-instructions h2 {
    margin: 0 0 10px; font-family: Georgia, serif; font-weight: 400;
    font-size: 17px; color: #14181C;
}
.exam-instructions ul { margin: 0; padding: 0; list-style: none; }
.exam-instructions li {
    position: relative; padding-left: 20px; margin-bottom: 5px; font-size: 15px;
}
/* The real papers use a small filled marker rather than a bullet. */
.exam-instructions li::before {
    content: ""; position: absolute; left: 4px; top: 0.62em;
    width: 5px; height: 5px; background: #14181C;
}

.exam-cover-foot {
    margin-top: 46px; padding-top: 14px;
    border-top: 1px solid rgba(20, 24, 28, 0.25);
    display: flex; justify-content: space-between;
    font-size: 11.5px; color: #4A5560;
}

/* ── Questions ──────────────────────────────────────────────────────────── */
.exam-rubric {
    margin-bottom: 30px; padding-bottom: 12px;
    border-bottom: 1px solid rgba(20, 24, 28, 0.2);
    font-size: 14.5px;
}

.exam-section-head {
    margin: 34px 0 18px;
    font-family: Georgia, serif; font-size: 17px; text-align: center;
    letter-spacing: 0.02em;
}

.exam-stimulus {
    margin: 0 0 30px; padding: 18px 20px;
    border: 1px solid rgba(20, 24, 28, 0.28);
    background: #f7f6f1;
}
.exam-stimulus-label {
    margin: 0 0 10px; font-size: 11px; font-weight: 700;
    letter-spacing: 0.09em; text-transform: uppercase;
}
.exam-stimulus-body > :first-child { margin-top: 0; }
.exam-stimulus-body > :last-child { margin-bottom: 0; }

/* Choice papers use the same small square-and-label language as the paper's
   answer options. The gold checked state is the site's existing Learning
   Center accent, while the question itself remains an exam sheet. */
.exam-choice {
    display: inline-grid;
    grid-template-columns: 22px 1fr;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    padding: 7px 10px;
    border: 1px solid rgba(27, 58, 75, 0.22);
    border-radius: 7px;
    background: #FFFEFB;
    color: #1B3A4B;
    cursor: pointer;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
}
.exam-choice:hover { background: rgba(195, 154, 76, 0.08); border-color: #C39A4C; }
.exam-choice input {
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1px solid #1B3A4B;
    border-radius: 3px;
    display: grid;
    place-content: center;
}
.exam-choice input::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: #C39A4C;
    transform: scale(0);
}
.exam-choice input:checked::before { transform: scale(1); }
.exam-choice:has(input:checked) {
    background: rgba(195, 154, 76, 0.12);
    border-color: #C39A4C;
}
.exam-choice:focus-within { outline: 2px solid #C39A4C; outline-offset: 2px; }

.exam-literary-passage {
    margin: 2px 0 22px;
    padding: 24px 26px;
    background: #FBF8EF;
}
.exam-literary-passage .exam-stimulus-body {
    font-size: 16px;
    line-height: 1.72;
}
.exam-literary-passage .exam-stimulus-body p { white-space: pre-line; }
/* `.exam-answer` is declared further down with the same weight, so the inactive
   state needs the doubled class to switch the ruled lines off; otherwise they
   strike through the notice. Dimming is carried by the faint rules, not by
   opacity, which took the notice itself down to 3.5:1. */
.exam-answer.exam-answer--inactive {
    background-image: none;
    min-height: 54px;
    border-top: 1px solid rgba(20, 24, 28, 0.2);
    border-bottom: 1px solid rgba(20, 24, 28, 0.2);
}
.exam-answer--inactive::before {
    content: "Choose this question to write your answer.";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #46566B;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    font-size: 13px;
}
.exam-answer--inactive textarea { visibility: hidden; }

/* The gutter is what makes it read as an exam rather than an article. */
.exam-q { display: grid; grid-template-columns: 34px 1fr; margin-bottom: 34px; }
.exam-q-num { font-size: 15px; padding-top: 1px; }
.exam-q-body { min-width: 0; }
.exam-q-stem { font-size: 16px; line-height: 1.62; }
.exam-q-stem p { margin: 0 0 15px; }
.exam-q-stem p:last-child { margin-bottom: 0; }
/* A new sub-part opens on a wider gap than the lines inside one, and its
   printed label sits in its own hanging column — "(a) (i)  Define…", never
   "(a)(i)Define…". Mirrors .stem-part-label / .stem-part-open in mock.css. */
.exam-q-stem p.stem-part-open { margin-top: 32px; }
.exam-q-stem p.stem-part-open:first-child { margin-top: 0; }
.exam-q-stem .stem-part-open { padding-left: 5.7em; text-indent: -5.7em; }
.exam-q-stem strong.stem-part-label {
    font-weight: 700;
    display: inline-block;
    min-width: 5.7em;
    padding-right: 0.8em;
    white-space: nowrap;
    text-indent: 0;
}

/* Sub-parts nest one gutter deeper, as they do on the page. */
.exam-part { display: grid; grid-template-columns: 32px 1fr; margin-top: 15px; }
.exam-part-label { font-size: 15px; white-space: nowrap; }

/* Marks sit hard right on their own line, after the question they price. */
.exam-marks {
    display: block; text-align: right;
    font-size: 15px; margin: 6px 0 8px;
    font-variant-numeric: tabular-nums;
}

/* ── Ruled answer space ─────────────────────────────────────────────────── */
/* The rules are painted on the container and the textarea sits transparent on
   top with a matched line-height, so typing lands ON the lines. Two lines per
   mark, which is what the real papers give (measured: 1→2, 2→4, 3→6, 4→8). */
.exam-answer {
    --exam-line: 27px;
    position: relative;
    margin-top: 4px;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(var(--exam-line) - 1px),
        rgba(20, 24, 28, 0.28) calc(var(--exam-line) - 1px),
        rgba(20, 24, 28, 0.28) var(--exam-line));
    background-position: 0 0;
}
.exam-answer textarea {
    display: block; width: 100%;
    padding: 0; margin: 0; border: 0; outline: 0;
    background: transparent; resize: none; overflow: hidden;
    font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    font-size: 15px;
    line-height: var(--exam-line);
    color: #14181C;
}
.exam-answer textarea::placeholder { color: #A9A288; font-style: italic; }

/* MCQ: lettered options, boxed selector — a real multiple-choice script. */
.exam-options { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.exam-option {
    display: grid; grid-template-columns: 30px 1fr;
    align-items: baseline; padding: 5px 4px; cursor: pointer;
}
.exam-option:hover { background: rgba(20, 24, 28, 0.035); }
.exam-option input { position: absolute; opacity: 0; pointer-events: none; }
.exam-option-key {
    width: 21px; height: 21px; border: 1px solid #14181C;
    display: grid; place-items: center;
    font-size: 13px; line-height: 1;
}
.exam-option input:checked + .exam-option-key { background: #14181C; color: #FFFEFB; }
.exam-option-text { font-size: 15px; }

/* ── Figures (GuideMate Canvas) ─────────────────────────────────────────── */
.exam-figure { margin: 14px 0 4px; text-align: center; }
/* A data table wider than the column scrolls in place instead of pushing past
   the sheet at phone width. */
.exam-figure--table { overflow-x: auto; max-width: 100%; }
.mock-figure-open {
    display: inline-flex; align-items: center; min-height: 44px;
    margin-left: 10px; color: #13233F; white-space: nowrap;
    text-decoration: underline; text-underline-offset: .2em;
}
.mock-figure-open::after { content: "\2192"; margin-left: 5px; }
.exam-figure img {
    display: block; max-width: min(100%, 760px); height: auto; margin: 0 auto;
    object-fit: contain;
}
.exam-data-table {
    width: auto; max-width: 100%; margin: 0 auto; border-collapse: collapse;
    font-family: 'Hanken Grotesk', system-ui, sans-serif; font-size: 14px;
}
.exam-data-table th,
.exam-data-table td {
    min-width: 54px; padding: 8px 12px; border: 1px solid #14181C;
    text-align: center; vertical-align: middle;
}
.exam-data-table th { background: #f1eee6; font-weight: 650; }
.mock-figure-svg {
    display: block; width: 100%; max-width: 640px; height: auto;
    margin: 0 auto; color: #14181C;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
}
.exam-figure figcaption {
    margin-top: 6px; font-size: 13px; color: #4A5560;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
}
.exam-figure-missing {
    padding: 20px; border: 1px dashed rgba(20, 24, 28, 0.3);
    font-size: 13px; color: #6B7480;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
}

/* ── End matter ─────────────────────────────────────────────────────────── */
.exam-total { text-align: right; font-size: 14.5px; margin-top: 10px; }
.exam-end {
    margin-top: 30px; padding-top: 16px;
    border-top: 1px solid rgba(20, 24, 28, 0.2);
    text-align: center; font-size: 13px; letter-spacing: 0.08em; color: #4A5560;
}

@media (max-width: 720px) {
    .exam-sheet { padding: 30px 22px 36px; }
    .exam-q { grid-template-columns: 26px 1fr; }
    .exam-part { grid-template-columns: 26px 1fr; }
    /* The label stacks above its part rather than squeezing the body. */
    .exam-part--catalog { grid-template-columns: 1fr; margin: 26px 0 8px; }
    .exam-q-stem .stem-part-open { padding-left: 4.8em; text-indent: -4.8em; }
    .exam-q-stem strong.stem-part-label { min-width: 4.8em; padding-right: 0.6em; }
}

/* Printing a mock to sit it on paper is a completely reasonable thing to want. */
@media print {
    .exam-desk { background: #fff; padding: 0; margin: 0; }
    .exam-sheet { box-shadow: none; border: 0; max-width: none; padding: 0; }
    .lc-topbar, .lc-control, .mock-submit-bar { display: none !important; }
    .exam-q { break-inside: avoid; }
}

/* The site-wide margin reset flattens markdown paragraphs inside stimulus
 * boxes into one unreadable block — restore inter-paragraph rhythm. */
.exam-stimulus-body p { margin: 0 0 13px; }
.exam-stimulus-body ul, .exam-stimulus-body ol { margin: 0 0 13px; padding-left: 1.3em; }

/* ── Catalog papers: labelled parts, numbered stimulus, drawing tools ────
 * The part rows keep the printed paper's grammar: a (a)(i) gutter, marks in
 * square brackets hard right, ruled answer space. The drawing surface is the
 * one new object, and it stays inside the sheet's language: cream plate,
 * hairline border, Space Grotesk labels, text-only tools. */
/* 78px, not 52px: the label is spaced "(b) (iii)" now and must not collide
   with the part body. Consecutive parts open on a wider gap than anything
   inside one. */
.exam-part--catalog { margin: 30px 0 8px; grid-template-columns: 78px 1fr; }
.exam-part--catalog:first-child { margin-top: 18px; }
.exam-part-body { min-width: 0; }
.exam-part--catalog .exam-marks { margin: 0 0 6px; }
.exam-part--catalog .exam-answer { margin-bottom: 10px; }

/* Numbered stimulus paragraphs ("[1]", "[2]"), as printed sources use. */
.exam-stimulus-para--numbered { position: relative; padding-left: 34px; }
.exam-stimulus-paranum {
    position: absolute; left: 0; top: 0;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    font-size: 12px; color: #4A5560; font-variant-numeric: tabular-nums;
}

/* ── The answer-artifact editor ─────────────────────────────────────────── */
.gm-artifact { margin: 8px 0 16px; }
.gm-artifact-toolbar {
    display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
    padding: 6px 0 8px;
    border-top: 1px solid rgba(23, 38, 46, 0.14);
}
.gm-artifact-toollabel {
    font-family: var(--gm-display, 'Space Grotesk', sans-serif);
    font-size: 10px; font-weight: 600; letter-spacing: 0.2em;
    text-transform: uppercase; color: #17262E;
    border-bottom: 2px solid #8B6F2E; padding-bottom: 3px;
}
/* Tools are clickable text, never boxes; the active tool holds the gold rule. */
.gm-tool {
    background: none; border: none; cursor: pointer; padding: 0 0 3px;
    font-family: var(--gm-display, 'Space Grotesk', sans-serif);
    font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em;
    color: #55666E; border-bottom: 2px solid transparent;
}
.gm-tool:hover { color: #17262E; }
.gm-tool.is-active { color: #17262E; border-bottom-color: #8B6F2E; }
.gm-tool--action { margin-left: auto; color: #17262E; }
.gm-tool--action:hover { border-bottom-color: #17262E; }
.gm-artifact-status {
    font-family: var(--gm-display, 'Space Grotesk', sans-serif);
    font-size: 11px; color: #7D8A90; min-width: 52px; text-align: right;
}
.gm-artifact-toolbar .gm-artifact-status { margin-left: 6px; }

.gm-curve { position: relative; }
.gm-curve-canvas {
    /* Height follows the viewBox ratio so pointer math maps exactly. */
    display: block; width: 100%; height: auto;
    background: #FDFBF4;
    border: 1px solid rgba(23, 38, 46, 0.2);
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
}
.gm-curve-labelinput {
    position: absolute; transform: translate(0, -50%);
    width: 130px; padding: 3px 6px;
    border: 1px solid #8B6F2E; background: #FFFEFB; color: #17262E;
    font-family: 'Hanken Grotesk', system-ui, sans-serif; font-size: 13px;
    outline: none;
}

/* economics_table: blank cells become answer cells, ruled in gold. */
.gm-table-editcell { padding: 0 !important; }
.gm-table-input {
    display: block; width: 100%; min-width: 54px; box-sizing: border-box;
    padding: 8px 12px; margin: 0; border: none; outline: none;
    background: rgba(139, 111, 46, 0.06);
    border-bottom: 2px solid #8B6F2E;
    font-family: 'Hanken Grotesk', system-ui, sans-serif; font-size: 14px;
    text-align: center; color: #14181C;
}
.gm-table-input:focus { background: rgba(139, 111, 46, 0.12); }
.gm-artifact-foot {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; margin-top: 6px;
}
.gm-artifact-hint {
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    font-size: 12px; color: #7D8A90;
}
