/* Shared lesson stylesheet — Tufte-inspired, dense but readable */
:root {
  --bg: #f7f4ef;
  --ink: #1a1a1a;
  --muted: #5c574f;
  --rule: #d4cfc4;
  --accent: #0b3d5c;
  --accent-soft: #e6eef4;
  --warn: #7a3e00;
  --warn-soft: #f5ead8;
  --ok: #1e4d2b;
  --ok-soft: #e3f0e6;
  --code-bg: #efeae2;
  --card: #fffdf9;
  --max: 48rem;
  --wide: 72rem;
  font-size: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  line-height: 1.55;
}

.wrap {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

header.lesson-header {
  max-width: var(--max);
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1.5rem;
}

header.lesson-header .meta {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: system-ui, -apple-system, sans-serif;
}

h1 {
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0.4rem 0 0.75rem;
  color: var(--accent);
}

.lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: var(--max);
}

h2 {
  font-size: 1.45rem;
  margin: 2.75rem 0 0.85rem;
  color: var(--accent);
  max-width: var(--max);
}

h3 {
  font-size: 1.1rem;
  margin: 1.75rem 0 0.5rem;
  max-width: var(--max);
}

p, ul, ol, blockquote, .callout, .quiz, .nav-footer {
  max-width: var(--max);
}

p { margin: 0.7rem 0; }

ul, ol { padding-left: 1.3rem; }

li { margin: 0.35rem 0; }

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

code, .path {
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.08em 0.32em;
  border-radius: 3px;
}

pre {
  max-width: var(--wide);
  background: #1e2430;
  color: #e8e6e1;
  padding: 1rem 1.15rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.45;
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

pre code { background: none; color: inherit; padding: 0; }

blockquote {
  margin: 1rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.callout {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin: 1.2rem 0;
}

.callout.accent { background: var(--accent-soft); border-color: #b7c9d6; }
.callout.warn { background: var(--warn-soft); border-color: #e0c9a0; }
.callout.ok { background: var(--ok-soft); border-color: #a8cbb3; }

.callout strong.label {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

/* Wide comparison tables */
.table-wrap {
  max-width: var(--wide);
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.4;
}

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

th {
  background: #ebe6dc;
  font-weight: 600;
  position: sticky;
  top: 0;
}

tr:last-child td { border-bottom: none; }

td.skill {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.84rem;
  white-space: nowrap;
  font-weight: 600;
  color: var(--accent);
}

.tag {
  display: inline-block;
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.12em 0.45em;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  text-transform: uppercase;
}

.tag.user { background: #e8e0f4; color: #3d2a6d; }
.tag.model { background: #dceee3; color: #1e4d2b; }

.flow {
  max-width: var(--wide);
  background: #1e2430;
  color: #e8e6e1;
  padding: 1.1rem 1.25rem;
  border-radius: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
}

.quiz {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  margin: 1.5rem 0;
}

.quiz h3 { margin-top: 0; }

.quiz .q { margin: 1.25rem 0 0.5rem; font-weight: 600; }

.quiz label {
  display: block;
  padding: 0.45rem 0.6rem;
  margin: 0.25rem 0;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
}

.quiz label:hover { background: var(--accent-soft); }

.quiz button {
  margin-top: 1rem;
  font-family: system-ui, sans-serif;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.quiz button:hover { filter: brightness(1.08); }

.quiz .feedback {
  margin-top: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
  display: none;
}

.quiz .feedback.show { display: block; }
.quiz .feedback.good { background: var(--ok-soft); color: var(--ok); }
.quiz .feedback.bad { background: #f6e4e4; color: #6b1c1c; }

.nav-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
  color: var(--muted);
}

.nav-footer a { font-weight: 600; }

.teacher-note {
  max-width: var(--max);
  margin-top: 2rem;
  padding: 1rem 1.1rem;
  border: 1px dashed var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
}

.toc {
  max-width: var(--max);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.9rem 1.2rem;
  margin: 1.5rem 0 2rem;
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
}

.toc ol { margin: 0.4rem 0 0; }

.cite {
  font-size: 0.88rem;
  color: var(--muted);
}

.cite a { color: var(--muted); }

@media print {
  body { background: #fff; font-size: 11pt; }
  .quiz button, .teacher-note { display: none; }
  pre, .flow { white-space: pre-wrap; }
}
