/* teach.css — shared stylesheet for the MCP Protocol Internals course.
   Tufte-inspired: generous margins, serif body, restrained palette, print-friendly. */

:root {
  --ink:        #1a1a18;
  --paper:      #fffff8;   /* warm Tufte paper */
  --muted:      #6b6b66;
  --rule:       #d8d8cf;
  --accent:     #8a1c1c;   /* deep red for emphasis & links */
  --accent-2:   #1c4a8a;   /* blue for citations */
  --wire-bg:    #11150f;   /* terminal-ish trace background */
  --wire-ink:   #e6e6dd;
  --wire-dim:   #7f9d6f;
  --key-bg:     #fbf3d8;
  --warn-bg:    #fbe6e3;
  --note-bg:    #e9f0f7;
  --maxw:       43rem;
}

html { font-size: 17px; }
body {
  margin: 0 auto;
  max-width: var(--maxw);
  padding: 4rem 1.5rem 6rem;
  background: var(--paper);
  color: var(--ink);
  font-family: et-book, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* --- masthead --- */
.eyebrow {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}
h1 { font-size: 2.1rem; line-height: 1.1; font-weight: 400; margin: .2rem 0 .4rem; }
.subtitle { color: var(--muted); font-style: italic; font-size: 1.15rem; margin: 0 0 1.2rem; }
.masthead { border-bottom: 1px solid var(--rule); padding-bottom: 1.2rem; margin-bottom: 2rem; }

h2 { font-size: 1.4rem; font-weight: 600; margin: 2.6rem 0 .6rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin: 1.8rem 0 .4rem; }
p, li { font-size: 1.05rem; }
a { color: var(--accent-2); text-decoration: none; border-bottom: 1px solid rgba(28,74,138,.3); }
a:hover { border-bottom-color: var(--accent-2); }

/* citation superscript links */
sup.cite a { color: var(--accent-2); font-size: .7rem; border: none; padding-left: .1rem; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .9em; background: #f1f1e8; padding: .08em .32em; border-radius: 3px;
}

/* --- the raw-traffic / wire trace block: the heart of this course --- */
.wire {
  background: var(--wire-bg); color: var(--wire-ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .82rem; line-height: 1.5;
  padding: 1rem 1.1rem; border-radius: 7px; overflow-x: auto;
  margin: 1rem 0; white-space: pre; tab-size: 2;
}
.wire .c { color: var(--wire-dim); }                 /* dim comment / annotation */
.wire .hdr { color: #8fc7ff; }                       /* HTTP header name */
.wire .meth { color: #ffd479; font-weight: 600; }    /* method / verb */
.wire .key { color: #c3e88d; }                        /* json key of interest */
.wire .bad { color: #ff8a80; font-weight: 600; }      /* error / bad */
.wire .ok  { color: #b9f6ca; }                         /* success */
.wire b { color: #fff; font-weight: 600; }

/* annotated callout boxes */
.callout { border-left: 4px solid var(--accent); padding: .7rem 1rem; margin: 1.2rem 0; border-radius: 0 5px 5px 0; }
.callout p:last-child { margin-bottom: 0; }
.callout .label { font-family: ui-monospace, monospace; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: .3rem; }
.callout.key  { background: var(--key-bg); border-color: #c9a227; }
.callout.key .label { color: #8a6d0b; }
.callout.warn { background: var(--warn-bg); border-color: var(--accent); }
.callout.warn .label { color: var(--accent); }
.callout.note { background: var(--note-bg); border-color: var(--accent-2); }
.callout.note .label { color: var(--accent-2); }

/* margin notes (Tufte) — inline on narrow screens */
.marginnote { color: var(--muted); font-size: .85rem; font-style: italic; display: block; margin: .4rem 0 .8rem; padding-left: 1rem; border-left: 2px solid var(--rule); }

/* numbered step list */
ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 2.4rem; margin: .9rem 0; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 1.6rem; height: 1.6rem; background: var(--accent); color: #fff;
  border-radius: 50%; text-align: center; line-height: 1.6rem; font-size: .85rem;
  font-family: ui-monospace, monospace;
}

/* try-it task box */
.task { background: #f4f4ea; border: 1px dashed var(--muted); border-radius: 7px; padding: 1rem 1.2rem; margin: 1.4rem 0; }
.task h3 { margin-top: 0; }

/* --- interactive quiz widget (used via quiz.js) --- */
.quiz { background: #f4f4ea; border: 1px solid var(--rule); border-radius: 7px; padding: 1.1rem 1.2rem; margin: 1.4rem 0; }
.quiz .q { font-weight: 600; margin-bottom: .7rem; }
.quiz button.opt {
  display: block; width: 100%; text-align: left; margin: .35rem 0; padding: .55rem .8rem;
  font: inherit; font-size: .98rem; background: var(--paper); border: 1px solid var(--rule);
  border-radius: 5px; cursor: pointer; transition: background .12s, border-color .12s;
}
.quiz button.opt:hover { border-color: var(--muted); }
.quiz button.opt.correct { background: #d9f2d9; border-color: #3a9a3a; }
.quiz button.opt.wrong   { background: #f7dcdc; border-color: var(--accent); }
.quiz .feedback { margin-top: .6rem; font-size: .95rem; min-height: 1.2rem; }
.quiz .feedback.show { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* footer / nav */
.lesson-footer { margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .95rem; }
.lesson-footer a { color: var(--accent-2); }
.primary-source { background: var(--key-bg); border-radius: 7px; padding: .9rem 1.1rem; margin: 1.5rem 0; }
.primary-source .label { font-family: ui-monospace, monospace; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: #8a6d0b; display: block; margin-bottom: .25rem; }
.ask-teacher { font-style: italic; color: var(--muted); }

@media print {
  body { padding: 0; max-width: 100%; font-size: 11pt; }
  .wire { border: 1px solid #999; background: #f6f6f0 !important; color: #111 !important; }
  .wire .c, .wire .hdr, .wire .meth, .wire .key, .wire .ok { color: #444 !important; }
  .wire .bad { color: #900 !important; }
  .quiz, .task { break-inside: avoid; }
  a { color: inherit; border: none; }
}
