/* Homework and test maker (teachers/homework.html). Uses the tokens in tools.css. */
:root { --c: #2B4C9B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c: #5B7FD6; } }
:root[data-theme="dark"] { --c: #5B7FD6; }
.seg-2 { display: grid; grid-template-columns: 1fr 1fr; }
.seg-2 button { font-size: 1rem; min-height: 46px; }
.seg-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.seg-3 button { font-size: 1rem; min-height: 46px; padding: 8px 6px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--c); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; text-align: left; }
.hw-avoid { display: grid; gap: 2px; }
.hw-order { display: grid; gap: 4px; border: 1px solid var(--line); border-radius: var(--r); padding: 6px; counter-reset: none; }
.hw-order li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.hw-order .btn { min-height: 34px; min-width: 38px; padding: 4px 8px; }
.hw-on { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 4px; background: var(--chip); font-weight: 700; font-size: .8rem; flex: none; }
.hw-ot { flex: 1; min-width: 0; font-size: .92rem; line-height: 1.25; }
.hw-series { display: grid; gap: 10px; }
.hw-si { display: grid; gap: 8px; }
.hw-st { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 0; }
.hw-rc { background: color-mix(in srgb, var(--c) 22%, var(--chip)); color: var(--ink); }
.hw-hist summary { cursor: pointer; }
.hw-hist { display: grid; gap: 8px; }
.hw-head { justify-content: space-between; }
.hw-total { font-family: var(--mono); font-size: .85rem; font-weight: 500; background: var(--chip); border-radius: 99px; padding: 4px 10px; }
.hw-steps { list-style: decimal; padding-left: 1.3em; display: grid; gap: 8px; margin: 4px 0 12px; }
.hw-empty { min-height: 260px; }

/* the question list */
.hw-list { display: grid; gap: 10px; }
.hw-item { border: 1px solid var(--line); border-left: 5px solid var(--ac); border-radius: var(--r); padding: 10px 12px; display: grid; gap: 8px; background: var(--surface); }
.hw-item.flash { animation: hwflash 1.2s ease-out; }
@keyframes hwflash { from { background: color-mix(in srgb, var(--c) 22%, var(--surface)); } to { background: var(--surface); } }
.hw-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hw-n { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 4px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: .9rem; }
.hw-tag { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--chip); border-radius: 4px; padding: 2px 6px; }
.hw-m { margin-left: auto; font-weight: 700; font-size: .9rem; }
.hw-q { overflow-wrap: anywhere; }
.hw-q sub, .hw-q sup, .hw-opts sub, .hw-opts sup { line-height: 0; }
.hw-opts { display: grid; gap: 4px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14em), 1fr)); }
.hw-opts li { display: flex; gap: 8px; align-items: baseline; }
.hw-opts b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); font-size: .8rem; flex: none; }
.hw-ans summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.hw-ans { display: grid; gap: 4px; }
.hw-ans[open] { background: var(--chip); border-radius: var(--r); padding: 6px 10px; }
.hw-pts { list-style: disc; padding-left: 1.2em; }
.hw-act { justify-content: flex-end; }
.hw-act .btn { min-height: 34px; }

/* online */
.hw-share { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 460px) { .hw-share { grid-template-columns: 1fr; justify-items: start; } }
.qrbtn { border: 1px solid var(--line); background: #fff; padding: 4px; border-radius: var(--r); cursor: zoom-in; line-height: 0; }
.hw-code { display: block; font-family: var(--mono); font-size: 1.9rem; letter-spacing: .06em; line-height: 1.2; }
.hw-code.big { font-size: clamp(2rem, 6vw, 4rem); color: #0E1626; }
.qrbig { position: fixed; inset: 0; z-index: 60; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; padding: 3vh; }
.qrbig .qr { width: min(80vw, 70vh); height: auto; }
.qrbig .btn { position: absolute; top: 14px; right: 14px; color: #0E1626; background: #fff; }
.lab { display: block; }
.mono { font-family: var(--mono); }

/* made on this device */
.hw-made { display: grid; gap: 6px; }
.hw-made button { width: 100%; text-align: left; display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.hw-made button:hover { background: var(--hover); }
.hw-made b { font-weight: 600; font-size: .95rem; }

/* results checker */
.hw-check summary { cursor: pointer; }
.hw-table-wrap { overflow-x: auto; }
.hw-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.hw-table th, .hw-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.hw-table th { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 500; }
.hw-table tr.bad td { color: var(--bad); }
.ok { color: var(--good); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .hw-item.flash { animation: none; } }

/* ---------------- the printed paper ---------------- */
@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  html, body { background: #fff !important; color: #000 !important; }
  #print-area.hwp { font: 10.5pt/1.4 "Schibsted Grotesk", Helvetica, Arial, sans-serif; color: #000; }
  .hwp sub, .hwp sup { line-height: 0; }
  .hwp .pc-top { display: flex; align-items: center; gap: 10px; }
  .hwp .pc-top b { display: block; font-size: 14pt; }
  .hwp .pc-top span { font-size: 10pt; }
  .hwp .pcover { break-after: page; display: flex; flex-direction: column; gap: 7mm; min-height: 240mm; }
  .hwp .pc-k { font: 500 9pt "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .06em; margin: 0; }
  .hwp .pc-t { font-size: 26pt; line-height: 1.1; margin: 0; }
  .hwp .pc-facts { display: grid; grid-template-columns: repeat(3, 1fr); border: 1pt solid #000; }
  .hwp .pc-facts div { padding: 3mm 4mm; border-left: 1pt solid #000; }
  .hwp .pc-facts div:first-child { border-left: 0; }
  .hwp .pc-facts span { display: block; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .05em; }
  .hwp .pc-facts b { font-size: 15pt; }
  .hwp .pc-inst { list-style: disc; padding-left: 6mm; display: grid; gap: 1.5mm; }
  .hwp .pc-marks { border-collapse: collapse; margin-top: auto; align-self: flex-end; }
  .hwp .pc-marks th, .hwp .pc-marks td { border: 1pt solid #000; padding: 2mm 5mm; text-align: center; font-size: 9pt; }
  .hwp .pc-marks b { font-size: 13pt; }
  .hwp .phead { display: flex; justify-content: space-between; align-items: flex-end; gap: 6mm; border-bottom: 1.2pt solid #000; padding-bottom: 2mm; }
  .hwp .ph-t { font-size: 17pt; line-height: 1.15; margin: 1mm 0 0; }
  .hwp .ph-m { font-size: 20pt; font-weight: 800; text-align: center; line-height: 1; }
  .hwp .ph-m span { display: block; font-size: 8pt; font-weight: 500; text-transform: uppercase; }
  .hwp .pwho { display: flex; gap: 6mm; margin: 4mm 0; }
  .hwp .pwho span { flex: 1; display: flex; gap: 2mm; align-items: flex-end; font-weight: 600; }
  .hwp .pwho span:first-child { flex: 2; }
  .hwp .pwho i { flex: 1; border-bottom: .8pt solid #000; min-height: 6mm; font-style: normal; font-weight: 400; padding-left: 1mm; }
  .hwp .pnote { font-size: 9.5pt; margin: 0 0 3mm; }
  .hwp .psec { font-size: 12pt; margin: 4mm 0 2mm; padding-bottom: 1mm; border-bottom: .6pt solid #000; }
  .hwp .psec.pbreak { break-before: page; }
  .hwp .pq { display: grid; grid-template-columns: 8mm 1fr 9mm; gap: 2mm; padding: 2.5mm 0; break-inside: avoid; border-bottom: .4pt solid #bbb; }
  .hwp .pq-n { font-weight: 800; }
  .hwp .pq-m { text-align: right; font-weight: 700; }
  .hwp .pq-m::after { content: ""; }
  .hwp .pq-q { margin-bottom: 1.5mm; }
  .hwp .pq-o { list-style: none; padding: 0; margin: 1mm 0 0; display: grid; gap: 1.2mm; }
  .hwp .pq-o li { display: flex; gap: 3mm; align-items: baseline; }
  .hwp .pq-l { display: inline-grid; place-items: center; width: 5.5mm; height: 5.5mm; border: .8pt solid #000; border-radius: 50%; font-weight: 700; font-size: 9pt; flex: none; }
  .hwp .pl i { display: block; height: 7.5mm; border-bottom: .5pt solid #999; }
  .hwp .pbrand { display: flex; align-items: center; gap: 2mm; font-size: 8.5pt; margin-bottom: 3mm; }
  .hwp .pbrand b { font-size: 9.5pt; }
  .hwp .pbrand span { margin-left: auto; font-weight: 700; }
  .hwp .pans { margin: 2mm 0 0; }
  .hwp .pend { text-align: center; font-weight: 700; margin-top: 6mm; }
  .hwp .prel { break-before: page; }
  .hwp .pnext { break-before: page; }
  .hwp.is-test .prel { break-after: page; }
  .hwp .prel-g { columns: 2; column-gap: 8mm; }
  .hwp .prel-g div { break-inside: avoid; margin-bottom: 4mm; }
  .hwp .prel-g b { display: block; margin-bottom: 1mm; }
  .hwp .prel-g span { display: block; padding: .8mm 0; border-bottom: .4pt solid #ccc; }
  .hwp .pa { width: 100%; border-collapse: collapse; margin-top: 4mm; }
  .hwp .pa th, .hwp .pa td { border: .6pt solid #000; padding: 1.6mm 2.4mm; vertical-align: top; text-align: left; }
  .hwp .pa th { background: #eee; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 9pt; }
  .hwp .pa tr { break-inside: avoid; }
  .hwp .pa p { margin: 0 0 .8mm; }
  .hwp .pa ul { margin: 0; padding-left: 5mm; }
  .hwp .pa-n, .hwp .pa-m { text-align: center !important; font-weight: 700; width: 10mm; }
  .hwp .pa-w { font-size: 9pt; color: #333; }
  .hwp .pa-t { display: block; font: 500 7.5pt "IBM Plex Mono", monospace; color: #555; text-transform: uppercase; margin-top: 1mm; }
  .hwp .pa tfoot td { font-weight: 800; }
}
.hw-code .note { font-family: var(--font); font-size: .9rem; letter-spacing: 0; display: block; }

/* data tables inside question text (Biology past-paper style questions) */
table.dt { border-collapse: collapse; margin: .5em 0; font-size: .92em; max-width: 100%; display: block; overflow-x: auto; }
table.dt th, table.dt td { border: 1px solid currentColor; padding: .25em .6em; text-align: center; }
table.dt th { font-weight: 600; }
table.dt tr > :first-child { text-align: left; }
@media print { table.dt { display: table; } }
