:root {
  color-scheme: light dark;
  --bg: #eef4ef;
  --surface: #ffffff;
  --ink: #10241b;
  --muted: #4d6357;
  --line: #cfdcd2;
  --primary: #1d6b4f;
  --accent: #b45309;
  --good: #137a46;
  --bad: #a1262b;
  --head: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --body: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1914;
    --surface: #15251d;
    --ink: #e6f0ea;
    --muted: #a3b9ab;
    --line: #263d31;
    --primary: #7fd1a6;
    --accent: #ffb454;
    --good: #6fd68f;
    --bad: #ff8a8f;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.65;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--head);
}
.skip:focus { left: 0; }

a { color: var(--primary); }

a:focus-visible,
button:focus-visible,
.opt:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Header */
header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  max-width: 66rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0;
  font-family: var(--head);
}

.brand {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav a {
  padding: 0.25rem 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
nav a:hover { color: var(--ink); }
nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Layout and type */
main {
  max-width: 66rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

h1, h2, h3, legend {
  font-family: var(--head);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 {
  max-width: 14ch;
  margin: 0 0 1rem;
  font-size: clamp(2.4rem, 1.3rem + 5.2vw, 4.75rem);
  letter-spacing: -0.035em;
}

h2 { margin: 0 0 0.75rem; font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); }

.lead { max-width: 36rem; font-size: 1.3rem; }

.btn {
  display: inline-block;
  padding: 0.75rem 1.3rem;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: var(--primary);
  color: var(--bg);
  font-family: var(--head);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--primary); }

/* Theme strip: the one memorable element */
.strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin: 2.5rem 0 0;
  overflow: hidden;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 6px;
}

.strip button {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 7rem;
  padding: 0.9rem 0.8rem;
  border: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--head);
  text-align: left;
  cursor: pointer;
}
.strip button:hover { background: var(--surface); }
.strip button[aria-selected="true"] { background: var(--primary); color: var(--bg); }
.strip button:focus-visible { outline-offset: -6px; }

.strip .n { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.strip .t { font-size: 0.95rem; font-weight: 700; line-height: 1.2; }

@media (max-width: 52rem) {
  .strip { grid-template-columns: repeat(3, 1fr); }
  /* Last theme alone on its row fills the row */
  .strip button:last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
}
@media (max-width: 32rem) {
  .strip { grid-template-columns: repeat(2, 1fr); }
  .strip button { min-height: 6rem; }
  .strip button:last-child:nth-child(3n + 1) { grid-column: auto; }
  .strip button:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

.panel { max-width: 44rem; margin-top: 2rem; }
.panel[hidden] { display: none; }
.panel:focus-visible { outline-offset: 8px; }
.panel p { margin: 0 0 1rem; }

.task {
  padding-left: 1.1rem;
  border-left: 5px solid var(--accent);
}

.cta { margin-top: 2.5rem; }

/* Quiz */
.quiz { max-width: 44rem; margin-top: 2rem; }

fieldset.q {
  margin: 0 0 2rem;
  padding: 1.25rem 0 0;
  border: 0;
  border-top: 2px solid var(--line);
}
legend { padding: 0 1rem 0 0; font-size: 1.3rem; line-height: 1.25; }

.opt {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0.6rem;
  margin: 0 -0.6rem;
  border-radius: 4px;
  cursor: pointer;
}
.opt input { flex: none; width: 1.25rem; height: 1.25rem; margin-top: 0.3rem; accent-color: var(--primary); }
.opt.locked { cursor: default; }
.opt.correct { color: var(--good); font-weight: 700; }
.opt.correct span::after { content: "  \2713"; }
.opt.wrong { color: var(--bad); }
.opt.wrong span::after { content: "  \2717"; }

.feedback { margin: 0.5rem 0 0; min-height: 1.65rem; }
.feedback strong { font-family: var(--head); }
.feedback.good strong { color: var(--good); }
.feedback.bad strong { color: var(--bad); }

.summary {
  max-width: 44rem;
  padding: 1.5rem;
  background: var(--surface);
  border-left: 6px solid var(--primary);
}
.summary[hidden] { display: none; }
.summary h2 { margin-bottom: 0.5rem; }
.summary p { margin: 0 0 0.75rem; }
.summary ul { margin: 0 0 1rem; padding-left: 1.2rem; }

footer.site {
  max-width: 66rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  border-top: 2px solid var(--line);
  color: var(--muted);
  font-family: var(--head);
  font-size: 0.95rem;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
