/* StoryVerse – Distraction-free reader */

.page-reader .site-header {
  border-bottom-color: transparent;
}

.page-reader.reader-dark,
.page-reader.reader-dark .site-main {
  background: #12121a;
  color: #e8e8f0;
  --text: #e8e8f0;
  --secondary: #f2f2fa;
  --muted: #b4b4c8;
  --border: rgba(255, 255, 255, 0.12);
  --surface: #1b1b27;
  --background: #12121a;
}

.page-reader.reader-dark .site-header {
  background: rgba(18, 18, 26, 0.92);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.page-reader.reader-dark .brand,
.page-reader.reader-dark .brand span,
.page-reader.reader-dark .main-nav__links > li > a,
.page-reader.reader-dark .icon-btn,
.page-reader.reader-dark .nav-toggle {
  color: #f2f2fa;
}

.page-reader.reader-dark h1,
.page-reader.reader-dark h2,
.page-reader.reader-dark h3,
.page-reader.reader-dark h4,
.page-reader.reader-dark h5 {
  color: #f2f2fa;
}

.reader-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--primary);
  z-index: 200;
  transition: width 0.08s linear;
}

.reader-shell {
  width: min(100% - 2rem, 760px);
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}

.reader-shell.theme-dark {
  color: #e8e8f0;
  --text: #e8e8f0;
  --secondary: #f2f2fa;
  --muted: #b4b4c8;
}

/* Headings use --secondary globally; force light text in dark mode */
.reader-shell.theme-dark h1,
.reader-shell.theme-dark h2,
.reader-shell.theme-dark h3,
.reader-shell.theme-dark h4,
.reader-shell.theme-dark h5,
.reader-shell.theme-dark .reader-header h1,
.reader-shell.theme-dark .reader-nav__title {
  color: #f2f2fa !important;
}

.reader-shell.theme-dark .muted,
.reader-shell.theme-dark .reader-kicker,
.reader-shell.theme-dark .reader-kicker a,
.reader-shell.theme-dark .reader-nav__label,
.reader-shell.theme-dark .reader-body {
  color: #d8d8e6;
}

.reader-shell.theme-dark a:not(.btn) {
  color: #c4b5ff;
}

.reader-shell.theme-dark .reader-toolbar {
  background: rgba(18, 18, 26, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
}

.reader-shell.theme-dark .form-control,
.reader-shell.theme-dark .btn--ghost,
.reader-shell.theme-dark .reader-tool-btn {
  background: #1b1b27;
  border-color: rgba(255, 255, 255, 0.12);
  color: #e8e8f0;
}

.reader-shell.theme-dark .btn--ghost .muted,
.reader-shell.theme-dark .btn--ghost .reader-nav__label {
  color: #b0b0c4;
}

.reader-shell.theme-dark .btn--soft {
  background: #2a2a3a;
  color: #e8e8f0;
}

.reader-shell.theme-dark .btn.is-active {
  background: rgba(108, 76, 227, 0.28);
  border-color: #9b82f0;
  color: #dcd6ff;
}

.page-reader.reader-dark .dropdown,
.page-reader.reader-dark .user-menu__panel {
  background: #1b1b27;
  border-color: rgba(255, 255, 255, 0.1);
  color: #e8e8f0;
}

.page-reader.reader-dark .dropdown a,
.page-reader.reader-dark .main-nav__actions .btn--ghost {
  color: #e8e8f0;
}

.reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  position: sticky;
  top: calc(var(--header-h) + 0.35rem);
  z-index: 20;
  background: rgba(248, 248, 252, 0.94);
  backdrop-filter: blur(12px);
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.reader-toolbar__left,
.reader-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.reader-toolbar .reader-tool-btn {
  color: var(--text);
  background: var(--surface);
  min-width: 2.55rem;
  min-height: 2.55rem;
  padding: 0.45rem 0.7rem;
  justify-content: center;
  line-height: 1;
}

.reader-toolbar .reader-tool-btn__icon {
  display: inline-block;
  color: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  speak: never;
}

.reader-chapter-select {
  min-width: min(100%, 220px);
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
}

.reader-header {
  margin-bottom: 1.75rem;
}

.reader-kicker {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.reader-kicker a:hover {
  color: var(--primary);
}

.reader-header h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin-bottom: 0.4rem;
}

.reader-content {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.28rem;
  line-height: 1.9;
}

.reader-content.font-lg {
  font-size: 1.45rem;
}

.reader-content.font-sm {
  font-size: 1.1rem;
}

.reader-body p {
  margin: 0 0 1.25rem;
}

.reader-body h2,
.reader-body h3 {
  margin-top: 1.8rem;
}

.reader-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.reader-shell.theme-dark .reader-nav {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.reader-nav .btn {
  border-radius: 16px;
  padding: 1rem 1.1rem;
  line-height: 1.35;
}

.reader-nav__link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
  min-height: 4.25rem;
  white-space: normal;
  text-align: left;
}

.reader-nav__link--next {
  align-items: flex-end;
  text-align: right;
  margin-left: auto;
}

.reader-nav__label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0.85;
}

.reader-nav__title {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.btn.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

@media (max-width: 640px) {
  .reader-nav {
    grid-template-columns: 1fr;
  }

  .reader-nav__link--next {
    align-items: flex-start;
    text-align: left;
    margin-left: 0;
  }

  .reader-chapter-select {
    width: 100%;
  }
}
