/* ── Bookshelf ──
   The site column keeps its exact size (780px); on wide screens it shifts left
   and the shelf takes the space on the right. Narrower screens get a Bookshelf tab instead. */
.with-shelf { display: flex; justify-content: center; gap: 64px; }
.with-shelf > .container { flex: 0 1 780px; margin: 0; min-width: 0; }
.shelf-side { flex: 0 0 300px; padding-top: 48px; opacity: 0; animation: fadeUp 0.8s ease 0.3s forwards; }
.shelf-side-inner { padding-bottom: 48px; }
.shelf-tab { display: none; }

@media (max-width: 1180px) {
  .with-shelf { display: block; }
  .with-shelf > .container { margin: 0 auto; }
  .shelf-side { display: none; }
  .shelf-tab { display: block; }
}

.shelf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.shelf-title { font-family: 'Cormorant Garamond', serif; font-size: clamp(1.25rem, 2.5vw, 1.55rem); font-weight: 400; letter-spacing: 0.01em; }
.shelf-count { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--ink-light); }
.shelf-side .section-eyebrow { margin-bottom: 28px; }

.shelves { display: grid; gap: 30px; }
.shelf-side .shelves { max-width: 300px; }
.shelf-tab .shelves { max-width: 520px; }
.shelf-row { display: flex; align-items: flex-end; gap: 2px; padding: 0 8px; }
/* Pale oak board, thin, with a soft floating shadow */
.shelf-board {
  height: 10px;
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, rgba(28,28,26,0.035) 0 2px, transparent 2px 11px),
    linear-gradient(#D8C2A0, #C4A67E 65%, #A98A62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 12px 14px -10px rgba(74,54,30,0.45);
}

/* Spines: one shape, five finishes. --c is the main cover colour, --a a second colour from the cover. */
.book {
  --c: #888; --a: #333; --t: #fff;
  position: relative; flex: none;
  width: var(--w); height: var(--h);
  border: none; padding: 0; cursor: pointer;
  border-radius: 3px 3px 1px 1px;
  transform-origin: bottom center;
  transition: transform 0.35s ease;
  background-color: var(--c);
  /* rounded-spine shading shared by every finish */
  background-image: linear-gradient(90deg, rgba(0,0,0,0.22), rgba(255,255,255,0.14) 22%, rgba(255,255,255,0) 46%, rgba(0,0,0,0.05) 74%, rgba(0,0,0,0.24));
  box-shadow: inset 0 0 0 1px rgba(28,28,26,0.1), 1px 0 0 rgba(28,28,26,0.12);
}
.book-title, .book-author { position: absolute; left: 0; width: 100%; writing-mode: vertical-rl; text-align: center; line-height: var(--w); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--t); }
.book-title { top: 14px; bottom: calc(24% + 22px); font-family: 'Forum', serif; font-size: 10px; letter-spacing: 0.05em; }
.book-author { bottom: 16px; height: 24%; font-family: 'DM Sans', sans-serif; font-size: 6.5px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.8; }
.book.slim .book-author { display: none; }
.book.slim .book-title { bottom: 14px; }
.book-mark { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); }

/* 1. Cloth-bound: linen weave, gold foil title, double gold rules */
.s-cloth {
  background-image:
    linear-gradient(90deg, rgba(0,0,0,0.25), rgba(255,255,255,0.12) 22%, rgba(255,255,255,0) 46%, rgba(0,0,0,0.05) 74%, rgba(0,0,0,0.28)),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 2px),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.07) 0 1px, transparent 1px 2px);
}
.s-cloth::before, .s-cloth::after { content: ''; position: absolute; left: 2px; right: 2px; height: 1px; background: #D9B672; box-shadow: 0 3px 0 #D9B672; opacity: 0.85; }
.s-cloth::before { top: 7px; } .s-cloth::after { bottom: 10px; }
.s-cloth .book-title, .s-cloth .book-author { color: #E4C88C; text-shadow: 0 1px 0 rgba(0,0,0,0.35); }

/* 2. Paperback: matte card, sans title, worn edges, small publisher block */
.s-paper { box-shadow: inset 0 0 0 1px rgba(28,28,26,0.1), inset 0 2px 1px -1px rgba(255,255,255,0.35), inset 0 -2px 2px -1px rgba(0,0,0,0.15); }
.s-paper .book-title { font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 8px; letter-spacing: 0.14em; text-transform: uppercase; }
.s-paper .book-mark { width: 8px; height: 8px; background: var(--a); border-radius: 1px; }

/* 3. Library label: a cream paper label carries the title */
.s-label .book-title { left: 3px; width: calc(100% - 6px); top: 16px; bottom: calc(24% + 24px); line-height: calc(var(--w) - 6px);
  background: #F3ECDD; color: #2A2620; border-radius: 1px; box-shadow: inset 0 0 0 1px rgba(28,28,26,0.18); font-size: 9px; }
.s-label::after { content: ''; position: absolute; left: 3px; right: 3px; bottom: 9px; height: 3px; background: var(--a); opacity: 0.9; }

/* 4. Three-band classic: coloured head and tail, cream middle */
.s-bands {
  background-image:
    linear-gradient(90deg, rgba(0,0,0,0.2), rgba(255,255,255,0.12) 22%, rgba(255,255,255,0) 46%, rgba(0,0,0,0.05) 74%, rgba(0,0,0,0.22)),
    linear-gradient(var(--c) 0 20%, #EFE8D8 20% 76%, var(--c) 76%); }
.s-bands .book-title { top: 24%; bottom: 28%; color: #2A2620; }
.s-bands .book-author { bottom: 4px; height: 18%; color: #F4F0E8; opacity: 0.85; }
.s-bands .book-mark { bottom: auto; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: #EFE8D8; }

/* 5. Dust jacket: glossy, with a stripe in the second cover colour */
.s-jacket {
  background-image:
    linear-gradient(90deg, rgba(0,0,0,0.2), rgba(255,255,255,0.32) 18%, rgba(255,255,255,0.05) 30%, rgba(255,255,255,0) 50%, rgba(0,0,0,0.05) 74%, rgba(0,0,0,0.24)),
    linear-gradient(transparent 12%, var(--a) 12% 17%, transparent 17%);
}
.s-jacket .book-title { top: 22%; font-weight: 400; font-size: 10.5px; }

.book:hover, .book:focus-visible { transform: translateY(-8px); }
.book.lean { transform: rotate(-7deg); margin-left: 10px; }
.book.lean:hover, .book.lean:focus-visible { transform: rotate(-7deg) translateY(-8px); }
.book:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.book-ribbon { position: absolute; left: 50%; bottom: -12px; width: 4px; height: 16px; transform: translateX(-50%); background: var(--coral); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); z-index: 2; }

.shelf-note { margin-top: 26px; font-size: 0.78rem; line-height: 1.6; color: var(--ink-light); max-width: 300px; }

/* Hover card, in the site's own type */
.book-card {
  position: fixed; z-index: 60; width: 220px; pointer-events: none;
  background: var(--cream); border: 1px solid var(--line); padding: 12px 14px;
  box-shadow: 0 16px 30px -18px rgba(28,28,26,0.5);
  opacity: 0; transform: translateY(4px); transition: opacity 0.2s, transform 0.2s;
}
.book-card.on { opacity: 1; transform: none; }
.book-card .k { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--coral); }
.book-card .n { font-family: 'Forum', serif; font-size: 1.08rem; line-height: 1.2; margin: 4px 0 2px; color: var(--ink); }
.book-card .a { font-size: 0.8rem; color: var(--ink-mid); margin-bottom: 8px; }
.book-card .m { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--ink-light); }
.book-card .s { color: var(--coral); letter-spacing: 1px; }

@media (prefers-reduced-motion: reduce) { .book, .book-card { transition: none; } }

/* ── Real-cover looks ── */
/* Spines cut from the cover: a centre slice of the art, with spine shading and the title on top */
.book.rs { background-color: #555; background-size: auto 100%; background-position: 50% 50%; overflow: hidden; }
.rs-shade { position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.38), rgba(255,255,255,0.16) 22%, rgba(255,255,255,0) 46%, rgba(0,0,0,0.08) 74%, rgba(0,0,0,0.4)),
    linear-gradient(rgba(0,0,0,0.12), rgba(0,0,0,0.32));
}
.book.rs .book-title { top: 12px; bottom: 12px; color: #FBF7EF; font-size: 10px; text-shadow: 0 0 3px rgba(0,0,0,0.75), 0 1px 1px rgba(0,0,0,0.6); }
