/* shelf.css — experimental spatial bookshelf UI (used only by views/shelf.ejs).
   Recreates the feel of a smart-mirror bookshelf: warm room scene built from
   CSS gradients, real colored book spines from data/books.json, and floating
   frosted-glass panels (greeting, progress, currently-reading). */

:root {
  --wall: #e9e2d6;
  --wall-2: #d9d0bf;
  --wood: #b98d5f;
  --wood-dark: #8a6540;
  --ink: #2b2620;
  --soft: #6f675c;
  --glass: rgba(255, 255, 255, 0.38);
  --glass-border: rgba(255, 255, 255, 0.55);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body.shelf {
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100svh;
  background: #14110d;
  display: flex;                     /* column flow so the footer sits below */
  flex-direction: column;
  align-items: center;
  -webkit-font-smoothing: antialiased;
}
body.shelf .v2-footer { width: 100%; }
/* The shared header now sits above the scene on this page */
body.shelf .v2-header, body.shelf .v2-mobile-nav { width: 100%; align-self: stretch; }

/* ---------- Room scene ---------- */
.scene {
  position: relative;
  width: min(100vw, 1500px);
  height: calc(100vh - 71px);        /* leave room for the shared header */
  height: calc(100svh - 71px);
  max-height: 1000px;
  overflow: hidden;
  background:
    radial-gradient(115% 70% at 50% 0%, #f6efe2 0%, var(--wall) 45%, var(--wall-2) 100%);
}

/* soft ceiling light pooling on the wall */
.scene__light {
  position: absolute;
  top: -12%;
  left: 50%;
  transform: translateX(-50%);
  width: 72%;
  height: 55%;
  background: radial-gradient(50% 60% at 50% 12%, rgba(255, 250, 235, 0.95), rgba(255, 250, 235, 0) 70%);
  pointer-events: none;
}

/* ---------- Glass panels ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px rgba(43, 38, 32, 0.16);
}

/* ---------- Top bar ---------- */
.topbar {
  position: absolute;
  top: clamp(20px, 5vh, 48px);
  left: 50%;
  transform: translateX(-50%);
  width: min(92%, 1080px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.topbar__greeting {
  font-size: clamp(1.15rem, 2.4vw, 1.8rem);
  font-weight: 400;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.topbar__greeting strong { font-weight: 700; }
.topbar__meta { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.topbar__clock { font-size: clamp(1.5rem, 2.6vw, 2.2rem); font-weight: 500; }
.topbar__divider { width: 1px; height: 40px; background: rgba(43, 38, 32, 0.25); }
.topbar__label { font-size: 0.78rem; line-height: 1.4; color: var(--soft); }

/* ---------- Shelf + books ---------- */
.shelfzone {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(96%, 1180px);
  height: 66%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.books {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  width: 100%;
  /* keep the right end of the shelf clear of the floating Progress card */
  padding: 0 clamp(24px, 19vw, 280px) 0 24px;
}

.book {
  position: relative;
  width: clamp(30px, 3.2vw, 44px);
  border-radius: 3px 3px 2px 2px;
  box-shadow:
    inset 3px 0 6px rgba(255, 255, 255, 0.18),
    inset -4px 0 8px rgba(0, 0, 0, 0.28),
    0 14px 18px -8px rgba(43, 38, 32, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
  transform-origin: bottom center;
  transition: transform 0.25s ease;
  cursor: default;
}
@media (hover: hover) { .book:hover { transform: translateY(-10px); } }

.book__title {
  writing-mode: vertical-rl;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  max-height: calc(100% - 28px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Featured book: front cover facing out */
.book--featured {
  width: clamp(150px, 16vw, 210px);
  height: clamp(220px, 24vw, 300px);
  margin: 0 18px;
  border-radius: 4px 8px 8px 4px;
  padding: 18px 16px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  box-shadow:
    inset 6px 0 10px rgba(255, 255, 255, 0.14),
    inset -2px 0 6px rgba(0, 0, 0, 0.2),
    -10px 16px 28px -6px rgba(43, 38, 32, 0.5);
}
@media (hover: hover) { .book--featured:hover { transform: translateY(-10px) rotate(-1deg); } }

.book__badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  opacity: 0.85;
}
.book__cover-title {
  font-size: clamp(1.05rem, 1.8vw, 1.5rem);
  font-weight: 700;
  line-height: 1.2;
}
.book__cover-author { font-size: 0.78rem; font-weight: 500; opacity: 0.8; }

/* Wooden shelf board + legs */
.shelfboard {
  width: 100%;
  height: 26px;
  border-radius: 4px;
  background: linear-gradient(180deg, #caa06f 0%, var(--wood) 35%, var(--wood-dark) 100%);
  box-shadow: 0 22px 34px -12px rgba(43, 38, 32, 0.55);
}
.shelflegs {
  width: 86%;
  height: clamp(60px, 12vh, 120px);
  display: flex;
  justify-content: space-between;
}
.shelflegs span {
  width: 26px;
  height: 100%;
  background: linear-gradient(90deg, var(--wood) 0%, var(--wood-dark) 100%);
  border-radius: 0 0 4px 4px;
}

/* ---------- Progress card ---------- */
.progress {
  position: absolute;
  right: clamp(16px, 4vw, 56px);
  top: 50%;
  transform: translateY(-58%);
  width: clamp(200px, 20vw, 260px);
  border-radius: 22px;
  padding: 24px 24px 20px;
}
.progress h2 { font-size: 1.35rem; font-weight: 600; margin-bottom: 14px; }
.progress ul { list-style: none; }
.progress li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--ink);
  padding: 6px 0;
}
.progress__num { font-size: 1.25rem; font-weight: 700; min-width: 28px; text-align: center; }
.progress__link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(43, 38, 32, 0.4);
  padding-bottom: 2px;
}
.progress__link:hover { border-color: var(--ink); }

/* ---------- Pills ---------- */
.backpill {
  position: absolute;
  left: clamp(16px, 4vw, 56px);
  top: 50%;
  transform: translateY(-50%);
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.backpill:hover { background: rgba(255, 255, 255, 0.55); }

.nowpill {
  position: absolute;
  bottom: clamp(14px, 3.5vh, 34px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 999px;
  padding: 10px 12px 10px 10px;
  text-decoration: none;
  color: var(--ink);
}
.nowpill:hover { background: rgba(255, 255, 255, 0.55); }
.nowpill__spine { width: 34px; height: 44px; border-radius: 4px; box-shadow: inset -3px 0 5px rgba(0,0,0,0.25); }
.nowpill__text { display: flex; flex-direction: column; gap: 2px; padding-right: 6px; }
.nowpill__author { font-size: 0.72rem; color: var(--soft); }
.nowpill__title { font-size: 0.9rem; font-weight: 600; }
.nowpill__go {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  line-height: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .scene { height: 100dvh; }
  /* Phone layout: stop floating the glass panels over the shelf. Absolutely
     positioned, they overlapped each other AND the books at 375px. Everything
     becomes a normal stacked column: greeting → shelf → reading-now → progress. */
  .scene {
    height: auto;
    max-height: none;
    min-height: calc(100svh - 71px);
    overflow: visible;
    display: flex;
    flex-direction: column;
    padding-bottom: 28px;
  }
  .scene__light { height: 32%; }

  .topbar {
    position: static;
    transform: none;
    order: 1;
    width: 100%;
    padding: 22px 18px 8px;
    flex-direction: column;
    align-items: center;          /* centred on mobile */
    text-align: center;
    gap: 6px;
  }
  .topbar__meta { justify-content: center; }
  .topbar__meta .topbar__divider { display: none; }

  .shelfzone {
    position: static;
    transform: none;
    order: 2;
    width: 100%;
    height: auto;
    margin-top: 12px;
  }

  /* Books swipe horizontally; the big right padding existed only to dodge the
     floating Progress card, which no longer overlaps them. */
  .books {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    justify-content: flex-start;
    padding: 12px 18px 0;
  }
  .book { flex-shrink: 0; scroll-snap-align: center; }
  .book--featured { margin: 0 10px; scroll-snap-align: center; }

  /* Swipe affordance */
  .shelfzone::after {
    content: "Swipe the shelf to browse";
    display: block;
    margin-top: 10px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--soft);
    text-align: center;
  }

  .nowpill, .progress, .backpill {
    position: static;
    transform: none;
    width: calc(100% - 36px);
    margin: 12px 18px 0;
  }
  .nowpill { order: 3; justify-content: center; }
  .nowpill__text { align-items: center; text-align: center; }
  .progress ul { display: inline-block; }
  .progress li { justify-content: center; }
  .progress { order: 4; width: calc(100% - 36px); padding: 20px 22px 18px; }
  .backpill { order: 5; justify-content: center; text-align: center; }
}
