/* Home page · the four books on a bookshop shelf (decided by the author on 17 November 2026).
   Each book is a box in CSS 3D: the cover (the book's own cover, redrawn as SVG from its
   canvas), the spine, the edge of the pages and the top. Its thickness follows the book's page
   count. Pointing at a book turns it slightly to show its spine; with reduced motion it stays
   still. The words under each book are the ones the cards already carried. */

.shelf { column-gap: 0; row-gap: 40px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1000px) { .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.shelf .book, .shelf .book.soon { background: transparent; border: 0; padding: 0 16px; gap: 10px; }
.shelf a.book:hover { box-shadow: none; }

/* the stage: the book standing, its shadow, and a piece of shelf the width of the column */
.tome-stage {
  --w: 116px;
  position: relative; display: block; margin: 0 -16px 8px;
  height: calc(var(--w) * 1.4144 + 46px);
  perspective: 1200px; perspective-origin: 50% 30%;
  background:
    linear-gradient(to bottom, transparent calc(100% - 24px), #3A3A42 calc(100% - 24px), #3A3A42 calc(100% - 18px),
      #141417 calc(100% - 18px), #141417 calc(100% - 4px), #0A0A0D calc(100% - 4px));
}
@media (min-width: 560px) { .tome-stage { --w: 150px; } }
@media (min-width: 1000px) { .tome-stage { --w: 156px; } }
.tome-stage::after {   /* the shadow on the shelf */
  content: ""; position: absolute; left: 50%; bottom: 20px; width: calc(var(--w) * 1.05); height: 10px;
  transform: translateX(-46%); background: radial-gradient(closest-side, rgba(0, 0, 0, 0.45), transparent); z-index: 0;
}

.tome {
  --h: calc(var(--w) * 1.4144);
  position: absolute; z-index: 1; left: 50%; bottom: 22px; width: var(--w); height: var(--h);
  margin-left: calc(var(--w) / -2);
  transform-style: preserve-3d;
  transform: rotateY(14deg);
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.tome .face { position: absolute; top: 0; left: 0; display: block; }
.tome .front { width: 100%; height: 100%; transform: translateZ(calc(var(--t) / 2)); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }
.tome .front img { display: block; width: 100%; height: 100%; }
.tome .back { width: 100%; height: 100%; background: #0A0A0D; transform: rotateY(180deg) translateZ(calc(var(--t) / 2)); }
.tome .spine {
  width: var(--t); height: 100%; left: calc(50% - var(--t) / 2);
  background: #0A0A0D; border-top: 6px solid var(--c); box-sizing: border-box;
  transform: rotateY(-90deg) translateZ(calc(var(--w) / 2));
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.tome .spine span {
  writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap;
  font-family: "IBM Plex Mono", monospace; font-size: 7.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #F5F3EE;
}
.tome .spine span b { color: var(--c); font-weight: 600; }
.tome .pages {
  width: var(--t); height: calc(100% - 4px); top: 2px; left: calc(50% - var(--t) / 2);
  background: repeating-linear-gradient(to right, #F5F3EE 0 1px, #D9D6CE 1px 2px);
  transform: rotateY(90deg) translateZ(calc(var(--w) / 2 - 2px));
}
.tome .top {
  width: calc(100% - 4px); height: var(--t); left: 0; top: calc(50% - var(--t) / 2);
  background: repeating-linear-gradient(to bottom, #F5F3EE 0 1px, #D9D6CE 1px 2px);
  transform: rotateX(90deg) translateZ(calc(var(--h) / 2 - 1px));
}

.shelf .book:hover .tome, .shelf a.book:focus-visible .tome { transform: translateY(-8px) rotateY(34deg); }
@media (prefers-reduced-motion: reduce) {
  .tome { transition: none; }
  .shelf .book:hover .tome, .shelf a.book:focus-visible .tome { transform: rotateY(14deg); }
}

/* the words under each book, a little tighter than on the old cards */
.shelf .book h2 { font-size: clamp(26px, 3vw, 34px); }
.shelf .book .sub { font-size: 15px; }
.shelf .book .for { font-size: 14px; }
@media (max-width: 559px) {
  .shelf .book, .shelf .book.soon { padding: 0 10px; }
  .tome-stage { margin: 0 -10px 8px; }
  .shelf .book h2 { font-size: 24px; }
  .shelf .book .sub, .shelf .book .for { font-size: 13px; }
}
