/* ── Tokens ────────────────────────────────────────── */
:root {
  --blue: #2c2cff;
  --blue-light: #ebebff;
  --text: #111;
  --text-muted: #555;
  --bg: #fff;
  --bg-alt: #f7f7fb;
  --border: #e0e0f0;
  --radius: 6px;
  --max-w: 760px;
  --font: "Georgia", serif;
  --font-ui: system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --blue: #7b7bff;
  --blue-light: #1a1a2e;
  --text: #efefef;
  --text-muted: #999;
  --bg: #0f0f13;
  --bg-alt: #16161e;
  --border: #2a2a3a;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ──────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

p { color: var(--text-muted); }
p strong { color: var(--text); }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: "Menlo", "Consolas", monospace;
  font-size: 0.875em;
  background: var(--blue-light);
  color: var(--blue);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

/* ── Layout wrapper ────────────────────────────────── */
section, header.hero, footer {
  padding: 5rem 1.5rem;
}

section > *, header.hero > * {
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
}

section > * + *, header.hero > * + * {
  margin-top: 1.5rem;
}

/* ── Nav ───────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 2rem;
  padding: 1rem 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

nav a {
  color: var(--text-muted);
}

nav a:hover {
  color: var(--blue);
  text-decoration: none;
}

#theme-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

#theme-toggle:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ── Hero ──────────────────────────────────────────── */
header.hero {
  padding-top: 7rem;
  padding-bottom: 7rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue) !important;
}

header.hero h1 {
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}

.hero-sub {
  font-size: 1.125rem;
  max-width: 560px;
}

.btn-primary {
  display: inline-block;
  background: var(--blue);
  color: #fff !important;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.85; text-decoration: none; }

/* ── Why section ───────────────────────────────────── */
.why {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.why h2 { color: var(--text); }

.reason-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.reason-list li {
  display: flex;
  gap: 0.75rem;
  color: var(--text-muted);
}

.mark {
  color: var(--blue);
  flex-shrink: 0;
  font-style: normal;
}

/* ── Callout ───────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--blue);
  padding: 0.75rem 1.25rem;
  background: var(--blue-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text) !important;
}

/* ── Mental model ──────────────────────────────────── */
.mental-model { border-bottom: 1px solid var(--border); }
.mental-model h2 { color: var(--text); }
.mental-model > p { }

.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
}

.concept-card {
  background: var(--bg);
  padding: 1.5rem;
}

.concept-mark {
  display: block;
  font-size: 1.25rem;
  color: var(--blue);
  margin-bottom: 0.5rem;
}

.concept-card h3 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.concept-card p {
  font-size: 0.9rem;
}

/* ── Tools ─────────────────────────────────────────── */
.tools {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.tools h2 { color: var(--text); }

.tool-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
}

.tool {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.tool:last-child { border-bottom: none; }

.tool--muted .tool-num,
.tool--muted h3,
.tool--muted p { opacity: 0.45; }

.tool-num {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.06em;
  padding-top: 0.25rem;
  flex-shrink: 0;
  width: 2rem;
}

.tool h3 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}

/* ── Workflow ──────────────────────────────────────── */
.workflow { border-bottom: 1px solid var(--border); }
.workflow h2 { color: var(--text); }

.workflow-steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
}

.workflow-steps li {
  counter-increment: step;
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9375rem;
  align-items: baseline;
}

.workflow-steps li:last-child { border-bottom: none; }

.workflow-steps li::before {
  content: "0" counter(step);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  width: 2rem;
  padding-top: 0.15rem;
}

.step-label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text);
  flex-shrink: 0;
  width: 6rem;
}

.loop-label {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
}

/* ── Actions ───────────────────────────────────────── */
.actions {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.actions h2 { color: var(--text); }

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
}

.action-card {
  background: var(--bg);
  padding: 1.5rem;
}

.action-card h3 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.action-mark {
  color: var(--blue);
  font-weight: 400;
}

.action-card p { font-size: 0.9rem; }

/* ── Habits ────────────────────────────────────────── */
.habits { border-bottom: 1px solid var(--border); }
.habits h2 { color: var(--text); }

.habit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
}

.habit-list li {
  padding: 1.1rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.habit-list li:last-child { border-bottom: none; }
.habit-list li strong { color: var(--text); }

/* ── Gotchas ───────────────────────────────────────── */
.gotchas {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.gotchas h2 { color: var(--text); }

.gotcha-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
}

.gotcha {
  background: var(--bg);
  padding: 1.5rem;
}

.gotcha h3 {
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.gotcha p { font-size: 0.9rem; }

/* ── Cheat sheet ───────────────────────────────────── */
.cheatsheet { border-bottom: 1px solid var(--border); }
.cheatsheet h2 { color: var(--text); }

table {
  width: 100%;
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-family: var(--font-ui);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

thead tr { background: var(--blue); }

th {
  text-align: left;
  padding: 0.75rem 1.25rem;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  padding: 0.85rem 1.25rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

td:first-child {
  font-weight: 600;
  color: var(--text);
  width: 35%;
}

tbody tr:nth-child(even) td { background: var(--bg-alt); }

/* ── Next ──────────────────────────────────────────── */
.next h2 { color: var(--text); }

/* ── Footer ────────────────────────────────────────── */
footer {
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
}

footer p {
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  color: var(--text-muted);
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 600px) {
  nav { gap: 1rem; font-size: 0.75rem; }

  .workflow-steps li {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .step-label { width: auto; }

  td:first-child { width: 40%; }
}
