:root {
  --bg: #141210;
  --ink: #e8dfd0;
  --muted: #9a8f7e;
  --line: #2a251f;
  --accent: #c4a574;
  --system: #7eb8c9;
  --measure: 38rem;
  --pad: clamp(1.1rem, 4vw, 2rem);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 50% -10%, #221c16 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, serif;
  font-optical-sizing: auto;
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: #e2c896;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem var(--pad);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}

.brand {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.chapter-nav a {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.2rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 999px;
}

.chapter-nav a.active,
.chapter-nav a:hover {
  color: var(--ink);
  border-color: var(--line);
}

.content {
  flex: 1;
  width: min(100%, calc(var(--measure) + 2 * var(--pad)));
  margin: 0 auto;
  padding: 2rem var(--pad) 5rem;
}

.home h1 {
  margin: 0.2rem 0 0.75rem;
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  line-height: 1.05;
}

.kicker {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.lede {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.home-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.home-list a {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  background: #1a1713;
}

.home-list a:hover {
  border-color: #3a3228;
  color: var(--accent);
}

.home-list span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.chapter h1 {
  margin: 0 0 1.5rem;
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  line-height: 1.15;
}

.chapter p {
  margin: 0 0 1.05rem;
  font-size: 1.12rem;
}

.chapter hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

.chapter blockquote {
  margin: 1.25rem 0;
  padding: 0.9rem 1rem;
  border-left: 2px solid var(--system);
  background: #101820;
  color: #d5e8ef;
  font-size: 0.98rem;
  line-height: 1.55;
}

.chapter blockquote p {
  margin: 0 0 0.45rem;
  font-size: inherit;
}

.chapter blockquote p:last-child {
  margin-bottom: 0;
}

.chapter strong {
  font-weight: 600;
}

.chapter em {
  font-style: italic;
}

.loading,
.error {
  color: var(--muted);
}

.bottom {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem var(--pad) calc(0.85rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
}

.bottom a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.bottom a:hover {
  color: var(--accent);
}

#prev {
  justify-self: start;
}

#toc {
  justify-self: center;
}

#next {
  justify-self: end;
}

#prev[aria-disabled="true"],
#next[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}
