/* course.css — shared stylesheet for the OpenTelemetry course.
   Tufte-inspired: generous margins, readable serif body, restrained colour.
   Linked by every lesson so the course reads as one consistent thing. */

:root {
  --ink:        #1a1a1a;
  --paper:      #fdfcf9;
  --muted:      #6b6b6b;
  --rule:       #e2ddd2;
  --accent:     #7c3a12;   /* burnt sienna — links, emphasis */
  --accent-bg:  #f6efe6;
  --otel:       #4353a8;   /* OpenTelemetry-ish indigo */
  --trace:      #2e7d5b;   /* traces green */
  --metric:     #b0682a;   /* metrics amber */
  --log:        #7a4ea3;   /* logs violet */
  --code-bg:    #f4f1ea;
  --good:       #2e7d5b;
  --bad:        #b23a3a;
  --maxw:       46rem;
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0 auto;
  max-width: var(--maxw);
  padding: 3rem 1.5rem 6rem;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Course chrome ---- */
.course-tag {
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.4rem;
}
.lesson-no {
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

/* ---- Headings ---- */
h1 { font-size: 2rem; line-height: 1.15; margin: 0.2rem 0 1rem; font-weight: 600; }
h2 { font-size: 1.35rem; margin: 2.6rem 0 0.8rem; font-weight: 600;
     border-bottom: 1px solid var(--rule); padding-bottom: 0.3rem; }
h3 { font-size: 1.08rem; margin: 1.8rem 0 0.5rem; font-weight: 600; }

p { margin: 0.9rem 0; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(124,58,18,0.3); }
a:hover { border-bottom-color: var(--accent); }

strong { font-weight: 650; }
em { font-style: italic; }

ul, ol { padding-left: 1.4rem; }
li { margin: 0.35rem 0; }

/* ---- Lead / subtitle ---- */
.lead { font-size: 1.12rem; color: #333; font-style: italic; margin-bottom: 1.6rem; }

/* ---- Diagram block: monospace ASCII art in a framed box ---- */
.diagram {
  font-family: "SF Mono", "JetBrains Mono", "Fira Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  background: #fbfaf6;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.1rem 1.2rem;
  margin: 1.4rem 0;
  overflow-x: auto;
  white-space: pre;
  color: #2a2a2a;
}
.diagram .cap,
figcaption {
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 0.5rem;
  font-style: normal;
}

/* ---- Signal colour chips ---- */
.sig { font-weight: 650; padding: 0 0.15em; border-radius: 3px; }
.sig-trace  { color: var(--trace); }
.sig-metric { color: var(--metric); }
.sig-log    { color: var(--log); }
.sig-otel   { color: var(--otel); }

/* ---- Callout boxes: predict / practice / prove / note ---- */
.box {
  border-left: 4px solid var(--rule);
  background: #fbfaf6;
  padding: 0.9rem 1.1rem;
  margin: 1.4rem 0;
  border-radius: 0 6px 6px 0;
}
.box .box-title {
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 0 0 0.4rem;
}
.box.predict  { border-left-color: var(--otel);   } .box.predict  .box-title { color: var(--otel); }
.box.practice { border-left-color: var(--metric); } .box.practice .box-title { color: var(--metric); }
.box.prove    { border-left-color: var(--good);   } .box.prove    .box-title { color: var(--good); }
.box.note     { border-left-color: var(--muted);  } .box.note     .box-title { color: var(--muted); }

/* ---- Code ---- */
code {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: inherit; }

/* ---- Tables ---- */
table { border-collapse: collapse; width: 100%; margin: 1.3rem 0; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
     font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* ---- Citations ---- */
.cite { font-size: 0.82rem; color: var(--muted); }
.cite a { color: var(--muted); }
.sources { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.85rem; }
.sources h2 { border: none; font-size: 0.95rem; margin-bottom: 0.5rem; }

/* ---- Quiz widget (paired with quiz.js) ---- */
.quiz { border: 1px solid var(--rule); border-radius: 8px; padding: 1.1rem 1.2rem; margin: 1.5rem 0; background: #fff; }
.quiz .q { font-weight: 600; margin: 0 0 0.7rem; }
.quiz .opts { list-style: none; padding: 0; margin: 0; }
.quiz .opts li { margin: 0.4rem 0; }
.quiz button.opt {
  display: block; width: 100%; text-align: left; cursor: pointer;
  font: inherit; font-size: 0.92rem;
  background: #faf8f3; border: 1px solid var(--rule); border-radius: 6px;
  padding: 0.55rem 0.8rem; transition: background 0.12s, border-color 0.12s;
}
.quiz button.opt:hover { background: var(--accent-bg); }
.quiz button.opt.correct { background: #e7f3ec; border-color: var(--good); color: #1c5c40; }
.quiz button.opt.wrong   { background: #fbeaea; border-color: var(--bad);  color: #7c2323; }
.quiz .feedback { margin-top: 0.7rem; font-size: 0.88rem; min-height: 1.2em; }
.quiz .feedback.correct { color: var(--good); }
.quiz .feedback.wrong   { color: var(--bad); }

/* ---- Reveal / self-test answer ---- */
details.reveal { margin: 1rem 0; border: 1px dashed var(--rule); border-radius: 6px; padding: 0.4rem 0.9rem; background: #fbfaf6; }
details.reveal summary { cursor: pointer; font-family: ui-sans-serif, -apple-system, sans-serif; font-size: 0.85rem; color: var(--accent); font-weight: 600; }
details.reveal[open] summary { margin-bottom: 0.6rem; }

/* ---- Footer nav ---- */
.nav { margin-top: 3rem; padding-top: 1.2rem; border-top: 2px solid var(--rule);
       display: flex; justify-content: space-between; font-family: ui-sans-serif, sans-serif; font-size: 0.85rem; }

.ask { font-family: ui-sans-serif, -apple-system, sans-serif; font-size: 0.85rem;
       background: var(--accent-bg); border-radius: 6px; padding: 0.8rem 1rem; margin: 2rem 0 0; color: #5a3a20; }

/* ---- Print ---- */
@media print {
  body { max-width: none; padding: 0; font-size: 11pt; background: #fff; }
  .quiz button.opt { border: 1px solid #999; }
  .nav, .ask { display: none; }
  a { color: var(--ink); border: none; }
  .diagram { page-break-inside: avoid; }
}
