:root {
  color-scheme: light dark;
  --ink: #12161c;
  --bg: #ffffff;
  --muted: #5b6472;
  --accent: #2f6df6;
}

@media (prefers-color-scheme: dark) {
  :root { --ink: #e7ecf3; --bg: #0b0e12; --muted: #93a0b4; --accent: #6ea0ff; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main { max-width: 720px; margin: 0 auto; padding: 48px 22px; }
h1 { font-size: clamp(28px, 5vw, 44px); letter-spacing: -0.02em; margin: 0 0 12px; }
a { color: var(--accent); }

/* ── Zones ────────────────────────────────────────────────────────────────────
   One hue, light→dark by intensity, so the zones read as an order, not as three
   unrelated categories. Validated as an ordinal ramp (dataviz validate_palette
   --ordinal) against #ffffff, and the dark set against #0b0e12, where the order
   flips so the hardest zone is the most prominent on either surface. */
:root { --zone-1: #86b6ef; --zone-2: #2a78d6; --zone-3: #104281; --line: #e3e7ee; --soft: #f5f7fa; --warn: #fff5e0; --warn-ink: #6b4400; }
@media (prefers-color-scheme: dark) {
  :root { --zone-1: #184f95; --zone-2: #3987e5; --zone-3: #9ec5f4; --line: #232a35; --soft: #121820; --warn: #2b2110; --warn-ink: #f2cf8a; }
}

main { max-width: 860px; }
h2 { font-size: 22px; margin: 36px 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 17px; margin: 18px 0 8px; }
.lede { font-size: 19px; color: var(--muted); }
.small { font-size: 14px; color: var(--muted); }
.eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 4px; }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 860px; margin: 0 auto; padding: 18px 22px 0; flex-wrap: wrap; }
.site-header nav { display: flex; gap: 18px; }
.site-header a { text-decoration: none; color: var(--ink); }
.site-header nav a { color: var(--muted); }
.site-header nav a:hover { color: var(--ink); }
.brand { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.site-footer { max-width: 860px; margin: 0 auto; padding: 24px 22px 48px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }

.button, button { display: inline-block; font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none; cursor: pointer; }
.button.secondary, button.secondary { background: transparent; color: var(--accent); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 400; font-size: 14px; }
button:disabled { opacity: 0.6; cursor: wait; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 8px; }

.hero { padding: 24px 0 8px; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin: 32px 0; }
.pillar h2 { font-size: 17px; margin: 0 0 6px; }
.pillar p { margin: 0; color: var(--muted); font-size: 15px; }

.card { border: 1px solid var(--line); border-left: 6px solid var(--zone-1); border-radius: 10px; padding: 18px 20px; margin: 16px 0; background: var(--bg); }
.card.zone-2 { border-left-color: var(--zone-2); }
.card.zone-3 { border-left-color: var(--zone-3); }
.card.rest { border-left-color: var(--line); }
.card h2, .card h3 { margin: 0 0 10px; }
.card dt { font-weight: 600; margin-top: 10px; }
.card dd { margin: 2px 0 0; }
.structure { padding-left: 20px; margin: 0 0 6px; }

.settings { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; margin: 12px 0 18px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
textarea { width: 100%; resize: vertical; }
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
.log { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; padding: 16px 0; }
.log h3, .log .wide, .log [role=status] { grid-column: 1 / -1; margin: 0; }
.ask { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 12px; }
.answer p { margin: 0 0 10px; }
.error { color: #c0392b; }

.week { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { width: 100%; height: 100%; text-align: left; padding: 8px; border-radius: 8px; border: 1px solid var(--line); border-top: 4px solid var(--zone-1); background: var(--bg); color: var(--ink); font-weight: 400; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.day.zone-2 { border-top-color: var(--zone-2); }
.day.zone-3 { border-top-color: var(--zone-3); }
.day.rest { border-top-color: var(--line); color: var(--muted); }
.day.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day .weekday { font-weight: 600; font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .week { grid-template-columns: 1fr; } .day { flex-direction: row; justify-content: space-between; } }

.callout { background: var(--soft); border-radius: 8px; padding: 12px 16px; }
.callout.warning { background: var(--warn); color: var(--warn-ink); }

/* The distribution bar: thin, 2px surface gap between segments, rounded ends. */
.stack-bar { display: flex; gap: 2px; height: 14px; margin: 12px 0 8px; }
.stack-bar .seg { flex-basis: 0; min-width: 4px; background: var(--zone-1); }
.stack-bar .seg:first-child { border-radius: 4px 0 0 4px; }
.stack-bar .seg:last-child { border-radius: 0 4px 4px 0; }
.stack-bar .seg:only-child { border-radius: 4px; }
.seg.zone-2, .swatch.zone-2 { background: var(--zone-2); }
.seg.zone-3, .swatch.zone-3 { background: var(--zone-3); }
.legend { list-style: none; padding: 0; display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend strong { color: var(--ink); }
.swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--zone-1); display: inline-block; }

table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; margin: 6px 0; }

.toc ol { padding-left: 20px; }
.lesson { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 24px; }
.lesson .summary { font-size: 18px; color: var(--muted); }
.takeaway { background: var(--soft); border-radius: 8px; padding: 10px 14px; }
