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

:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --dark-bg: #111827;
  --dark-surface: #1f2937;
  --dark-text: #f9fafb;
  --dark-muted: #9ca3af;
  --green: #16a34a;
  --amber: #d97706;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.75;
}

/* Nav */
nav {
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.nav-logo {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
}
.nav-link {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--accent); }

/* Layout */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 96px;
}

/* Breadcrumb */
.breadcrumb { font-size: 0.8rem; color: var(--muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* Tag */
.tag {
  display: inline-block;
  background: #eff6ff;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 16px;
}

/* Headings */
h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 16px;
}
.subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.6;
}
h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 2.5em 0 0.75em;
  scroll-margin-top: 80px;
}
h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.8em 0 0.5em;
}

/* Meta */
.meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--muted);
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.meta-dot { color: var(--border); }

/* TOC */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 28px;
  margin-bottom: 48px;
}
.toc-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.toc ol { padding-left: 20px; }
.toc li { margin-bottom: 6px; font-size: 0.9rem; }
.toc a { color: var(--accent); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* Article body */
.article-body p { margin-bottom: 1.4em; }

/* Formula block */
.formula {
  background: var(--dark-bg);
  color: var(--dark-text);
  border-radius: 8px;
  padding: 24px 28px;
  margin: 2em 0;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 2;
}
.formula .label {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dark-muted);
  margin-bottom: 8px;
  display: block;
}
.formula .eq { color: #93c5fd; font-weight: 600; }
.formula .result { color: #6ee7b7; font-weight: 700; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 2em 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead tr { background: var(--dark-bg); color: var(--dark-text); }
th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}
td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tbody tr:hover { background: var(--surface); }
.highlight-row td {
  font-weight: 600;
  background: #eff6ff;
  color: var(--accent-dark);
  border-bottom: none;
}

/* Callouts */
.callout {
  border-left: 3px solid var(--accent);
  background: #eff6ff;
  padding: 16px 20px;
  border-radius: 0 6px 6px 0;
  margin: 2em 0;
  font-size: 0.95rem;
  color: #1e3a8a;
}
.callout strong { display: block; margin-bottom: 4px; }
.callout.warning {
  border-left-color: var(--amber);
  background: #fffbeb;
  color: #92400e;
}
.callout.green {
  border-left-color: var(--green);
  background: #f0fdf4;
  color: #14532d;
}

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 1em 0 1.5em; }
.checklist li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.checklist li::before {
  content: "✓";
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Scenario box */
.scenario {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 32px;
  margin: 2em 0;
  background: var(--surface);
}
.scenario-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.scenario h3 { margin-top: 0; font-size: 1rem; color: var(--text); }

/* CTA */
.cta {
  background: var(--dark-bg);
  border-radius: 10px;
  padding: 40px 44px;
  margin-top: 3.5em;
  color: var(--dark-text);
}
.cta h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark-text);
  margin-bottom: 10px;
  margin-top: 0;
}
.cta p { color: var(--dark-muted); font-size: 0.95rem; margin-bottom: 24px; }
.cta-features { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.cta-pill {
  background: var(--dark-surface);
  color: var(--dark-muted);
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 20px;
}
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-dark); }

/* Footer */
footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 24px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 40px;
}
footer a { color: inherit; }

@media (max-width: 520px) {
  .cta { padding: 28px 24px; }
  .scenario { padding: 20px; }
}
