/* ═══════════════════════════════════════════════════════════════
   litreads.css  —  Literature page: book reader, quotes, reading list
   Used by: litreads.php
═══════════════════════════════════════════════════════════════ */

/* ── Flush panel variant: reader fills its panel edge-to-edge ── */
.panel--flush {
  padding: 0 !important;
  overflow: hidden;
}

/* ── Padded panel variant: quotes & reading list get breathing room ── */
.panel--padded {
  padding: 1rem !important;
}

/* ── 3-column layout ── */
.lit-page {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  padding: 1.25rem 0.75rem 1.5rem;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 240px;
  gap: 1rem;
  align-items: stretch;
}

.lit-col-left,
.lit-col-center,
.lit-col-right {
  display: flex;
  flex-direction: column;
}

.lit-col-left > .panel,
.lit-col-center > .panel,
.lit-col-right > .panel {
  flex: 1;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .lit-page { grid-template-columns: 1fr; }
  .lit-col-left   { order: 2; }
  .lit-col-center { order: 1; }
  .lit-col-right  { order: 3; }
}

/* ── Quotes ── */
.quote-block {
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.quote-block:last-child { border-bottom: none; }

.quote-text {
  font-style: italic;
  line-height: 1.7;
  font-size: 0.88em;
  color: #c8d3e0;
  margin: 0 0 0.35rem;
}

.quote-source {
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  opacity: 0.75;
}

/* ── Recommended reading list ── */
.reading-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 0.9em;
}
.reading-item:last-child { border-bottom: none; }

.reading-num {
  font-size: 0.70em;
  color: var(--muted);
  opacity: 0.5;
  flex-shrink: 0;
  min-width: 16px;
  text-align: right;
}

.reading-title {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
  color: var(--text);
}
.reading-title a { color: var(--accent); text-decoration: none; }
.reading-title a:hover { text-decoration: underline; }

.reading-author {
  font-size: 0.78em;
  color: var(--muted);
  width: 100%;
  padding-left: 22px;
  margin-top: 1px;
}

/* ── Reader topbar ── */
#readerTopbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0.75rem;
  height: 42px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px 8px 0 0;
}

#readerMenuBtn {
  font-size: 19px;
  cursor: pointer;
  line-height: 1;
  color: var(--muted);
  flex-shrink: 0;
  transition: color 0.2s;
  user-select: none;
}
#readerMenuBtn:hover { color: var(--text); }

#readerTopTitle {
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ── Reader body wrapper ── */
#readerBody {
  display: flex;
  position: relative;
  min-height: 380px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

/* ── Sidebar ── */
#readerSidebar {
  width: 200px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.22);
  border-right: 1px solid rgba(148, 163, 184, 0.14);
  overflow-y: auto;
  padding: 0.5rem 0.4rem;
  box-sizing: border-box;
  position: absolute;
  top: 0; left: -200px; bottom: 0;
  transition: left 0.28s ease;
  z-index: 10;
  border-radius: 0 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
#readerSidebar.open { left: 0; }

@media (max-width: 960px) {
  #readerSidebar {
    background: #0b1120;
    border-right: 1px solid rgba(148, 163, 184, 0.22);
  }
}

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.55;
  padding: 0.5rem 0.4rem 0.25rem;
}

/* ── Book items in sidebar ── */
.bookItem {
  padding: 0.45rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.80rem;
  line-height: 1.35;
  color: var(--muted);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  margin-bottom: 2px;
}
.bookItem:hover {
  background: rgba(56, 189, 248, 0.10);
  color: var(--text);
}
.bookItem.active {
  color: var(--accent);
  font-weight: 600;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.22);
}
.bookItem-title  { display: block; }
.bookItem-author { display: block; font-size: 0.72rem; opacity: 0.6; margin-top: 1px; }

.sidebar-divider {
  border: none;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  margin: 0.4rem 0;
}

#backToBooks {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 0.35rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.76rem;
  color: var(--accent);
  opacity: 0.8;
  transition: opacity 0.15s, background 0.15s;
  margin-bottom: 2px;
}
#backToBooks:hover { opacity: 1; background: rgba(56, 189, 248, 0.08); }
#backToBooks.visible { display: flex; }

/* ── Chapter items in sidebar ── */
.chapterItem {
  padding: 0.42rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.79rem;
  line-height: 1.4;
  color: var(--muted);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
}
.chapterItem:hover {
  background: rgba(56, 189, 248, 0.10);
  color: var(--text);
}
.chapterItem.active {
  color: var(--accent);
  font-weight: 600;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.22);
}

/* ── Reader content pane ── */
#readerContent {
  flex: 1;
  padding: 1rem;
  box-sizing: border-box;
  overflow-y: auto;
  max-height: 580px;
}

/* ── Book picker grid ── */
#bookPicker { display: none; }
#bookPicker.visible { display: block; }

.bookGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.bookCard {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.bookCard:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.07);
  transform: translateY(-2px);
}
.bookCard-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 0.25rem;
}
.bookCard-author { font-size: 0.76rem; color: var(--accent); opacity: 0.8; }
.bookCard-desc   { font-size: 0.74rem; color: var(--muted); margin-top: 0.3rem; line-height: 1.45; }

/* ── Reading pane ── */
#readingPane { display: none; }
#readingPane.visible { display: block; }

#currentBookLabel {
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
  cursor: pointer;
}
#currentBookLabel:hover { opacity: 1; text-decoration: underline; }

#readerChTitle {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem;
  opacity: 0;
  transition: opacity 0.32s ease;
}
#readerChText {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.92rem;
  line-height: 1.82;
  color: #aeb9c8;
  opacity: 0;
  transition: opacity 0.32s ease;
}
#readerChTitle.visible,
#readerChText.visible { opacity: 1; }

/* ── Prev / Next buttons ── */
.readerNav {
  display: flex;
  gap: 8px;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.readerBtn {
  flex: 1;
  padding: 0.48rem 0.75rem;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.08);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}
.readerBtn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.6);
  color: var(--text);
  transform: translateY(-1px);
}
.readerBtn:disabled { opacity: 0.22; cursor: default; }

/* Desktop: sidebar always open */
@media (min-width: 961px) {
  #readerMenuBtn { display: none; }
  #readerSidebar { position: relative; left: 0 !important; }
}
