:root {
  --paper: #f5f0e6;
  --paper-strong: #efe5d4;
  --wine: #8b2d3a;
  --sage: #8fa87a;
  --lavender: #b8a5cc;
  --ink: #2f241f;
  --muted: #6b5b51;
  --line: rgba(47, 36, 31, 0.12);
  --shadow: 0 22px 50px rgba(70, 38, 43, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(184, 165, 204, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(143, 168, 122, 0.18), transparent 26%),
    linear-gradient(180deg, #fbf8f2 0%, var(--paper) 100%);
}

body.is-nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  border-radius: 16px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--wine);
  color: #fff8f1;
  padding: 0.85rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

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

.site-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(250px, 290px) minmax(0, 1fr) minmax(220px, 280px);
}

.site-sidebar,
.site-toc {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 2rem 1.5rem;
  overflow: auto;
}

.site-sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 251, 245, 0.82);
  backdrop-filter: blur(16px);
}

.site-brand {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 2rem;
}

.site-brand strong {
  font-size: 1.6rem;
}

.site-brand__eyebrow,
.doc-article__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  color: var(--wine);
}

.doc-tree,
.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-tree--nested {
  margin-top: 0.6rem;
  padding-left: 0.9rem;
  border-left: 1px solid var(--line);
}

.doc-group summary {
  cursor: pointer;
  padding: 0.55rem 0;
  color: var(--muted);
  font-weight: 700;
}

.doc-tree__link {
  display: block;
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
}

.doc-tree__link.is-active {
  background: rgba(139, 45, 58, 0.12);
  color: var(--wine);
  font-weight: 700;
}

.site-main {
  display: grid;
  grid-auto-rows: max-content;
  justify-items: center;
  padding: 0.9rem clamp(1.2rem, 4vw, 3rem) 4rem;
}

.page-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  width: min(100%, 1040px);
  position: sticky;
  top: 0.45rem;
  z-index: 12;
  padding: 0.25rem 0 0.7rem;
  margin-bottom: 1rem;
  background: transparent;
  box-shadow: none;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 0.75rem 1rem;
}

.sidebar-backdrop {
  display: none;
}

.search-form {
  flex: 1;
  display: flex;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: none;
  overflow: hidden;
}

.search-form input,
.listing-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.95rem 1.2rem;
  font: inherit;
}

.search-form input {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.7);
}

.doc-article {
  width: min(100%, 920px);
}

.doc-article__header {
  margin-bottom: 2rem;
}

.doc-article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.9rem;
  margin-bottom: 0.35rem;
}

.doc-article__eyebrow {
  margin: 0;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
}

.doc-article__header h1 {
  margin: 0.35rem 0 0.8rem;
  font-size: clamp(2.5rem, 5vw, 4.2rem);
  line-height: 0.96;
}

.doc-article__excerpt {
  max-width: 58ch;
  font-size: 1.1rem;
  color: var(--muted);
}

.doc-updated {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(139, 45, 58, 0.12);
  color: var(--wine);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.version-pill--muted {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.content-body {
  line-height: 1.8;
  font-size: 1.04rem;
}

.content-body h1,
.content-body h2,
.content-body h3,
.content-body h4 {
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  line-height: 1.12;
  margin: 2.2rem 0 1rem;
  scroll-margin-top: 2rem;
}

.content-body h2 {
  font-size: 2rem;
}

.content-body h3 {
  font-size: 1.5rem;
}

.content-body p,
.content-body ul,
.content-body ol,
.content-body blockquote,
.content-body table,
.content-body pre {
  margin: 0 0 1.2rem;
}

.content-body blockquote {
  margin-left: 0;
  padding: 1rem 1.2rem;
  border-left: 4px solid var(--lavender);
  background: rgba(184, 165, 204, 0.12);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.content-body pre {
  overflow: auto;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: #211c1d;
  color: #f7f1eb;
}

.content-body code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--line);
}

.content-body th,
.content-body td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.content-body th {
  background: rgba(143, 168, 122, 0.16);
}

.callout {
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  background: rgba(143, 168, 122, 0.12);
  border: 1px solid rgba(143, 168, 122, 0.3);
}

.callout-note {
  background: rgba(184, 165, 204, 0.12);
  border-color: rgba(184, 165, 204, 0.3);
}

.page-pagination {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: min(100%, 920px);
  margin-top: 2.5rem;
}

.page-pagination__link {
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  min-height: 96px;
}

.page-pagination__link span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.page-pagination__link strong {
  display: block;
  margin-top: 0.4rem;
}

.page-pagination__link--next {
  text-align: right;
}

.toc-card,
.listing-card {
  background: rgba(255, 252, 247, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.toc-card__title {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--wine);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.toc-list__item {
  margin-bottom: 0.7rem;
  font-size: 0.95rem;
}

.toc-list__item--level-3,
.toc-list__item--level-4 {
  padding-left: 1rem;
  color: var(--muted);
}

.toc-list a {
  color: var(--muted);
}

.listing-shell {
  min-height: 100vh;
  padding: clamp(1rem, 3vw, 2rem);
}

.listing-hero,
.listing-main {
  max-width: 920px;
  margin: 0 auto;
}

.listing-hero {
  padding: clamp(1.4rem, 5vw, 3rem);
  border-radius: 36px;
  background:
    linear-gradient(135deg, rgba(245, 240, 230, 0.96), rgba(255, 252, 247, 0.92)),
    rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.listing-hero h1 {
  margin: 0.25rem 0 0.8rem;
  font-size: clamp(2.5rem, 6vw, 4.2rem);
}

.listing-hero__brand {
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--wine);
}

.listing-search {
  display: flex;
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.listing-main {
  padding-top: 1.5rem;
}

.listing-card--centered {
  max-width: 540px;
  margin: 10vh auto 0;
  text-align: center;
}

.search-results {
  display: grid;
  gap: 1rem;
}

.search-result {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.search-result:first-child {
  border-top: 0;
  padding-top: 0.4rem;
}

.search-result__title {
  font-size: 1.2rem;
  font-weight: 700;
}

.search-result__snippet {
  color: var(--muted);
}

mark {
  background: rgba(184, 165, 204, 0.45);
  color: inherit;
  border-radius: 0.3rem;
}

@media (max-width: 1080px) {
  .site-shell {
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  }

  .site-toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .site-shell {
    grid-template-columns: 1fr;
  }

  .site-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 320px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    z-index: 20;
  }

  .site-sidebar.is-open {
    transform: translateX(0);
  }

  .nav-toggle {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(47, 36, 31, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    z-index: 19;
  }

  body.is-nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .page-topbar {
    flex-wrap: wrap;
    width: 100%;
    top: 0.25rem;
    padding-top: 0.25rem;
  }

  .page-pagination {
    grid-template-columns: 1fr;
  }

  .listing-search {
    flex-direction: column;
  }
}
