/* ============================================================
   Thread Starvation Course — shared stylesheet
   Tufte-ish: quiet, readable, prints well, light + dark.
   Linked by every lesson and reference doc.
   ============================================================ */

:root {
  --bg:        #fdfcf9;
  --ink:       #1a1a17;
  --muted:     #6b675f;
  --rule:      #e4e0d6;
  --accent:    #a8341f;   /* oxidised red — the "broken" colour */
  --good:      #2f6b3f;   /* the "fixed" colour */
  --panel:     #f4f1e9;
  --panel-ink: #35322c;
  --code-bg:   #f4f1e9;
  --link:      #8a2b1a;
  --maxw:      44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #16161a;
    --ink:       #e6e3dc;
    --muted:     #9a958a;
    --rule:      #33323a;
    --accent:    #e8785f;
    --good:      #7fc394;
    --panel:     #201f26;
    --panel-ink: #d8d4cc;
    --code-bg:   #201f26;
    --link:      #e8785f;
  }
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "iA Writer Duo", "ET Book", Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.62;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 8rem;
  text-rendering: optimizeLegibility;
}

/* ---- structure ---- */
.eyebrow {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}
h1 { font-size: 2.05rem; line-height: 1.15; margin: 0 0 0.4rem; font-weight: 650; }
h1 + .sub { color: var(--muted); font-style: italic; margin: 0 0 2.5rem; font-size: 1.08rem; }
h2 {
  font-size: 1.32rem; margin: 2.8rem 0 0.4rem; font-weight: 650;
  border-bottom: 1px solid var(--rule); padding-bottom: 0.3rem;
}
h3 { font-size: 1.05rem; margin: 1.8rem 0 0.3rem; font-weight: 650; }
p { margin: 0.7rem 0; }
a { color: var(--link); text-decoration: none; border-bottom: 1px solid color-mix(in oklab, var(--link) 35%, transparent); }
a:hover { border-bottom-color: var(--link); }
strong { font-weight: 650; }
hr { border: none; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
small { color: var(--muted); }

/* ---- code ---- */
code, kbd, pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
code {
  background: var(--code-bg);
  padding: 0.08em 0.35em;
  border-radius: 4px;
  font-size: 0.86em;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
}
pre code { background: none; padding: 0; }
kbd {
  background: var(--panel); border: 1px solid var(--rule);
  border-bottom-width: 2px; border-radius: 5px;
  padding: 0.05em 0.45em; font-size: 0.8em;
}

/* ---- callouts ---- */
.callout {
  border-left: 3px solid var(--accent);
  background: color-mix(in oklab, var(--accent) 7%, transparent);
  padding: 0.6rem 1.1rem; margin: 1.4rem 0; border-radius: 0 6px 6px 0;
}
.callout.good { border-left-color: var(--good); background: color-mix(in oklab, var(--good) 9%, transparent); }
.callout .label {
  font-family: ui-monospace, monospace; font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 0.2rem;
}
.callout.good .label { color: var(--good); }

/* pushback: where the teacher will call you out */
.pushback { border-left-color: #b8860b; background: color-mix(in oklab, #b8860b 9%, transparent); }
.pushback .label { color: #b8860b; }

/* ---- figures / tables ---- */
figure { margin: 1.6rem 0; }
figcaption { color: var(--muted); font-size: 0.85rem; font-style: italic; margin-top: 0.4rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; margin: 1.2rem 0; }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 650; }
td.num, th.num { text-align: right; font-family: ui-monospace, monospace; }

/* ---- footer nav ---- */
.nav {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}
.ask {
  margin-top: 3rem; padding: 1rem 1.2rem; border: 1px dashed var(--rule);
  border-radius: 8px; color: var(--muted); font-size: 0.92rem;
}
.ask strong { color: var(--ink); }
.source {
  margin-top: 2rem; padding: 0.9rem 1.1rem; background: var(--panel);
  border-radius: 8px; font-size: 0.9rem;
}
.source .label { font-family: ui-monospace, monospace; font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); display:block; margin-bottom:0.25rem;}

/* ---- print ---- */
@media print {
  :root { --bg:#fff; --ink:#000; }
  body { font-size: 11pt; max-width: none; padding: 0; }
  .predict, .quiz, .nav, .ask { break-inside: avoid; }
  a { border: none; color: #000; }
}
