@font-face {
  font-family: Grandstander;
  src: url("mackery-moves-in/grandstander.woff2") format("woff2");
  font-display: swap;
  font-weight: 600;
}

:root {
  color-scheme: light;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  color: #241841;
  background: #f8f2ff;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at top right, #ebdcff 0, transparent 49%),
    linear-gradient(148deg, #fffbf2, #f8f2ff 70%, #f4edff);
}

main {
  width: min(100%, 1190px);
  margin-inline: auto;
  padding: clamp(18px, 4.8vw, 56px) clamp(12px, 4vw, 42px) max(30px, env(safe-area-inset-bottom));
}
header { margin-bottom: clamp(15px, 3vw, 30px); }
header h1 {
  margin: 0;
  font: 600 clamp(30px, 5.2vw, 58px)/1.05 Grandstander, "Trebuchet MS", system-ui, sans-serif;
  color: #3d226b;
  letter-spacing: -.04em;
}
header p {
  margin: 7px 0 0;
  color: #574672;
  line-height: 1.45;
  font-size: clamp(14px, 2.1vw, 17px);
}
.embed main { padding-top: 14px; }
.embed h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.embed header p { margin: 0; }
.shelf {
  --shelf-headroom: clamp(22px, 4vw, 40px);
  --shelf-ledge: clamp(12px, 1.8vw, 20px);
  --wood: linear-gradient(to bottom, #e6bc83 0 16%, #ca935c 17% 59%, #b67945 84%, #925b35 100%);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  border: clamp(7px, 1.2vw, 13px) solid #bc875a;
  border-top-color: #d8a975;
  border-bottom-color: #a77048;
  border-radius: 8px;
  background:
    repeating-linear-gradient(4deg, transparent 0 14px, #c28a5020 15px, transparent 16px 29px),
    radial-gradient(ellipse at top, #fff6df, #f1d7b4 82%);
  box-shadow: 0 7px 15px #633e3330, inset 0 0 18px #965b4945;
  list-style: none;
  isolation: isolate;
}
.shelf > li { min-width: 0; }
.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  color: #3d226b;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.book-card:focus-visible {
  outline: 3px solid #6d36aa;
  outline-offset: -4px;
  border-radius: 5px;
  z-index: 2;
}
.book-stand {
  position: relative;
  display: block;
  padding: var(--shelf-headroom) 13% var(--shelf-ledge);
}
.book-stand::after,
.shelf::after {
  content: "";
  height: var(--shelf-ledge);
  background: var(--wood);
  box-shadow: 0 4px 5px #75472a40;
}
.book-stand::after {
  position: absolute;
  inset: auto 0 0;
}
.shelf::after { display: none; }
.book-volume {
  position: relative;
  z-index: 1;
  display: block;
  aspect-ratio: 1;
  perspective: 540px;
  border-radius: 3px 5px 5px 3px;
  background: #fcf5df;
  box-shadow: 2px 4px 7px #50342362;
}
.book-volume::before {
  position: absolute;
  content: "";
  inset: 3px -5px 2px 3px;
  border: 1px solid #ac8457;
  border-radius: 2px 5px 5px 2px;
  background:
    linear-gradient(138deg, transparent 67%, #d8b08030),
    repeating-linear-gradient(to right, #f7ecd3 0 1px, #d4bb97 1px 2px, #fff7e3 2px 3px);
}
.book-cover {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #40264448;
  border-radius: inherit;
  background: #f8eef9;
  backface-visibility: hidden;
  transform-origin: left center;
}
.book-cover::after {
  position: absolute;
  content: "";
  inset: 0;
  background: linear-gradient(90deg, #30203d60, #fff6 3%, #32223233 5%, transparent 8%);
  pointer-events: none;
}
.book-cover img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.book-caption {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 12px clamp(7px, 1.4vw, 16px) 14px;
  text-align: center;
}
.book-title {
  display: block;
  overflow-wrap: anywhere;
  font: 600 clamp(15px, 1.7vw, 20px)/1.18 Grandstander, "Trebuchet MS", system-ui, sans-serif;
}
.book-action {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #57279d;
  text-decoration: underline;
  text-underline-offset: 2px;
}
@media (max-width: 900px) {
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shelf::after {
    display: block;
    margin-top: calc(var(--shelf-headroom) + 74%);
  }
}
@media (max-width: 540px) {
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: no-preference) {
  :root:not(.reduced-motion) .book-volume {
    transition: transform 200ms ease, box-shadow 200ms ease;
  }
  :root:not(.reduced-motion) .book-card:focus-visible .book-volume {
    transform: translateY(-5px) rotate(-2deg);
    box-shadow: 4px 9px 12px #50342355;
  }
  .book-card.is-opening { z-index: 3; }
  .is-opening .book-volume { animation: pick-up 450ms cubic-bezier(.25,.62,.27,1) both; }
  .is-opening .book-cover { animation: open-cover 450ms cubic-bezier(.27,.55,.32,1) both; }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  :root:not(.reduced-motion) .book-card:hover .book-volume {
    transform: translateY(-5px) rotate(-2deg);
    box-shadow: 4px 9px 12px #50342355;
  }
}
@keyframes pick-up {
  32% { transform: translateY(-13%) rotate(-4deg); }
  100% { transform: translateY(-10%) scale(1.06); }
}
@keyframes open-cover {
  0%, 28% { transform: rotateY(0); }
  100% { transform: rotateY(-118deg); }
}
