/* ============================================
   Terra Lanna TRAVEL — LANNA LIBRARY PAGE CSS
   (2026-09-13, คุณโอเชี่ยน: repurposed the former photo-gallery page —
   "เปลี่ยนใช้จากแกลลอรี่" — into a library of translated rare Lanna
   history books. Ships as a mission statement + "coming soon" empty
   state first, same as the gallery page originally shipped empty;
   real book entries land in the `library` Firestore collection later.
   Card grid below is ready for that once titles exist — simple text
   cards, no cover-image requirement, since old manuscripts rarely
   have a usable cover photo.)
   ============================================ */

.library-intro {
  max-width: 720px;
  margin: 0 auto 48px;
  text-align: center;
  color: var(--color-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ---- Book card grid (ready for when real entries land) ---- */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 0 0 80px;
}

.library-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), transform var(--transition);
}
/* Anchor variant (book has a published first chapter) gets a pointer +
   slightly stronger hover; plain div variant (no chapters yet) has no
   affordance suggesting it's clickable. */
a.library-card { cursor: pointer; }
.library-card:hover {
  border-color: var(--color-gold);
  transform: translateY(-3px);
}

/* ---- Chapter reading page: prev/next navigation ---- */
.library-chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 40px 0;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}
@media (max-width: 560px) {
  .library-chapter-nav { flex-direction: column; align-items: stretch; }
}

/* Bleeds to the card's own edges via negative margins matching its
   28px/24px padding, rather than giving the card overflow:hidden — a
   plain manuscript card with no image (most books, by design — see file
   header) needs no layout change at all. */
.library-card-cover {
  display: block;
  width: calc(100% + 48px);
  height: 160px;
  object-fit: cover;
  margin: -28px -24px 20px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.library-card-era {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: 10px;
}

.library-card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--color-white);
  margin: 0 0 8px;
}

.library-card-author {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin: 0 0 12px;
}

.library-card-desc {
  font-size: 0.92rem;
  color: rgba(245, 240, 232, 0.82);
  line-height: 1.6;
}

/* ---- Empty state (no books published yet) ---- */
.library-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--color-muted);
}
.library-empty i {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
  color: var(--color-border);
}
.library-empty p {
  font-size: 1rem;
  font-family: var(--font-heading);
}

@media (max-width: 560px) {
  .library-grid { grid-template-columns: 1fr; }
}

/* ---- Book table-of-contents page (chapter list) ---- */
.library-toc-page { max-width: 760px; margin: 0 auto; }

.library-toc-author {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin: 0 0 4px;
}

.library-toc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 32px 0 40px;
}

.library-toc-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), transform var(--transition);
}
.library-toc-row:hover {
  border-color: var(--color-gold);
  transform: translateX(4px);
}

.library-toc-num {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-gold);
  flex-shrink: 0;
  width: 24px;
}

.library-toc-title {
  flex: 1;
  font-size: 0.98rem;
  color: var(--color-white);
}

.library-toc-status {
  flex-shrink: 0;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.library-toc-status--ready { color: var(--color-gold); }

@media (max-width: 560px) {
  .library-toc-row { padding: 14px 16px; gap: 12px; }
  .library-toc-status { display: none; }
}
