:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --bg-alt: #efe8de;
  --surface: #fffdf9;
  --surface-strong: #f4eee5;
  --text: #221f1a;
  --muted: #625648;
  --line: #d8cbb8;
  --accent: #496247;
  --accent-strong: #2f4630;
  --highlight: #9a6b3f;
  --shadow: 0 24px 60px rgba(43, 33, 21, 0.08);
  --radius: 18px;
  --radius-sm: 10px;
  --shell: 1200px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a {
  color: inherit;
}

img,
svg {
  max-width: 100%;
}

code,
pre,
table {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--accent-strong);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  z-index: 20;
}

.skip-link:focus {
  top: 1rem;
}

.shell {
  width: min(var(--shell), calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(247, 244, 239, 0.88);
  border-bottom: 1px solid rgba(216, 203, 184, 0.8);
}

.header-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 72px;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  color: var(--highlight);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.top-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  color: var(--text);
}

.hero-band {
  padding: 4.5rem 0 3rem;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 244, 239, 0.95)),
    linear-gradient(135deg, rgba(154, 107, 63, 0.08), transparent 40%),
    var(--bg);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 2rem;
  align-items: start;
}

.hero-copy h1 {
  margin: 0.3rem 0 1rem;
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  line-height: 1.02;
}

.hero-text {
  max-width: 64ch;
  margin: 0;
  font-size: 1.08rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid transparent;
}

.button-primary {
  color: #fff;
  background: var(--accent-strong);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.65);
  border-color: var(--line);
}

.hero-panel,
.toc-card,
.callout-panel {
  background: rgba(255, 253, 249, 0.84);
  border: 1px solid rgba(216, 203, 184, 0.88);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 1rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.metric-card,
.decision-card {
  min-height: 100%;
  padding: 1rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.metric-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-value {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.metric-note {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.section-band {
  padding: 2.75rem 0;
}

.section-band-tint {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-intro {
  margin-bottom: 1.4rem;
}

.section-intro h2 {
  margin: 0.35rem 0 0.65rem;
  font-size: clamp(1.75rem, 2vw, 2.4rem);
  line-height: 1.1;
}

.section-intro p {
  margin: 0;
  max-width: 72ch;
  color: var(--muted);
}

.decision-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.decision-card h3 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

.decision-card ul {
  margin: 0;
  padding-left: 1.15rem;
}

.page-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.toc-rail {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 1rem;
}

.toc-card {
  padding: 1rem;
}

.toc-list,
.source-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.toc-item,
.toc-subitem {
  margin: 0;
}

.toc-subitem {
  padding-left: 0.85rem;
}

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

.toc-list a:hover,
.toc-list a:focus-visible {
  color: var(--text);
}

.source-list li + li {
  margin-top: 0.55rem;
}

.source-list code {
  display: inline-block;
  white-space: normal;
  word-break: break-word;
  font-size: 0.84rem;
}

.content-stack {
  display: grid;
  gap: 2rem;
}

.document-section {
  display: grid;
  gap: 1rem;
}

.document-frame {
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.prose {
  color: var(--text);
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2,
.prose h3,
.prose h4 {
  line-height: 1.15;
}

.prose h2 {
  margin: 2.4rem 0 1rem;
  font-size: clamp(1.45rem, 1.7vw, 2rem);
}

.prose h3 {
  margin: 1.75rem 0 0.8rem;
  font-size: 1.1rem;
}

.prose p,
.prose li {
  font-size: 1rem;
}

.prose p,
.prose ul,
.prose ol,
.prose table,
.prose pre,
.prose blockquote {
  margin: 0 0 1rem;
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
}

.prose strong {
  font-weight: 800;
}

.prose code {
  padding: 0.15rem 0.35rem;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.92em;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  min-width: 160px;
}

.prose th {
  background: var(--surface-strong);
  font-size: 0.92rem;
}

.prose blockquote {
  margin-left: 0;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--highlight);
  background: #faf4eb;
}

.prose pre {
  padding: 1rem;
  overflow: auto;
  background: #f2ede6;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.prose-visuals h2:first-of-type {
  margin-top: 0;
}

.mermaid {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  overflow-x: auto;
  background: linear-gradient(180deg, #fffdf9, #f7f1e9);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.section-band-callout {
  padding-top: 0.5rem;
}

.callout-panel {
  padding: 1.4rem;
}

.callout-panel h2 {
  margin: 0.4rem 0 0.75rem;
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  line-height: 1.08;
}

.callout-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .hero-grid,
  .page-layout,
  .decision-grid {
    grid-template-columns: 1fr;
  }

  .toc-rail {
    position: static;
  }
}

@media (max-width: 720px) {
  .header-shell {
    align-items: flex-start;
    padding: 0.85rem 0;
  }

  .top-nav {
    gap: 0.75rem 1rem;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .hero-band {
    padding-top: 3rem;
  }

  .hero-copy h1 {
    font-size: 2.3rem;
  }

  .document-frame,
  .hero-panel,
  .toc-card,
  .callout-panel {
    padding: 1rem;
  }

  .shell {
    width: min(var(--shell), calc(100% - 1rem));
  }
}

@media print {
  .site-header,
  .toc-rail,
  .hero-actions,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
  }

  .hero-band,
  .section-band,
  .section-band-tint {
    padding: 1rem 0;
    background: #fff;
    border: 0;
  }

  .document-frame,
  .hero-panel,
  .callout-panel {
    box-shadow: none;
    background: #fff;
  }
}
