:root {
  --bg: #f7f6f2;
  --panel: #ffffff;
  --ink: #1d2330;
  --muted: #5d6676;
  --line: #dcd9d0;
  --grid: #e7e4dc;
  --brand: #1f5f8b;
  --water: #1f77b4;
  --jacob: #d9772b;
  --accent: #e0a100;
  --shade: rgba(120, 120, 120, 0.10);
  --good: #237a3b;
  --warn: #9a6a00;
  --bad: #b3261e;
  --key: #eef5ec;
  --keyline: #9cc79f;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c; --panel: #1a2029; --ink: #e6e9ef; --muted: #9aa3b2; --line: #2c3440; --grid: #2a313c;
    --brand: #7cc4ff; --water: #6fb6ff; --jacob: #f4a261; --accent: #ffd166; --shade: rgba(255, 255, 255, 0.06);
    --good: #6fcf8a; --warn: #f2c14e; --bad: #ff8a80; --key: #18261c; --keyline: #3f6e48;
  }
}
:root[data-theme="dark"] {
  --bg: #11151c; --panel: #1a2029; --ink: #e6e9ef; --muted: #9aa3b2; --line: #2c3440; --grid: #2a313c;
  --brand: #7cc4ff; --water: #6fb6ff; --jacob: #f4a261; --accent: #ffd166; --shade: rgba(255, 255, 255, 0.06);
  --good: #6fcf8a; --warn: #f2c14e; --bad: #ff8a80; --key: #18261c; --keyline: #3f6e48;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.6 "Source Serif 4", Georgia, serif;
}
h1, h2, h3, nav, .eyebrow, button, label, .readout, table, .verdict, .meta {
  font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
header.hero { padding: 40px 0 18px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--brand); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: 13px; }
h1 { font-size: clamp(28px, 4.5vw, 40px); line-height: 1.15; margin: 6px 0 10px; }
h2 { font-size: 26px; margin: 0 0 6px; }
h3 { font-size: 19px; margin: 22px 0 6px; }
.meta { color: var(--muted); font-size: 15px; }
nav.steps { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
nav.steps ol { list-style: none; display: flex; gap: 4px; margin: 0; padding: 8px 0; overflow-x: auto; }
nav.steps a {
  display: block; white-space: nowrap; padding: 6px 12px; border-radius: 999px; color: var(--ink);
  text-decoration: none; font-size: 15px; border: 1px solid var(--line); background: var(--panel);
}
nav.steps a:hover { border-color: var(--brand); color: var(--brand); }
section { padding: 34px 0 10px; }
.step-no { color: var(--brand); font-family: "Source Sans 3", system-ui, sans-serif; font-weight: 700; margin-right: 8px; }
.lede { color: var(--muted); margin-top: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.objectives li { margin: 4px 0; }
.videos { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.videos figure { margin: 0; }
.videos video { width: 100%; border-radius: 8px; background: #000; display: block; aspect-ratio: 16 / 9; }
.videos figcaption { font-family: "Source Sans 3", system-ui, sans-serif; font-size: 15px; color: var(--muted); margin-top: 6px; }
.key { background: var(--key); border: 1px solid var(--keyline); border-radius: 8px; padding: 6px 14px; margin: 12px 0; overflow-x: auto; }
.note { border-left: 4px solid var(--accent); padding: 4px 14px; margin: 14px 0; background: var(--panel); }
.muted { color: var(--muted); }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

/* simulator */
.sim { display: grid; grid-template-columns: 300px 1fr; gap: 18px; }
.controls label { display: block; margin: 10px 0 2px; font-size: 15px; font-weight: 600; }
.controls .val { float: right; font-weight: 400; color: var(--brand); font-variant-numeric: tabular-nums; }
.controls input[type=range] { width: 100%; accent-color: var(--brand); }
.readout { margin-top: 14px; font-size: 15px; border-top: 1px solid var(--line); padding-top: 10px; }
.readout div { display: flex; justify-content: space-between; padding: 2px 0; font-variant-numeric: tabular-nums; }
.readout span:first-child { color: var(--muted); }
.verdict { margin-top: 10px; padding: 8px 10px; border-radius: 8px; font-size: 14px; font-weight: 600; border: 1px solid currentColor; }
.verdict.good { color: var(--good); } .verdict.warn { color: var(--warn); } .verdict.bad { color: var(--bad); }
.plots { display: grid; grid-template-rows: auto auto; gap: 10px; min-width: 0; }
.plot { width: 100%; height: 300px; }
.plot-title { font-family: "Source Sans 3", system-ui, sans-serif; font-weight: 600; font-size: 15px; margin: 4px 0 0; }
button {
  font-size: 15px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); cursor: pointer;
}
button:hover { border-color: var(--brand); color: var(--brand); }
button.primary { background: var(--brand); color: var(--panel); border-color: var(--brand); }
button.primary:hover { filter: brightness(1.08); color: var(--panel); }
details { margin: 8px 0; }
details summary { cursor: pointer; font-family: "Source Sans 3", system-ui, sans-serif; font-weight: 600; }
details > div { padding: 6px 0 4px 18px; }

/* self-check */
.problem .ptext { margin-bottom: 8px; }
.pfields { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 8px 0; }
.field { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.field input {
  width: 140px; padding: 6px 8px; font-size: 16px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums;
}
.field .unit { color: var(--muted); }
.mark { font-weight: 700; width: 1em; }
.mark.good { color: var(--good); } .mark.bad { color: var(--bad); }
.pbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pfeedback { font-family: "Source Sans 3", system-ui, sans-serif; font-size: 15px; margin-top: 8px; color: var(--muted); }
.psol { margin-top: 10px; padding: 10px 14px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--line); line-height: 2; }
.tablewrap { overflow-x: auto; margin-top: 8px; }
table.data { border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { border: 1px solid var(--line); padding: 4px 8px; text-align: center; }
table.data th { background: var(--bg); }
.mc .opts { display: grid; gap: 6px; margin: 8px 0; }
.mc button.opt { text-align: left; font-family: inherit; font-size: 16px; }
.mc button.chosen-good { border-color: var(--good); color: var(--good); font-weight: 600; }
.mc button.chosen-bad { border-color: var(--bad); color: var(--bad); }
.mcfb { font-size: 16px; min-height: 1em; }
.wcalc { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-family: "Source Sans 3", system-ui, sans-serif; }
.wcalc input { width: 140px; padding: 6px 8px; font-size: 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
#wcOut { font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.next li { margin: 6px 0; }
footer { color: var(--muted); font-size: 14px; padding: 30px 0 40px; border-top: 1px solid var(--line); margin-top: 30px; font-family: "Source Sans 3", system-ui, sans-serif; }

@media (max-width: 820px) {
  .videos, .sim { grid-template-columns: 1fr; }
  .plot { height: 260px; }
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
}

/* ---- additions for Module 1 ---- */
.yt { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #000; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ytlist { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ytlist figure { margin: 0; }
.ytlist figcaption { font-family: "Source Sans 3", system-ui, sans-serif; font-size: 15px; color: var(--muted); margin-top: 6px; }
.tag { display: inline-block; font-family: "Source Sans 3", system-ui, sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin-right: 6px; }
.tag.req { color: var(--brand); border-color: var(--brand); }
.videos.three { grid-template-columns: 1fr 1fr 1fr; }
table.terms { width: 100%; border-collapse: collapse; font-size: 16px; }
table.terms th, table.terms td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
table.terms th { font-family: "Source Sans 3", system-ui, sans-serif; width: 28%; }
.match { display: grid; gap: 8px; }
.match label { display: grid; grid-template-columns: 1fr 220px 1.2em; gap: 10px; align-items: center; font-size: 16px; }
.match select { padding: 6px; font-size: 15px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.phase { display: flex; flex-direction: column-reverse; width: 90px; height: 240px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.phase div { display: flex; align-items: center; justify-content: center; font-family: "Source Sans 3", system-ui, sans-serif; font-size: 13px; font-weight: 600; }
.ph-s { background: #d8b98a; color: #3a2a12; } .ph-w { background: #4aa3df; color: #fff; } .ph-a { background: #cfd6dd; color: #333; }
.soilsim { display: grid; grid-template-columns: 280px 110px 1fr; gap: 18px; align-items: start; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.presets button { font-size: 13px; padding: 4px 10px; }
.checklist li { margin: 6px 0; }
.download { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--brand); color: var(--brand); text-decoration: none; font-family: "Source Sans 3", system-ui, sans-serif; font-weight: 600; margin: 4px 6px 4px 0; }
.download:hover { background: var(--brand); color: var(--panel); }
ol.steps-list > li { margin: 14px 0; }
.answer { font-family: "Source Sans 3", system-ui, sans-serif; display: inline-block; min-width: 120px; border-bottom: 1px solid var(--ink); }
@media (max-width: 820px) {
  .ytlist, .videos.three, .soilsim { grid-template-columns: 1fr; }
  .match label { grid-template-columns: 1fr; }
}
.pfields .field[role=radiogroup] { flex-wrap: wrap; gap: 6px 14px; }
.pfields .field[role=radiogroup] label { white-space: nowrap; }

.cards { display: grid; gap: 14px; }
a.cardlink { display: block; text-decoration: none; color: inherit; }
a.cardlink .card:hover { border-color: var(--brand); }
.card h3 { margin: 0 0 4px; } .card p { margin: 4px 0; }
.num { font-family: "Source Sans 3", system-ui, sans-serif; color: var(--brand); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
.files a { font-family: "Source Sans 3", system-ui, sans-serif; font-size: 15px; margin-right: 14px; }
.backlink { font-family: "Source Sans 3", system-ui, sans-serif; font-size: 14px; color: var(--brand); text-decoration: none; }
