:root {
  color-scheme: dark;
  --bg: #070909;
  --surface: #101617;
  --surface-strong: #172021;
  --text: #eeeae1;
  --muted: #aeb9b7;
  --accent: #ffb703;
  --line: rgba(255, 255, 255, 0.14);
  --error: #ff9b9b;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: "Literata", Georgia, serif;
  background: var(--bg);
}

a {
  color: inherit;
}

button {
  font: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.reader-header {
  border-bottom: 1px solid var(--line);
  background: #090d0d;
}

.reader-header-inner {
  width: min(1060px, calc(100% - 32px));
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto;
}

.reader-brand {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.55rem;
  text-decoration: none;
}

.collection-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-family: "Sora", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 160ms ease-out, color 160ms ease-out;
}

.collection-link:hover {
  border-color: var(--accent);
  color: var(--text);
}

.reader-main {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.chapter-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  margin-bottom: 16px;
  font-family: "Sora", sans-serif;
}

.toolbar-button {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 160ms ease-out, background-color 160ms ease-out;
}

.toolbar-button:hover {
  border-color: var(--accent);
  background: var(--surface-strong);
}

.share-status {
  flex-basis: 100%;
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: right;
}

.share-status[data-state="error"] {
  color: var(--error);
}

.chapter-article {
  padding: clamp(26px, 6vw, 58px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.chapter-header {
  margin-bottom: clamp(30px, 6vw, 52px);
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.book-title,
.chapter-kicker,
.reading-time {
  font-family: "Sora", sans-serif;
}

.book-title {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.chapter-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.chapter-header h1 {
  margin: 12px 0 0;
  color: #ffffff;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(2.8rem, 8vw, 5rem);
  line-height: 1;
  text-wrap: balance;
}

.reading-time {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.chapter-body {
  font-size: clamp(1.05rem, 2vw, 1.16rem);
  line-height: 1.88;
}

.chapter-body p {
  margin: 0 0 1.35em;
  text-wrap: pretty;
}

.chapter-body > p:first-of-type::first-letter {
  float: left;
  margin: 0.08em 0.12em 0 0;
  color: var(--accent);
  font-family: "Bebas Neue", sans-serif;
  font-size: 3.5em;
  line-height: 0.78;
}

.chapter-body h2 {
  margin: 2.2em 0 0.75em;
  color: #ffffff;
  font-family: "Sora", sans-serif;
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  line-height: 1.35;
  text-wrap: balance;
}

.chapter-body em {
  color: #ffffff;
}

.scripture {
  margin: 0 0 2em;
  padding: 20px 22px;
  border-left: 4px solid var(--accent);
  background: #0b1010;
}

.scripture p {
  margin: 0;
  font-size: 0.98em;
  font-style: italic;
  line-height: 1.75;
}

.scripture cite {
  display: block;
  margin-top: 12px;
  color: var(--accent);
  font-family: "Sora", sans-serif;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
}

.key-insight {
  margin: 2em 0 !important;
  padding: 18px 20px;
  border-left: 4px solid var(--accent);
  color: #ffffff;
  background: #0b1010;
  font-weight: 600;
}

.chapter-source {
  margin: 38px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: "Sora", sans-serif;
  font-size: 0.68rem;
  line-height: 1.6;
}

.chapter-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  font-family: "Sora", sans-serif;
}

.chapter-nav a {
  min-width: 0;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 160ms ease-out, background-color 160ms ease-out;
}

.chapter-nav a:hover {
  border-color: var(--accent);
  background: var(--surface-strong);
}

.chapter-nav span {
  color: var(--muted);
  font-size: 0.68rem;
}

.chapter-nav strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
  line-height: 1.4;
}

.nav-next {
  text-align: right;
}

.reader-footer {
  padding: 24px 16px 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: "Sora", sans-serif;
  font-size: 0.7rem;
  text-align: center;
}

@media (max-width: 640px) {
  .reader-header-inner,
  .reader-main {
    width: min(100% - 20px, 820px);
  }

  .reader-header-inner {
    min-height: 64px;
  }

  .reader-brand {
    font-size: 1.25rem;
  }

  .collection-link {
    min-height: 40px;
    padding: 8px 11px;
    font-size: 0.7rem;
  }

  .reader-main {
    padding-top: 22px;
  }

  .chapter-toolbar {
    justify-content: stretch;
  }

  .toolbar-button {
    flex: 1 1 130px;
    min-height: 44px;
  }

  .share-status {
    text-align: left;
  }

  .chapter-article {
    padding: 24px 18px 30px;
    border-radius: 14px;
  }

  .chapter-header {
    margin-bottom: 30px;
    padding-bottom: 22px;
  }

  .chapter-body {
    font-size: 1.04rem;
    line-height: 1.78;
  }

  .chapter-body p {
    margin-bottom: 1.25em;
  }

  .scripture,
  .key-insight {
    padding: 16px;
  }

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

  .nav-next {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

@media print {
  @page {
    size: A4;
    margin: 18mm 17mm 20mm;
  }

  :root {
    color-scheme: light;
  }

  body {
    min-width: 0;
    color: #111111;
    background: #ffffff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11pt;
  }

  .reader-header,
  .chapter-toolbar,
  .chapter-nav,
  .reader-footer {
    display: none !important;
  }

  .reader-main {
    width: auto;
    margin: 0;
    padding: 0;
  }

  .chapter-article {
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #111111;
    background: #ffffff;
  }

  .chapter-header {
    margin-bottom: 9mm;
    padding-bottom: 7mm;
    border-color: #999999;
  }

  .book-title,
  .chapter-kicker,
  .reading-time {
    color: #333333;
  }

  .chapter-header h1 {
    color: #000000;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 24pt;
    line-height: 1.15;
  }

  .chapter-body {
    font-size: 11pt;
    line-height: 1.55;
  }

  .chapter-body p {
    margin-bottom: 4.5mm;
    text-align: justify;
    orphans: 3;
    widows: 3;
  }

  .chapter-body > p:first-of-type::first-letter {
    color: #000000;
  }

  .chapter-body h2 {
    break-after: avoid;
    color: #000000;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15pt;
  }

  .chapter-body em {
    color: inherit;
  }

  .scripture,
  .key-insight {
    break-inside: avoid;
    border-left: 2pt solid #000000;
    color: #111111;
    background: transparent;
  }

  .scripture cite {
    color: #111111;
  }

  .chapter-source {
    border-color: #999999;
    color: #444444;
  }
}
