/* ===============================================
   Sinverse Library -- styles.css
   =============================================== */

/* -- Header ------------------------------------ */
.lib-header {
  padding: 2rem 3rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(196,154,120,0.05) 0%, transparent 100%);
}

.lib-brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-logo {
  width: 48px; height: 48px;
  object-fit: contain; opacity: 0.85;
  transition: opacity 0.25s ease;
}
.header-logo:hover { opacity: 1; }

.lib-title-block { display: flex; flex-direction: column; gap: 0.15rem; }

.lib-title {
  font-family: var(--font-caps);
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.25em;
  color: var(--accent);
  text-transform: uppercase;
  line-height: 1;
}

.lib-eyebrow {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* -- Controls ---------------------------------- */
.lib-controls {
  padding: 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.search-input {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  width: 100%;
  max-width: 400px;
  outline: none;
  transition: border-color 0.25s ease;
}
.search-input::placeholder { color: var(--text-muted); font-style: italic; }
.search-input:focus { border-color: var(--border-mid); }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-group-label {
  font-family: var(--font-caps);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.filter-btns { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.25em 0.7em;
  font-family: var(--font-caps);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s ease;
}
.filter-btn:hover  { border-color: var(--border-mid); color: var(--text-secondary); }
.filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.sort-select {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3em 0.7em;
  font-family: var(--font-caps);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
}

.tag-filter-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.tag-filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.2em 0.6em;
  font-family: var(--font-caps);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s ease;
}
.tag-filter-btn:hover  { border-color: var(--border-mid); color: var(--text-secondary); }
.tag-filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* -- Library Grid ------------------------------ */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px;
  background: var(--border);
  padding: 1px;
}

.loading-placeholder {
  grid-column: 1 / -1;
  padding: 5rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg);
  font-size: 1rem;
}

/* -- Library Card ------------------------------ */
.lib-card {
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  transition: background 0.25s ease;
  position: relative;
  overflow: hidden;
}
.lib-card:hover { background: var(--bg-card-hover); }

.lib-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.lib-card:hover::after { opacity: 1; }

.lib-card-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--bg-inset);
  flex-shrink: 0;
}

.lib-card-cover {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.4s ease;
}
.lib-card:hover .lib-card-cover { transform: scale(1.03); }

.lib-card-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  color: var(--text-muted);
  opacity: 0.2;
}

/* Type badge */
.lib-type-badge {
  font-family: var(--font-caps);
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.2em 0.55em;
  border-radius: 2px;
  display: inline-block;
}

/* Absolute only when inside the cover image wrap */
.lib-card-cover-wrap .lib-type-badge {
  position: absolute;
  top: 0.6rem; left: 0.6rem;
  backdrop-filter: blur(4px);
}
.lib-type-standalone  { background: rgba(30,70,50,0.85);   color: #90c8a0; }
.lib-type-serial      { background: rgba(50,50,110,0.85);  color: #a0a8e0; }
.lib-type-collection  { background: rgba(100,50,10,0.85);  color: #d4a060; }

.lib-canonical-badge {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  color: var(--accent);
  font-size: 0.75rem;
  text-shadow: 0 0 6px rgba(0,0,0,0.8);
}

.lib-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.lib-card-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-primary);
  line-height: 1.25;
  transition: color 0.25s ease;
}
.lib-card:hover .lib-card-title { color: var(--accent-light); }

.lib-card-author {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.lib-card-summary {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.lib-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.lib-wordcount {
  font-family: var(--font-caps);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.15em 0.4em;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.content-tag {
  font-family: var(--font-caps);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warn);
  background: var(--warn-dim);
  padding: 0.15em 0.5em;
  border-radius: 1px;
  border: 1px solid rgba(160,112,64,0.2);
}

/* -- Collection panel -------------------------- */
.collection-panel {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 80;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}

.collection-panel-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.collection-close-btn { align-self: flex-start; }

.collection-header { display: flex; flex-direction: column; gap: 0.75rem; }

.collection-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2rem;
  font-weight: 300;
  color: var(--accent);
}

.collection-summary {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.collection-stories { display: flex; flex-direction: column; gap: 1px; background: var(--border); }

.collection-story-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  text-decoration: none;
  color: inherit;
  transition: background 0.25s ease;
  gap: 1rem;
}
.collection-story-row:hover { background: var(--bg-card-hover); }

.csr-info { display: flex; flex-direction: column; gap: 0.2rem; }
.csr-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-primary);
  transition: color 0.25s ease;
}
.collection-story-row:hover .csr-title { color: var(--accent-light); }
.csr-author { font-size: 0.78rem; color: var(--text-muted); font-style: italic; }
.csr-meta { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.lib-empty { color: var(--text-muted); font-style: italic; padding: 2rem; text-align: center; }

/* -- Footer ------------------------------------ */
.lib-footer {
  padding: 1.5rem 3rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.footer-home-link { color: var(--accent); font-size: 0.78rem; }
.footer-sep { color: var(--border-bright); }
.lib-count { font-family: var(--font-caps); font-size: 0.65rem; letter-spacing: 0.1em; }

/* ===============================================
   READER
   =============================================== */

.reader-body { display: flex; flex-direction: column; min-height: 100vh; }

.reader-topbar {
  position: sticky; top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: rgba(17,13,11,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  gap: 1rem;
}

.reader-back-btn { flex-shrink: 0; }

.reader-topbar-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--text-secondary);
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-nav-logo {
  width: 28px; height: 28px;
  object-fit: contain;
  opacity: 0.7;
  transition: opacity 0.25s ease;
  flex-shrink: 0;
}
.reader-nav-logo:hover { opacity: 1; }

/* -- Reader layout ----------------------------- */
.reader-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: 0;
}

/* -- Sidebar ----------------------------------- */
.reader-sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
}

.reader-cover {
  width: 100%;
  border-radius: var(--radius);
  object-fit: cover;
  object-position: center top;
}

.reader-meta-block { display: flex; flex-direction: column; gap: 0.6rem; }

.reader-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.2;
}

.reader-author { font-size: 0.82rem; color: var(--text-muted); font-style: italic; }

.reader-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.reader-summary {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.reader-wordcount {
  font-family: var(--font-caps);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* Chapter list in sidebar */
.reader-chapters { flex: 1; min-height: 0; }
.reader-chapters-label {
  font-family: var(--font-caps);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.reader-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  max-height: 280px;
}

.chapter-list-btn {
  background: transparent;
  border: none;
  border-left: 2px solid var(--border);
  padding: 0.4rem 0.75rem;
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  line-height: 1.4;
}
.chapter-list-btn:hover { color: var(--text-secondary); border-left-color: var(--border-mid); }
.chapter-list-btn.active { color: var(--accent); border-left-color: var(--accent); }

/* Progress bar */
.reader-progress-wrap {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.reader-progress-label {
  font-family: var(--font-caps);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.reader-progress-bar {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}

.reader-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.2s ease;
  width: 0%;
}

.reader-progress-pct {
  font-family: var(--font-caps);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* -- Main content ------------------------------ */
.reader-main {
  padding: clamp(2rem, 5vw, 4rem) clamp(2rem, 6vw, 6rem);
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  max-width: 800px;
}

.reader-chapter-header {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.reader-chapter-title {
  font-family: var(--font-caps);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Story content styles */
.reader-content {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.9;
  color: var(--text-primary);
}

.reader-content p { margin-bottom: 1.2em; }
.reader-content p:first-child::first-letter {
  font-family: var(--font-display);
  font-size: 3.2em;
  font-weight: 300;
  float: left;
  line-height: 0.75;
  margin: 0.08em 0.08em 0 0;
  color: var(--accent);
}

.reader-content h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--accent);
  margin: 2rem 0 1rem;
}

.reader-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.reader-content em  { font-style: italic; }
.reader-content strong { font-weight: 400; color: var(--text-primary); }

/* -- Chapter navigation ----------------------- */
.reader-chapter-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.chapter-nav-btn { min-width: 160px; }

.chapter-counter {
  font-family: var(--font-caps);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

/* -- End of story ------------------------------ */
.reader-end {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.reader-end-ornament {
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.3em;
  opacity: 0.6;
}

.reader-end-label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.8rem;
  font-weight: 300;
  color: var(--accent);
}

/* External story link */
.external-story-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  align-items: flex-start;
}

.external-story-note {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* -- Responsive -------------------------------- */
@media (max-width: 900px) {
  .lib-header   { padding: 1.5rem; }
  .lib-controls { padding: 1rem 1.5rem; }
  .lib-footer   { padding: 1.25rem 1.5rem; }
  .lib-grid     { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

  .reader-layout { grid-template-columns: 1fr; }
  .reader-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    padding: 1rem;
    gap: 0.75rem;
  }
  .reader-cover { width: 120px; flex-shrink: 0; }
  .reader-meta-block { flex: 1; min-width: 160px; }
  .reader-chapters { width: 100%; border-top: 1px solid var(--border); padding-top: 0.75rem; }
  .reader-chapter-list { max-height: 140px; }
  .reader-progress-wrap { width: 100%; }
  .reader-main { padding: 1.5rem; }
  .chapter-nav-btn { min-width: 120px; }
}

@media (max-width: 480px) {
  .lib-grid { grid-template-columns: 1fr 1fr; }
  .reader-sidebar { flex-direction: column; }
  .reader-cover { width: 100%; }
}

/* -- Filter bottom row ------------------------ */
.filter-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* -- View toggle ------------------------------- */
.view-toggle {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.view-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.3em 0.7em;
  font-family: var(--font-caps);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.view-toggle-btn:hover { color: var(--text-secondary); border-color: var(--border-mid); }
.view-toggle-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* -- List view --------------------------------- */
.lib-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  padding: 1px;
}

.lib-row {
  background: var(--bg-card);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem 2rem;
  transition: background 0.2s ease;
  position: relative;
  overflow: hidden;
}

.lib-row::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lib-row:hover { background: var(--bg-card-hover); }
.lib-row:hover::after { opacity: 1; }

.lib-row-left {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.lib-row-title-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.lib-row-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--text-primary);
  transition: color 0.2s ease;
  line-height: 1.2;
}
.lib-row:hover .lib-row-title { color: var(--accent-light); }

.lib-canonical-star {
  color: var(--accent);
  font-size: 0.7rem;
  opacity: 0.7;
}

.lib-row-author {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.lib-row-summary {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 680px;
}

.lib-row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.1rem;
}

.lib-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-top: 0.2rem;
}

.lib-row-cta {
  font-family: var(--font-caps);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.2s ease;
  margin-top: auto;
}
.lib-row:hover .lib-row-cta { color: var(--accent); }

/* -- Generated title card ---------------------- */
.lib-title-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem;
  text-align: center;
  position: relative;
}

.lib-title-card-line {
  width: 40px;
  height: 1px;
  opacity: 0.5;
}

.lib-title-card-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 300;
  line-height: 1.25;
  word-break: break-word;
  hyphens: auto;
}

.lib-title-card-author {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
  font-style: italic;
  letter-spacing: 0.04em;
}

.lib-title-card-type {
  font-family: var(--font-caps);
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.2);
}

/* -- Responsive -------------------------------- */
@media (max-width: 600px) {
  .lib-row { flex-direction: column; gap: 1rem; padding: 1.25rem; }
  .lib-row-right { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
}

/* -- Tabs -------------------------------------- */
.lib-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.lib-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.85rem 2rem;
  font-family: var(--font-caps);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  margin-bottom: -1px;
}

.lib-tab:hover { color: var(--text-secondary); }
.lib-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* -- Controls top row -------------------------- */
.lib-controls-top {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* -- Collection cards in collections tab ------- */
.lib-collection-card {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}
.lib-collection-card:hover { background: var(--bg-card-hover); }

.lib-collection-header {
  padding: 1.5rem 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.lib-collection-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.lib-collection-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.2;
}

.lib-collection-summary {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.lib-collection-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.lib-collection-stories {
  display: flex;
  flex-direction: column;
}

.lib-collection-story-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
  gap: 1rem;
}
.lib-collection-story-row:last-child { border-bottom: none; }
.lib-collection-story-row:hover { background: rgba(255,255,255,0.02); }

/* -- Collection badge in story cards ----------- */
.lib-in-collection {
  font-family: var(--font-caps);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.15em 0.45em;
  border: 1px solid var(--border);
  border-radius: 2px;
}

@media (max-width: 600px) {
  .lib-tab { padding: 0.75rem 1.25rem; }
  .lib-collection-header { padding: 1.25rem; }
  .lib-collection-story-row { padding: 0.75rem 1.25rem; }
}

/* -- Collection card preview list -------------- */
.lib-collection-story-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.lib-col-preview-row {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.lib-col-preview-title {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lib-col-preview-author {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.lib-col-preview-more {
  font-family: var(--font-caps);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 0.2rem;
}