/* Shared course stylesheet — Case AI Interview workspace.
   Linked by every lesson and reference doc. Tufte-leaning: quiet, readable, prints well. */

:root {
  --ink: #1a1a1a;
  --ink-soft: #555;
  --paper: #fffdf8;
  --rule: #d9d4c8;
  --accent: #8a3b12;        /* burnt sienna — links, lesson numbers */
  --accent-soft: #f3e6dc;
  --good: #2e6b34;
  --good-soft: #e6f0e6;
  --bad: #9a2c2c;
  --bad-soft: #f6e4e4;
  --note-soft: #eef0e6;
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", Menlo, monospace;
  --serif: "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8e4da;
    --ink-soft: #a8a396;
    --paper: #1c1a17;
    --rule: #403c34;
    --accent: #e08a4f;
    --accent-soft: #35271d;
    --good: #7fbf85;
    --good-soft: #22301f;
    --bad: #e08787;
    --bad-soft: #35201f;
    --note-soft: #262a20;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
  max-width: 46rem;
  font-family: var(--serif);
  font-size: 1.075rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.9rem; margin: 0.4rem 0 0.6rem; }
h2 { font-size: 1.35rem; margin: 2.6rem 0 0.7rem; border-bottom: 1px solid var(--rule); padding-bottom: 0.3rem; }
h3 { font-size: 1.1rem; margin: 1.8rem 0 0.5rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
p { margin: 0.7rem 0; }
strong { font-weight: 650; }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--accent-soft);
  padding: 0.08em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--accent-soft);
  padding: 0.8rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: inherit; }

/* ---- Lesson header ---- */
.kicker {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.lesson-meta {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 2rem;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid var(--rule);
}
.lesson-meta a { color: var(--ink-soft); }

/* ---- Callouts ---- */
.callout {
  margin: 1.2rem 0;
  padding: 0.8rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  font-size: 0.98rem;
}
.callout.mission { border-left-color: var(--good); background: var(--good-soft); }
.callout.trap    { border-left-color: var(--bad);  background: var(--bad-soft); }
.callout.drill   { border-left-color: #6b6b2e;     background: var(--note-soft); }
.callout .label {
  display: block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  color: var(--ink-soft);
}

/* ---- Tables ---- */
table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.table-scroll { overflow-x: auto; }

/* ---- Architecture diagram primitives ---- */
.diagram {
  font-family: var(--sans);
  font-size: 0.85rem;
  margin: 1.4rem 0;
}
.node {
  border: 1.5px solid var(--ink-soft);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  text-align: center;
  background: var(--paper);
}
.node .svc { font-weight: 700; }
.node .why { display: block; font-size: 0.78rem; color: var(--ink-soft); }
.node.aws { border-color: var(--accent); }
.arrow {
  text-align: center;
  color: var(--ink-soft);
  padding: 0.15rem 0;
  font-size: 0.9rem;
}
.fanout { display: flex; gap: 0.6rem; align-items: stretch; flex-wrap: wrap; }
.fanout > div { flex: 1 1 10rem; display: flex; flex-direction: column; }
.fanout .node { flex: 1; }
.vpc {
  border: 2px dashed var(--accent);
  border-radius: 10px;
  padding: 0.9rem;
  margin: 0.3rem 0;
}
.vpc-label {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.sidecar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
.sidecar .node { flex: 1 1 9rem; border-style: dotted; }

/* ---- Quiz (rendered by quiz.js) ---- */
.quiz { font-family: var(--sans); margin: 1.5rem 0; }
.quiz-q {
  margin: 1.4rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.quiz-q .prompt { font-weight: 650; margin-bottom: 0.6rem; }
.quiz-opt {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0.35rem 0;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); }
.quiz-opt:disabled { cursor: default; opacity: 0.75; }
.quiz-opt.correct { background: var(--good-soft); border-color: var(--good); opacity: 1; }
.quiz-opt.wrong   { background: var(--bad-soft);  border-color: var(--bad); }
.quiz-why {
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  border-top: 1px dashed var(--rule);
  padding-top: 0.5rem;
}
.quiz-score {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: var(--accent-soft);
  font-weight: 650;
}
.quiz-reset {
  margin-top: 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  color: var(--ink-soft);
}

/* ---- Footer nav / sources ---- */
.sources { font-size: 0.9rem; }
.sources li { margin: 0.3rem 0; }
.footer-nav {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 2px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ---- Reference-doc helpers ---- */
.ref-title { margin-bottom: 0; }
.ref-subtitle { color: var(--ink-soft); margin-top: 0.2rem; font-style: italic; }
.term { font-weight: 700; }
dl.glossary dt { font-weight: 700; margin-top: 0.9rem; font-family: var(--sans); font-size: 0.95rem; }
dl.glossary dd { margin: 0.15rem 0 0 0; padding-left: 1rem; border-left: 2px solid var(--rule); font-size: 0.95rem; }

/* ---- Print ---- */
@media print {
  :root { --paper: #fff; --ink: #000; }
  body { max-width: none; padding: 0; font-size: 10.5pt; }
  a { color: #000; text-decoration: none; }
  .quiz, .quiz-reset, .no-print { display: none !important; }
  h2 { break-after: avoid; }
  table, .quiz-q, .callout, .vpc { break-inside: avoid; }
}
