/* The first page of every opened book: the introduction on the left, the book itself on the right,
   a real object with boards, spine and page block, floating over the paper and nudged by the pointer. */
.bh { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; padding: 104px 7vw 80px; --ink: #1C1A17; --mid: #6D6A63; color: var(--ink); }
.bh-txt { max-width: 440px; }
.bh-k { font: 600 11px/1 "Inter Tight", "Noto Sans SC", sans-serif; letter-spacing: .22em; color: var(--acc, #2541AE); }
.bh-t { margin-top: 22px; white-space: nowrap; font: 600 clamp(48px, 6vw, 104px)/1.05 "Newsreader", "Noto Serif SC", serif; letter-spacing: .08em; }
.bh-en { margin-top: 14px; font: 500 12px "Inter Tight", sans-serif; letter-spacing: .34em; color: var(--mid); }
.bh-intro { margin-top: 34px; font: 400 16px/2.05 "Newsreader", "Noto Serif SC", serif; letter-spacing: .04em; max-width: 24em; }
.bh-meta { margin-top: 34px; display: grid; grid-template-columns: auto 1fr; gap: 10px 22px; font: 400 13px/1.5 "Inter Tight", "Noto Sans SC", sans-serif; }
.bh-meta dt { color: var(--mid); letter-spacing: .12em; }
.bh-meta dd { font-family: "Newsreader", "Noto Serif SC", serif; font-size: 15px; letter-spacing: .04em; }
.bh-txt > * { opacity: 0; transform: translateY(18px); transition: opacity 1s cubic-bezier(.22,.61,.36,1), transform 1s cubic-bezier(.22,.61,.36,1); transition-delay: calc(var(--i, 0) * 90ms + 150ms); }
.bh.in .bh-txt > * { opacity: 1; transform: none; }

/* the book */
.bh-book { position: relative; justify-self: center; --H: min(62vh, 560px); --W: calc(var(--H) * .62); --T: calc(var(--H) * .1); width: var(--W); height: var(--H); perspective: 1800px; }
.bh-shadow { position: absolute; left: 6%; right: -4%; bottom: -9%; height: 14%; border-radius: 50%; background: radial-gradient(closest-side, rgba(40,30,15,.32), rgba(40,30,15,0)); filter: blur(6px); transform-origin: center; will-change: transform, opacity; }
.bh-3d { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.bh-3d > i { position: absolute; display: block; backface-visibility: hidden; }
.bh-3d .f { inset: 0; transform: translateZ(calc(var(--T) / 2)); background-size: 100% 100%; border-radius: 2px 4px 4px 2px; overflow: hidden; }
.bh-3d .bk { inset: 0; transform: rotateY(180deg) translateZ(calc(var(--T) / 2)); background: #2a2622; border-radius: 4px 2px 2px 4px; }
.bh-3d .s { top: 0; height: 100%; width: var(--T); left: 50%; margin-left: calc(var(--T) / -2); transform: rotateY(-90deg) translateZ(calc(var(--W) / 2)); background-size: 100% 100%; filter: brightness(.86); }
.bh-3d .e { top: 1.5%; height: 97%; width: var(--T); left: 50%; margin-left: calc(var(--T) / -2); transform: rotateY(90deg) translateZ(calc(var(--W) / 2 - 3px)); background: repeating-linear-gradient(90deg, #F1ECE1 0 1px, #DCD4C3 1px 2px, #EAE4D7 2px 3px); }
.bh-3d .tp { left: 1%; width: 97%; height: var(--T); top: 50%; margin-top: calc(var(--T) / -2); transform: rotateX(90deg) translateZ(calc(var(--H) / 2 - 3px)); background: repeating-linear-gradient(0deg, #F1ECE1 0 1px, #DCD4C3 1px 2px); }
.bh-3d .bt { left: 1%; width: 97%; height: var(--T); top: 50%; margin-top: calc(var(--T) / -2); transform: rotateX(-90deg) translateZ(calc(var(--H) / 2 - 3px)); background: #D8D0BF; }
/* printed-board texture: paper fibre, a faint linen weave, and a sheen that travels with the tilt */
.bh-3d .f .tex { position: absolute; inset: 0; opacity: .32;
  background:
    url("/lab/shelf/grain.png") 0 0 / 180px,
    repeating-linear-gradient(0deg, rgba(60,45,25,.05) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(60,45,25,.04) 0 1px, transparent 1px 3px); }
.bh-3d .f .sheen { position: absolute; inset: 0; background: linear-gradient(105deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.13) 47%, rgba(255,255,255,0) 62%) 0 0 / 260% 100% no-repeat; }
.bh-3d .f .edge { position: absolute; inset: 0; box-shadow: inset 6px 0 10px -6px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.06); }

@media (max-width: 767px) {
  .bh { display: flex; flex-direction: column; justify-content: center; gap: 30px; padding: 76px 28px 40px; }
  /* the book keeps its own size on a phone: the column must never squeeze it, however long the introduction */
  .bh-book { order: -1; flex-shrink: 0; --H: min(30svh, 250px); }
  .bh-t { font-size: clamp(36px, 12vw, 52px); margin-top: 14px; }
  .bh-intro { margin-top: 18px; font-size: 15px; }
  .bh-meta { margin-top: 18px; }
}
/* short phones (iPhone SE and the like): a smaller book and tighter type, so the longest introduction still fits */
@media (max-width: 767px) and (max-height: 720px) {
  .bh { gap: 20px; padding: 66px 26px 24px; }
  .bh-book { --H: min(24svh, 190px); }
  .bh-t { font-size: 34px; margin-top: 10px; }
  .bh-en { margin-top: 10px; }
  .bh-intro { margin-top: 12px; font-size: 13.5px; line-height: 1.85; }
  .bh-meta { margin-top: 12px; gap: 6px 18px; font-size: 12px; }
  .bh-meta dd { font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) { .bh-txt > * { transition: none; } }
