/* IT Fundamentals Test: black / tan / gold */
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Young Serif";
  src: url("fonts/young-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  color-scheme: light;
  --black: #000000;
  --ink: #221c12;
  --ink-soft: #5b4d36;
  --paper: #f3ead8;
  --tan: #e4d4b3;
  --tan-deep: #c8ae7f;
  --gold: #c99a2e;
  --gold-ink: #7d5c10;
  --surface: #fbf6ec;
  --on-gold: #000000;
  --wrong: #8f2d17;
  --focus: #7d5c10;

  --font-body: "Atkinson Hyperlegible", Verdana, Arial, sans-serif;
  --font-head: "Young Serif", Georgia, "Times New Roman", serif;
  --radius-sm: 6px;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #f1e6cf;
    --ink-soft: #c9b893;
    --paper: #000000;
    --tan: #2c2416;
    --tan-deep: #5e4c2c;
    --gold: #e0b54a;
    --gold-ink: #e8c46a;
    --surface: #15110a;
    --on-gold: #000000;
    --wrong: #f08a6c;
    --focus: #e8c46a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  min-height: 100%;
  display: flex; flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  background: var(--black);
  color: #efe4cf;
  border-bottom: 4px solid var(--gold);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand { margin: 0; font-family: var(--font-head); font-size: 1.3rem; color: #e9d8b2; }
.topbar-status { display: flex; gap: 1.25rem; font-size: 0.95rem; color: #e9d8b2; }
.status-count { color: #e0b54a; font-weight: 700; }

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--tan-deep);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2.25rem);
  max-width: 760px; margin: 0 auto;
}
.panel.narrow { max-width: 640px; }
h1, h2 { font-family: var(--font-head); font-weight: 400; line-height: 1.15; margin: 0 0 0.5rem; }
h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); }
h2 { font-size: 1.5rem; }
.lede { font-size: 1.15rem; color: var(--ink-soft); margin: 0 0 1.5rem; max-width: 34em; }

.facts {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 0 0 1.5rem; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--tan-deep);
}
.facts div { padding: 0.75rem 0.5rem 0.75rem 0; }
.facts dt { font-size: 0.9rem; color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 700; font-size: 1.4rem; }

.rules { padding-left: 1.2rem; margin: 0 0 1.75rem; max-width: 36em; }
.rules li { margin-bottom: 0.4rem; }

.resume {
  border-left: 4px solid var(--gold);
  background: var(--tan);
  padding: 0.9rem 1rem; margin-bottom: 1.5rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.resume p { margin: 0 0 0.75rem; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field label, #reset-form label { display: block; font-weight: 700; margin-bottom: 0.3rem; }
input {
  width: 100%;
  font: inherit; color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--tan-deep);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
}
input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--ink); }
input[aria-invalid="true"] { border-color: var(--wrong); }
.form-error { color: var(--wrong); min-height: 1.5em; margin: 0.5rem 0; font-weight: 700; }
.storage-warning { margin-top: 1rem; color: var(--wrong); }

/* Buttons */
.btn {
  font: inherit; font-weight: 700;
  min-height: 48px; padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--ink);
  background: transparent; color: var(--ink);
  cursor: pointer;
}
.btn:hover { background: var(--tan); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: var(--black); color: #e0b54a; }
.btn.ghost { border-color: var(--tan-deep); }
.btn.ghost[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.wide { width: 100%; margin-top: 1rem; }
.btn:focus-visible, summary:focus-visible, .bubble:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (prefers-color-scheme: dark) {
  .btn.primary:hover { background: var(--gold); color: var(--black); border-color: var(--gold); }
}

/* Test layout */
.test-layout { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 2rem; align-items: start; }
.question-card {
  background: var(--surface);
  border: 1px solid var(--tan-deep);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
}
.q-meta { display: flex; justify-content: space-between; gap: 1rem; margin: 0 0 1rem; color: var(--ink-soft); font-size: 0.95rem; }
.q-cat { font-style: italic; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend {
  font-family: var(--font-head);
  font-size: clamp(1.3rem, 2.6vw, 1.65rem);
  line-height: 1.3;
  margin-bottom: 1.25rem; padding: 0;
  max-width: 32em;
}
.choices { display: grid; gap: 0.65rem; }
.choice {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.75rem 0.9rem;
  border: 2px solid var(--tan);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
}
.choice:hover { border-color: var(--tan-deep); }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice .oval {
  flex: none;
  width: 2.1rem; height: 1.6rem;
  border: 2px solid var(--ink-soft);
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.9rem; color: var(--ink-soft);
}
.choice.selected { border-color: var(--ink); background: var(--tan); }
.choice.selected .oval { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.choice.focused { outline: 3px solid var(--focus); outline-offset: 2px; }
.flag-note { margin: 1rem 0 0; color: var(--gold-ink); font-weight: 700; }

.q-nav { display: flex; gap: 0.75rem; justify-content: space-between; margin-top: 1rem; flex-wrap: wrap; }
.q-nav .btn { flex: 1 1 8rem; }
.kbd-hint { color: var(--ink-soft); font-size: 0.9rem; margin: 0.75rem 0 0; }

/* Answer sheet: the one bold element */
.sheet-col { position: sticky; top: 1rem; }
.sheet {
  background: var(--surface);
  border: 1px solid var(--tan-deep);
  border-top: 6px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 1rem 0.85rem;
}
.sheet summary { font-family: var(--font-head); font-size: 1.2rem; cursor: pointer; }
.legend { list-style: none; padding: 0; margin: 0.6rem 0 0.8rem; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.85rem; color: var(--ink-soft); }
.legend li { display: flex; align-items: center; gap: 0.35rem; }
.dot { width: 1rem; height: 0.75rem; border-radius: 50%; border: 1.5px solid var(--ink-soft); display: inline-block; }
.dot.answered { background: var(--ink); border-color: var(--ink); }
.dot.flagged { border: 2.5px solid var(--gold); }
.bubbles {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px;
  max-height: 52vh; overflow-y: auto; padding: 4px;
}
.bubble {
  font: inherit; font-size: 0.75rem; font-variant-numeric: tabular-nums;
  min-height: 26px; padding: 0;
  border-radius: 999px;
  border: 1.5px solid var(--tan-deep);
  background: transparent; color: var(--ink-soft);
  cursor: pointer;
}
.bubble.answered { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.bubble.flagged { border: 3px solid var(--gold); }
.bubble[aria-current="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--gold-ink); }

/* Dialog */
dialog {
  border: 1px solid var(--tan-deep);
  border-top: 6px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  width: min(560px, calc(100vw - 2rem));
  padding: 1.5rem;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.review-group { margin: 0.75rem 0; }
.review-group p { margin: 0 0 0.4rem; font-weight: 700; }
.jump-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.jump-list .btn { min-height: 36px; padding: 0.2rem 0.6rem; font-size: 0.9rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.25rem; flex-wrap: wrap; }

/* Results */
.results-name { font-size: 1.15rem; margin: 0 0 0.25rem; color: var(--ink-soft); }
.score-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 0.75rem; }
.score { font-weight: 700; letter-spacing: -0.02em; font-size: clamp(3rem, 9vw, 4.75rem); line-height: 1; margin: 0; font-variant-numeric: tabular-nums; }
.score-of { font-size: 0.4em; color: var(--ink-soft); }
.verdict { margin: 0; padding: 0.5rem 1rem; border-radius: var(--radius-sm); font-weight: 700; font-size: 1.15rem; }
.verdict.pass { background: var(--gold); color: var(--on-gold); }
.verdict.fail { background: var(--ink); color: var(--paper); }
.score-detail { margin: 0.75rem 0 1.5rem; }
.cat-table { width: 100%; border-collapse: collapse; margin-bottom: 1.75rem; font-variant-numeric: tabular-nums; }
.cat-table caption { text-align: left; font-family: var(--font-head); font-size: 1.2rem; margin-bottom: 0.4rem; }
.cat-table th, .cat-table td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--tan-deep); }
.cat-table th:not(:first-child), .cat-table td:not(:first-child) { text-align: right; }
.pdf-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.pdf-msg { min-height: 1.5em; font-weight: 700; color: var(--gold-ink); }
.turn-in { color: var(--ink-soft); }
.teacher { margin-top: 2rem; border-top: 1px solid var(--tan-deep); padding-top: 1rem; font-size: 0.95rem; }
.teacher summary { cursor: pointer; color: var(--ink-soft); }
.pin-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.pin-row input { max-width: 12rem; }

.site-footer { text-align: center; color: var(--ink-soft); font-size: 0.9rem; padding: 1rem 1rem 1.5rem; }
.site-footer p { margin: 0; }

@media (max-width: 900px) {
  .test-layout { grid-template-columns: 1fr; }
  .sheet-col { position: static; }
  .bubbles { max-height: none; }
}
@media (max-width: 520px) {
  main { padding: 1rem 0.75rem 2rem; }
  .field-row { grid-template-columns: 1fr; }
  .facts dd { font-size: 1.2rem; }
  .bubble { min-height: 28px; }
  .q-nav .btn.ghost { order: 3; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
