/* =========================================================================
   The shelf — the homepage.
   Every work the studio makes is a spine in its own cloth and typeface.
   At desk width the books stand on two shelves; on a phone they lie in piles,
   spines out, titles reading left to right. Spine metrics come from
   tools/catalogue.json as custom properties (--w --h --fs --len --dx).
   ========================================================================= */
:root {
  --board:     #2B2622;   /* the shelf itself, ebonised */
  --board-top: #4A4138;
  --brass:     #9C7A35;   /* label holders */
  --plate:     #F4EFE1;
  --plate-ink: #2B2622;
  --shelf-shadow: rgba(23, 32, 27, .30);
}
@media (prefers-color-scheme: dark) {
  :root {
    --board: #050A08; --board-top: #22332B; --brass: #C2A05A;
    --plate: #E7DFCA; --plate-ink: #1A1611; --shelf-shadow: rgba(0, 0, 0, .6);
  }
}

.masthead--bare .mark { color: var(--spruce); }

.case { container-type: inline-size; padding-block: var(--space-2xs) clamp(3rem, 7vw, 5rem); }
.shelf { display: flex; align-items: flex-end; }
.shelf + .shelf { margin-top: 54px; }
.bay { display: flex; flex-direction: column; justify-content: flex-end; }
.bay--grow { flex: 1; min-width: 0; }
.board {
  position: relative; height: 26px;
  background: linear-gradient(var(--board-top) 0 2px, var(--board) 2px);
  box-shadow: 0 16px 20px -10px var(--shelf-shadow);
}
.board__plate {
  position: absolute; left: 8px; top: 5px; height: 16px; padding: 0 9px;
  display: flex; align-items: center; white-space: nowrap; line-height: 1;
  background: var(--plate); color: var(--plate-ink);
  border: 1px solid var(--brass); box-shadow: 0 0 0 1px var(--board);
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase;
}
.books { display: flex; align-items: flex-end; gap: .28cqw; padding-inline: .4cqw; }
.bay--sep .books { padding-right: 3.4cqw; }

.wall { padding: 0 4cqw 44px 0; }
.wall h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.5rem, 6.3cqw, 4.6rem); line-height: 1.02; letter-spacing: -.012em;
}

/* a spine */
.spine {
  position: relative; flex: none; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 10px;
  width: calc(var(--w) * 1cqw); height: calc(var(--h) * 1cqw); padding: 13px 0 11px;
  border-radius: 2px; background-color: var(--cloth); color: var(--foil);
  /* the two foil bands, head and tail */
  background-image: linear-gradient(var(--foil), var(--foil)), linear-gradient(var(--foil), var(--foil));
  background-size: 100% 1px; background-position: 0 7px, 0 calc(100% - 7px); background-repeat: no-repeat;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .35);
  transition: transform .22s cubic-bezier(.3, .7, .2, 1);
}
.shelf--lower .spine { width: calc(var(--w) * 1.16cqw); }
/* the round of the spine */
.spine::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.34), rgba(255,255,255,.13) 16%, rgba(255,255,255,0) 46%, rgba(0,0,0,.26));
}
.spine:hover, .spine:focus-visible { transform: translateY(-12px); }
.spine:active { opacity: 1; }
.spine:focus-visible { outline-color: var(--ink); }
.spine__author, .spine__title { position: relative; writing-mode: vertical-rl; text-orientation: sideways; white-space: nowrap; }
.spine__title:lang(ja) { text-orientation: mixed; }
.spine__author { font-family: var(--font-text); font-size: max(8px, .76cqw); letter-spacing: .16em; text-transform: uppercase; opacity: .86; }
.spine__title { font-family: var(--face); font-weight: var(--wt, 400); font-size: calc(var(--fs) * 1cqw); line-height: 1; letter-spacing: var(--ls, 0); }
.spine__pine { position: relative; flex: none; width: max(10px, 1.05cqw); height: max(13px, 1.3cqw); fill: currentColor; opacity: .9; }

/* the one thick volume: the Reading List, and the rest of the canon with it */
.spine--tome { padding: 26px 10px 14px; text-align: center; }
.tome__title { position: relative; font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 2.15cqw; line-height: 1.02; }
.tome__title small { display: block; margin-top: .9cqw; font-family: var(--font-text); font-weight: 400; font-size: max(8px, .8cqw); letter-spacing: .2em; text-transform: uppercase; }
.tome__more { position: relative; font-family: "Fraunces", Georgia, serif; font-weight: 600; line-height: .95; }
.tome__more b { display: block; font-size: 3.5cqw; font-weight: 600; font-variant-numeric: lining-nums; }
.tome__more i { display: block; font-size: 1.5cqw; }

/* narrow: the books lie in piles */
@media (max-width: 979px) {
  .shelf { display: block; }
  .shelf + .shelf { margin-top: 0; }
  .bay { margin-top: 34px; }
  .bay--wall { margin-top: 0; }
  .bay--wall .board { display: none; }
  .wall { padding: 10px 0 4px; }
  .wall h1 { font-size: clamp(2.5rem, 11.5vw, 4rem); }
  .books, .bay--sep .books { flex-direction: column; align-items: flex-start; gap: 2px; padding: 0 6px; }
  .spine, .shelf--lower .spine {
    flex-direction: row; gap: 12px; padding: 0 20px;
    width: calc(var(--len) * 1%); max-width: 520px; height: 54px; margin-left: calc(var(--dx) * 1px);
    background-size: 1px 100%; background-position: 9px 0, calc(100% - 9px) 0;
  }
  .spine::before { background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,0) 38%, rgba(0,0,0,.3)); }
  .spine:hover, .spine:focus-visible { transform: translateX(10px); }
  .spine__author, .spine__title { writing-mode: horizontal-tb; }
  .spine__title { order: 1; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: clamp(15px, calc(var(--fs) * 10.5px), 28px); line-height: 1.25; }
  .spine__author { order: 2; font-size: 8.5px; letter-spacing: .12em; }
  .spine__pine { order: 0; width: 11px; height: 14px; }
  .spine--tome { height: 96px; padding: 0 22px; text-align: left; }
  .tome__title { flex: 1; font-size: 21px; }
  .tome__title br { display: none; }
  .tome__title small { margin-top: 5px; font-size: 9px; }
  .tome__more { text-align: right; }
  .tome__more b { font-size: 30px; }
  .tome__more i { font-size: 14px; }
  .board { max-width: 540px; }
}

/* ---- The flight: a spine comes off the shelf and turns its cover to you.
   shelf.js builds this overlay on a click, then follows the link; the work
   page opens the cover (work.css).                                         */
.flight { position: fixed; inset: 0; z-index: 60; perspective: 1900px; overflow: hidden; }
.flight__ground { position: absolute; inset: 0; background: var(--flight-paper); opacity: 0; }
.flight__vol { position: absolute; transform-style: preserve-3d; transform-origin: 100% 50%; }
.flight__spine {
  position: absolute; inset: 0; background: var(--cloth);
  background-image: linear-gradient(90deg, rgba(0,0,0,.34), rgba(255,255,255,.13) 16%, rgba(255,255,255,0) 46%, rgba(0,0,0,.26));
}
.flight__face { position: absolute; left: 100%; top: 0; height: 100%; transform-origin: 0 50%; transform: rotateY(90deg); }
.flight__flat { position: absolute; transform-origin: 0 0; }
.flight .cover { position: relative; }
