/* Shared stylesheet for the citizenship study workspace.
   Phone-first, offline, printable. No web fonts, no network calls. */

:root {
  --ink: #1a1a18;
  --ink-soft: #55534e;
  --paper: #fdfcf9;
  --rule: #d8d4c8;
  --accent: #9b1c1c;      /* Canadian red, muted for long reading */
  --accent-soft: #f5e6e6;
  --good: #1b6b3a;
  --good-soft: #e4f0e8;
  --bad: #9b1c1c;
  --bad-soft: #f7e3e3;
  --measure: 34rem;
}

* { box-sizing: border-box; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 1.25rem 1.1rem 5rem;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  line-height: 1.55;
  max-width: var(--measure);
  margin-inline: auto;
}

/* ---------- Typography ---------- */

h1 {
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 0 0 .2rem;
  font-weight: normal;
}

h2 {
  font-size: 1.15rem;
  margin: 2.2rem 0 .6rem;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--rule);
  font-weight: normal;
  letter-spacing: .01em;
}

h3 {
  font-size: 1rem;
  margin: 1.5rem 0 .4rem;
  font-weight: bold;
}

p { margin: 0 0 .85rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

ul, ol { padding-left: 1.3rem; margin: 0 0 .9rem; }
li { margin-bottom: .35rem; }

strong { font-weight: bold; }

.kicker {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .7rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 .5rem;
}

.standfirst {
  font-size: 1.02rem;
  color: var(--ink-soft);
  font-style: italic;
  margin: .6rem 0 1.6rem;
}

/* ---------- Source citations ---------- */

.cite {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: .72rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.source-note {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: .8rem;
  color: var(--ink-soft);
  border-left: 2px solid var(--rule);
  padding: .1rem 0 .1rem .8rem;
  margin: 1.2rem 0;
}

/* ---------- Callouts ---------- */

.warn {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: .8rem .9rem;
  margin: 1.3rem 0;
  font-size: .92rem;
}

.warn strong { color: var(--accent); }

.keyfact {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: .85rem .95rem;
  margin: 1.2rem 0;
}

.keyfact h3 { margin-top: 0; }

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.4rem;
  font-size: .92rem;
}

th, td {
  text-align: left;
  padding: .45rem .5rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: normal;
}

/* ---------- Quiz ---------- */

.quiz {
  margin: 2rem 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .6rem;
  font-size: .78rem;
  color: var(--ink-soft);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: .7rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--rule);
}

.quiz-timer { font-variant-numeric: tabular-nums; }
.quiz-timer.low { color: var(--bad); font-weight: bold; }

.quiz-q {
  font-family: Georgia, serif;
  font-size: 1.08rem;
  line-height: 1.4;
  margin: 0 0 1rem;
}

.quiz-opts { list-style: none; padding: 0; margin: 0; }

.quiz-opt {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: .95rem;
  line-height: 1.4;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: .8rem .9rem;
  margin-bottom: .55rem;
  cursor: pointer;
  min-height: 44px;              /* comfortable phone tap target */
  -webkit-tap-highlight-color: transparent;
}

.quiz-opt:active { transform: translateY(1px); }

.quiz-opt.correct {
  background: var(--good-soft);
  border-color: var(--good);
  color: var(--good);
}

.quiz-opt.wrong {
  background: var(--bad-soft);
  border-color: var(--bad);
  color: var(--bad);
}

.quiz-opt[disabled] { cursor: default; opacity: 1; }

.quiz-explain {
  font-size: .88rem;
  line-height: 1.5;
  background: #fff;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink-soft);
  border-radius: 4px;
  padding: .75rem .85rem;
  margin-top: .9rem;
}

.quiz-next {
  font: inherit;
  font-size: .9rem;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 6px;
  padding: .75rem 1.4rem;
  margin-top: 1rem;
  cursor: pointer;
  min-height: 44px;
}

.quiz-progress {
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1.1rem;
}

.quiz-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width .2s;
}

/* ---------- Results ---------- */

.result-score {
  font-family: Georgia, serif;
  font-size: 2.8rem;
  line-height: 1;
  margin: .3rem 0;
}

.result-verdict {
  font-family: system-ui, sans-serif;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .3rem .7rem;
  border-radius: 3px;
  display: inline-block;
}

.result-verdict.pass { background: var(--good-soft); color: var(--good); }
.result-verdict.fail { background: var(--bad-soft); color: var(--bad); }

.result-missed { margin-top: 1.6rem; }

.result-missed li {
  font-family: system-ui, sans-serif;
  font-size: .88rem;
  margin-bottom: .9rem;
}

.result-missed .yours { color: var(--bad); }
.result-missed .right { color: var(--good); }

/* ---------- Navigation ---------- */

.nav {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: .85rem;
  margin: 2.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.2rem;
}

.home-link {
  font-family: system-ui, sans-serif;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 1.2rem;
}

.card-list { list-style: none; padding: 0; margin: 0; }

.card {
  display: block;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #fff;
  padding: .85rem .95rem;
  margin-bottom: .6rem;
  text-decoration: none;
  color: var(--ink);
}

.card b { display: block; font-size: 1rem; margin-bottom: .15rem; }

.card span {
  font-family: system-ui, sans-serif;
  font-size: .8rem;
  color: var(--ink-soft);
}

.ask {
  font-family: system-ui, sans-serif;
  font-size: .85rem;
  background: #fff;
  border: 1px dashed var(--rule);
  border-radius: 6px;
  padding: .8rem .9rem;
  margin: 2rem 0 0;
  color: var(--ink-soft);
}

/* ---------- Print ---------- */

@media print {
  body { max-width: none; padding: 0; background: #fff; font-size: 11pt; }
  .quiz, .nav, .home-link, .ask { display: none; }
  h2 { page-break-after: avoid; }
  table, .keyfact { page-break-inside: avoid; }
  a { color: var(--ink); text-decoration: none; }
}

@media (min-width: 40rem) {
  html { font-size: 18px; }
  body { padding: 2.5rem 2rem 6rem; }
}

/* Personal details entered on-device (assets/personal.js). Never published. */
table.personal { width: 100%; }
table.personal td:first-child { width: 45%; }
.personal-input {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 1rem;              /* 16px minimum stops iOS zooming on focus */
  color: inherit;
  background: #fff;
  border: 1px solid #c9c2b6;
  border-radius: 4px;
  box-sizing: border-box;
}
.personal-input:focus { outline: 2px solid #8c1a1a; outline-offset: 1px; }
@media print {
  .personal-input { border: none; border-bottom: 1px solid #999; border-radius: 0; }
}
