/* BOOKS 100x: real covers standing on a shelf. Point at one and it straightens up and tilts
   toward the cursor, like lifting it off the shelf; the record on the right cross-fades in,
   each line arriving a beat after the last. Loaded after the page's inline <style>, so it wins
   the cascade without !important. */

.books-lede { margin-top: 0.6rem; max-width: 46ch; }

.shelf-bk {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(1rem, 3vw, 2.4rem);
  height: clamp(230px, 28vw, 320px);
  margin-top: clamp(2rem, 4vw, 2.8rem);
  padding: 0 1rem 16px;
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 16px 18px -14px rgba(10, 13, 18, 0.4);
}

.bk {
  --r: 0deg;
  --tx: 0deg;
  --ty: 0deg;
  position: relative;
  width: clamp(112px, 14vw, 164px);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  opacity: 0.85;
  transform-origin: bottom center;
  transform: perspective(1200px) rotateZ(var(--r)) rotateY(var(--tx)) rotateX(var(--ty));
  transition: transform 0.55s var(--ease-spring), filter 0.4s var(--ease-out), opacity 0.4s var(--ease-out);
  filter: drop-shadow(0 10px 12px rgba(10, 13, 18, 0.18));
}
.bk__img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(10, 13, 18, 0.08);
}
.bk:hover, .bk:focus-visible, .bk[aria-pressed="true"] {
  opacity: 1;
  z-index: 1;
  transform: perspective(1200px) rotateZ(0deg) rotateY(var(--tx)) rotateX(var(--ty)) translateY(-22px) scale(1.07);
  filter: drop-shadow(0 26px 26px rgba(10, 13, 18, 0.28));
}
.bk:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 4px; }
@media (hover: none) { .bk { opacity: 1; } }

.bk-card { margin-top: 2rem; }
.bk-card h3 { font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.16; }
.bk-card__pub { margin-top: 0.5rem; font-family: var(--label); font-weight: 600; color: var(--accent); }
.bk-card p { margin-top: 1rem; color: var(--ink-2); max-width: 46ch; }
.bk-card__eds { margin-top: 0.9rem; font-size: 0.93rem; color: var(--muted); }
.bk-card__eds a {
  color: var(--ink-2); font-weight: 600; text-decoration: underline;
  text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px;
  transition: color 0.2s;
}
.bk-card__eds a:hover, .bk-card__eds a:focus-visible { color: var(--accent); }

/* the cross-fade: each field fades/rises/blurs out fast, then back in a beat after the last */
.bk-card h3, .bk-card__pub, .bk-card p, .bk-card__eds {
  transition: opacity 0.4s var(--ease-out), translate 0.4s var(--ease-out), filter 0.4s var(--ease-out);
}
.bk-card.is-turning h3, .bk-card.is-turning .bk-card__pub, .bk-card.is-turning p, .bk-card.is-turning .bk-card__eds {
  opacity: 0;
  translate: 0 6px;
  filter: blur(6px);
}

@media (max-width: 960px) {
  .shelf-bk { height: clamp(210px, 42vw, 280px); justify-content: center; }
}
@media (max-width: 600px) {
  .shelf-bk { gap: 0.75rem; padding: 0 0.4rem 12px; }
  .bk { width: clamp(90px, 25vw, 126px); }
}

@media (prefers-reduced-motion: reduce) {
  .bk, .bk-card h3, .bk-card__pub, .bk-card p, .bk-card__eds { transition: none !important; }
}

/* pass 1 (whole page): the covers are landscape, so a fixed tall shelf left most of it empty. The
   shelf now fits the books, the books are larger, and the shelf edge is a line, not a bar. */
.shelf-bk { height: auto; padding-top: clamp(1.5rem, 3vw, 2.5rem); border-bottom-width: 2px; }
.bk { width: clamp(132px, 16vw, 200px); }
@media (max-width: 960px) { .shelf-bk { height: auto; } }
@media (max-width: 600px) { .bk { width: clamp(96px, 27vw, 132px); } }

/* pass 2 (whole page): the shelf and the words meet in the middle */
#books .books__grid { align-items: center; }
