:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --ink: #16150f;
  --ink-soft: #55514a;
  --ink-faint: #8b857c;
  --line: #e4e0d8;
  --accent: #1f5f4f;
  --accent-soft: #e8f0ed;
  --done: #2f7d63;
  --radius: 10px;
  --measure: 34rem;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--accent); }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- header ---------- */

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
}

.brand {
  font-family: var(--serif);
  font-size: 18px;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.brand span { color: var(--ink-faint); }

.topbar-progress {
  font-size: 13px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- home ---------- */

.hero { padding: 56px 0 32px; }

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 12px;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 6vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  font-weight: 600;
}

.lede {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.meter {
  height: 5px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.meter-fill {
  height: 100%;
  background: var(--done);
  width: 0%;
  transition: width 0.3s ease;
}

.meter-label {
  font-size: 13px;
  color: var(--ink-faint);
  margin: 0 0 40px;
}

.chapter-list {
  list-style: none;
  padding: 0;
  margin: 0 0 64px;
  border-top: 1px solid var(--line);
}

.chapter-list li { border-bottom: 1px solid var(--line); }

.chapter-link {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 18px 4px;
  text-decoration: none;
  color: inherit;
}

.chapter-link:hover { background: var(--surface); }

.chapter-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-faint);
  min-width: 2.2em;
  font-variant-numeric: tabular-nums;
}

.chapter-body { flex: 1; }

.chapter-title {
  font-weight: 600;
  margin: 0 0 3px;
  letter-spacing: -0.01em;
}

.chapter-outcome {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0;
}

.chapter-meta {
  font-size: 13px;
  color: var(--ink-faint);
  white-space: nowrap;
}

.chapter-meta.complete { color: var(--done); }

/* ---------- chapter page ---------- */

.backlink {
  display: inline-block;
  font-size: 14px;
  text-decoration: none;
  color: var(--ink-faint);
  margin: 32px 0 20px;
}

.backlink:hover { color: var(--accent); }

.chapter-head { margin-bottom: 28px; }

.chapter-head h1 { font-size: clamp(26px, 5.5vw, 34px); }

.intro { color: var(--ink-soft); }

/* video facade */

.video {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  padding: 0;
  margin: 0 0 32px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #11100c center/cover no-repeat;
  cursor: pointer;
}

.video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 9, 6, 0.25);
  transition: background 0.2s;
}

.video:hover::after { background: rgba(10, 9, 6, 0.1); }

.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  display: grid;
  place-items: center;
}

.video-play::before {
  content: "";
  border-left: 17px solid var(--ink);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  margin-left: 4px;
}

.video iframe { width: 100%; height: 100%; border: 0; }

/* steps */

.steps { list-style: none; padding: 0; margin: 0 0 40px; }

.step {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px 20px;
  margin-bottom: 12px;
}

.step.done { background: var(--accent-soft); border-color: #cfe0da; }

.step-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}

.step-head input {
  appearance: none;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  border: 1.5px solid #c4bfb5;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.step-head input:checked {
  background: var(--done);
  border-color: var(--done);
}

.step-head input:checked::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.step-title { font-weight: 600; letter-spacing: -0.01em; }

.step.done .step-title { color: var(--ink-soft); }

.step-body { padding-left: 32px; }

.step-body p { margin: 8px 0; }

.step-body img {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 12px 0;
  display: block;
}

/* copy block */

.copy {
  position: relative;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f3ef;
}

.copy pre {
  margin: 0;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* outcome + nav */

.outcome {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 16px;
  margin: 0 0 40px;
  color: var(--ink-soft);
}

.outcome strong {
  display: block;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 24px 0 72px;
  font-size: 15px;
}

.chapter-nav a { text-decoration: none; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 11px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
}

footer {
  border-top: 1px solid var(--line);
  padding: 24px 0;
  font-size: 13px;
  color: var(--ink-faint);
}

footer a { color: var(--ink-faint); }

.placeholder {
  border: 1px dashed #c9c3b8;
  border-radius: var(--radius);
  padding: 24px;
  color: var(--ink-faint);
  text-align: center;
  margin-bottom: 40px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121210;
    --surface: #1b1a17;
    --ink: #f0ece4;
    --ink-soft: #b5aea3;
    --ink-faint: #837c72;
    --line: #2e2c27;
    --accent: #7fc9b1;
    --accent-soft: #1d2b27;
    --done: #5bb797;
  }
  :root:not([data-theme="light"]) .copy { background: #232220; }
  :root:not([data-theme="light"]) .step-head input { background: #232220; border-color: #4a463f; }
  :root:not([data-theme="light"]) .step-head input:checked::after { border-color: #121210; }
}
