:root {
  color-scheme: light;
  --bg: #fcfbf8;
  --panel: #fffefa;
  --sidebar-bg: #f3f0e8;
  --text: #28231c;
  --muted: #766f64;
  --line: #ded6c8;
  --line-soft: #ebe4d8;
  --accent: #6a4b2a;
  --accent-strong: #5d4225;
  --code-bg: #f3eee5;
  --sidebar-width: 19.5rem;
  --measure: 50rem;
  --sidenote-width: 18rem;
  --sidenote-gap: 2.2rem;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: "Source Serif 4", "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.58;
}

body {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration-color: rgba(106, 75, 42, 0.45);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.16em;
}

a:hover {
  color: #3f2d1b;
  text-decoration-color: currentColor;
}

.skip-link {
  background: var(--text);
  color: white;
  left: 1rem;
  padding: 0.6rem 0.8rem;
  position: fixed;
  top: -4rem;
  z-index: 10;
}

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

.site-shell {
  display: grid;
  grid-template-columns: minmax(17rem, var(--sidebar-width)) minmax(0, 1fr);
  min-height: 100vh;
}

.site-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  height: 100vh;
  overflow: auto;
  padding: 1.35rem 1.05rem;
  position: sticky;
  top: 0;
}

.site-brand {
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.85rem;
  padding: 0 0.35rem 0.95rem;
}

.site-brand a {
  color: var(--text);
  display: inline-block;
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.15;
  text-decoration: none;
}

.site-brand span {
  color: var(--muted);
  display: block;
  font-size: 0.88rem;
  line-height: 1.32;
  margin-top: 0.45rem;
}

.site-nav {
  font-size: 0.9rem;
  line-height: 1.35;
}

.nav-section {
  border-bottom: 1px solid rgba(80, 62, 42, 0.11);
  padding: 0.15rem 0;
}

.nav-section summary {
  color: #403629;
  cursor: pointer;
  font-weight: 600;
  list-style-position: outside;
  padding: 0.48rem 0.35rem;
}

.nav-section ul {
  list-style: none;
  margin: 0;
  padding: 0 0 0.45rem;
}

.nav-section li {
  margin: 0;
}

.nav-subsection {
  color: #5a4c3b;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 0.35rem 0.22rem 1.05rem;
}

.nav-section a {
  border-radius: 3px;
  color: #4d4337;
  display: block;
  padding: 0.28rem 0.35rem;
  text-decoration: none;
}

.nav-section a:hover,
.nav-section a[aria-current="page"] {
  background: rgba(106, 75, 42, 0.08);
  color: var(--accent);
}

.nav-depth-2 a {
  padding-left: 1.15rem;
}

.nav-depth-3 a,
.nav-depth-4 a {
  color: var(--muted);
  padding-left: 1.75rem;
}

.site-main {
  min-width: 0;
  padding: 2.4rem clamp(1.4rem, 5vw, 4.5rem);
}

.content-page,
.home-page {
  background: transparent;
  box-shadow: none;
  margin: 0 auto;
  max-width: 72rem;
  padding: clamp(1.15rem, 3vw, 2.6rem) 0;
}

.content-page .page-header,
.content-page .prose,
.content-page .page-pagination,
.home-page .page-header,
.home-page .prose {
  max-width: var(--measure);
}

.page-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.8rem;
  padding-bottom: 1.2rem;
}

.eyebrow {
  color: var(--muted);
  font-family: "Source Serif 4", "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  margin: 0 0 0.4rem;
  text-transform: none;
}

.page-header h1 {
  font-family: "Source Serif 4", "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 3vw, 2.65rem);
  font-weight: 600;
  line-height: 1.12;
  margin: 0;
}

.prose {
  font-family: "Source Serif 4", "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
}

.prose h2,
.prose h3,
.prose h4 {
  color: #332b22;
  font-family: "Source Serif 4", "EB Garamond", Georgia, "Times New Roman", serif;
  font-weight: 600;
  line-height: 1.22;
  margin: 2.2rem 0 0.8rem;
}

.prose h2 {
  font-size: 1.45rem;
}

.prose h3 {
  font-size: 1.22rem;
}

.prose h4 {
  font-size: 1.05rem;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose table {
  margin-bottom: 1.05rem;
  margin-top: 0;
}

.prose img {
  display: block;
  height: auto;
  max-width: 100%;
}

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

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 0.48rem 0.62rem;
  vertical-align: top;
}

.prose th {
  background: #f6f1e8;
  font-weight: 600;
}

.prose blockquote {
  border-left: 3px solid rgba(106, 75, 42, 0.45);
  color: #51483e;
  margin-left: 0;
  padding-left: 1rem;
}

.prose code {
  background: var(--code-bg);
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.86em;
  padding: 0.1rem 0.25rem;
}

.prose pre {
  background: var(--code-bg);
  overflow-x: auto;
  padding: 1rem;
}

.sidenote-wrapper {
  position: relative;
}

.sidenote-marker {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  display: inline;
  font-family: "Source Serif 4", "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 0.68em;
  font-weight: 700;
  line-height: 1;
  margin: 0 0.05rem;
  padding: 0 0.08rem;
  vertical-align: super;
}

.sidenote-marker:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidenote-content {
  color: var(--text);
  font-family: "Source Serif 4", "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  line-height: 1.45;
}

.sidenote-content::before {
  color: var(--accent);
  content: attr(data-note-number);
  font-size: 0.72em;
  font-weight: 700;
  margin-right: 0.35rem;
  vertical-align: super;
}

.sidenote-content p {
  margin: 0;
}

.chapter-list {
  margin-top: 2rem;
}

.chapter-list h2 {
  border-top: 1px solid var(--line);
  color: #3c3328;
  font-size: 1rem;
  font-weight: 600;
  margin: 1.45rem 0 0.5rem;
  padding-top: 0.9rem;
}

.chapter-list-items {
  columns: 2 18rem;
  gap: 2rem;
  margin-top: 0;
  padding-left: 0;
}

.chapter-list-items li {
  break-inside: avoid;
  list-style: none;
  margin: 0.25rem 0;
}

.chapter-list-items a {
  display: inline-block;
}

.chapter-subsection {
  color: #574a3a;
  font-weight: 600;
  margin-top: 0.75rem;
}

.chapter-depth-3,
.chapter-depth-4 {
  padding-left: 1rem;
}

.page-pagination {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 2.5rem;
  padding-top: 1.25rem;
}

.page-pagination-link {
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 5.5rem;
  padding: 0.9rem 1rem;
  text-decoration: none;
}

.page-pagination-link:hover {
  border-color: rgba(106, 75, 42, 0.42);
  color: var(--accent);
}

.page-pagination-link span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: none;
}

.page-pagination-link strong {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}

.page-pagination-link.next {
  align-items: flex-end;
  text-align: right;
}

.page-pagination-link.is-empty {
  border-color: transparent;
}

@media (max-width: 860px) {
  .site-shell {
    display: block;
  }

  .site-sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    height: auto;
    max-height: 42vh;
    position: relative;
  }

  .site-main {
    padding: 1rem;
  }

  .content-page,
  .home-page {
    box-shadow: none;
    padding: 1rem 0;
  }

  .page-header h1 {
    font-size: 2rem;
  }

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

  .page-pagination-link.is-empty {
    display: none;
  }
}

@media (min-width: 1180px) {
  .sidenote-content {
    border-left: 2px solid var(--line);
    clear: right;
    color: var(--muted);
    float: right;
    font-size: 0.78rem;
    line-height: 1.38;
    margin-bottom: 0.75rem;
    margin-right: calc((var(--sidenote-width) + var(--sidenote-gap)) * -1);
    margin-top: 0.18rem;
    padding-left: 0.65rem;
    width: var(--sidenote-width);
  }
}

@media (max-width: 1179px) {
  .sidenote-content {
    background: #f8f4ec;
    border-left: 3px solid rgba(106, 75, 42, 0.45);
    border-radius: 3px;
    display: none;
    margin: 0.55rem 0 0.9rem;
    padding: 0.7rem 0.8rem;
  }

  .sidenote-wrapper.is-open .sidenote-content {
    display: block;
  }

  .sidenote-wrapper.is-open .sidenote-marker {
    color: var(--accent);
  }
}

@media print {
  .site-sidebar,
  .skip-link {
    display: none;
  }

  .site-shell {
    display: block;
  }

  .site-main {
    padding: 0;
  }

  .content-page,
  .home-page {
    box-shadow: none;
    max-width: none;
    padding: 0;
  }

  .sidenote-content {
    border-left: 2px solid #999;
    clear: right;
    float: right;
    font-size: 0.75rem;
    margin-right: -19rem;
    padding-left: 0.5rem;
    width: 16rem;
  }
}
