:root {
  --paper: #f3e6c4;
  --paper-dark: #e6d3a3;
  --ink: #3b2a1a;
  --ink-soft: #6b5238;
  --accent: #7a2e1d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 2rem 1rem;
  background: #2a1f16 radial-gradient(circle at center, #3b2c1f, #1c140d);
  color: var(--ink);
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.7;
}

/* The open book */
.book {
  display: flex;
  max-width: 1050px;
  margin: 0 auto;
  border-radius: 4px;
  border: 1px solid #5a3a1e;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 0 80px rgba(120, 80, 30, 0.35);
  background:
    /* fine paper grain */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.30  0 0 0 0 0.20  0 0 0 0 0.10  0 0 0 0.5 -0.1'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    /* large aged blotches and stains */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='800' height='800'><filter id='b'><feTurbulence type='fractalNoise' baseFrequency='0.012' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.38  0 0 0 0 0.15  0 0 0 0.6 -0.15'/></filter><rect width='100%' height='100%' filter='url(%23b)'/></svg>"),
    var(--paper);
}

/* Left page: table of contents */
nav {
  width: 240px;
  flex-shrink: 0;
  padding: 2.5rem 1.5rem;
  background: linear-gradient(to right, transparent 85%, rgba(90, 58, 30, 0.18));
  border-right: 2px double var(--ink-soft);
}
nav h2 {
  margin: 0 0 1rem;
  font-family: 'IM Fell English SC', Georgia, serif;
  font-weight: normal;
  font-size: 1.4rem;
  text-align: center;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--ink-soft);
  padding-bottom: 0.5rem;
}
nav a {
  display: block;
  padding: 0.25rem 0;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dotted rgba(107, 82, 56, 0.4);
}
nav a:hover { color: var(--accent); font-style: italic; }

/* Right page: the content */
main {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 3rem 3.5rem;
  background: linear-gradient(to left, transparent 90%, rgba(90, 58, 30, 0.12));
}

h1, h2, h3, h4 {
  font-family: 'IM Fell English SC', Georgia, serif;
  font-weight: normal;
  line-height: 1.2;
}
main h1 { text-align: center; font-size: 2.4rem; margin: 0; }
main h2 { font-size: 1.7rem; border-bottom: 1px solid var(--ink-soft); padding-bottom: 0.2rem; margin-top: 2rem; }

.ornament {
  text-align: center;
  font-size: 1.6rem;
  color: var(--accent);
  margin: 0.5rem 0 1.5rem;
}

p { margin: 0 0 1rem; text-align: justify; hyphens: auto; }

/* Illuminated first letter */
main > p:first-of-type::first-letter {
  float: left;
  font-family: 'IM Fell English SC', Georgia, serif;
  font-size: 4.2rem;
  line-height: 0.8;
  padding: 0.35rem 0.5rem 0 0;
  color: var(--accent);
}

main a { color: var(--accent); text-decoration: underline; text-decoration-style: dotted; }
main a:hover { text-decoration-style: solid; }

ul { padding-left: 1.5rem; }
li { margin-bottom: 0.3rem; }

/* Phones: stack the pages */
@media (max-width: 760px) {
  .book { flex-direction: column; }
  nav { width: auto; border-right: none; border-bottom: 2px double var(--ink-soft); padding: 1.5rem; }
  main { padding: 1.5rem; }
  p { text-align: left; }
}