:root {
  color-scheme: dark;
  --paper: #18191c;
  --header: #131417;
  --panel: #202125;
  --ink: #e8e5de;
  --muted: #b6b4ae;
  --gold: #cfad73;
  --line: #35363a;
  --reading-size: 21px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="paper"] {
  color-scheme: light;
  --paper: #f7f4ed;
  --header: #eeebe3;
  --panel: #fffdf8;
  --ink: #2c2d29;
  --muted: #64645d;
  --gold: #82602d;
  --line: #d8d4ca;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 30px; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; text-underline-offset: .3em; }
button, select { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 5px;
}
::selection { background: var(--gold); color: var(--paper); }
.skip-link {
  position: fixed;
  top: -90px;
  left: 20px;
  z-index: 10;
  padding: 14px 18px;
  background: var(--gold);
  color: var(--header);
}
.skip-link:focus { top: 12px; }
.reading-progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 5; }
.reading-progress span {
  display: block;
  height: 100%;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
}
.site-header { background: var(--header); border-bottom: 1px solid var(--line); }
.header-inner {
  width: min(1160px, calc(100% - 64px));
  min-height: 78px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 44px;
}
.header-inner nav { align-self: stretch; display: flex; align-items: stretch; gap: 24px; }
.chapter-link {
  display: flex;
  align-items: center;
  position: relative;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--muted);
}
.chapter-link:hover, .current-chapter { color: var(--ink); }
.current-chapter::after {
  content: "";
  position: absolute;
  inset: auto 0 15px;
  height: 2px;
  background: var(--gold);
}
.settings { position: relative; margin-left: auto; }
.settings summary {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  list-style: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
}
.settings summary::-webkit-details-marker { display: none; }
.settings[open] summary { color: var(--gold); border-color: var(--gold); }
.settings-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 4;
  width: 280px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 14px 35px rgb(0 0 0 / .18);
}
.settings-title { margin: 0 0 20px; font-size: 13px; font-weight: 600; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 13px; }
.setting-row + .setting-row { margin-top: 18px; }
.size-controls { display: flex; gap: 6px; }
.size-controls button, .setting-row select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.size-controls button { width: 44px; }
.setting-row select { padding-inline: 10px; }
.chapter-bar { border-bottom: 1px solid var(--line); }
.bar-inner {
  width: min(720px, calc(100% - 48px));
  min-height: 54px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  font-size: 12px;
  color: var(--muted);
}
.preview-label { color: var(--gold); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.chapter { width: min(720px, calc(100% - 48px)); margin-inline: auto; }
.chapter-heading { padding: 100px 0 72px; text-align: center; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--gold); font-size: 11px; font-weight: 600; letter-spacing: .22em; line-height: 1.6; }
h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(56px, 7.5vw, 94px);
  line-height: 1.12;
  letter-spacing: -.04em;
  font-weight: 400;
}
.draft-label { margin: 24px 0 0; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.prose {
  padding-top: 64px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: var(--reading-size);
  line-height: 1.85;
  overflow-wrap: break-word;
}
.prose:focus { outline: none; }
.prose p { margin: 0 0 1.18em; }
.prose > p:first-child::first-letter {
  float: left;
  color: var(--gold);
  font-size: 4em;
  line-height: .86;
  padding: .07em .12em 0 0;
}
.scene-break { text-align: center; color: var(--gold); margin: 3.2em 0; font-size: 18px; letter-spacing: .28em; }
.chapter-end { border-top: 1px solid var(--line); margin-top: 64px; padding: 48px 0 72px; text-align: center; }
.chapter-end .eyebrow { margin: 0 0 24px; }
.reader-note { max-width: 400px; margin: 0 auto 24px; color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: 17px; line-height: 1.75; }
.chapter-end a { display: inline-block; padding: 10px; color: var(--gold); font-size: 13px; }
.chapter-pagination { margin: 0 0 24px; }
.site-footer {
  width: min(1160px, calc(100% - 64px));
  margin-inline: auto;
  padding: 25px 0 32px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 11px;
  color: var(--muted);
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@media (max-width: 600px) {
  .header-inner { width: calc(100% - 36px); min-height: 72px; gap: 22px; }
  .current-chapter { font-size: 12px; }
  .current-chapter::after { bottom: 13px; }
  .settings-panel { width: 268px; }
  .chapter, .bar-inner { width: calc(100% - 40px); }
  .bar-inner { font-size: 11px; min-height: 52px; gap: 10px; }
  .preview-label { font-size: 9px; letter-spacing: .09em; }
  .chapter-heading { padding: 66px 0 48px; }
  h1 { font-size: clamp(48px, 13vw, 66px); }
  .draft-label { margin-top: 20px; }
  .prose { padding-top: 42px; line-height: 1.8; }
  .prose > p:first-child::first-letter { font-size: 3.4em; }
  .chapter-end { padding-bottom: 44px; }
  .site-footer { width: calc(100% - 40px); flex-direction: column; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  :root { --paper: white; --ink: black; --muted: #333; --gold: #333; --line: #bbb; --reading-size: 12pt; }
  .site-header, .chapter-bar, .reading-progress, .site-footer, .chapter-end a, .reader-note { display: none; }
  .chapter { width: 100%; }
  .chapter-heading { padding: 0 0 30px; }
  h1 { font-size: 36pt; }
  .prose { padding-top: 24px; line-height: 1.6; }
  .prose p { orphans: 3; widows: 3; }
}
