/* QuestionQuery HSC — "marked paper": warm paper, black ink, one red marking pen. */
:root {
  --bg: #f7f4ee;
  --surface: #fdfbf7;
  --raised: #efe9df;
  --ink: #1f1b16;
  --ink-2: #5e554a;
  --ink-3: #6f665a;
  --line: rgba(31, 27, 22, 0.1);
  --line-strong: rgba(31, 27, 22, 0.22);
  --pen: #c4301c;          /* examiner's red pen, 5.3:1 on --surface */
  --on-ink: #fdfbf7;
  --sheet: #ffffff;        /* the paper itself, kept white in both themes */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --surface: #1c1a18;
    --raised: #262421;
    --ink: #efe9de;
    --ink-2: #aaa398;
    --ink-3: #9a9388;
    --line: rgba(239, 233, 222, 0.1);
    --line-strong: rgba(239, 233, 222, 0.24);
    --pen: #ee6a55;
    --on-ink: #161513;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/22px var(--sans);
}
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
a { color: inherit; }

/* ---- masthead ---------------------------------------------------------- */
.masthead-inner {
  max-width: 1760px; margin: 0 auto; padding: 20px clamp(24px, 3vw, 48px) 0;
  display: flex; align-items: baseline; gap: 16px;
}
.logo { text-decoration: none; font-size: 20px; line-height: 24px; font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.logo-q { color: var(--ink); }
.logo-h { color: var(--pen); margin-left: 6px; }
#range { margin-left: auto; font-size: 12px; line-height: 16px; }

/* ---- layout ------------------------------------------------------------ */
.layout {
  max-width: 1760px; margin: 0 auto; padding: 32px clamp(24px, 3vw, 48px) 64px;
  display: grid; grid-template-columns: clamp(264px, 21vw, 360px) minmax(0, 1fr); gap: clamp(32px, 3.5vw, 64px); align-items: start;
}
.filters { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; padding-right: 22px; scrollbar-gutter: stable; display: flex; flex-direction: column; gap: 24px; scrollbar-width: thin; overscroll-behavior: contain; }
.field { border: 0; padding: 0; margin: 0; min-width: 0; display: block; }
.label { display: block; font-size: 13px; line-height: 16px; color: var(--ink-2); margin: 0 0 8px; padding: 0; }

input[type="search"] {
  width: 100%; height: 36px; font: inherit; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink);
  transition: border-color 150ms var(--ease);
}
input[type="search"]::placeholder { color: var(--ink-3); }
input[type="search"]:hover { border-color: var(--ink-3); }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
input[type="search"]:focus-visible { outline-offset: 0; }

/* year grid: a ruled table of mono cells */
.years { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--line-strong); gap: 1px; }
.yr {
  font: 400 13px/16px var(--mono); font-variant-numeric: tabular-nums; height: 32px; border: 0; border-radius: 0;
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.yr.legacy-yr { color: var(--ink-3); }
.yr:hover { background: var(--raised); }
.yr[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.yr:focus-visible { outline-offset: -2px; }

/* segmented controls */
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--line-strong); gap: 1px; }
.seg-btn {
  flex: 1; font: 400 13px/16px var(--sans); height: 32px; padding: 0 8px; border: 0; background: var(--surface); color: var(--ink);
  cursor: pointer; transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.seg-btn:hover { background: var(--raised); }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.seg-btn:focus-visible { outline-offset: -2px; }

/* topics */
.syl { margin: 24px 0 8px; font: 400 12px/16px var(--mono); color: var(--ink-3); }
.syl:first-child { margin-top: 0; }
details.group { border-top: 1px solid var(--line); padding: 4px 0; }
details.group > summary { cursor: pointer; font-size: 14px; line-height: 20px; font-weight: 500; padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(-45deg); transition: transform 150ms var(--ease); margin: 0 3px 0 2px; }
details.group[open] > summary::before { transform: rotate(45deg); }
.topic { display: flex; gap: 10px; align-items: flex-start; padding: 4px 0 4px 20px; font-size: 14px; line-height: 20px; color: var(--ink-2); cursor: pointer; transition: color 150ms var(--ease); }
.topic:hover { color: var(--ink); }
.topic:has(input:checked) { color: var(--ink); }
.topic input { appearance: none; flex: none; width: 16px; height: 16px; margin: 2px 0 0; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); cursor: pointer; display: grid; place-content: center; }
.topic input::after { content: ""; width: 8px; height: 4px; border-left: 1.5px solid var(--on-ink); border-bottom: 1.5px solid var(--on-ink); transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.topic input:checked { background: var(--ink); border-color: var(--ink); }
.topic input:checked::after { opacity: 1; }
.topic .n { margin-left: auto; font: 400 12px/20px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-3); }

/* buttons */
.btn {
  font: 500 14px/20px var(--sans); height: 36px; padding: 0 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: background-color 150ms var(--ease), transform 150ms var(--ease);
}
.btn:hover { background: var(--raised); }
.btn:active { transform: scale(0.98); }
.btn.quiet { border-color: transparent; background: none; color: var(--ink-2); align-self: flex-start; padding: 0 8px; margin-left: -8px; }
.btn.quiet:hover { color: var(--ink); background: none; text-decoration: underline; }
.only-mobile { display: none; }

/* ---- results ----------------------------------------------------------- */
.title { margin: 0; font: 400 36px/1.15 var(--serif); letter-spacing: -0.02em; max-width: 24em; }
.summary { margin: 12px 0 32px; font-size: 13px; line-height: 20px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 32px; overflow: hidden; animation: rise 360ms var(--ease) both; }
.card:nth-child(2) { animation-delay: 50ms; } .card:nth-child(3) { animation-delay: 100ms; }
.card:nth-child(4) { animation-delay: 150ms; } .card:nth-child(5) { animation-delay: 200ms; }
.card:nth-child(n+6) { animation-delay: 250ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 16px 20px; }
.card-id { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card-title { font: 500 24px/28px var(--serif); letter-spacing: -0.01em; }
.card-year { font: 400 13px/20px var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.badge-legacy { font: 400 12px/16px var(--mono); color: var(--ink-3); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 6px; }
.card-meta { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; line-height: 20px; color: var(--ink-3); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font: 400 13px/20px var(--sans); padding: 0 8px; border-radius: 4px; border: 1px solid var(--line-strong); background: none; color: var(--ink-2); cursor: pointer; transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.tag:hover { background: var(--raised); color: var(--ink); }

/* the signature: marks circled in red pen */
.marks { grid-column: 2; grid-row: 1 / span 2; justify-self: end; display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; }
.ring { position: relative; display: inline-grid; place-items: center; width: 52px; height: 36px; font: 500 17px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); isolation: isolate; }
.ring::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--pen);
  -webkit-mask: var(--scribble) center / 100% 100% no-repeat; mask: var(--scribble) center / 100% 100% no-repeat;
  --scribble: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 36'%3E%3Cpath d='M9 22C5 12 18 4 31 5.5 45 7.3 51 17 44 26 36 33.500 15 33.500 8 23.500 5 19 6.500 13 12 9' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.ring.small { width: 36px; height: 32px; }
.ring.small::before { --scribble: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 32'%3E%3Cpath d='M7 20C3.500 11 13 4 23.500 5 34 6.300 36 15 31 23 25 30 11 30.500 6 21.500 4 18 5 12.500 9 9' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

.paper { background: var(--sheet); padding: 16px 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.paper img, .guide img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.paper img + img, .guide img + img { margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(0, 0, 0, 0.18); }

.card-foot { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 12px 20px; }
.card-foot .btn { height: 32px; font-size: 13px; padding: 0 12px; }
.card-foot a { margin-left: auto; font-size: 13px; color: var(--ink-3); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.card-foot a:hover { color: var(--ink); }
.answer { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.answer .ring { font-size: 15px; color: var(--ink); }

.guide-wrap { border-top: 1px solid var(--line); }
.guide-label { font: 400 12px/16px var(--mono); color: var(--pen); padding: 12px 20px 8px; }
.guide { background: var(--sheet); padding: 16px 24px; border-top: 1px solid var(--line); border-left: 3px solid var(--pen); }

#more { display: block; margin: 8px auto 0; }
.empty { text-align: center; color: var(--ink-3); padding: 64px 0; }
.foot { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; line-height: 20px; max-width: 48em; }

@media (max-width: 860px) {
  .masthead-inner { padding: 16px 16px 0; align-items: center; }
  #range { display: none; }
  .only-mobile { display: inline-block; margin-left: auto; height: 32px; font-size: 13px; }
  .layout { grid-template-columns: 1fr; gap: 24px; padding: 24px 16px 48px; }
  .filters { position: static; max-height: none; display: none; padding: 0 0 24px; border-bottom: 1px solid var(--line); }
  .filters.open { display: flex; }
  .title { font-size: 28px; }
  .summary { margin-bottom: 24px; }
  .card-head { grid-template-columns: 1fr; padding: 16px; }
  .marks { grid-column: 1; grid-row: auto; justify-self: start; }
  .paper, .guide { padding: 12px; }
  .card-foot { padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  * { transition: none !important; }
}

.syl-tabs { margin-bottom: 8px; }
.syl-tabs .seg-btn { flex: 1; padding-inline: 6px; font-size: 12px; display: flex; flex-direction: column; align-items: center; line-height: 1.3; }
.syl-tabs .yrs { font-family: var(--mono); opacity: .75; }
.syl-block .syl { margin-top: 8px; }
.clear-top { align-self: flex-start; }

.export { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 24px; }
.export .btn { height: 32px; font-size: 13px; padding: 0 12px; }
.export .btn.quiet { padding: 0 8px; margin-left: 0; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink); opacity: .88; }
.btn:disabled { opacity: .5; cursor: default; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); cursor: pointer; margin-left: auto; }
.btn.select[aria-pressed="true"] { border-color: var(--pen); color: var(--pen); }
.card.is-selected { border-color: var(--pen); box-shadow: 0 0 0 1px var(--pen); }
@media (max-width: 860px) { .check { margin-left: 0; } }
.check select { font: 400 13px/20px var(--sans); height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }

.export { display: block; border: 1px solid var(--line-strong); border-radius: 12px; padding: 16px 20px; }
.export-title { margin: 0 0 12px; font: 400 12px/16px var(--mono); color: var(--ink-3); }
.export-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.export .check { margin-left: 0; }
.export-hint { margin: 12px 0 0; font-size: 13px; line-height: 20px; color: var(--ink-3); }

.seg.stack { flex-direction: column; }
.seg.stack .seg-btn { text-align: left; padding: 0 12px; }
.seg.stack .seg-btn { min-height: 36px; }

.redacted-note { margin: 0; padding: 10px 20px; font-size: 13px; line-height: 20px; color: var(--ink-2); background: var(--raised); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (max-width: 860px) { .redacted-note { padding: 10px 16px; } }

/* ---- export progress ---------------------------------------------------- */
.exp-progress { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
.exp-progress-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; line-height: 20px; color: var(--ink); }
.exp-progress-top .mono { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.exp-progress progress { display: block; width: 100%; height: 8px; margin: 10px 0; border: 0; border-radius: 999px; overflow: hidden; background: var(--line-strong); appearance: none; -webkit-appearance: none; }
.exp-progress progress::-webkit-progress-bar { background: var(--line-strong); border-radius: 999px; }
.exp-progress progress::-webkit-progress-value { background: var(--pen); border-radius: 999px; transition: width 200ms var(--ease); }
.exp-progress progress::-moz-progress-bar { background: var(--pen); border-radius: 999px; }
.exp-progress-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; line-height: 20px; color: var(--ink-3); }
.exp-progress-foot .btn.quiet { margin: 0; height: 28px; padding: 0 8px; font-size: 13px; }
#exp-result { margin-top: 12px; }

/* dropdown arrow: thin chevron icon, themed, with room on the right */
.check select {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.25 1.5 6 6.25 10.75 1.5' stroke='%236b665c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
@media (prefers-color-scheme: dark) { .check select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.25 1.5 6 6.25 10.75 1.5' stroke='%23aaa397' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); } }
.check select:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
