:root {
  color-scheme: light;
  --paper: #fbfaf7;
  --ink: #24211d;
  --muted: #716b63;
  --faint: #e6e0d7;
  --line: #d7cec1;
  --accent: #36625d;
  --accent-strong: #214a45;
  --panel: #ffffff;
  --mark: #f2d36b;
  --shadow: 0 24px 80px rgba(36, 33, 29, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

body {
  margin: 0;
}

a {
  color: var(--accent-strong);
  text-decoration-color: rgba(54, 98, 93, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

button,
input,
textarea {
  font: inherit;
}

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

.toc {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow: auto;
  padding: 28px 22px;
  border-right: 1px solid var(--faint);
  background: rgba(251, 250, 247, 0.92);
}

.brand {
  display: block;
  margin-bottom: 28px;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  line-height: 1.1;
}

.brand small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

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

.toc a,
.home-toc a {
  display: block;
  padding: 6px 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.25;
  text-decoration: none;
}

.toc a:hover,
.toc a.active,
.home-toc a:hover {
  color: var(--ink);
}

.toc a.active {
  font-weight: 650;
}

.toc-part {
  margin: 20px 0 7px;
  color: var(--accent);
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-link {
  margin: 28px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--faint);
  font-size: 0.82rem;
}

.contact-link a,
.home-contact a {
  color: var(--muted);
  text-decoration-color: rgba(113, 107, 99, 0.35);
}

main {
  min-width: 0;
}

.home {
  max-width: 840px;
  margin: 0 auto;
  padding: 96px 40px;
}

.eyebrow,
.part-label {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.home h1,
.chapter h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.03;
  letter-spacing: 0;
}

.home h1 {
  max-width: 680px;
  font-size: clamp(3rem, 9vw, 6rem);
}

.dek {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
}

.intro {
  max-width: 620px;
  margin: 28px 0 0;
  color: #3b3732;
  font-size: 1rem;
}

.home-contact {
  margin: 18px 0 0;
  font-size: 0.95rem;
}

.start-button,
.comment-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--accent-strong);
  border-radius: 6px;
  background: var(--accent-strong);
  color: white;
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
}

.start-button {
  margin-top: 34px;
  padding: 0 18px;
}

.recent-comments {
  max-width: 680px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--faint);
}

.home-toc {
  margin-top: 70px;
  padding-top: 28px;
  border-top: 1px solid var(--faint);
}

.recent-comments + .home-toc {
  margin-top: 42px;
}

.home-toc h2,
.recent-comments h2 {
  margin: 0 0 18px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recent-comment {
  border-top: 1px solid var(--faint);
}

.recent-comment:first-child {
  border-top: 0;
}

.recent-comment a {
  display: block;
  padding: 15px 0;
  color: var(--ink);
  text-decoration: none;
}

.recent-comment a:hover .recent-comment-body {
  text-decoration: underline;
  text-decoration-color: rgba(54, 98, 93, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.recent-comment-meta,
.recent-comment-body,
.recent-comment-quote {
  display: block;
}

.recent-comment-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.recent-comment-body {
  margin-top: 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.06rem;
  line-height: 1.45;
}

.recent-comment-quote {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.chapter {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 76px 40px 110px;
}

.chapter-header {
  margin-bottom: 46px;
}

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

.reader-block {
  position: relative;
  margin: 0 0 1.05em;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  line-height: 1.72;
}

.reader-block h3,
h3.reader-block {
  margin-top: 2.2em;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.35;
}

blockquote.reader-block {
  margin-left: 0;
  padding-left: 22px;
  border-left: 3px solid var(--line);
  color: #4b4640;
}

.reader-block.comment-selected .reader-text {
  background: linear-gradient(transparent 58%, rgba(242, 211, 107, 0.46) 58%);
}

.footnote-ref {
  margin-left: 0.08em;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.62em;
  line-height: 0;
}

.footnote-ref a {
  color: var(--accent-strong);
  text-decoration: none;
}

.footnotes {
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--faint);
  color: var(--muted);
}

.footnotes h2 {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footnotes ol {
  margin: 0;
  padding-left: 1.25rem;
}

.footnotes li {
  margin-bottom: 0.7em;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.92rem;
  line-height: 1.55;
}

.footnote-backref {
  margin-left: 0.5em;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
}

.comment-dot {
  position: absolute;
  left: -42px;
  top: 0.45em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 120ms ease, border-color 120ms ease, color 120ms ease;
}

.reader-block:hover .comment-dot,
.comment-dot[data-count]:not([data-count="0"]),
.reader-block.comment-selected .comment-dot {
  opacity: 1;
}

.comment-dot[data-count]:not([data-count="0"]) {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--faint);
}

.chapter-nav a {
  display: block;
  padding: 16px 0;
  color: var(--ink);
  text-decoration: none;
}

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

.chapter-nav span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.comment-panel {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: min(390px, calc(100vw - 36px));
  padding: 24px;
  border: 1px solid var(--faint);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 30px));
  transition: transform 180ms ease;
  overflow: auto;
}

.comment-panel.open {
  transform: translateX(0);
}

.panel-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.4rem;
}

.comment-panel h2 {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.comment-panel p {
  color: var(--muted);
}

.comment-anchor-label {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.selected-quote {
  margin: 0 0 18px;
  padding-left: 14px;
  border-left: 3px solid var(--mark);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

.comment-item {
  padding: 14px 0;
  border-top: 1px solid var(--faint);
}

.comment-meta {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.74rem;
}

.comment-body {
  margin: 0;
  white-space: pre-wrap;
}

.comment-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--faint);
}

.comment-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

.comment-form textarea {
  resize: vertical;
}

.comment-form button {
  padding: 0 16px;
}

.website-field {
  position: absolute;
  left: -9999px;
}

.form-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.82rem;
}

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

  .toc {
    position: static;
    height: auto;
    max-height: 42vh;
    border-right: 0;
    border-bottom: 1px solid var(--faint);
  }

  .chapter,
  .home {
    padding-right: 24px;
    padding-left: 24px;
  }

  .comment-dot {
    position: static;
    display: none;
    margin-left: 8px;
    min-width: 1.55rem;
    height: 1.4rem;
    padding: 0 0.42rem;
    border-radius: 999px;
    background: transparent;
    font-size: 0.68rem;
    line-height: 1;
    vertical-align: middle;
  }

  .comment-dot[data-count]:not([data-count="0"]),
  .reader-block.comment-selected .comment-dot {
    display: inline-flex;
    opacity: 1;
  }
}

@media (max-width: 620px) {
  html {
    font-size: 16px;
  }

  .reader-block {
    font-size: 1.08rem;
    line-height: 1.68;
  }

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

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