/* Orthographic Practice: a drawing office. Cool tracing-paper grey, graphite ink, a teal drafting-tape accent,
   condensed technical lettering for headings, and every drawing on a white sheet with a thin border, the way a
   drawing sits inside its frame. Black line work on white paper in print, with visible, hidden and centre lines at
   0.7, 0.35 and 0.25 mm. */
:root {
  --bg: #eceeea;
  --paper: #ffffff;
  --sheet: #ffffff;
  --ink: #1b2023;
  --muted: #4c5459;
  --line: #d3d8d4;
  --edge: #7d878b;
  --accent: #0e5e66;
  --accent-ink: #ffffff;
  --accent-soft: #dcebea;
  --draw: #15191b;
  --draw-soft: #8a9296;
  --grid: #c9d3d6;
  --ok: #1d6a37;
  --ok-soft: #dff0e4;
  --close: #7a5300;
  --close-soft: #f6ead0;
  --bad: #a3231b;
  --bad-soft: #f8e1dd;
  --info: #23566b;
  --focus: #1d5fd1;
  --head: Bahnschrift, "DIN Alternate", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --r: 2px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151a1b;
    --paper: #1e2526;
    --sheet: #1a2021;
    --ink: #e4e9e7;
    --muted: #aab4b3;
    --line: #34403f;
    --edge: #6c7a7b;
    --accent: #7cc9c9;
    --accent-ink: #062224;
    --accent-soft: #1d3436;
    --draw: #e8eeec;
    --draw-soft: #8e9b9b;
    --grid: #33403f;
    --ok: #8fd8a3;
    --ok-soft: #15301d;
    --close: #f0c56b;
    --close-soft: #352a12;
    --bad: #ff9c8f;
    --bad-soft: #3a1c18;
    --info: #86c6e0;
    --focus: #8ab8ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.hero { padding: 20px 0 2px; max-width: 820px; border-left: 6px solid var(--accent); padding-left: 14px; margin-top: 14px; }
h1 { font: 700 clamp(1.8rem, 5.2vw, 2.7rem)/1.05 var(--head); margin: 0 0 8px; letter-spacing: 0.005em; }
.lede { margin: 0 0 4px; color: var(--muted); max-width: 64ch; }
h2 { font: 700 1.4rem/1.2 var(--head); margin: 0 0 10px; }

/* settings */
.setup { margin: 16px 0 4px; }
@media (min-width: 1000px) {
  .setup { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 4px 28px; align-items: end; }
  .setup .topics { grid-column: 1 / span 2; }
}
fieldset { border: 0; padding: 0; margin: 0 0 10px; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.toggles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 1000px) { .toggles { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.tg { position: relative; display: block; cursor: pointer; }
.tg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tg span { display: flex; flex-direction: column; justify-content: center; min-height: 44px; height: 100%; padding: 5px 9px; border: 1px solid var(--edge); border-radius: var(--r); background: var(--paper); color: var(--muted); line-height: 1.2; }
.tg b { font: 650 0.95rem/1.15 var(--head); }
.tg small { display: none; font-size: 0.82rem; }
@media (min-width: 1000px) { .tg small { display: block; } }
.tg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tg input:checked + span small { color: inherit; opacity: 0.9; }
.tg .short { display: none; }
@media (max-width: 640px) {
  .tg .long { display: none; }
  .tg .short { display: block; }
  .tg span { padding: 5px 2px; text-align: center; align-items: center; }
}
.tg input:focus-visible + span, .sg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden; }
.sg { position: relative; display: block; cursor: pointer; }
.sg + .sg { border-left: 1px solid var(--edge); }
.sg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sg > span { display: flex; align-items: center; justify-content: center; min-height: 44px; height: 100%; padding: 4px; text-align: center; font: 650 0.92rem/1.15 var(--head); background: var(--paper); }
.sg input:checked + span { background: var(--ink); color: var(--bg); }
.setrow { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 10px; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 600; }
select, input { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--edge); border-radius: var(--r); min-height: 44px; padding: 6px 10px; }
select { max-width: 100%; }
.btn { font: inherit; font-weight: 650; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 6px 14px; }
.btn:hover { filter: brightness(0.95); }
.link { font: inherit; background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.note { margin: 12px 0; padding: 10px 12px; border-left: 5px solid var(--close); background: var(--close-soft); }
.note.info { border-left-color: var(--info); background: var(--paper); }
.note .link { min-height: 0; padding: 0; font-weight: 600; }

/* the set */
.sheet { margin: 10px 0 0; }
.sheet:focus { outline: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
.sheet-head h2 { margin: 0; font-size: 1.3rem; }
.code { font-family: var(--mono); letter-spacing: 0.08em; color: var(--accent); }
.score { margin: 0; font-size: 0.95rem; color: var(--muted); }
.sheet-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.practice { margin: 6px 0 0; font-size: 0.93rem; color: var(--muted); }
.zoom { background: transparent; }
@media (min-width: 900px) { .zoom { display: none; } }
.qs { list-style: none; margin: 0; padding: 0; }
.q { border-bottom: 1px solid var(--line); padding: 22px 0 10px; }
.q h3 { font: 700 1.25rem/1.2 var(--head); margin: 0 0 4px; }
.q h3 .qn { color: var(--accent); margin-right: 7px; }
.q .scen { margin: 0 0 12px; max-width: 72ch; }

/* drawings: white sheets with a thin frame */
.fig { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; align-items: flex-start; }
.fig figure { margin: 0; background: var(--sheet); border: 1px solid var(--edge); border-radius: var(--r); padding: 8px; min-width: 0; }
.fig figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.fig svg { display: block; width: 100%; height: auto; }
.fig-iso .pic { width: min(100%, 420px); }
.fig-sheet .pic { flex: 0 1 260px; }
.fig-sheet .views { flex: 1 1 420px; max-width: 640px; }
.fig-sketch figure { flex: 1 1 300px; max-width: 520px; }
@media (max-width: 640px) {
  .fig-sheet .pic { flex-basis: 100%; max-width: 220px; }
  .fig-sheet .views { flex-basis: 100%; }
}
/* phones: zoomed drawings double in width inside their own sideways scroller */
@media (max-width: 899px) {
  .qs.zoomed .fig figure { overflow-x: auto; }
  .qs.zoomed .fig .views svg, .qs.zoomed .fig-sketch svg { width: 200%; max-width: none; }
}

/* line work, on screen (widths in drawing millimetres; the drawings are about 2.5 to 4 px per mm) */
svg .ln.v { stroke-linecap: square; }
svg .ln, svg .sy, svg .ex, svg .dl, svg .ar, svg .ld, svg .mbox { fill: none; stroke: var(--draw); }
main svg .ln.v { stroke-width: 0.75; stroke-linecap: square; }
main svg .ln.h { stroke-width: 0.42; }
main svg .ln.c { stroke-width: 0.3; }
main svg .ex, main svg .dl, main svg .ld { stroke-width: 0.26; }
svg .mbox { stroke: var(--draw-soft); }
svg .ah { fill: var(--draw); }
svg text { fill: var(--draw); font-family: var(--sans); }
svg .vl { font-weight: 700; fill: var(--accent); }
svg .fl { fill: var(--sheet); stroke: var(--accent); }
svg .flab { font-weight: 700; fill: var(--accent); }
svg .mq { fill: var(--draw-soft); }
svg .grid { stroke: var(--grid); fill: none; }
svg .dot { fill: var(--draw-soft); }
svg .mark text { font-weight: 700; }
main .isosvg .ln.v { stroke-width: 0.6; stroke-linejoin: round; }

/* questions */
.qparts { max-width: 760px; }
.part { margin: 0 0 14px; min-width: 0; }
.part > .prompt, .part legend { display: block; font-weight: 600; margin: 0 0 6px; }
.opts { display: grid; gap: 4px; }
.opts.pics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .opts.pics { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.opt { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); cursor: pointer; }
.opt input { margin: 3px 0 0; min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.opt .ot { min-width: 0; flex: 1; }
.opts.pics .opt { flex-direction: column; gap: 4px; padding: 6px; background: var(--sheet); }
.opts.pics .ot { display: block; width: 100%; }
.opts.pics svg { display: block; width: 100%; height: auto; }
.olab { font: 700 0.95rem var(--head); color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.ain input { width: 9em; font-family: var(--mono); }
.qfoot { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.qfoot .fb { margin: 0; }
.fbwrap:empty { display: none; }
.fb { margin: 6px 0 0; padding: 6px 10px; border-radius: var(--r); max-width: 72ch; }
.fb.right { background: var(--ok-soft); color: var(--ok); }
.fb.close { background: var(--close-soft); color: var(--close); }
.fb.wrong, .fb.unread { background: var(--bad-soft); color: var(--bad); }
.part.is-right .ain input { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.part.is-wrong .ain input, .part.is-unread .ain input { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.work { margin-top: 4px; }
.work > summary { cursor: pointer; color: var(--muted); font-size: 0.93rem; padding: 10px 0; min-height: 44px; display: flex; align-items: center; list-style: none; }
.work > summary::-webkit-details-marker { display: none; }
.work > summary::before { content: "+"; margin-right: 6px; font-weight: 700; font-family: var(--mono); }
.work[open] > summary::before { content: "−"; }
.work .ans { margin: 0 0 2px; }
.steps { list-style: disc; margin: 2px 0 10px; padding-left: 1.4em; font-size: 0.94rem; overflow-wrap: anywhere; }
.sk-ans figure { margin: 0 0 6px; background: var(--sheet); border: 1px solid var(--edge); border-radius: var(--r); padding: 8px; max-width: 520px; }
.sk-ans svg { display: block; width: 100%; height: auto; }
.sk-ans figcaption { font-size: 0.85rem; color: var(--muted); }
.kpic { display: none; }
.sheet-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 0; }

.share { margin: 10px 0 8px; }
.print-row { display: flex; align-items: flex-end; gap: 8px 10px; flex-wrap: wrap; }
.print-row label, .share-out label { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; font-weight: 600; }
.share-out input { width: 100%; }
.recent { margin-top: 12px; border-top: 1px solid var(--line); }
.recent summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 4px 0; }
.recent small { display: block; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 8px 0 10px; }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 160%); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r); max-width: calc(100% - 32px); transition: transform 0.2s; z-index: 20; }
.toast.on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* content */
.content { padding: 22px 0 8px; max-width: 800px; }
.content h2 { margin-top: 30px; }
.content p { max-width: 68ch; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.faq details p { margin: 0 0 12px; }
.sources { font-size: 0.92rem; color: var(--muted); overflow-wrap: anywhere; margin-top: 22px; }

footer { border-top: 1px solid var(--line); margin-top: 20px; padding: 16px 0 28px; color: var(--muted); font-size: 0.92rem; }
.indep { margin: 0 0 10px; }
.sb-footer p { margin: 6px 0; }
.sb-more { line-height: 1.8; }
.sb-footer a { color: var(--ink); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

@media (max-width: 600px) {
  .hero { padding-top: 6px; margin-top: 10px; }
  .q .scen { font-size: 0.97rem; }
  .fig figure { padding: 5px; }
}

/* print: worksheet and key only, black line work on white */
.print-root { display: none; }
@page { margin: 0.45in 0.5in; }
@media print {
  :root { --ink: #000; --muted: #333; --line: #999; --paper: #fff; --sheet: #fff; --edge: #555; --draw: #000; --draw-soft: #777; --grid: #b8b8b8; --accent: #000; }
  body { background: #fff; color: #000; font: 10.5pt/1.38 var(--sans); }
  main, footer, .toast, .skip { display: none !important; }
  .print-root { display: block; }
  svg { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  /* line widths come from the drawing itself in print (0.7, 0.35, 0.25 mm on paper) */
  .print-root svg .grid { stroke: #b8b8b8; }
  .print-root svg .dot { fill: #555; }
  table.pt { width: 100%; border-collapse: collapse; }
  table.pt > tbody > tr > td, table.pt > thead > tr > td { padding: 0; }
  .prun { font: 8.5pt var(--sans); color: #444; text-align: right; padding-bottom: 6pt !important; }
  .ph { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2pt solid #000; margin-bottom: 6pt; }
  .ph h2 { font: 700 15pt var(--head); margin: 0; }
  .ph p { margin: 0; }
  .pmeta { display: flex; justify-content: space-between; gap: 12pt; margin: 4pt 0 6pt; }
  .plabel { margin: 0 0 6pt; font-size: 9pt; font-style: italic; }
  .pq { list-style: none; margin: 0; padding: 0; }
  .pq > li { padding: 7pt 0 6pt; border-bottom: 0.75pt solid #999; }
  .pq > li:not(.pq-sketch), .pqtop { break-inside: avoid; page-break-inside: avoid; }
  /* two full-size grids are taller than a page: the heading stays with the first grid; never break inside one */
  .pq-sketch .pqh { break-after: avoid; page-break-after: avoid; }
  .fig-sketch figure { break-inside: avoid; page-break-inside: avoid; }
  .pqh { break-after: avoid; page-break-after: avoid; }
  .pq h3 { font: 700 11.5pt var(--head); margin: 0 0 2pt; }
  .pq .pscen { margin: 0 0 5pt; }
  .fig { display: flex; flex-wrap: wrap; gap: 4mm; margin: 0 0 4pt; align-items: flex-start; }
  .fig figure { margin: 0; border: 0; padding: 0; background: none; }
  .fig figure, .fig-sheet .pic, .fig-sheet .views, .fig-sketch figure { flex: 0 0 auto; max-width: 100%; }
  .checkbar { display: block; margin-top: 2pt; }
  .fig svg { width: auto; max-width: 100%; height: auto; }
  .fig figcaption { font-size: 8pt; color: #333; margin-top: 1pt; }
  .pparts { display: flex; flex-wrap: wrap; gap: 3pt 10mm; }
  .pparts .pp { flex: 1 1 75mm; margin: 0 0 5pt; break-inside: avoid; page-break-inside: avoid; }
  .pparts .pp.wide { flex-basis: 100%; }
  .pparts .pp p { margin: 0 0 2pt; }
  .pparts ol.popts { margin: 0; padding-left: 14pt; list-style: upper-alpha; font-size: 9.5pt; }
  .pparts ol.popts li { margin: 0 0 1pt; }
  .pparts .pline { margin-top: 8pt !important; }
  ol.ppics { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 3mm 6mm; }
  ol.ppics li { display: flex; gap: 1.5mm; align-items: flex-start; }
  ol.ppics b { font: 700 10pt var(--head); }
  ol.ppics svg { display: block; height: auto; }
  .symsvg { width: 22mm; }
  .pkey { break-before: page; page-break-before: always; }
  .pk { margin: 0; padding-left: 18pt; }
  .pk > li { padding: 3pt 0 3pt; border-bottom: 0.75pt solid #bbb; break-inside: avoid; page-break-inside: avoid; }
  .pk h3 { font: 700 10.5pt var(--head); margin: 0 0 2pt; break-after: avoid; page-break-after: avoid; }
  .pk .ans { margin: 0.5pt 0 0; font-weight: 600; font-size: 10pt; line-height: 1.3; }
  .pk .steps { margin: 0 0 1pt; padding-left: 13pt; font-size: 8.8pt; line-height: 1.28; }
  .kpic { display: block; margin: 1pt 0; }
  .kpic svg { display: block; }
  .sk-ans figure { margin: 0; border: 0; padding: 0; }
  .sk-ans svg { width: auto; max-width: 100%; }
  .sk-ans figcaption { font-size: 8pt; }
}
