:root {
  color: #1f2933;
  background: #f7f4ed;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

a {
  color: #0f766e;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.site-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0;
}

.brand {
  color: #18212f;
  font-size: 1.1rem;
  font-weight: 800;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.95rem;
}

.site-header nav a {
  color: #475569;
  text-decoration: none;
}

.hero {
  padding: 76px 0 54px;
  max-width: 820px;
}

.hero h1,
.chapter h1,
.not-found h1 {
  color: #111827;
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  line-height: 0.98;
  margin: 0;
}

.hero p:last-child {
  color: #475569;
  font-size: 1.18rem;
  max-width: 670px;
}

.eyebrow {
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.section-heading {
  border-top: 1px solid #ded7c8;
  padding-top: 28px;
}

.section-heading h2 {
  color: #111827;
  font-size: 2rem;
  margin: 0 0 24px;
}

.chapter-list {
  padding-bottom: 72px;
}

.chapter-list ol,
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapter-list li {
  border-top: 1px solid #ded7c8;
}

.chapter-list li:last-child {
  border-bottom: 1px solid #ded7c8;
}

.chapter-list a {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1.2fr);
  gap: 24px;
  padding: 22px 0;
  color: #18212f;
  text-decoration: none;
}

.chapter-list span {
  font-size: 1.24rem;
  font-weight: 760;
}

.chapter-list small {
  color: #64748b;
  font-size: 1rem;
}

.chapter-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 760px);
  gap: 64px;
  padding: 42px 0 84px;
}

.toc {
  align-self: start;
  position: sticky;
  top: 24px;
}

.toc-title {
  color: #475569;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.toc a {
  display: block;
  border-left: 3px solid transparent;
  color: #64748b;
  padding: 7px 0 7px 12px;
  text-decoration: none;
}

.toc a.active {
  border-left-color: #0f766e;
  color: #111827;
  font-weight: 760;
}

.chapter > header {
  border-bottom: 1px solid #ded7c8;
  margin-bottom: 34px;
  padding-bottom: 28px;
}

.chapter > header h1 {
  font-size: clamp(2.2rem, 6vw, 4.4rem);
}

.chapter > header p:last-child {
  color: #64748b;
  font-size: 1.12rem;
  margin-bottom: 0;
}

.prose {
  color: #263241;
  font-size: 1.05rem;
}

.prose h1 {
  display: none;
}

.prose h2 {
  color: #111827;
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 2.2em 0 0.4em;
}

.prose h3 {
  color: #18212f;
  font-size: 1.25rem;
  margin: 1.8em 0 0.4em;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.1em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose code {
  background: #ebe4d6;
  border-radius: 4px;
  color: #111827;
  font-size: 0.92em;
  padding: 0.12em 0.28em;
}

.prose pre {
  background: #18212f;
  border-radius: 8px;
  color: #f8fafc;
  overflow-x: auto;
  padding: 18px;
}

.prose pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.prose pre code.hljs {
  color: #e5edf7;
  display: block;
  line-height: 1.7;
}

.prose .hljs-comment,
.prose .hljs-quote {
  color: #94a3b8;
  font-style: italic;
}

.prose .hljs-keyword,
.prose .hljs-selector-tag,
.prose .hljs-subst {
  color: #7dd3fc;
}

.prose .hljs-string,
.prose .hljs-regexp,
.prose .hljs-attribute,
.prose .hljs-symbol,
.prose .hljs-bullet {
  color: #fbbf24;
}

.prose .hljs-title,
.prose .hljs-title.function_,
.prose .hljs-title.class_,
.prose .hljs-section {
  color: #c4b5fd;
}

.prose .hljs-number,
.prose .hljs-literal,
.prose .hljs-variable,
.prose .hljs-template-variable {
  color: #fca5a5;
}

.prose .hljs-built_in,
.prose .hljs-type,
.prose .hljs-name,
.prose .hljs-tag {
  color: #5eead4;
}

.prose .hljs-meta,
.prose .hljs-operator,
.prose .hljs-punctuation {
  color: #cbd5e1;
}

.prose .hljs-deletion {
  color: #fca5a5;
}

.prose .hljs-addition {
  color: #86efac;
}

.chapter-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 48px;
}

.chapter-pager a,
.button-link {
  border: 1px solid #d2c7b8;
  border-radius: 8px;
  color: #18212f;
  padding: 16px;
  text-decoration: none;
}

.chapter-pager a:last-child {
  text-align: right;
}

.chapter-pager small {
  color: #64748b;
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.not-found {
  max-width: 620px;
  padding: 80px 0;
}

.button-link {
  display: inline-block;
  font-weight: 760;
}

@media (max-width: 780px) {
  .site-shell {
    width: min(100% - 24px, 1120px);
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .hero {
    padding: 42px 0 36px;
  }

  .chapter-list a {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .chapter-layout {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 28px;
  }

  .toc {
    border-bottom: 1px solid #ded7c8;
    padding-bottom: 18px;
    position: static;
  }

  .toc ol {
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .chapter-pager {
    grid-template-columns: 1fr;
  }

  .chapter-pager a:last-child {
    text-align: left;
  }
}
