/* ─────────────────────────────────────────────────────────────
   LIBRARY EXTENSION
   Append this to your existing themes/ramble/static/css/style.css
   Inherits all your existing variables, fonts, and base styles.
   ───────────────────────────────────────────────────────────── */

/* ── Library header / breadcrumb ─────────────────────────── */

.library-breadcrumb {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--color-muted, #999);
  margin-bottom: 1.5rem;
}

.library-breadcrumb a {
  color: var(--color-muted, #999);
  text-decoration: none;
}

.library-breadcrumb a:hover {
  color: var(--color-text, #1a1a1a);
}

.library-header {
  margin-bottom: 2rem;
}

.library-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  font-weight: 400;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

.library-desc {
  font-size: 0.85rem;
  color: var(--color-muted, #888);
  margin: 0 0 0.35rem;
}

.library-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--color-muted, #aaa);
  margin: 0;
}

.library-meta a {
  color: var(--color-muted, #aaa);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Topic list (top-level /library/ page) ────────────────── */

.topic-group {
  margin-bottom: 0.15rem;
}

.topic-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border, #eee);
}

.topic-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  color: var(--color-text, #1a1a1a);
  text-decoration: none;
}

.topic-name:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.topic-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--color-muted, #bbb);
}

/* ── Book rows (topic page) ───────────────────────────────── */

.book-group {
  margin-bottom: 2rem;
}

.book-group-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted, #bbb);
  margin: 0 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--color-border, #eee);
}

.book-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border, #f0f0f0);
}

.book-row:last-child {
  border-bottom: none;
}

/* Strikethrough style for done books */
.book-row.done .book-row-title {
  opacity: 0.45;
}

.book-row.dropped .book-row-title {
  opacity: 0.3;
  text-decoration: line-through;
  text-decoration-color: var(--color-muted, #ccc);
}

.book-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  top: -1px;
  background: var(--color-border, #ddd);     /* unread */
}

.book-row.reading  .book-status-dot { background: #4a9eff; }
.book-row.done     .book-status-dot { background: #5cb85c; }
.book-row.dropped  .book-status-dot { background: #ccc; }

.book-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.book-row-title {
  font-family: 'Lora', serif;
  font-size: 0.88rem;
  color: var(--color-text, #1a1a1a);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-row-title:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.book-row-author {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  color: var(--color-muted, #aaa);
}

.book-row-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.book-length {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.66rem;
  color: var(--color-muted, #ccc);
}

.book-rating {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--color-muted, #888);
}

.book-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
}

.book-badge.reading {
  background: #e8f2ff;
  color: #4a9eff;
}

.book-badge.dropped {
  background: #f5f5f5;
  color: #bbb;
}

.priority-dot {
  font-size: 0.5rem;
  color: #f0a500;
  line-height: 1;
}

/* ── Topic notes block ────────────────────────────────────── */

.topic-notes {
  font-size: 0.85rem;
  color: var(--color-muted, #888);
  margin-bottom: 1.5rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--color-border, #eee);
}

/* ── Responsive: allow full titles on desktop ─────────────── */

@media (min-width: 768px) {
  .book-row-main {
    max-width: none;
  }
  
  .book-row-title {
    white-space: normal;
    word-break: break-word;
  }
  
  .book-row {
    align-items: flex-start;
    padding: 0.6rem 0;
  }
}

/* ── Single book page ─────────────────────────────────────── */

.book-page-header {
  margin-bottom: 1.5rem;
}

.book-page-author {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--color-muted, #888);
  margin: 0.25rem 0 0;
}

.book-page-fields {
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.5rem;
  align-items: baseline;
}

.book-field {
  display: contents;
}

.field-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--color-muted, #aaa);
  text-transform: lowercase;
  white-space: nowrap;
}

.field-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--color-text, #1a1a1a);
}

.field-value.book-notes-inline {
  font-family: 'Lora', serif;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--color-muted, #888);
}

/* Status colours on single page */
.status-unread  { color: var(--color-muted, #aaa); }
.status-reading { color: #4a9eff; }
.status-done    { color: #5cb85c; }
.status-dropped { color: #ccc; }

/* Reading notes section */
.book-reading-notes {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border, #eee);
}
