/* Shared look for every module of "An Intuitive Introduction to Kalman Filtering".
   Color code used in every figure, widget and slide:
     blue  = truth      red = sensor measurement      green = our estimate      */
:root {
  --paper: #f6f4ee;  --card: #ffffff;  --ink: #1b2430;  --muted: #5d6875;  --rule: #d9d4c7;
  --truth: #0072bd;  --meas: #d95319;  --est: #3d8f2f;  --gold: #b9770e;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", Cambria, Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "Cascadia Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #2a323d; color: var(--ink); font-family: var(--sans); }

/* ---------- slide stage: a fixed 1280 x 720 page scaled to fit the window ---------- */
body.deck { overflow: hidden; }
#stage { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px;
  transform-origin: 0 0; background: var(--paper); box-shadow: 0 10px 40px rgba(0,0,0,.45); overflow: hidden; }
.slide { position: absolute; inset: 0 0 44px 0; padding: 44px 64px 20px; display: none; flex-direction: column; }
.slide.active { display: flex; }
.slide h1 { font-family: var(--serif); font-size: 58px; line-height: 1.08; margin: 0 0 18px; font-weight: 600; letter-spacing: -.5px; }
.slide h2 { font-family: var(--serif); font-size: 38px; line-height: 1.15; margin: 0 0 6px; font-weight: 600; }
.slide h3 { font-size: 21px; margin: 0 0 6px; }
.kicker { font-size: 14px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--gold); font-weight: 700; margin-bottom: 8px; }
.lede { font-size: 23px; line-height: 1.45; color: var(--muted); margin: 4px 0 14px; max-width: 1000px; }
.slide p, .slide li { font-size: 21px; line-height: 1.45; }
.slide ul, .slide ol { margin: 6px 0; padding-left: 26px; }
.slide li { margin: 6px 0; }
.small { font-size: 16px !important; color: var(--muted); }
.body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: center; flex: 1; min-height: 0; }
.cols.wide-right { grid-template-columns: 0.8fr 1.2fr; }
.cols.wide-left { grid-template-columns: 1.2fr 0.8fr; }
.center { text-align: center; }
figure { margin: 0; text-align: center; min-height: 0; }
figure img { max-width: 100%; max-height: 470px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
figure.tall img { max-height: 520px; }
figcaption { font-size: 15px; color: var(--muted); margin-top: 6px; }
.truth { color: var(--truth); font-weight: 600; }  .meas { color: var(--meas); font-weight: 600; }  .est { color: var(--est); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 16px 20px; }
.callout { border-left: 5px solid var(--gold); background: #fffaf0; padding: 12px 18px; font-size: 21px; line-height: 1.4; border-radius: 0 6px 6px 0; margin: 10px 0; }
.question { font-family: var(--serif); font-size: 34px; line-height: 1.3; font-style: italic; text-align: center; max-width: 980px; margin: 10px auto; }
.eq { font-size: 30px; text-align: center; margin: 14px 0; font-family: var(--serif); }
.eq math { font-size: 32px; }
math { font-family: "Cambria Math", "STIX Two Math", serif; }
code, pre { font-family: var(--mono); }
pre { background: #1f2933; color: #e6edf3; padding: 14px 18px; border-radius: 8px; font-size: 16.5px; line-height: 1.45; margin: 8px 0; overflow: hidden; }
pre .c { color: #8fb97a; }  pre .k { color: #ffb86b; }
code { background: #ebe7dc; padding: 1px 6px; border-radius: 4px; font-size: .9em; }
table.grid { border-collapse: collapse; width: 100%; font-size: 17px; }
table.grid th { text-align: left; border-bottom: 2px solid var(--ink); padding: 6px 10px; font-size: 15px; letter-spacing: .3px; }
table.grid td { border-bottom: 1px solid var(--rule); padding: 7px 10px; vertical-align: top; line-height: 1.3; }
table.grid td:first-child { font-weight: 600; white-space: nowrap; }

/* widgets */
.widget { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 16px; }
.widget canvas { display: block; width: 100%; }
.controls { display: flex; gap: 16px; align-items: center; font-size: 17px; margin-top: 8px; flex-wrap: wrap; }
.controls input[type=range] { flex: 1; min-width: 180px; accent-color: var(--gold); }
.controls output { font-family: var(--mono); min-width: 84px; font-weight: 700; }
button.btn { font: 600 16px var(--sans); padding: 7px 14px; border-radius: 6px; border: 1px solid var(--ink); background: var(--card); color: var(--ink); cursor: pointer; }
button.btn:hover { background: var(--ink); color: #fff; }
.readout { font-family: var(--mono); font-size: 16px; color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.gallery .cell { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px 6px; }
.gallery .cell b { font-size: 16px; }  .gallery .cell span { display: block; font-size: 13px; color: var(--muted); line-height: 1.25; min-height: 33px; }
.gallery canvas { width: 100%; height: 92px; display: block; }

/* concept checks */
details.check { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 18px; margin: 9px 0; }
details.check summary { font-size: 21px; font-weight: 600; cursor: pointer; line-height: 1.35; }
details.check p { margin: 10px 0 2px; color: #24543a; font-size: 20px; }

/* footer bar, notes */
#bar { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; display: flex; align-items: center; gap: 14px;
  padding: 0 18px; background: var(--ink); color: #cfd6de; font-size: 14px; }
#bar a { color: #cfd6de; text-decoration: none; }  #bar a:hover { color: #fff; }
#bar .title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bar button { font: 600 14px var(--sans); background: transparent; color: #cfd6de; border: 1px solid #5d6875; border-radius: 5px; padding: 4px 10px; cursor: pointer; }
#bar button:hover { background: #cfd6de; color: var(--ink); }
#bar .preview-badge { background: var(--gold); color: #fff; font-weight: 700; padding: 3px 10px; border-radius: 4px; white-space: nowrap; }
#progress { position: absolute; left: 0; bottom: 44px; height: 4px; background: var(--gold); transition: width .2s; z-index: 5; }
#notes { position: absolute; left: 0; right: 0; bottom: 44px; max-height: 190px; overflow: auto; background: #fff8dc; border-top: 3px solid var(--gold);
  padding: 12px 64px; font-size: 17px; line-height: 1.4; display: none; z-index: 6; }
#notes.show { display: block; }  #notes b { color: var(--gold); }
aside.notes { display: none; }

/* ---------- course home page ---------- */
body.home { background: var(--paper); height: auto; min-height: 100%; overflow: visible; }
/* The deck pages keep a dark surround; the home page scrolls, so its whole canvas must be paper,
   otherwise everything below the first screen sits on the dark background. */
html:has(body.home) { background: var(--paper); height: auto; }
.home main { max-width: 1040px; margin: 0 auto; padding: 56px 32px 80px; }
.home h1 { font-family: var(--serif); font-size: 54px; margin: 0 0 10px; letter-spacing: -.5px; }
.home h2 { font-family: var(--serif); font-size: 28px; margin: 44px 0 12px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.home p { font-size: 18px; line-height: 1.55; max-width: 800px; }
.modlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.modlist li { display: grid; grid-template-columns: 54px 1fr auto; gap: 16px; align-items: center; background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 18px; }
.modlist .num { font-family: var(--serif); font-size: 30px; color: var(--gold); font-weight: 700; text-align: center; }
.modlist b { font-size: 19px; }  .modlist span.d { display: block; color: var(--muted); font-size: 15.5px; margin-top: 2px; }
.modlist a.go { font-weight: 700; color: #fff; background: var(--ink); padding: 8px 16px; border-radius: 6px; text-decoration: none; }
.modlist .soon { color: var(--muted); font-size: 14px; border: 1px dashed var(--rule); padding: 6px 12px; border-radius: 6px; }
.home table.grid td:first-child { font-family: "Cambria Math", serif; font-size: 20px; }
