:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --ink: #202124;
  --muted: #626a73;
  --line: #d9ded7;
  --primary: #f35b2f;
  --primary-dark: #b83b1d;
  --green: #227a55;
  --blue: #245b82;
  --shadow: 0 16px 42px rgba(32, 33, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

a {
  color: var(--primary-dark);
  font-weight: 750;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.site-header,
.site-footer {
  background: rgba(247, 245, 241, 0.96);
  border-bottom: 1px solid rgba(32, 33, 36, 0.08);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
}

.wrap {
  width: min(1060px, calc(100% - 32px));
  margin: 0 auto;
}

.nav-row,
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  display: grid;
  line-height: 1.2;
}

.brand small,
.muted {
  color: var(--muted);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.hero {
  padding: 64px 0 28px;
}

.eyebrow {
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  line-height: 1.16;
  letter-spacing: 0;
}

h1 {
  max-width: 900px;
  margin: 10px 0 18px;
  font-size: clamp(2.35rem, 6vw, 4.6rem);
}

h2 {
  margin: 38px 0 12px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

h3 {
  margin: 22px 0 8px;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.12rem;
}

.article-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: start;
  padding: 24px 0 64px;
}

.article-card,
.toc,
.callout,
.formula,
.related-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.article-card {
  padding: 30px;
}

.article-card p,
.article-card li {
  color: #3f454b;
}

.toc {
  position: sticky;
  top: 96px;
  padding: 18px;
}

.toc strong {
  display: block;
  margin-bottom: 10px;
}

.toc a {
  display: block;
  color: var(--muted);
  padding: 5px 0;
  text-decoration: none;
}

.callout {
  background: #fff8f1;
  border-color: #f2c9a8;
  padding: 16px;
}

.formula {
  overflow-x: auto;
  background: #18222a;
  color: #eef8f2;
  padding: 16px;
}

.formula code {
  white-space: pre;
}

.meta-row,
.pill-row,
.related-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 5px 10px;
  font-size: 0.86rem;
  font-weight: 750;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.related-card {
  padding: 16px;
  text-decoration: none;
}

.related-card strong {
  display: block;
  color: var(--ink);
}

.button-link {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid rgba(32, 33, 36, 0.08);
  border-bottom: 0;
}

@media (max-width: 860px) {
  .nav-row,
  .footer-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .article-shell,
  .related-grid {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
  }

  .article-card {
    padding: 22px;
  }
}
