/* Immersive book reading modal */

.reading-modal {
  --book-page-bg: #fdfaf5;
  --book-shadow: rgba(15, 23, 42, 0.25);
  --book-outline: rgba(15, 23, 42, 0.08);
  border: 0;
  padding: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  background: transparent;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  color: var(--color-ink);
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.reading-modal[open] {
  opacity: 1;
  transform: none;
}

.reading-modal--closing {
  opacity: 0;
  transform: translateY(30px) scale(0.96);
  pointer-events: none;
}

.reading-modal::backdrop {
  background: rgba(7, 11, 27, 0.75);
  backdrop-filter: blur(12px);
}

.reading-modal__shell {
  width: 100vw;
  max-height: 100vh;
  height: 100vh;
  background: linear-gradient(135deg, #f9f7f2 0%, #ffffff 45%, #f5f1e9 100%);
  border-radius: 0;
  box-shadow: 0 40px 90px rgba(8, 15, 35, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

/* Reading comfort: set on .reading-modal__body[data-reading-comfort-target="scope"] via Stimulus */
.reading-modal__body[data-reading-comfort-target] {
  --reader-font-scale: 1;
  --reader-content-max-ch: 65ch;
}

/* PDF spreads are sized to the viewport by pdf-page; do not apply the prose column width here. */
.reading-modal__body[data-reading-comfort-target] .reading-modal__reading-content:not(.page--pdf-page),
.reading-modal__body[data-reading-comfort-target] .reading-modal__reading-content:not(.page--pdf-page) .house-md-content {
  font-size: calc(1em * var(--reader-font-scale, 1));
  max-width: var(--reader-content-max-ch, 65ch);
  margin-inline: auto;
}

.reading-modal__body[data-reading-comfort-target] .reading-modal__reading-content.page--pdf-page {
  max-width: none;
  width: 100%;
  margin-inline: 0;
}

.reading-modal__body[data-reading-comfort-target] .page--section h1,
.reading-modal__body[data-reading-comfort-target] .page--page {
  font-size: calc(1em * var(--reader-font-scale, 1));
}

.reading-modal__toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
}

.reading-modal__toolbar [data-controller~="dialog"] {
  flex-shrink: 0;
}

.reading-modal__comfort {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.reading-modal__comfort-btn {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.35rem 0.45rem;
  color: var(--color-ink);
  cursor: pointer;
  min-width: 2rem;
  text-align: center;
}

.reading-modal__comfort-btn:hover {
  background: rgba(15, 23, 42, 0.06);
}

.reading-modal__comfort-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-link) 50%, transparent);
  outline-offset: 2px;
}

.reading-modal__comfort-btn--width {
  min-width: 4.25rem;
  font-weight: 500;
  font-size: 0.72rem;
}

.reading-modal__comfort-sep {
  display: inline-block;
  width: 1px;
  height: 1.1rem;
  background: rgba(15, 23, 42, 0.12);
  margin: 0 0.15rem;
}

.reading-modal__toolbar-info {
  flex: 1;
  min-width: 0;
}

.reading-modal__toolbar-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reading-modal__toolbar-subtitle {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  color: var(--color-ink);
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reading-modal__toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-ink);
  background: rgba(15, 23, 42, 0.04);
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.reading-modal__toolbar-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  border-color: rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.reading-modal__close-btn {
  background: rgba(15, 23, 42, 0.08);
  border-color: transparent;
}

.reading-modal__close-btn:hover {
  background: rgba(15, 23, 42, 0.15);
}

.reading-modal__toc-toggle {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.reading-modal__body {
  flex: 1 1 auto;
  position: relative;
  padding: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: radial-gradient(circle at top, rgba(0, 0, 0, 0.04), transparent 60%);
  overflow-y: auto;
  min-height: 0;
}

.reading-modal__surface {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.reading-modal__pages {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--book-page-bg);
  border-radius: 1.5rem;
  box-shadow:
    0 25px 70px var(--book-shadow),
    0 0 0 1px var(--book-outline);
  padding: 0 clamp(3rem, 5vw, 5rem);
  overflow-y: auto;
  overflow-x: hidden;
  isolation: isolate;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.2) transparent;
  transition: box-shadow 0.3s ease;
}

.reading-modal__pages:focus-within {
  box-shadow:
    0 25px 70px var(--book-shadow),
    0 0 0 2px rgba(59, 130, 246, 0.2),
    0 0 0 1px var(--book-outline);
}

.reading-modal__pages::-webkit-scrollbar {
  width: 8px;
}

.reading-modal__pages::-webkit-scrollbar-track {
  background: transparent;
}

.reading-modal__pages::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.2);
  border-radius: 4px;
}

.reading-modal__pages::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.3);
}

/* Preview reading pages */
.preview-reading__page {
  position: relative;
  width: 100%;
  animation: fadeIn 0.4s ease-out;
  opacity: 1;
}

.preview-reading__page[style*="display: none"] {
  animation: fadeOut 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.reading-modal__pages::before {
  display: none;
}

.reading-modal__pages::after {
  display: none;
}

.reading-modal__pages--section::after,
.reading-modal__pages--picture::after {
  display: none;
}

.reading-modal__preview-banner {
  position: relative;
  z-index: 1;
  margin-bottom: 1.5rem;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 216, 168, 0.4);
  border: 1px solid rgba(255, 159, 67, 0.35);
  font-size: 0.95rem;
  color: var(--color-ink);
  text-align: center;
}

.reading-modal__preview-banner strong {
  display: inline-block;
  margin-right: 0.35rem;
  font-weight: 600;
}

.reading-modal__preview-link {
  color: var(--color-link);
  font-weight: 600;
  text-decoration: underline;
}

.reading-modal__preview-link:hover {
  opacity: 0.85;
}

.reading-modal__reading-content {
  position: relative;
  z-index: 1;
  column-count: 1;
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.85;
  letter-spacing: 0.01em;
  color: rgba(15, 23, 42, 0.92);
  text-align: left;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  word-spacing: 0.05em;
  max-width: none;
  margin: 0;
  /* Optimal reading: ~65-75 characters per line */
}

.reading-modal__reading-content h1,
.reading-modal__reading-content h2,
.reading-modal__reading-content h3,
.reading-modal__reading-content h4,
.reading-modal__reading-content h5,
.reading-modal__reading-content h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.4;
  margin: 2rem 0 1.25rem;
  break-inside: avoid;
  break-after: avoid;
  color: rgba(15, 23, 42, 0.95);
  letter-spacing: -0.01em;
}

.reading-modal__reading-content h1:first-child,
.reading-modal__reading-content h2:first-child,
.reading-modal__reading-content h3:first-child {
  margin-top: 0;
}

.reading-modal__reading-content h1 {
  font-size: clamp(2rem, 3vw, 2.5rem);
  margin-top: 0;
}

.reading-modal__reading-content h2 {
  font-size: clamp(1.6rem, 2.5vw, 2rem);
}

.reading-modal__reading-content h3 {
  font-size: clamp(1.3rem, 2vw, 1.6rem);
}

.reading-modal__reading-content p {
  margin: 0 0 1.5rem;
  text-indent: 1.5rem;
  break-inside: avoid;
  orphans: 3;
  widows: 3;
}

.reading-modal__reading-content p:first-of-type {
  text-indent: 0;
}

.reading-modal__reading-content p:last-child {
  margin-bottom: 0;
}

.reading-modal__reading-content ul,
.reading-modal__reading-content ol {
  margin: 0 0 1.5rem 1.5rem;
  padding-left: 1rem;
}

.reading-modal__reading-content li {
  margin-bottom: 0.5rem;
  break-inside: avoid;
}

.reading-modal__reading-content blockquote {
  margin: 2rem 0;
  padding: 1.25rem 0 1.25rem 2rem;
  border-left: 3px solid rgba(15, 23, 42, 0.25);
  font-style: italic;
  color: rgba(15, 23, 42, 0.85);
  break-inside: avoid;
  column-span: all;
}

.reading-modal__reading-content figure {
  margin: 2rem 0;
  text-align: center;
  break-inside: avoid;
}

.reading-modal__reading-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.18);
}

.reading-modal__reading-content figcaption {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  margin-top: 0.75rem;
  color: rgba(15, 23, 42, 0.75);
}

.reading-modal__reading-content a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  transition: opacity 0.2s ease;
}

.reading-modal__reading-content a:hover {
  opacity: 0.8;
  text-decoration-thickness: 2px;
}

.reading-modal__reading-content code {
  font-family: var(--font-mono);
  background: rgba(15, 23, 42, 0.08);
  padding: 0.15em 0.35em;
  border-radius: 0.3rem;
}

.reading-modal__reading-content pre {
  margin: 1.5rem 0;
  padding: 1rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.08);
  overflow-x: auto;
  column-span: all;
}

.reading-modal__reading-content pre code {
  background: none;
  padding: 0;
}

.reading-modal__reading-content.page--section {
  column-count: 1;
  text-align: center;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 600;
  text-indent: 0;
}

.reading-modal__reading-content.page--section h1 {
  margin-bottom: 0;
}

/* Two columns at every viewport; avoid single-column overrides in media queries. */
.reading-modal__pdf-spread {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-items: stretch;
  position: relative;
}

.reading-modal__pdf-spread-page {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.reading-modal__pdf-spread-page + .reading-modal__pdf-spread-page {
  justify-content: flex-start;
  border-left: 0;
}

.reading-modal__pdf-spread::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-0.5px);
  background: rgba(15, 23, 42, 0.18);
  pointer-events: none;
}

.reading-modal__pdf-spread .pdf-page-reader {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  gap: 0;
  justify-content: center;
}

.reading-modal__pdf-spread .pdf-page-reader__loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1rem;
  text-align: center;
  color: rgba(15, 23, 42, 0.5);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: rgba(253, 250, 245, 0.92);
  backdrop-filter: blur(10px);
}

.reading-modal__pdf-spread .pdf-page-reader__loading[hidden] {
  display: none !important;
}

.reading-modal__pdf-spread .pdf-page-reader__loading-spinner {
  color: rgba(15, 23, 42, 0.45);
}

.reading-modal__pdf-spread-page + .reading-modal__pdf-spread-page .pdf-page-reader {
  align-items: flex-start;
}

/* Non-PDF spread panes: full-width content in each half. */
.reading-modal__spread-page {
  align-items: stretch;
  justify-content: stretch;
  padding: 0 0.6rem;
}

.reading-modal__spread-page .reading-modal__reading-content {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 0.35rem;
}

.reading-modal__pdf-spread-page--locked {
  justify-content: center;
}

.reading-modal__pdf-locked-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: min(100%, 420px);
  height: min(100%, 680px);
  border-radius: 0.75rem;
  border: 1px dashed rgba(15, 23, 42, 0.2);
  background: rgba(15, 23, 42, 0.05);
  color: rgba(15, 23, 42, 0.85);
  text-align: center;
  padding: 1rem;
}

.reading-modal__pdf-locked-note span {
  color: rgba(15, 23, 42, 0.65);
}

.reading-modal__pdf-spread .pdf-page-reader__canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* PDF preview: edge-to-edge in the modal — no padding around pages, banner, or spread. */
.reading-modal__pages.reading-modal__pages--pdf-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border-radius: 0;
}

/* Library / full reader: same edge-to-edge PDF treatment as the preview modal shell. */
.reading-modal__pages.reading-modal__pages--pdf-page:not(.reading-modal__pages--pdf-preview) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
  border-radius: 0;
}

.reading-modal__pages.reading-modal__pages--pdf-page:not(.reading-modal__pages--pdf-preview) .reading-modal__preview-banner {
  flex-shrink: 0;
  margin: 0;
  padding-block: 0.5rem;
  padding-inline: 0;
  border-radius: 0;
  border: none;
}

.reading-modal__pages--pdf-preview .reading-modal__preview-banner {
  flex-shrink: 0;
  margin: 0;
  padding-block: 0.5rem;
  padding-inline: 0;
  border-radius: 0;
  border: none;
}

.reading-modal__pages--pdf-preview .preview-reading__page.reading-modal__pages--pdf-page {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
}

.reading-modal__pages--pdf-page {
  overflow: hidden;
  padding: clamp(0.75rem, 1.8vw, 1.5rem);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.reading-modal__pages.reading-modal__pages--pdf-page > .reading-modal__pdf-spread {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
}

.reading-modal__pages--pdf-page .reading-modal__reading-content.page--pdf-page {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reading-modal__pages--pdf-preview .reading-modal__reading-content.page--pdf-page .reading-modal__pdf-spread,
.reading-modal__pages--pdf-page .reading-modal__reading-content.page--pdf-page .reading-modal__pdf-spread {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
}

.reading-modal__pages--pdf-page .reading-modal__reading-content {
  height: 100%;
  min-height: 0;
}

.reading-modal__pages--picture .reading-modal__reading-content,
.reading-modal__reading-content.page--picture {
  column-count: 1;
  text-align: center;
  text-indent: 0;
}

.reading-modal__pages--picture img {
  margin: 0 auto;
  max-height: 70vh;
}

.reading-modal__footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
}

.reading-modal__footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.reading-modal__footer-nav-group {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.reading-modal__footer-nav-group:first-child {
  justify-content: flex-start;
}

.reading-modal__footer-nav-group:last-child {
  justify-content: flex-end;
}

.reading-modal__footer-nav .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: rgba(15, 23, 42, 0.05);
  color: var(--color-ink);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  max-width: 100%;
  min-width: 0;
  justify-content: space-between;
  cursor: pointer;
}

.reading-modal__footer-nav .btn:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.12);
  border-color: rgba(15, 23, 42, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.reading-modal__footer-nav .btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.reading-modal__footer-nav .btn:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

.reading-modal__footer-nav .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.reading-modal__footer-nav-center {
  flex: 0 0 auto;
  font-size: 0.85rem;
  color: rgba(15, 23, 42, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.reading-modal__footer-nav .overflow-ellipsis {
  display: inline-block;
  max-width: 100%;
  min-width: 0;
}

.reading-modal__page-indicator {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  transition: background 0.2s ease;
}

.reading-modal__page-indicator:hover {
  background: rgba(15, 23, 42, 0.1);
}

/* Table of contents panel */
.reading-modal__toc {
  position: absolute;
  top: clamp(1rem, 2vw, 1.5rem);
  left: clamp(1rem, 2vw, 1.5rem);
  width: min(360px, 80vw);
  height: calc(100% - 2 * clamp(1rem, 2vw, 1.5rem));
  transform: translateX(-120%);
  transition: transform 0.35s ease, opacity 0.35s ease;
  pointer-events: none;
  opacity: 0;
  z-index: 10;
}

.reading-modal__toc--open {
  transform: translateX(0);
  pointer-events: auto;
  opacity: 1;
}

.reading-modal__toc-panel {
  height: 100%;
  border-radius: 1rem;
  background: #ffffff;
  box-shadow: 0 35px 70px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reading-modal__toc-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.reading-modal__toc-header > div:first-child {
  min-width: 0;
  flex: 1;
}

.reading-modal__toc-eyebrow {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(15, 23, 42, 0.6);
}

.reading-modal__toc-title {
  margin: 0.2rem 0 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-ink);
}

/* Book title in TOC header (same BEM class as row titles; must wrap) */
.reading-modal__toc-header .reading-modal__toc-title {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.reading-modal__toc-close {
  border: none;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.reading-modal__toc-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 0.85rem 1.75rem;
  scroll-padding-top: 1rem;
}

.reading-modal__toc-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.reading-modal__toc-item {
  margin: 0;
}

.reading-modal__toc-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1.2rem;
  border-radius: 0.9rem;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-ink);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.reading-modal__toc-link:hover {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.08);
}

.reading-modal__toc-link.active {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.15);
  color: var(--color-link);
}

.reading-modal__toc-link .reading-modal__toc-title {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-modal__toc-kicker {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(15, 23, 42, 0.55);
}

.reading-modal__toc-item--section .reading-modal__toc-title {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Responsive */
@media (max-width: 1200px) {
  .reading-modal__pages {
    width: 100%;
    height: 100%;
    min-height: 0;
  }
  
  .reading-modal__reading-content {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    max-width: none;
  }
}

@media (max-width: 900px) {
  .reading-modal {
    align-items: stretch;
  }
  
  .reading-modal__shell {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  
  .reading-modal__toolbar {
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
  }
  
  .reading-modal__body {
    padding: 0;
  }
  
  .reading-modal__pages {
    padding: 0 1.75rem;
    border-radius: 0;
    width: 100%;
  }
  
  .reading-modal__reading-content {
    max-width: 100%;
    font-size: clamp(1rem, 4vw, 1.1rem);
    line-height: 1.8;
    padding: 0;
  }

  .reading-modal__toc {
    width: calc(100% - 2rem);
    left: 1rem;
    right: 1rem;
    top: 1rem;
    height: calc(100% - 2rem);
  }
}

@media (max-width: 600px) {
  .reading-modal__footer-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .reading-modal__footer-nav-group,
  .reading-modal__footer-nav-center {
    width: 100%;
    justify-content: stretch;
  }

  .reading-modal__footer-nav-center {
    order: -1;
    margin-bottom: 0.5rem;
    text-align: center;
  }

  .reading-modal__footer-nav .btn {
    width: 100%;
  }
}
