/* ==========================================================================
 * 4. MINIMALIST WELCOME STRIP & ARCHITECTURAL FLOATING BOOKSHELVES
 * ========================================================================== */
.sanctuary-welcome-bar {
  background: var(--bg-surface);
  color: var(--fg-primary);
  border-radius: 14px;
  padding: 1.25rem 1.65rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
}

.sanctuary-welcome-bar h2 {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg-primary);
}

.sanctuary-welcome-bar p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--fg-muted);
}

.sanctuary-metrics {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.sanctuary-metric-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.95rem;
  text-align: left;
  min-width: 110px;
}

.sanctuary-metric-pill strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}

.sanctuary-metric-pill span {
  font-size: 0.72rem;
  color: var(--fg-muted);
}

.bookshelf-stream {
  margin-bottom: 2.5rem;
}

.stream-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.stream-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.stream-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--fg-muted);
}

/* ==========================================================================
 * SEGMENTED VIEW & BOOKSHELF CONTROLS
 * ========================================================================== */
.view-controls-cluster {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.view-controls-divider {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
  opacity: 0.55;
  margin: 0 0.15rem;
}

.segmented-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.32rem 0.68rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  line-height: 1.25;
}

.segmented-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.82;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.segmented-btn:hover {
  color: var(--fg-primary);
  background: rgba(0, 0, 0, 0.04);
}

:root[data-ui-theme="candlelight"] .segmented-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.segmented-btn:hover svg {
  opacity: 1;
}

.segmented-btn.active {
  color: var(--primary-fg);
  background: var(--primary);
  font-weight: 600;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.14),
    0 1px 2px rgba(0, 0, 0, 0.08);
}

.segmented-btn.active svg {
  opacity: 1;
}

.segmented-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

@media (max-width: 640px) {
  .view-controls-cluster {
    width: 100%;
    justify-content: flex-start;
  }
  .segmented-btn {
    padding: 0.28rem 0.5rem;
    font-size: 0.75rem;
  }
}

.bookshelf-case {
  position: relative;
  max-width: 100%;
  padding: 0.5rem 0.25rem 0;
}

.bookshelf-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 1.75rem 1.5rem;
  align-items: end;
  padding-bottom: 0.35rem;
}

/* Option 1: Horizontal Carousel Shelf (Default) */
.bookshelf-row.shelf-carousel {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 1.5rem;
  padding: 0.5rem 0.35rem 0.65rem;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.bookshelf-row.shelf-carousel::-webkit-scrollbar {
  height: 5px;
}

.bookshelf-row.shelf-carousel::-webkit-scrollbar-thumb {
  background: rgba(120, 113, 108, 0.28);
  border-radius: 999px;
}

.bookshelf-row.shelf-carousel::-webkit-scrollbar-track {
  background: transparent;
}

.bookshelf-row.shelf-carousel .book-slot {
  flex: 0 0 164px;
  width: 164px;
  scroll-snap-align: start;
}

/* Option 2: Multi-Tier Bookshelf with Per-Row Wooden Planks */
.bookshelf-row.shelf-multitier {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 2.75rem 1.5rem;
  align-items: end;
  padding-bottom: 0.5rem;
}

.bookshelf-row.shelf-multitier .book-slot {
  position: relative;
}

.bookshelf-row.shelf-multitier .book-slot::after {
  content: "";
  position: absolute;
  left: -0.75rem;
  right: -0.75rem;
  bottom: -10px;
  height: 8px;
  background: var(--shelf-plank);
  border-top: 1px solid var(--shelf-lip);
  border-radius: 999px;
  box-shadow: var(--shelf-shadow);
  z-index: 1;
}

/* Shelf Scroll Navigation Buttons (Prev / Next) */
.shelf-scroll-btn {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  z-index: 15;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--fg-primary);
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  opacity: 0.82;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    background 0.18s ease;
}

.shelf-scroll-btn:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.08);
  background: var(--bg-elevated);
}

.shelf-scroll-btn.prev {
  left: -14px;
}

.shelf-scroll-btn.next {
  right: -14px;
}

@media (max-width: 768px) {
  .shelf-scroll-btn {
    display: none;
  }
}

@media (max-width: 640px) {
  .bookshelf-row.shelf-multitier {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    gap: 2rem 1rem;
  }
  .bookshelf-row.shelf-carousel .book-slot {
    flex: 0 0 138px;
    width: 138px;
  }
  .hardcover-card {
    width: 100%;
    max-width: 156px;
  }
}

.wooden-shelf-plank {
  height: 8px;
  background: var(--shelf-plank);
  border-top: 1px solid var(--shelf-lip);
  border-radius: 999px;
  box-shadow: var(--shelf-shadow);
  margin: 0 0 0.5rem;
  position: relative;
}

.book-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}

.hardcover-card {
  width: 164px;
  aspect-ratio: 2 / 3;
  position: relative;
  border-radius: 3px 8px 8px 3px;
  cursor: pointer;
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s ease;
  box-shadow:
    0 10px 22px -6px rgba(28, 25, 23, 0.22),
    0 2px 6px rgba(28, 25, 23, 0.08),
    inset -3px 0 0 rgba(255, 255, 255, 0.78);
  overflow: hidden;
  user-select: none;
}

.hardcover-card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 18px 32px -8px rgba(28, 25, 23, 0.28),
    0 4px 10px rgba(28, 25, 23, 0.1),
    inset -3px 0 0 rgba(255, 255, 255, 0.88);
}

.hardcover-card.large-showcase {
  width: 216px;
  cursor: default;
}

.hardcover-card.mini-volume {
  width: 108px;
}

.book-spine-sheen {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 12px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.22) 0%,
    rgba(255, 255, 255, 0.14) 42%,
    rgba(0, 0, 0, 0.08) 78%,
    transparent 100%
  );
  z-index: 2;
  pointer-events: none;
}

.gold-foil-frame {
  position: absolute;
  inset: 0;
  padding: 1.05rem 0.95rem 0.95rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  z-index: 1;
}

.cover-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
}

.cover-cat-pill {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cover-emblem-center {
  margin: auto 0;
  color: rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.cover-title-block {
  margin-top: auto;
}

.cover-book-title {
  font-family:
    "Merriweather", "Noto Serif KR", "Noto Serif SC", "Noto Serif TC", Georgia,
    serif;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.32;
  color: #ffffff;
  margin: 0 0 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hardcover-card.large-showcase .cover-book-title {
  font-size: 1.15rem;
  -webkit-line-clamp: 4;
}

.hardcover-card.mini-volume .cover-book-title {
  font-size: 0.72rem;
  -webkit-line-clamp: 2;
}

.cover-divider {
  width: 24px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.38);
  margin: 0.35rem 0;
}

.cover-book-author {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cover-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 500;
  padding-top: 0.4rem;
  margin-top: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.bookmark-ribbon {
  position: absolute;
  top: 0;
  right: 12px;
  width: 18px;
  height: 26px;
  background: rgba(255, 255, 255, 0.92);
  color: #1c1917;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 3px;
  font-size: 0.6rem;
  font-weight: 700;
}

.bookmark-ribbon.ribbon-gold {
  background: #e9c46a;
  color: #1c1917;
}

.cover-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.35);
  z-index: 5;
}

.cover-progress-fill {
  height: 100%;
  background: var(--accent-gold);
  transition: width 0.25s ease;
}

.cover-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 19, 0.74);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.hardcover-card:hover .cover-hover-overlay,
.hardcover-card:focus-within .cover-hover-overlay {
  opacity: 1;
}

.book-slot-caption {
  width: 164px;
  margin-top: 0.55rem;
  text-align: left;
}

.book-slot-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--fg-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.book-slot-title:hover {
  color: var(--primary);
}

.book-slot-meta {
  font-size: 0.74rem;
  color: var(--fg-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.12rem;
}

.work-detail-hub {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.85rem;
  box-shadow: var(--card-shadow);
}

.detail-colorscape-banner {
  display: flex;
  flex-direction: column;
}

.detail-top-breadcrumb {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.detail-hero-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2.25rem;
  align-items: start;
}

@media (max-width: 768px) {
  .detail-hero-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

.detail-info-col h2 {
  margin: 0.25rem 0 0.35rem;
  font-size: 1.65rem;
}

.detail-subtitle {
  font-size: 0.98rem;
  color: var(--fg-secondary);
  margin: 0 0 0.85rem;
}

.detail-synopsis {
  font-size: 0.92rem;
  color: var(--fg-secondary);
  line-height: 1.65;
  margin: 0.5rem 0 1rem;
}

.detail-metadata-strip,
.detail-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.85rem 0 1.1rem;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  color: var(--fg-secondary);
}

.detail-cta-row,
.detail-cta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1.15rem;
}

.detail-tabs-bar,
.detail-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  border-bottom: 1px solid var(--border);
  margin-top: 1.75rem;
  margin-bottom: 1.35rem;
  padding-bottom: 0.65rem;
}

.detail-tab-btn {
  background: transparent;
  color: var(--fg-secondary);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.48rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.detail-tab-btn:hover {
  background: var(--bg-elevated);
  color: var(--fg-primary);
}

.detail-tab-btn.active {
  background: var(--primary);
  color: var(--primary-fg);
}

.detail-tab-body {
  min-height: 180px;
}

.editions-volume-grid,
.edition-volume-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.edition-volume-card {
  display: flex;
  gap: 1rem;
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  align-items: center;
  transition: all 0.15s ease;
}

.edition-volume-card.active,
.edition-volume-card.selected-edition {
  border-color: var(--primary);
  background: var(--accent-sage-soft);
}

.edition-volume-info {
  flex: 1;
  min-width: 0;
}
