/*
 * BOOKSHELF
 * =========
 * Concept: "Browse someone's actual shelf." Books displayed as spines —
 * vertical text, varying widths by page count, color-coded by genre.
 * Click a spine to pull a book out and see details.
 *
 * Hook: The spine visualization. Most book lists are just lists.
 * This looks and feels like a real shelf.
 *
 * Why Libre Baskerville? Bookish, literary, warm. This is a library,
 * not a database. The serif gives the page the feeling of printed matter.
 */

:root {
  --font-serif: 'Libre Baskerville', Georgia, serif;
  --font-mono:  'IBM Plex Mono', 'Consolas', monospace;
  
  --bg:         #1c1916;
  --bg-raised:  #252119;
  --text:       #e4ddd0;
  --text-mid:   #a09882;
  --text-quiet: #6e6558;
  --accent:     #c4a878;
  --shelf-wood: #2e2820;
  --shelf-edge: #3a3228;
  
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:         #f4f0e8;
    --bg-raised:  #ebe5d8;
    --text:       #2c2620;
    --text-mid:   #6e6458;
    --text-quiet: #a09888;
    --accent:     #8a6e42;
    --shelf-wood: #ddd5c4;
    --shelf-edge: #c8bfae;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding: 3rem 2rem;
  max-width: 960px;
  margin: 0 auto;
}

::selection { background: var(--accent); color: var(--bg); }

/* HEADER */
.header { margin-bottom: 3rem; }

.label {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 0.82rem;
  color: var(--text-mid);
}

/* SHELF */
.shelf-wrapper {
  margin-bottom: 2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.shelf {
  position: relative;
  min-width: min-content;
}

.shelf__row {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 0 0.5rem;
  min-height: 280px;
}

/* The shelf base — a wooden ledge under the spines */
.shelf__base {
  height: 8px;
  background: var(--shelf-wood);
  border-top: 2px solid var(--shelf-edge);
  border-radius: 0 0 2px 2px;
  margin-top: 0;
}

/* SPINES */
.spine {
  height: 260px;
  min-width: 30px;
  background: var(--spine-bg);
  color: var(--spine-text);
  border: none;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px 2px 0 0;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  /* staggered entrance */
  animation: slideUp 0.4s var(--ease) both;
}

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

.spine:hover {
  transform: translateY(-12px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  z-index: 2;
}

.spine--active {
  transform: translateY(-18px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  z-index: 3;
}

.spine:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.spine__title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 230px;
  padding: 10px 0;
}

/* DETAIL PANEL */
.detail {
  background: var(--bg-raised);
  border: 1px solid var(--shelf-edge);
  padding: 2rem;
  margin-top: 1.5rem;
  position: relative;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

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

.detail__close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: none;
  border: none;
  color: var(--text-quiet);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.detail__close:hover { color: var(--text); }

.detail__genre {
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.detail__title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  font-style: italic;
  line-height: 1.25;
  margin-bottom: 0.3rem;
}

.detail__author {
  font-size: 0.82rem;
  color: var(--text-mid);
  margin-bottom: 0.15rem;
}

.detail__year {
  font-size: 0.7rem;
  color: var(--text-quiet);
  margin-bottom: 1.2rem;
}

.detail__notes {
  font-size: 0.82rem;
  color: var(--text-mid);
  line-height: 1.7;
  margin-bottom: 1rem;
  max-width: 520px;
}

.detail__rating {
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}

/* STATS */
.stats {
  display: flex;
  gap: 2rem;
  font-size: 0.68rem;
  color: var(--text-quiet);
  letter-spacing: 0.05em;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--shelf-edge);
}

/* RESPONSIVE */
@media (max-width: 640px) {
  body { padding: 2rem 1rem; }
  .spine { height: 200px; }
  .shelf__row { min-height: 220px; }
  .detail { padding: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .spine { animation: none; transition: none; }
  .detail { transition: none; }
}
