/* Redistricting Data Analysis Course : LMS styles */

:root {
  /* Brand */
  --teal: #01696F;
  --teal-hover: #0C4E54;
  --teal-soft: #E1ECEE;
  --clay: #A84B2F;
  --clay-soft: #F2E0D9;
  --bg: #F7F6F2;
  --surface: #FBFBF9;
  --surface-alt: #F0EEE7;
  --border: #DCD9D0;
  --border-strong: #C8C4B7;
  --text: #28251D;
  --text-muted: #7A7974;
  --text-faint: #BAB9B4;
  --success: #437A22;
  --success-soft: #E8F0DD;
  --warning: #964219;
  --warning-soft: #F6E4D9;

  /* Type */
  --font-sans: "Inter", "Helvetica Neue", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-display: "Fraunces", "Source Serif 4", "Georgia", serif;
  --font-mono: "JetBrains Mono", "Consolas", "SF Mono", monospace;

  /* Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --text-4xl: 2.875rem;

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* Layout */
  --sidebar-w: 280px;
  --content-w: 760px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(40, 37, 29, 0.05);
  --shadow-md: 0 4px 12px rgba(40, 37, 29, 0.08);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--teal); text-decoration: none; border-bottom: 1px solid rgba(1, 105, 111, 0.25); transition: border-color 0.15s, color 0.15s; }
a:hover { color: var(--teal-hover); border-bottom-color: var(--teal-hover); }
a:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; color: var(--text); margin: 0; }
h1 { font-size: var(--text-3xl); line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: var(--text-2xl); line-height: 1.2; margin-top: var(--space-7); }
h3 { font-size: var(--text-xl); line-height: 1.3; margin-top: var(--space-6); }
h4 { font-size: var(--text-lg); line-height: 1.3; margin-top: var(--space-5); font-weight: 600; font-family: var(--font-sans); }
p { margin: 0 0 var(--space-4); }
ul, ol { margin: 0 0 var(--space-4); padding-left: 1.25rem; }
li { margin-bottom: var(--space-2); }
strong { font-weight: 600; color: var(--text); }
blockquote { margin: var(--space-5) 0; padding: var(--space-4) var(--space-5); border-left: 3px solid var(--clay); background: var(--surface); font-family: var(--font-display); font-size: var(--text-lg); font-style: italic; color: var(--text); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
blockquote p:last-child { margin-bottom: 0; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-alt); padding: 0.1em 0.4em; border-radius: 4px; color: var(--text); }

/* ============ LAYOUT ============ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-5) var(--space-4);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  border: none;
  color: var(--text);
}
.brand:hover { color: var(--text); border: none; }
.brand-mark { width: 38px; height: 38px; flex-shrink: 0; }
.brand-text {
  display: flex; flex-direction: column; line-height: 1.15;
}
.brand-name { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 500; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); font-weight: 500; }

.progress-block { padding: var(--space-3) var(--space-3); background: var(--surface-alt); border-radius: var(--radius-sm); }
.progress-label { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-xs); color: var(--text-muted); margin-bottom: var(--space-2); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.progress-bar { height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--teal); transition: width 0.3s ease; }

.nav-section { margin-top: var(--space-3); }
.nav-section-title { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); font-weight: 600; padding: 0 var(--space-2); margin-bottom: var(--space-2); }

.nav-module {
  margin-bottom: var(--space-3);
}
.nav-module-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border: none;
}
.nav-module-head:hover { background: var(--surface-alt); color: var(--text); border: none; }
.nav-module-head .badge-mini {
  font-size: 0.6875rem; padding: 2px 8px; border-radius: 99px; font-weight: 500;
  background: var(--surface-alt); color: var(--text-muted);
}
.nav-module-head.is-active { background: var(--teal-soft); color: var(--teal); }
.nav-module-head.is-active .badge-mini { background: var(--teal); color: white; }

.nav-pages { list-style: none; padding: 0; margin: var(--space-1) 0 0; }
.nav-pages li { margin: 0; }
.nav-pages a {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 6px var(--space-3) 6px 36px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  position: relative;
}
.nav-pages a::before {
  content: ""; position: absolute; left: 20px; top: 50%;
  width: 5px; height: 5px; border-radius: 99px;
  background: var(--border-strong); transform: translateY(-50%);
}
.nav-pages a:hover { background: var(--surface-alt); color: var(--text); border: none; }
.nav-pages a.is-current { color: var(--teal); font-weight: 600; }
.nav-pages a.is-current::before { background: var(--teal); }

.sidebar-foot { margin-top: auto; padding-top: var(--space-4); border-top: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-muted); }

/* Mobile nav toggle */
.mobile-bar {
  display: none;
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  align-items: center; justify-content: space-between;
}
.mobile-bar .brand { gap: var(--space-2); }
.mobile-bar .brand-mark { width: 30px; height: 30px; }
.menu-btn {
  appearance: none; background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: var(--text-sm);
  color: var(--text); cursor: pointer; font-family: inherit;
}
.menu-btn:hover { background: var(--bg); }

/* Main */
.main {
  min-width: 0;
  padding: var(--space-6) var(--space-7) var(--space-9);
}
.content {
  max-width: var(--content-w);
  margin: 0 auto;
}

/* ============ COMPONENTS ============ */

/* Module hero (top of each page) */
.module-hero {
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--clay);
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.module-hero h1 { font-size: var(--text-4xl); line-height: 1.05; margin-bottom: var(--space-4); }
.module-hero .lede { font-size: var(--text-lg); color: var(--text-muted); max-width: 60ch; line-height: 1.5; }
.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-4); margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.meta-grid > div { display: flex; flex-direction: column; gap: 4px; }
.meta-grid .label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 600; }
.meta-grid .value { font-size: var(--text-sm); font-weight: 500; color: var(--text); }

/* Page section */
.page {
  margin: var(--space-8) 0;
  scroll-margin-top: var(--space-6);
}
.page:first-of-type { margin-top: var(--space-6); }
.page-head {
  display: flex; align-items: baseline; gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.page-num {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--clay);
  font-weight: 500;
}
.page-time {
  font-size: var(--text-xs);
  background: var(--surface-alt);
  padding: 3px 10px;
  border-radius: 99px;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: auto;
  white-space: nowrap;
}
.page h2 { margin-top: 0; font-size: var(--text-2xl); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  margin: var(--space-5) 0;
}
.card h3, .card h4 { margin-top: 0; }

/* Audio intro */
.audio-intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: var(--space-5);
  margin: var(--space-5) 0;
}
.audio-intro h3 { margin-top: 0; margin-bottom: var(--space-2); }
.audio-intro .audio-intro-help { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--space-3); }
.audio-intro audio { display: block; width: 100%; max-width: 100%; margin: var(--space-3) 0; }
.audio-intro details { margin-top: var(--space-3); border-top: 1px solid var(--border); padding-top: var(--space-3); }
.audio-intro summary { cursor: pointer; font-weight: 600; font-size: var(--text-sm); color: var(--text); }
.audio-intro summary:hover { color: var(--teal); }
.audio-intro .transcript { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--text-muted); line-height: 1.6; }
.audio-intro .transcript p { margin: 0 0 var(--space-2); }

/* Diagram figure */
figure.diagram {
  margin: var(--space-6) 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
figure.diagram img {
  width: 100%; height: auto; display: block;
  background: var(--surface);
  padding: var(--space-5);
}
figure.diagram figcaption {
  padding: var(--space-3) var(--space-5) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
}
figure.diagram figcaption strong { color: var(--text); }

/* Tables */
.tbl-wrap { overflow-x: auto; margin: var(--space-5) 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-alt); font-weight: 600; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Callouts */
.callout {
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-5) 0;
  border-left: 4px solid var(--text-muted);
  background: var(--surface);
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: var(--space-3);
  align-items: start;
}
.callout .icon { width: 22px; height: 22px; margin-top: 2px; }
.callout h4 { margin: 0 0 var(--space-2); font-size: var(--text-base); }
.callout p:last-child { margin-bottom: 0; }
.callout.checkpoint { border-left-color: var(--teal); background: var(--teal-soft); }
.callout.checkpoint .icon { color: var(--teal); }
.callout.tip { border-left-color: var(--success); background: var(--success-soft); }
.callout.tip .icon { color: var(--success); }
.callout.warning { border-left-color: var(--warning); background: var(--warning-soft); }
.callout.warning .icon { color: var(--warning); }
.callout.key { border-left-color: var(--clay); background: var(--clay-soft); }
.callout.key .icon { color: var(--clay); }
.callout.case-study { border-left-color: var(--border-strong); background: var(--surface-alt); }
.callout.case-study .icon { color: var(--text-muted); }
.callout.case-study .case-tag { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 600; margin-bottom: var(--space-2); }
.callout.case-study p { margin: 0 0 var(--space-2); }
.callout.case-study .source { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--space-2); margin-bottom: 0; }

/* Quiz / interaction blocks */
.quiz {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  margin: var(--space-5) 0;
}
.quiz .quiz-tag { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--teal); font-weight: 600; margin-bottom: var(--space-2); }
.quiz h4 { margin-top: 0; }
.choices { list-style: none; padding: 0; margin: var(--space-3) 0 0; display: grid; gap: var(--space-2); }
.choices li { margin: 0; }
.choices label {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.choices label:hover { border-color: var(--border-strong); background: var(--surface-alt); }
.choices input[type="radio"], .choices input[type="checkbox"] {
  margin-top: 3px; accent-color: var(--teal); flex-shrink: 0;
}
.choices .letter { font-family: var(--font-mono); font-weight: 600; color: var(--text-muted); margin-right: var(--space-2); }
.choices label.is-correct { border-color: var(--success); background: var(--success-soft); }
.choices label.is-incorrect { border-color: var(--warning); background: var(--warning-soft); }
.quiz-feedback { margin-top: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); font-size: var(--text-sm); display: none; }
.quiz-feedback.show { display: block; }
.quiz-feedback.correct { background: var(--success-soft); color: #2d5215; border: 1px solid #c1d9aa; }
.quiz-feedback.incorrect { background: var(--warning-soft); color: #6b2e10; border: 1px solid #e9c8b3; }
.quiz-actions { margin-top: var(--space-3); display: flex; gap: var(--space-3); flex-wrap: wrap; }
button.btn {
  appearance: none; font-family: inherit; font-size: var(--text-sm); font-weight: 600;
  padding: 9px 18px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button.btn-primary { background: var(--teal); color: white; }
button.btn-primary:hover { background: var(--teal-hover); }
button.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
button.btn-ghost:hover { background: var(--surface-alt); }
button.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Textareas */
textarea, input[type="text"] {
  width: 100%; padding: var(--space-3) var(--space-4);
  font-family: inherit; font-size: var(--text-base);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); resize: vertical;
}
textarea:focus, input[type="text"]:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }

/* Completion bar at end of page */
.completion {
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  background: var(--surface);
}
.completion .text { font-size: var(--text-sm); color: var(--text-muted); }
.completion .text strong { color: var(--text); }

/* Action slider : interactive "drag to complete" control */
.action-slider {
  --as-track-h: 52px;
  --as-thumb: 44px;
  --as-thumb-inset: 4px;
  position: relative;
  flex: 0 0 260px;
  min-width: 220px;
  max-width: 320px;
  height: var(--as-track-h);
}
.action-slider .as-track {
  position: absolute; inset: 0;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 2px rgba(40, 37, 29, 0.08);
  overflow: hidden;
}
.action-slider .as-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: var(--as-progress, 0%);
  background: linear-gradient(90deg, var(--teal) 0%, var(--clay) 100%);
  transition: background 0.25s ease;
  pointer-events: none;
}
/* Visible "knob" : purely decorative, positioned by --as-knob-x (set by JS) */
.action-slider .as-knob {
  position: absolute;
  top: var(--as-thumb-inset);
  left: var(--as-thumb-inset);
  width: var(--as-thumb); height: var(--as-thumb);
  border-radius: 50%;
  background: #FBFBF9;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm), inset 0 -1px 0 rgba(40, 37, 29, 0.06);
  transform: translateX(var(--as-knob-x, 0px));
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.05s linear;
}
.action-slider:not(.is-active) .as-knob {
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.action-slider .as-knob::before,
.action-slider .as-knob::after {
  content: "";
  position: absolute;
  width: 7px; height: 7px;
  border-top: 2px solid var(--teal);
  border-right: 2px solid var(--teal);
  transform: rotate(45deg);
  opacity: 0.85;
}
.action-slider .as-knob::before { left: 12px; }
.action-slider .as-knob::after { left: 19px; }
.action-slider .as-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding-left: calc(var(--as-thumb) + var(--as-thumb-inset) * 2);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
  transition: color 0.25s ease, opacity 0.25s ease;
}
.action-slider .as-label .as-label-default { display: inline; }
.action-slider .as-label .as-label-done { display: none; }
/* Fade label as user drags */
.action-slider .as-label {
  opacity: calc(1 - (var(--as-progress-frac, 0)));
}
.action-slider input[type="range"] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; padding: 0;
  background: transparent;
  -webkit-appearance: none; appearance: none;
  cursor: grab;
  z-index: 2;
}
.action-slider input[type="range"]:active { cursor: grabbing; }
.action-slider input[type="range"]:focus { outline: none; }
.action-slider:focus-within .as-track {
  box-shadow: inset 0 1px 2px rgba(40, 37, 29, 0.08), 0 0 0 2px var(--bg), 0 0 0 4px var(--teal);
}
.action-slider input[type="range"]::-webkit-slider-runnable-track {
  height: var(--as-track-h); background: transparent; border: none;
}
.action-slider input[type="range"]::-moz-range-track {
  height: var(--as-track-h); background: transparent; border: none;
}
/* Invisible native thumb : visible knob is .as-knob */
.action-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: var(--as-thumb); height: var(--as-thumb);
  border-radius: 50%;
  background: transparent;
  border: none;
  margin-top: calc((var(--as-track-h) - var(--as-thumb)) / 2);
  cursor: grab;
}
.action-slider input[type="range"]::-moz-range-thumb {
  width: var(--as-thumb); height: var(--as-thumb);
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: grab;
}
.action-slider input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }
.action-slider input[type="range"]:active::-moz-range-thumb { cursor: grabbing; }
/* Idle nudge animation : only when untouched */
@keyframes as-nudge {
  0%, 60%, 100% { transform: translateX(0); }
  75% { transform: translateX(4px); }
  85% { transform: translateX(0); }
}
.action-slider:not(.is-complete):not(.is-active) .as-knob {
  animation: as-nudge 3.2s ease-in-out 1.5s infinite;
}
.action-slider.is-active .as-knob {
  background: #FBFBF9;
  border-color: var(--teal);
  box-shadow: var(--shadow-md);
}

.action-slider.is-complete .as-fill {
  width: 100% !important;
}
.action-slider.is-complete .as-label {
  color: #F7F6F2;
  opacity: 1;
  padding-left: 0;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(40, 37, 29, 0.25);
}
.action-slider.is-complete .as-label .as-label-default { display: none; }
.action-slider.is-complete .as-label .as-label-done {
  display: inline-flex; align-items: center; gap: 8px;
}
.action-slider.is-complete .as-label .as-label-done::before {
  content: "";
  display: inline-block;
  width: 12px; height: 7px;
  border-left: 2px solid #F7F6F2;
  border-bottom: 2px solid #F7F6F2;
  transform: rotate(-45deg) translateY(-2px);
}
.action-slider.is-complete .as-label .as-label-done::after {
  content: " · tap to undo";
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #F7F6F2;
  opacity: 0.85;
}
.action-slider.is-complete { cursor: pointer; }
.action-slider.is-complete input[type="range"] { cursor: pointer; }
.action-slider.is-complete .as-knob {
  display: none;
}

/* Module completion banner */
.badge-earn {
  margin: var(--space-7) 0 var(--space-6);
  padding: var(--space-6);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--teal) 0%, #015057 100%);
  color: #F7F6F2;
  display: flex; align-items: center; gap: var(--space-5);
}
.badge-earn .badge-circle {
  width: 80px; height: 80px; flex-shrink: 0;
  border-radius: 99px; background: rgba(247, 246, 242, 0.12);
  border: 2px solid rgba(247, 246, 242, 0.4);
  display: flex; align-items: center; justify-content: center;
}
.badge-earn .badge-circle svg { width: 44px; height: 44px; color: #F7F6F2; }
.badge-earn h3 { color: #F7F6F2; margin: 0 0 4px; font-size: var(--text-xl); font-family: var(--font-display); }
.badge-earn p { margin: 0; opacity: 0.9; font-size: var(--text-sm); }

/* Course landing */
.landing-hero {
  padding: var(--space-9) 0 var(--space-7);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-7);
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.landing-hero .eyebrow { color: var(--clay); }
.landing-hero h1 { font-size: clamp(2.25rem, 4.5vw, 3.5rem); line-height: 1.02; letter-spacing: -0.025em; margin-bottom: var(--space-4); }
.landing-hero h1 em { font-style: italic; color: var(--teal); font-weight: 400; }
.landing-hero .lede { font-size: var(--text-lg); color: var(--text-muted); margin-bottom: var(--space-5); max-width: 50ch; line-height: 1.5; }
.landing-hero .cta-row { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-5); }
.btn-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: var(--text-sm); font-weight: 600;
  padding: 11px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  text-decoration: none; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.btn-link.primary { background: var(--teal); color: white; border-color: var(--teal); }
.btn-link.primary:hover { background: var(--teal-hover); border-color: var(--teal-hover); color: white; }
.btn-link.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-link.ghost:hover { background: var(--surface); }

.landing-hero .hero-art {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
}
.landing-hero .hero-art img, .landing-hero .hero-art svg { width: 100%; height: 100%; object-fit: contain; }

.section { padding: var(--space-8) 0; }
.section h2 { margin-top: 0; }
.section .section-lede { font-size: var(--text-lg); color: var(--text-muted); max-width: 60ch; margin-bottom: var(--space-6); }

.module-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
}
.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-3);
  text-decoration: none; color: var(--text);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.2s;
  border-bottom: 1px solid var(--border);
}
.module-card:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--text); }
.module-card .num {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--clay);
  font-weight: 500; letter-spacing: 0.05em;
}
.module-card h3 { margin: 0; font-size: var(--text-xl); }
.module-card .meta { display: flex; gap: var(--space-3); font-size: var(--text-xs); color: var(--text-muted); flex-wrap: wrap; }
.module-card .meta span { display: inline-flex; align-items: center; gap: 6px; }
.module-card .desc { color: var(--text-muted); font-size: var(--text-sm); line-height: 1.55; margin: 0; }
.module-card .arrow {
  margin-top: auto;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--teal); font-size: var(--text-sm); font-weight: 600;
}

.principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-5);
}
.principle {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.principle .num { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--clay); margin-bottom: var(--space-2); display: block; }
.principle h4 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-weight: 500; font-size: var(--text-lg); }
.principle p { margin: 0; font-size: var(--text-sm); color: var(--text-muted); line-height: 1.55; }

/* Footer */
.site-foot {
  margin-top: var(--space-9);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap;
}

/* Sources */
.sources { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.sources strong { color: var(--text); }

/* ============ TEMPLATE LIBRARY ============ */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-5);
}
.template-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-3);
}
.template-card .tpl-module {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--clay);
  font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase;
}
.template-card h3 { margin: 0; font-size: var(--text-lg); }
.template-card .tpl-desc { color: var(--text-muted); font-size: var(--text-sm); line-height: 1.55; margin: 0; }
.template-card .tpl-actions {
  display: flex; flex-direction: column; gap: var(--space-2);
  margin-top: auto; padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.tpl-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--teal); font-size: var(--text-sm); font-weight: 600;
  border-bottom: none;
}
.tpl-link:hover { color: var(--teal-hover); }
.tpl-placeholder {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-faint); font-size: var(--text-sm); font-weight: 500;
  font-style: italic;
  cursor: not-allowed;
}
.tpl-placeholder::before {
  content: "🕓"; font-style: normal;
}

/* Tool option cards */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
}
.tool-card h4 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-weight: 500; font-size: var(--text-lg); }
.tool-card p { margin: 0 0 var(--space-3); font-size: var(--text-sm); color: var(--text-muted); line-height: 1.55; }
.tool-card .tool-meta { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--clay); letter-spacing: 0.05em; text-transform: uppercase; }
.tool-card .tool-link { font-size: var(--text-sm); font-weight: 600; }

/* Schema table : for Looker starter dashboard schema */
.schema-table th { font-family: var(--font-mono); font-size: var(--text-xs); }
.schema-table td code { font-size: 0.85em; }

/* Bundle highlight */
.bundle-callout {
  background: var(--teal-soft);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-5);
  margin-top: var(--space-5);
}
.bundle-callout h4 { margin: 0 0 var(--space-3); font-family: var(--font-display); font-weight: 500; font-size: var(--text-lg); }
.bundle-callout ul { margin: 0; padding-left: 1.25rem; }
.bundle-callout li { margin-bottom: var(--space-1); font-size: var(--text-sm); }

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; width: 300px;
    transform: translateX(-100%); transition: transform 0.25s ease;
    z-index: 100; box-shadow: var(--shadow-md);
  }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-bar { display: flex; }
  .main { padding: var(--space-5) var(--space-5) var(--space-8); }
  .landing-hero { grid-template-columns: 1fr; padding: var(--space-6) 0 var(--space-6); }
  .landing-hero .hero-art { order: -1; aspect-ratio: 5 / 3; }
}

@media (max-width: 600px) {
  :root { --text-3xl: 1.875rem; --text-4xl: 2.25rem; }
  .main { padding: var(--space-4); }
  .module-hero h1 { font-size: var(--text-3xl); }
  .meta-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); padding: var(--space-3); }
  .badge-earn { flex-direction: column; align-items: flex-start; padding: var(--space-5); }
  .badge-earn .badge-circle { width: 60px; height: 60px; }
  .badge-earn .badge-circle svg { width: 32px; height: 32px; }
  .completion { flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .completion .action-slider { flex: 1 1 auto; width: 100%; max-width: none; }
  th, td { padding: 8px 10px; font-size: 0.8125rem; }
  figure.diagram img { padding: var(--space-3); }
}

/* Backdrop for mobile nav */
.nav-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(40, 37, 29, 0.4);
  z-index: 99;
}
.nav-backdrop.is-open { display: block; }

/* Subsection page navigation */
.subsection-hero .eyebrow a { color: inherit; text-decoration: none; }
.subsection-hero .eyebrow a:hover { text-decoration: underline; }

.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-4);
}
.page-nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
  min-height: 64px;
}
.page-nav-link:hover { border-color: var(--teal); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.page-nav-link.next { justify-content: flex-end; text-align: right; }
.page-nav-link.prev { justify-content: flex-start; text-align: left; }
.page-nav-link span { display: inline-flex; flex-direction: column; }
.page-nav-eyebrow { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.page-nav-title { font-weight: 600; font-size: var(--text-sm); }
.page-nav-link.is-disabled { visibility: hidden; }

@media (max-width: 640px) {
  .page-nav { grid-template-columns: 1fr; }
}

/* Module overview subsection grid */
.subsection-list h2 { margin-top: var(--space-6); }
.subsection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
}
.subsection-card {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.subsection-card:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.subsection-card .num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--clay);
  letter-spacing: 0.04em;
}
.subsection-card h3 { margin: 0; font-size: var(--text-lg); }
.subsection-card .meta { color: var(--text-muted); font-size: var(--text-sm); margin: 0; }
.subsection-card .arrow { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); color: var(--teal); font-weight: 600; margin-top: var(--space-1); }

/* Reading section: a longer-form module-level reading */
.reading-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-6) 0;
}
.reading-section .reading-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: var(--space-2);
}
.reading-section h3 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1.25;
}
.reading-section p { margin: 0 0 var(--space-4); }
.reading-section p:last-child { margin-bottom: 0; }
.reading-section ul, .reading-section ol { margin: 0 0 var(--space-4) 1.25rem; }
.reading-section a { color: var(--teal); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Print */
@media print {
  .sidebar, .mobile-bar, .quiz-actions, .completion { display: none; }
  .app { grid-template-columns: 1fr; }
  .main { padding: 0; }
}
