/* ═══════════════════════════════════════════════════
   阅读手帐 — Reading Journal
   Editorial literary design system (Timeline Edition)
   ═══════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Typography */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Light Mode Colors */
  --bg-primary: hsl(40, 25%, 97%);
  --bg-secondary: hsl(38, 20%, 94%);
  --bg-card: hsl(40, 30%, 99%);
  --text-primary: hsl(30, 10%, 18%);
  --text-secondary: hsl(30, 8%, 42%);
  --text-tertiary: hsl(30, 6%, 58%);
  --accent: hsl(24, 55%, 48%);
  --accent-soft: hsl(24, 55%, 48%, 0.12);
  --border: hsl(30, 12%, 88%);
  --border-light: hsl(30, 10%, 92%);
  --shadow-sm: 0 1px 2px hsl(30, 10%, 18%, 0.04);
  --shadow-md: 0 2px 8px hsl(30, 10%, 18%, 0.06);

  /* Timeline */
  --timeline-line: hsl(30, 12%, 85%);
  --timeline-dot: hsl(24, 55%, 48%);
  --timeline-dot-read: hsl(30, 8%, 72%);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;

  /* Layout */
  --max-width: 700px;
  --content-padding: 1.25rem;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 0.3s;
}

/* ── Dark Mode ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: hsl(30, 8%, 10%);
    --bg-secondary: hsl(30, 6%, 14%);
    --bg-card: hsl(30, 8%, 12%);
    --text-primary: hsl(38, 15%, 88%);
    --text-secondary: hsl(38, 10%, 62%);
    --text-tertiary: hsl(38, 8%, 45%);
    --accent: hsl(24, 65%, 58%);
    --accent-soft: hsl(24, 65%, 58%, 0.15);
    --border: hsl(30, 8%, 22%);
    --border-light: hsl(30, 6%, 18%);
    --shadow-sm: 0 1px 2px hsl(0, 0%, 0%, 0.15);
    --shadow-md: 0 2px 8px hsl(0, 0%, 0%, 0.25);
    --timeline-line: hsl(30, 6%, 22%);
    --timeline-dot: hsl(24, 65%, 58%);
    --timeline-dot-read: hsl(30, 6%, 38%);
  }
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
}

a:hover {
  color: var(--text-primary);
}

/* ── Layout ── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: var(--space-xl) var(--content-padding) var(--space-2xl);
}

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: hsl(40, 25%, 97%, 0.85);
}

@media (prefers-color-scheme: dark) {
  .site-header {
    background: hsl(30, 8%, 10%, 0.85);
  }
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-md) var(--content-padding);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.site-title {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  color: var(--text-primary);
  text-decoration: none;
}

.title-zh {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.title-en {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.site-nav {
  display: flex;
  gap: var(--space-lg);
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--space-xs) 0;
  border-bottom: 1.5px solid transparent;
  transition: all var(--duration) var(--ease-out);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* ── Loading State ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) 0;
  gap: var(--space-lg);
}

.loading-pulse {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) 0;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.7;
}

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ── Date Navigation ── */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.date-nav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease-out);
}

.date-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.date-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.date-display {
  text-align: center;
}

.entry-date {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  display: block;
  letter-spacing: 0.02em;
}

.entry-day {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  padding: var(--space-sm) 0;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stat-divider {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════
   TIMELINE
   ═══════════════════════════════════════════════════ */

.timeline {
  position: relative;
  padding-left: 80px;
}

/* Vertical line */
.timeline::before {
  content: '';
  position: absolute;
  left: 62px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--timeline-line);
}

/* ── Timeline Book Header ── */
.timeline-book-header {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
  margin-bottom: var(--space-sm);
  position: relative;
}

.timeline-book-header::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--timeline-dot);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 0 2px var(--timeline-dot);
}

.timeline-book-header .book-cover {
  width: 48px;
  height: 72px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: var(--shadow-md), 2px 2px 0 var(--border);
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.timeline-book-header .book-cover-placeholder {
  width: 48px;
  height: 72px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--border-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.timeline-book-header .book-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.timeline-book-header .book-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
}

.timeline-book-header .book-author {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: var(--space-xs);
}

/* ── Timeline Events ── */
.timeline-event {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  position: relative;
}

/* Dot on the timeline */
.timeline-highlight::before {
  content: '';
  position: absolute;
  left: -21px;
  top: var(--space-md);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--timeline-line);
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  letter-spacing: 0.03em;
  flex-shrink: 0;
  width: 72px;
  text-align: right;
  position: absolute;
  left: -80px;
  top: var(--space-sm);
  padding-top: 2px;
}

.timeline-content {
  flex: 1;
  min-width: 0;
  padding-bottom: var(--space-sm);
}

/* Highlight text */
.timeline-content .highlight-text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.timeline-content .highlight-text::before {
  content: '\201C';
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.2em;
  font-weight: 700;
  margin-right: 0.1em;
}

.timeline-content .highlight-text::after {
  content: '\201D';
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.2em;
  font-weight: 700;
  margin-left: 0.1em;
}

.timeline-content .highlight-note {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--accent);
  font-style: italic;
  margin-top: var(--space-sm);
  padding-left: var(--space-md);
}

.timeline-content .highlight-note::before {
  content: '— ';
  font-style: normal;
}

/* ── "Opened" (Read Only) Event ── */
.timeline-opened .timeline-opened-content {
  padding: var(--space-md);
  border-radius: 6px;
  border: 1px dashed var(--border);
  background: transparent;
}

.timeline-opened::before {
  content: '';
  position: absolute;
  left: -21px;
  top: var(--space-lg);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--timeline-dot-read);
}

.opened-book-info {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.opened-book-cover {
  width: 32px;
  height: 48px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.7;
}

.opened-book-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
}

.opened-book-author {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-style: italic;
  display: block;
}

.opened-book-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  display: block;
  margin-top: var(--space-xs);
}

/* ═══════════════════════════════════════════════════
   BOOK SECTION (Fallback for legacy data)
   ═══════════════════════════════════════════════════ */

.book-section {
  margin-bottom: var(--space-2xl);
  animation: fadeInUp 0.5s var(--ease-out) both;
}

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

.book-header {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.book-cover {
  width: 56px;
  height: 84px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: var(--shadow-md), 2px 2px 0 var(--border);
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.book-cover-placeholder {
  width: 56px;
  height: 84px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--border-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.book-meta {
  flex: 1;
  min-width: 0;
}

.book-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.book-author {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: var(--space-sm);
}

.book-stats {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Read-only book (opened, no highlights) */
.book-read-only {
  opacity: 0.75;
}

.book-read-only .book-header {
  border-bottom-style: dashed;
}

.read-only-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  font-style: italic;
}

/* Highlights list (fallback) */
.highlights-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.highlight-item {
  position: relative;
  padding: var(--space-md) var(--space-md) var(--space-md) var(--space-lg);
  border-left: 3px solid var(--border-light);
  background: transparent;
  border-radius: 0 4px 4px 0;
  transition: all var(--duration) var(--ease-out);
}

.highlight-item:hover {
  background: var(--bg-secondary);
}

.highlight-time {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: var(--space-xs);
}

.highlight-text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.highlight-text::before {
  content: '\201C';
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.2em;
  font-weight: 700;
  margin-right: 0.1em;
}

.highlight-text::after {
  content: '\201D';
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.2em;
  font-weight: 700;
  margin-left: 0.1em;
}

.highlight-note {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--accent);
  font-style: italic;
  margin-top: var(--space-sm);
  padding-left: var(--space-md);
}

.highlight-note::before {
  content: '— ';
  font-style: normal;
}

/* ── Archive View ── */
.archive-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--space-xl);
  letter-spacing: 0.02em;
}

.archive-list {
  display: flex;
  flex-direction: column;
}

.archive-entry {
  display: flex;
  align-items: baseline;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  text-decoration: none;
  color: inherit;
}

.archive-entry:hover {
  padding-left: var(--space-sm);
  border-bottom-color: var(--accent);
}

.archive-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  width: 90px;
}

.archive-summary {
  flex: 1;
  min-width: 0;
}

.archive-summary-text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archive-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ── Pagination ── */
.archive-pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-xl) 0;
}

.pagination-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: all var(--duration) var(--ease-out);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) var(--content-padding);
  text-align: center;
}

.site-footer p {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  :root {
    --content-padding: 1rem;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .title-en {
    display: none;
  }

  .entry-date {
    font-size: 1.3rem;
  }

  /* Timeline mobile adjustments */
  .timeline {
    padding-left: 60px;
  }

  .timeline::before {
    left: 42px;
  }

  .timeline-time {
    width: 56px;
    left: -60px;
    font-size: 0.58rem;
  }

  .timeline-book-header::before {
    left: -22px;
  }

  .timeline-highlight::before,
  .timeline-opened::before {
    left: -21px;
  }

  .timeline-book-header .book-cover,
  .timeline-book-header .book-cover-placeholder {
    width: 40px;
    height: 60px;
  }

  .book-header {
    gap: var(--space-md);
  }

  .book-cover,
  .book-cover-placeholder {
    width: 46px;
    height: 70px;
  }

  .book-title {
    font-size: 1.05rem;
  }

  .archive-entry {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .archive-date {
    width: auto;
  }
}

/* ── Print ── */
@media print {
  .site-header,
  .site-footer,
  .date-nav-btn {
    display: none !important;
  }

  .highlight-item,
  .timeline-event {
    break-inside: avoid;
  }
}

/* ── Scroll-reveal animation ── */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════
   Book Wall
   ═══════════════════════════════════════════════════ */

.books-view {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-xl) var(--content-padding);
}

.books-header {
  margin-bottom: var(--space-xl);
}

.books-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.books-filters {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.books-sort {
  display: flex;
  gap: 2px;
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 2px;
}

.sort-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.4rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--duration) var(--ease-out);
}

.sort-btn:hover {
  color: var(--text-secondary);
}

.sort-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.year-filter {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.75rem;
}

.year-filter:focus {
  outline: none;
  border-color: var(--accent);
}

.books-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Book Grid ── */

.book-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-lg);
}

.book-card {
  cursor: pointer;
  transition: transform var(--duration) var(--ease-out);
  text-align: center;
}

.book-card:hover {
  transform: translateY(-4px);
}

.book-cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-sm);
  transition: box-shadow var(--duration) var(--ease-out);
}

.book-card:hover .book-cover-wrap {
  box-shadow: 0 6px 20px hsl(30, 10%, 18%, 0.12);
}

@media (prefers-color-scheme: dark) {
  .book-card:hover .book-cover-wrap {
    box-shadow: 0 6px 20px hsl(0, 0%, 0%, 0.4);
  }
}

.book-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--text-tertiary);
  font-style: italic;
  padding: var(--space-sm);
  text-align: center;
  line-height: 1.2;
}

.book-highlight-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: hsl(24, 55%, 48%, 0.9);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}

.book-card-title {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-author {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Book Detail Modal ── */

.book-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-xl);
  overflow-y: auto;
}

.book-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: hsl(30, 10%, 10%, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@media (prefers-color-scheme: dark) {
  .book-modal-backdrop {
    background: hsl(0, 0%, 0%, 0.7);
  }
}

.book-modal-content {
  position: relative;
  width: 100%;
  max-width: 700px;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 16px 48px hsl(30, 10%, 10%, 0.2);
  overflow: hidden;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-2xl);
  animation: modalIn 0.3s var(--ease-out);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.book-modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 1.3rem;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1;
  transition: background var(--duration) var(--ease-out);
}

.book-modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.book-modal-body {
  padding: var(--space-xl);
}

/* Modal header */
.modal-book-header {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  align-items: flex-start;
}

.modal-book-cover {
  width: 100px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.modal-book-cover img {
  width: 100%;
  display: block;
}

.modal-book-info {
  flex: 1;
  min-width: 0;
}

.modal-book-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.modal-book-author {
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: var(--space-sm);
}

.modal-book-stats {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Modal highlights list */
.modal-highlights {
  border-top: 1px solid var(--border-light);
  padding-top: var(--space-lg);
}

.modal-highlights-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.modal-highlight-item {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-light);
}

.modal-highlight-item:last-child {
  border-bottom: none;
}

.modal-highlight-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.modal-highlight-text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-primary);
  position: relative;
  padding-left: var(--space-md);
  border-left: 2px solid var(--accent-soft);
}

.modal-highlight-note {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  padding-left: var(--space-md);
}

.modal-no-highlights {
  text-align: center;
  padding: var(--space-xl) 0;
  color: var(--text-tertiary);
  font-style: italic;
}

/* ── Mobile: Book Wall ── */
@media (max-width: 600px) {
  .book-wall {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-md);
  }

  .books-filters {
    flex-direction: column;
    align-items: flex-start;
  }

  .book-modal {
    padding: var(--space-sm);
  }

  .book-modal-content {
    margin-top: var(--space-md);
    border-radius: 8px;
  }

  .modal-book-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

