:root {
  color-scheme: light;
  --bg: #f5efe6;
  --paper: #fffaf2;
  --ink: #241d18;
  --muted: #76685d;
  --soft: #e8dccd;
  --line: rgba(36, 29, 24, 0.14);
  --accent: #8a4c2a;
  --accent-strong: #66331f;
  --shadow: 0 22px 70px rgba(57, 40, 27, 0.18);
  --reading-font-size: 21px;
}

:root.is-dark {
  color-scheme: dark;
  --bg: #191613;
  --paper: #25211d;
  --ink: #f3eadf;
  --muted: #b7a89b;
  --soft: #3a3129;
  --line: rgba(243, 234, 223, 0.15);
  --accent: #d6a15f;
  --accent-strong: #f0bd76;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

img {
  display: block;
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  padding: 10px clamp(16px, 4vw, 46px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(18px);
}

.reading-progress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: transparent;
  overflow: hidden;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}

.reading-tools {
  display: flex;
  gap: 6px;
}

.reading-tools button,
.contents__toggle {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
  cursor: pointer;
}

.reading-tools button:disabled {
  cursor: default;
  opacity: 0.4;
}

.topbar a {
  color: var(--ink);
  text-decoration: none;
}

.topbar__brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 700;
}

.topbar__nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.topbar__nav a {
  color: var(--muted);
}

.topbar__nav a:hover,
.topbar__brand:hover {
  color: var(--accent);
}

.hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(260px, 430px);
  align-items: center;
  gap: clamp(28px, 7vw, 90px);
  min-height: calc(100vh - 62px);
  padding: clamp(34px, 7vw, 92px) clamp(18px, 7vw, 96px);
}

.hero__copy {
  max-width: 660px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 8vw, 108px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero p:not(.eyebrow) {
  max-width: 560px;
  margin: 24px 0 30px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.65;
}

.hero__button {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.cover {
  justify-self: center;
  width: min(100%, 390px);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  background: var(--soft);
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 820px);
  justify-content: center;
  gap: clamp(22px, 5vw, 62px);
  padding: 28px clamp(14px, 4vw, 48px) 90px;
}

.contents {
  position: sticky;
  top: 82px;
  align-self: start;
  max-height: calc(100vh - 104px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  overflow: auto;
}

.contents__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.contents__head button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.contents__list {
  display: grid;
  gap: 4px;
}

.contents__toggle {
  display: none;
  width: 100%;
  margin-bottom: 10px;
}

.contents__list a {
  display: block;
  padding: 8px 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.25;
  text-decoration: none;
}

.contents__list a:hover,
.contents__list a.is-active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-strong);
}

.book {
  min-width: 0;
  padding: clamp(24px, 5vw, 54px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.book-section {
  scroll-margin-top: 86px;
}

.book h2 {
  margin: 2.8rem 0 1.4rem;
  color: var(--accent-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
}

.book p {
  margin: 0 0 1.05rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: var(--reading-font-size);
  line-height: 1.74;
  text-align: justify;
}

.book-note {
  color: var(--muted);
  font-style: italic;
}

.book p::first-letter {
  margin-left: 1.3em;
}

.verse,
.toc-text {
  white-space: pre-wrap;
  margin: 0 0 1.35rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: max(17px, calc(var(--reading-font-size) - 1px));
  line-height: 1.72;
}

.book-illustration {
  margin: 1.8rem 0 2.4rem;
}

.book-illustration__button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: zoom-in;
  overflow: hidden;
}

.book-illustration img {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 44px rgba(57, 40, 27, 0.16);
}

.lightbox {
  width: min(96vw, 1200px);
  height: min(94vh, 1000px);
  padding: 46px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}

.lightbox::backdrop {
  background: rgba(15, 12, 10, 0.84);
  backdrop-filter: blur(6px);
}

.lightbox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.verse {
  padding-left: clamp(8px, 3vw, 34px);
}

.toc-text {
  color: var(--muted);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.scroll-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.scroll-top.is-visible {
  display: block;
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .cover {
    order: -1;
    width: min(76vw, 340px);
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .contents {
    position: static;
    max-height: 260px;
  }

  .contents__toggle {
    display: block;
  }

  .contents:not(.is-open) .contents__list {
    display: none;
  }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 56px;
    padding: 8px 12px;
  }

  .topbar__brand {
    font-size: 18px;
  }

  .topbar__nav {
    display: none;
  }

  .reading-tools {
    margin-left: auto;
  }

  .hero {
    padding: 18px 12px 34px;
  }

  h1 {
    font-size: 46px;
  }

  .hero p:not(.eyebrow) {
    font-size: 16px;
  }

  .layout {
    padding: 14px 10px 70px;
  }

  .book {
    padding: 22px 16px;
  }

  .book p {
    text-align: left;
  }

  .book p::first-letter {
    margin-left: 0;
  }
}
