:root {
  --desk-top: #8e7460;
  --desk-bottom: #655041;
  --ink: #2f251f;
  --muted: #7f6858;
  --paper: #f9f3e8;
  --paper-deep: #efe2cf;
  --paper-line: rgba(106, 79, 57, 0.16);
  --accent: #8c5b40;
  --shadow: 0 28px 80px rgba(34, 20, 12, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top, rgba(255, 239, 210, 0.18), transparent 26%),
    linear-gradient(180deg, var(--desk-top) 0%, #745d4d 24%, var(--desk-bottom) 100%);
}

a,
button,
input {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 2rem 1.3rem;
  color: #f4ecdf;
  background:
    linear-gradient(180deg, rgba(48, 35, 29, 0.96), rgba(30, 22, 18, 0.97)),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 8px
    );
  border-right: 1px solid rgba(255, 243, 224, 0.08);
}

.sidebar-mark,
.kicker {
  margin: 0 0 0.8rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.sidebar h1,
.frontispiece h2,
.page-header h2,
.section-heading h2 {
  margin: 0;
  font-weight: 400;
  letter-spacing: 0;
}

.sidebar h1 {
  font-size: clamp(2.1rem, 3.5vw, 3.25rem);
  line-height: 1;
}

.sidebar-copy {
  margin: 1rem 0 1.6rem;
  line-height: 1.75;
  color: rgba(244, 236, 223, 0.8);
}

.sidebar-nav {
  display: grid;
  gap: 0.55rem;
}

#sidebar-links {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.3rem;
}

.sidebar-nav a {
  color: inherit;
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: rgba(255, 247, 236, 0.03);
}

.sidebar-nav a:hover,
.sidebar-nav a:focus-visible {
  border-color: rgba(255, 247, 236, 0.18);
  background: rgba(255, 247, 236, 0.08);
}

.book {
  padding: 2rem;
  display: grid;
  gap: 2rem;
}

.page {
  width: min(100%, 920px);
  margin: 0 auto;
  position: relative;
  padding: clamp(1.5rem, 4vw, 4.1rem) clamp(1.1rem, 5vw, 5.2rem);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.42), transparent 26%),
    repeating-linear-gradient(
      180deg,
      rgba(102, 78, 53, 0.02) 0,
      rgba(102, 78, 53, 0.02) 2px,
      transparent 2px,
      transparent 10px
    ),
    linear-gradient(180deg, #fcf7ee 0%, var(--paper) 100%);
  border: 1px solid rgba(111, 82, 57, 0.14);
  border-radius: 10px 14px 14px 10px;
  box-shadow:
    var(--shadow),
    inset 16px 0 20px rgba(115, 84, 57, 0.08),
    inset -10px 0 16px rgba(115, 84, 57, 0.05);
}

.page::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(104, 77, 55, 0.08);
  border-radius: 5px 10px 10px 5px;
  pointer-events: none;
}

.frontispiece {
  text-align: center;
  min-height: 86vh;
  display: grid;
  align-content: center;
  justify-items: center;
}

.frontispiece-art {
  position: relative;
  min-height: 180px;
  width: 100%;
  margin-bottom: 1.4rem;
}

.ornament {
  position: absolute;
  filter: drop-shadow(0 14px 18px rgba(66, 40, 25, 0.1));
}

.ornament-heart {
  width: 126px;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  opacity: 0.94;
}

.dedication,
.section-summary,
.section-content p,
.contents-link {
  line-height: 1.8;
}

.frontispiece blockquote {
  max-width: 28ch;
  margin: 0 0 1rem;
  font-style: italic;
  font-size: clamp(1.18rem, 2vw, 1.5rem);
  color: #5d493b;
}

.dedication {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  color: var(--muted);
  font-style: italic;
}

.page-header {
  text-align: center;
  margin-bottom: 1.8rem;
}

.page-header h2 {
  font-size: clamp(2.1rem, 4vw, 3.6rem);
}

.contents-grid {
  display: grid;
  gap: 0.9rem;
}

.contents-group {
  display: grid;
  gap: 0.65rem;
}

.contents-group h3 {
  margin: 0.2rem 0 0.1rem;
  font-size: 1.02rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.contents-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(111, 82, 57, 0.22);
  padding-bottom: 0.36rem;
}

.contents-link:hover,
.contents-link:focus-visible {
  color: var(--accent);
  border-color: rgba(140, 91, 64, 0.4);
}

.section-page {
  display: grid;
  gap: 1.4rem;
}

.section-heading {
  text-align: center;
}

.section-heading h2 {
  font-size: clamp(2rem, 4.3vw, 4rem);
  line-height: 1.02;
  max-width: 14ch;
  margin-inline: auto;
}

.section-art {
  display: grid;
  justify-items: center;
  margin-top: 0.25rem;
}

.section-art img {
  max-width: min(100%, 260px);
  max-height: 290px;
}

.section-content {
  font-size: 1.1rem;
}

.section-content p {
  margin: 0 auto 1rem;
  max-width: 34em;
  text-align: justify;
  text-wrap: pretty;
  hyphens: auto;
}

.section-content p:first-child::first-letter {
  float: left;
  margin: 0.05em 0.08em 0 0;
  font-size: 4.4em;
  line-height: 0.82;
  color: var(--accent);
}

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

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 243, 224, 0.08);
  }
}

@media (max-width: 720px) {
  .book,
  .sidebar {
    padding: 1rem;
  }

  .page {
    padding: 1.3rem 0.95rem 1.5rem;
  }

  .frontispiece-art {
    min-height: 120px;
  }

  .ornament-heart {
    width: 92px;
    top: 26px;
  }

}
