:root {
  --ink: #1c1e21;
  --muted: #5b6570;
  --paper: #fbfaf8;
  --accent: #6f3ff5;       /* Polygon purple */
  --accent-soft: #efe9ff;
  --gopher: #00add8;       /* Go cyan */
  --code-bg: #1e2233;
  --code-ink: #e6e9f0;
  --rule: #e4e0d8;
  --warn-bg: #fff6e6;
  --warn-border: #e6b34d;
}

body {
  max-width: 42rem;
  margin: 3rem auto 5rem;
  padding: 0 1.25rem;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* --- Headings --- */
h1 {
  font-size: 2rem;
  line-height: 1.15;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
h2 {
  font-size: 1.3rem;
  margin-top: 2.5rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.3rem;
}
h3 { font-size: 1.05rem; margin-top: 1.75rem; }

.kicker {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.kicker .n {
  color: var(--accent);
  font-weight: 700;
}

/* --- Prose --- */
p, li { font-size: 1.02rem; }
strong { color: #000; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

/* --- Code --- */
code {
  font-family: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--accent-soft);
  color: #3a1d8a;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 1.1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.5;
  font-size: 0.85rem;
}
pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.filename {
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.03em;
  margin-bottom: -0.6rem;
  margin-top: 1.4rem;
}

/* --- Callouts --- */
.note, .warn, .win {
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin: 1.6rem 0;
  font-size: 0.96rem;
}
.note { background: var(--accent-soft); border-left: 3px solid var(--accent); }
.warn { background: var(--warn-bg); border-left: 3px solid var(--warn-border); }
.win  { background: #e9f7ef; border-left: 3px solid #34a06a; }
.note strong, .warn strong, .win strong {
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.3rem;
}

/* --- Definition list for jargon --- */
dl.jargon { margin: 1.5rem 0; }
dl.jargon dt { font-weight: bold; margin-top: 0.8rem; }
dl.jargon dd { margin-left: 0; color: var(--muted); }

/* --- Quiz widget --- */
.quiz {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.2rem 1.3rem;
  margin: 1.8rem 0;
  background: #fff;
}
.quiz p.q { font-weight: bold; margin-top: 0; }
.quiz button {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.95rem;
  margin: 0.4rem 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
  transition: background 0.12s;
}
.quiz button:hover { background: var(--accent-soft); }
.quiz button.correct { background: #e9f7ef; border-color: #34a06a; }
.quiz button.wrong { background: #fdecea; border-color: #d9534f; }
.quiz .feedback {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* --- Primary source --- */
.source {
  margin: 2rem 0;
  padding: 1rem 1.2rem;
  border: 1px dashed var(--gopher);
  border-radius: 8px;
  background: #f0fbfd;
  font-size: 0.95rem;
}
.source strong {
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0a7d99;
}

/* --- Navigation --- */
nav.lesson-links {
  margin-top: 3.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
nav.lesson-links a { text-decoration: none; }

.teacher-nudge {
  font-style: italic;
  color: var(--muted);
  margin-top: 2rem;
}

/* --- Print (references print well) --- */
@media print {
  body { max-width: none; color: #000; background: #fff; }
  pre { background: #f4f4f4; color: #000; border: 1px solid #ccc; }
  .quiz button, nav.lesson-links { display: none; }
  a { color: #000; text-decoration: underline; }
}
