/* ───────────────────────── Footer shelf: the real book set ─────────────────────────
   A full-bleed stage inside .foot: the hero-style wordmark, the row of titles, then the
   nine spines standing on the shelf. Each spine is its own clipped layer of one image,
   so it can be lifted on its own, as if being picked. */

.foot { margin-top: clamp(60px, 8vw, 120px); }

.shelf {
  --fs: min(27vw, 36vh);
  --bh: min(40vh, 27vw); /* book row height */
  position: relative;
  height: 100vh;
  min-height: 620px;
  margin: 0 calc(var(--pad) * -1) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  background: var(--bg);
  border-top: 1px solid var(--line);
  isolation: isolate;
}

/* Wordmark — same face as the hero name: bold, tight, upright */
.shelf__word {
  position: relative;
  z-index: 1;
  margin: 0 0 0 -0.04em;
  font-family: var(--sans);
  font-weight: 700;
  font-size: var(--fs);
  line-height: 0.8;
  letter-spacing: -0.065em;
  white-space: nowrap;
  color: var(--fg);
  pointer-events: none;
  user-select: none;
}

/* Book-title link row, in shelf order */
.shelf__links {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 2.1vw;
  margin: clamp(22px, 3.2vh, 40px) 0 clamp(28px, 6vh, 64px);
  padding: 0 var(--pad);
  font: 500 max(10px, 0.74vw) / 1.2 var(--sans);
}
.shelf__links a { opacity: 0.6; transition: opacity 0.25s; }
.shelf__links a:hover,
.shelf__links a:focus-visible,
.shelf__links a.is-on { opacity: 1; }

/* The shelf: nine spines over one plank line */
.shelf__books {
  position: relative;
  z-index: 2;
  height: var(--bh);
  aspect-ratio: 800 / 403;
  flex: none;
}
.shelf__books::after {
  /* plank */
  content: '';
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: -1px;
  height: 1px;
  background: var(--line);
}

.shelf__book {
  position: absolute;
  inset: 0;
  pointer-events: none; /* only the clipped spine takes the pointer */
  transform: translate3d(0, 0, 0);
  transition: transform 0.55s cubic-bezier(0.34, 1.5, 0.5, 1), filter 0.4s ease;
  will-change: transform;
}
.shelf__spine {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: auto;
  background: url('/shelf/books-set.webp') center / 100% 100% no-repeat;
  clip-path: var(--clip);
  cursor: pointer;
}
/* picked: rises a little off the shelf and casts a shadow onto it */
.shelf__book:hover,
.shelf__book.is-lift {
  transform: translate3d(0, -6.5%, 0);
  filter: drop-shadow(0 calc(var(--bh) * 0.05) calc(var(--bh) * 0.04) rgba(0, 0, 0, 0.55)) brightness(1.06);
  z-index: 3;
}

/* breathing room between the shelf and the © row */
.shelf + .foot__row { padding-top: clamp(18px, 2.4vh, 28px); }

/* Tip that follows the pointer over a book */
.shelf__tip {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--fg);
  color: #0a0a0a;
  font: 500 11px / 1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-18px) scale(0.9);
  transition: opacity 0.2s, transform 0.25s var(--ease-out);
}
.shelf__tip.is-on { opacity: 1; transform: translate(-50%, -100%) translateY(-22px) scale(1); }

/* Intro: hidden until the footer scrolls into view, then animated in by shelf.js */
.js .shelf__links, .js .shelf__word, .js .shelf__spine { opacity: 0; }
.shelf.no-motion .shelf__links, .shelf.no-motion .shelf__word, .shelf.no-motion .shelf__spine { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .shelf__book { transition: filter 0.3s ease; }
  .shelf__book:hover, .shelf__book.is-lift { transform: none; }
}

/* Phones */
@media (max-width: 760px) {
  .shelf {
    --fs: 26.5vw;
    --bh: min(46vw, 34vh);
    height: auto;
    min-height: 0;
    padding-top: 18vh;
  }
  .shelf__links { gap: 0 18px; padding: 0 8vw; font-size: 13px; }
  .shelf__links a { padding: 14px 0; }
}
