/* ============================================================
   System Design, Made Clear — shared course stylesheet
   Locked from Ch 13 pilot. Do not edit per chapter.
   To add a new primitive: update 26-visual-system.md first,
   then update this file. Never inline overrides in a chapter.
   ============================================================ */

:root {
  /* surfaces */
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-soft: #F4F3EE;
  --rule: #E7E6E0;
  --rule-strong: #D8D6CE;

  /* ink */
  --ink: #0E1116;
  --ink-muted: #565C66;
  --ink-soft: #8B8F98;

  /* accents — one per job */
  --accent: #2752E7;       /* primary / user path */
  --accent-soft: #EAEFFE;
  --data: #1B7A60;         /* data / read path */
  --data-soft: #E5F2EC;
  --cache: #B8801F;        /* cache / highlight */
  --cache-soft: #FBF2DE;
  --warn: #B14A2A;         /* cost / weak / risk */
  --warn-soft: #FBEBE2;
  --pos: #1B7A60;

  /* spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 0 rgba(14,17,22,0.04);
  --shadow: 0 1px 2px rgba(14,17,22,0.04), 0 8px 24px rgba(14,17,22,0.04);

  --container: 760px;
  --wide: 1040px;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- top bar + sticky framework ribbon ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250,250,247,0.85);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex; align-items: center; gap: 24px;
  font-size: 13px;
  color: var(--ink-muted);
}
.topbar .course {
  font-weight: 600; color: var(--ink); letter-spacing: -0.01em;
}
.topbar .course a { color: inherit; text-decoration: none; }
.topbar .chap { color: var(--ink-soft); }
.ribbon {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 500;
}
.ribbon .step {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  transition: all .2s ease;
}
.ribbon .step .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-soft);
}
.ribbon .step.active {
  color: var(--ink);
  background: var(--accent-soft);
  border-color: rgba(39,82,231,0.18);
}
.ribbon .step.active .dot { background: var(--accent); }
.ribbon .sep { color: var(--ink-soft); opacity: 0.4; }

/* ---------- layout ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.wide { max-width: var(--wide); margin: 0 auto; padding: 0 24px; }

section { padding: var(--s8) 0; border-bottom: 1px solid var(--rule); }
section:last-of-type { border-bottom: 0; }

.eyebrow {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--s3);
}

h1, h2, h3, h4 { color: var(--ink); letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
h1 { font-size: 56px; font-weight: 600; }
h2 { font-size: 32px; font-weight: 600; margin-bottom: var(--s5); }
h3 { font-size: 21px; font-weight: 600; margin: 0 0 var(--s3); }
h4 { font-size: 15px; font-weight: 600; }

p { margin: 0 0 var(--s4); color: var(--ink); }
p.lead { font-size: 19px; color: var(--ink-muted); }

ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean > li {
  position: relative;
  padding: 10px 0 10px 26px;
  border-bottom: 1px dashed var(--rule);
  color: var(--ink);
}
ul.clean > li:last-child { border-bottom: 0; }
ul.clean > li:before {
  content: ""; position: absolute; left: 4px; top: 19px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink);
}
ul.clean.muted > li:before { background: var(--ink-soft); }

/* ---------- hero ---------- */
.hero { padding: 96px 0 var(--s8); }
.hero .meta {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink-soft); font-size: 13px; font-weight: 500;
  margin-bottom: var(--s5);
}
.hero .meta .pill {
  padding: 4px 10px; border: 1px solid var(--rule-strong); border-radius: 999px;
  color: var(--ink); background: var(--surface);
}
.hero h1 .accent { color: var(--accent); }
.hero .subtitle {
  font-family: 'Newsreader', Georgia, serif;
  font-style: italic;
  font-size: 22px;
  color: var(--ink-muted);
  margin-top: var(--s5);
  max-width: 640px;
  line-height: 1.5;
}
.hero .objective {
  margin-top: var(--s7);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  color: var(--ink);
}
.hero .objective .label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 6px;
}

/* ---------- learning science blocks ---------- */
.science-grid,
.misconception-row,
.faded-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4);
  margin-top: var(--s5);
}
.science-card,
.misconception-row > div,
.faded-step {
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.science-card h3,
.misconception-row h3,
.faded-step h3 {
  font-size: 17px;
  margin-bottom: var(--s3);
}
.science-card p,
.misconception-row p,
.faded-step p {
  color: var(--ink-muted);
}
.science-card p:last-child,
.misconception-row p:last-child,
.faded-step p:last-child {
  margin-bottom: 0;
}
.science-label {
  display: inline-block;
  margin-bottom: var(--s3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.misconception-row .wrong { border-left: 3px solid var(--warn); }
.misconception-row .better { border-left: 3px solid var(--accent); }
.misconception-row .move { border-left: 3px solid var(--ok); }
.faded-practice .lead { max-width: 760px; }
.faded-step .step-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 24px;
  padding: 0 8px;
  margin-bottom: var(--s3);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- callout cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s5);
  box-shadow: var(--shadow-sm);
}
.card.tinted { background: var(--surface-soft); }
.card .card-title {
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: var(--s3);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s4); }

/* ---------- mental model ---------- */
.mental {
  background: var(--surface-soft);
  border-radius: var(--radius-lg);
  padding: var(--s7);
  text-align: center;
}
.mental .head {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 30px;
  color: var(--ink);
  line-height: 1.25;
  max-width: 620px; margin: 0 auto var(--s5);
  letter-spacing: -0.01em;
}
.mental .head em { color: var(--accent); font-style: normal; }

/* ---------- speaking script ---------- */
.scripts { display: grid; gap: var(--s4); }
.script {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: var(--s5);
  padding: var(--s4) 0;
  border-bottom: 1px dashed var(--rule);
  align-items: start;
}
.script:last-child { border-bottom: 0; }
.script .tag {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent);
  padding-top: 4px;
}
.script .quote {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 19px; line-height: 1.5;
  color: var(--ink);
}
.script .quote:before { content: "\201C"; color: var(--ink-soft); margin-right: 2px; }
.script .quote:after { content: "\201D"; color: var(--ink-soft); margin-left: 2px; }

/* ---------- weak / strong ---------- */
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-bottom: var(--s4); }
.vs > div {
  padding: var(--s5);
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
}
.vs .weak { border-left: 3px solid var(--warn); background: var(--warn-soft); }
.vs .strong { border-left: 3px solid var(--pos); background: var(--data-soft); }
.vs .label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 8px;
}
.vs .weak .label { color: var(--warn); }
.vs .strong .label { color: var(--pos); }
.vs .line {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 18px; line-height: 1.5;
  color: var(--ink);
}

/* ---------- mistakes list ---------- */
ul.mistakes { list-style: none; padding: 0; margin: 0; }
ul.mistakes > li {
  position: relative;
  padding: 12px 0 12px 30px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}
ul.mistakes > li:last-child { border-bottom: 0; }
ul.mistakes > li:before {
  content: "\00d7";
  position: absolute; left: 0; top: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  color: var(--warn); font-weight: 700;
  background: var(--warn-soft);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}

/* ---------- trade-off table ---------- */
.tradeoff {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 15px;
}
.tradeoff th, .tradeoff td {
  text-align: left; padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.tradeoff thead th {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-muted);
  background: var(--surface-soft);
}
.tradeoff tbody tr:last-child td { border-bottom: 0; }
.tradeoff td.choice { font-weight: 600; color: var(--ink); width: 22%; }
.tradeoff td.line {
  font-family: 'Newsreader', Georgia, serif;
  font-style: italic;
  color: var(--ink);
}
.tradeoff .default-tag {
  display: inline-block; margin-left: 8px;
  font-family: 'Inter', sans-serif; font-style: normal;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}
.table-scroll:focus {
  outline: 2px solid rgba(39,82,231,0.35);
  outline-offset: 3px;
}
.rubric-table {
  min-width: 920px;
}
.rubric-table th:first-child,
.rubric-table td:first-child {
  width: 18%;
}

/* ---------- case study ---------- */
.case-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-top: var(--s5);
}
.case-grid > div {
  padding: var(--s5); border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
}
.case-grid h4 {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--s3);
}
.case-grid ul { margin: 0; padding-left: 18px; }
.case-grid ul li { margin: 6px 0; }

/* ---------- practice / model answer ---------- */
.practice {
  padding: var(--s6);
  background: var(--surface);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
}
.practice .prompt-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 10px;
}
.practice .prompt {
  font-size: 22px; line-height: 1.4; font-weight: 500; color: var(--ink);
  margin-bottom: var(--s5);
}
details.model {
  margin-top: var(--s5);
  border-top: 1px solid var(--rule);
  padding-top: var(--s4);
}
details.model summary {
  cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--accent);
  list-style: none;
}
details.model summary::-webkit-details-marker { display: none; }
details.model summary:before {
  content: "\25B8"; display: inline-block; margin-right: 8px;
  transition: transform .15s ease; color: var(--accent);
}
details.model[open] summary:before { transform: rotate(90deg); }
details.model .answer {
  margin-top: var(--s4);
  font-family: 'Newsreader', Georgia, serif;
  font-size: 18px; line-height: 1.6; color: var(--ink);
}

/* ---------- memory hook ---------- */
.memory {
  background: var(--ink); color: #fff;
  border-radius: var(--radius-lg);
  padding: var(--s8) var(--s7);
  text-align: center;
}
.memory .label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: var(--s4);
}
.memory .line {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 40px; line-height: 1.15;
  letter-spacing: -0.01em;
  color: #fff;
  max-width: 720px; margin: 0 auto;
}
.memory .line .accent { color: #93AFFF; }

/* ---------- recap ---------- */
.recap { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.recap .item {
  padding: var(--s5);
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
}
.recap .num {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 32px; color: var(--accent);
  line-height: 1; margin-bottom: var(--s3);
}
.recap .interview-line {
  margin-top: var(--s7); padding: var(--s5);
  background: var(--accent-soft);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.recap .interview-line .label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 6px;
}
.recap .interview-line .quote {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 19px; color: var(--ink);
}

/* ---------- chapter index hub ---------- */
.parts { display: grid; gap: var(--s7); }
.part-block .part-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--s3);
}
.part-block h2 { font-size: 24px; margin-bottom: var(--s5); }
.chapter-list { display: grid; gap: var(--s3); }
.chapter-card {
  display: grid; grid-template-columns: 56px 1fr auto;
  gap: var(--s4); align-items: center;
  padding: var(--s4) var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s ease, transform .15s ease;
}
.chapter-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.chapter-card.draft {
  background: var(--surface-soft);
  border-style: dashed;
  cursor: default;
}
.chapter-card.draft:hover { transform: none; border-color: var(--rule-strong); }
.chapter-card .num {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 26px; color: var(--accent); line-height: 1;
}
.chapter-card.draft .num { color: var(--ink-soft); }
.chapter-card .title { font-weight: 600; }
.chapter-card .sub { display: block; font-size: 13px; color: var(--ink-muted); margin-top: 2px; font-weight: 400; }
.chapter-card .status {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  background: var(--data-soft); color: var(--data);
}
.chapter-card.draft .status { background: var(--rule); color: var(--ink-soft); }

/* ---------- training system ---------- */
.training-band {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--s6);
  box-shadow: var(--shadow-sm);
}
.training-band h3 { margin-bottom: var(--s3); }
.training-band p:last-child { margin-bottom: 0; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s4);
  margin-top: var(--s5);
}
.metric {
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.metric .value {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 34px;
  line-height: 1;
  color: var(--accent);
  margin-bottom: var(--s3);
}
.metric .label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s4);
}
.route-card {
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.route-card .route-label,
.drill-card .drill-label,
.scorecard .score-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s2);
}
.route-card h3,
.drill-card h3 {
  font-size: 20px;
  margin-bottom: var(--s3);
}
.route-card ul,
.drill-card ul,
.scorecard ul {
  margin: 0;
  padding-left: 18px;
}
.route-card li,
.drill-card li,
.scorecard li {
  margin: 6px 0;
}

.drill-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4);
}
.drill-card {
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.drill-card.emphasis {
  background: var(--accent-soft);
  border-color: rgba(39,82,231,0.22);
}

.scorecard {
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.score-row {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 0.9fr 0.9fr 0.9fr;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  font-size: 14px;
}
.score-row > div {
  padding: 12px 14px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.score-row > div:nth-child(5n) { border-right: 0; }
.score-row > div:nth-last-child(-n+5) { border-bottom: 0; }
.score-row .head {
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.score-row .criterion { font-weight: 600; color: var(--ink); }

.timeline {
  display: grid;
  gap: var(--s4);
}
.timeline-step {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: var(--s5);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.timeline-step .time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.training-loop {
  padding: var(--s6);
  background: var(--surface-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.training-loop .loop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4);
  margin-top: var(--s5);
}
.training-loop .loop-item {
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.training-loop .loop-item h3 {
  font-size: 18px;
  margin-bottom: var(--s3);
}
.training-loop .loop-item p { color: var(--ink-muted); }
.training-loop .loop-item p:last-child { margin-bottom: 0; }

/* ---------- diagram caption ---------- */
.figure { margin: var(--s6) 0 var(--s5); }
.figure svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.figcap {
  font-size: 13px; color: var(--ink-muted);
  text-align: center; margin-top: var(--s3);
  font-family: 'Newsreader', Georgia, serif; font-style: italic;
}

/* svg type */
svg text { font-family: 'Inter', sans-serif; }
svg text.mono { font-family: 'JetBrains Mono', monospace; }

/* ---------- footer ---------- */
footer {
  padding: var(--s8) 0;
  color: var(--ink-soft); font-size: 13px;
  text-align: center;
}
footer a { color: var(--ink-muted); text-decoration: none; border-bottom: 1px solid var(--rule); }
footer a:hover { color: var(--accent); border-color: var(--accent); }

/* responsive */
@media (max-width: 820px) {
  h1 { font-size: 40px; }
  h2 { font-size: 26px; }
  .grid-2, .vs, .case-grid, .recap, .grid-3, .grid-4,
  .metric-grid, .route-grid, .drill-grid, .training-loop .loop-grid,
  .science-grid, .misconception-row, .faded-steps { grid-template-columns: 1fr; }
  .ribbon { display: none; }
  .memory .line { font-size: 28px; }
  .script { grid-template-columns: 1fr; gap: 6px; }
  .chapter-card { grid-template-columns: 40px 1fr; }
  .chapter-card .status { display: none; }
  .score-row { grid-template-columns: 1fr; }
  .score-row > div { border-right: 0; }
  .timeline-step { grid-template-columns: 1fr; gap: var(--s2); }
}

/* Back to articulet.com — added when course was integrated into articulet.com */
.topbar-inner .back-articulet {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  color: #6b7280;
  text-decoration: none;
  margin-right: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.topbar-inner .back-articulet:hover {
  background: rgba(0,0,0,0.04);
  color: #1a1a1a;
}
