/* Books hub — hovering 3D book mockups, the shelf grid, the landing page, and
   the open-book reader (Look inside).
   Uses the studio design tokens (see static/css/theme/tokens.css). All layout is
   self-contained here so no Tailwind rebuild is needed. */

/* ---------------------------------------------------------------- layout */
.books-wrap { max-width: 78rem; margin: 0 auto; padding: 0 1.25rem; }

.books-hero-band { padding: 3.5rem 0 1.5rem; }
.books-eyebrow { margin-bottom: 0.9rem; }
.books-h1 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0 0 0.6rem;
  color: var(--ink);
}
.books-lede { color: var(--muted); font-size: 1.1rem; max-width: 40rem; line-height: 1.6; }

/* ---------------------------------------------------------- book object
   The hovering 3D book from the ebook shot in the YouTube video
   (claude-youtube-editor · remotion/src/shots/video-2/EbookCta.tsx): the real
   cover on a block of pages, yawed ~21° with a hint of pitch, floating over a
   soft floor shadow, gently bobbing and swaying.

   All geometry is in container-query units of the cover's width (the .bk3d
   box is an inline-size container), so a 160px shelf tile and a 340px hero
   share the same proportions: thickness ≈ 8cqw (34px on the video's 430px
   cover), perspective ≈ 370cqw (1600px on 430px), bob ≈ 2cqw (9px).

   The cover keeps its native ratio and is NEVER cropped: on a product page the
   cover art has to be exact. Hover straightens the book a few degrees (the
   cover gets MORE legible, not less) rather than tilting it further. */
@property --bk-yaw {
  syntax: '<angle>';
  inherits: true;
  initial-value: -21deg;
}
.bk3d {
  --bk-yaw: -21deg;
  --bk-pitch: 4deg;
  --bk-thick: 8cqw;
  position: relative;
  display: block;
  width: 100%;
  container-type: inline-size;
  /* room for the floor shadow (percent = containing block width ≈ own width) */
  padding-bottom: 12%;
  transition: --bk-yaw 0.45s cubic-bezier(0.16, 0.84, 0.44, 1);
}
.book-card:hover .bk3d,
.bk3d--hero:hover,
.bk3d--hero:focus-within { --bk-yaw: -13deg; }

/* Floor shadow — a blurred ellipse under the book, NOT part of the 3D object,
   so it can breathe against the bob (book up → shadow smaller and lighter). */
.bk3d__shadow {
  position: absolute;
  left: -4%; right: -16%;
  bottom: 0;
  height: 11cqw;
  border-radius: 50%;
  background: rgba(24, 20, 50, 0.34);
  filter: blur(5cqw);
  transform-origin: center;
  animation: bk-shadow 5.4s ease-in-out infinite;
  pointer-events: none;
}

.bk3d__float {
  position: relative;
  perspective: 370cqw;
  perspective-origin: 50% 50%;
  animation: bk-bob 5.4s ease-in-out infinite;
}
.bk3d__obj {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(var(--bk-yaw)) rotateX(var(--bk-pitch));
  animation: bk-sway 9.2s ease-in-out infinite;
}

/* Back cover, one thickness behind the front. */
.bk3d__back {
  position: absolute; inset: 0;
  border-radius: 0.5cqw 2cqw 2cqw 0.5cqw;
  background: #12122a;
  transform: translateZ(calc(-1 * var(--bk-thick)));
}
/* Fore-edge page block: a face standing on the right side, spanning from the
   front cover (z=0) back to the back cover (z=-thick). Fine cream/grey stripes
   read as sheets at any size. */
.bk3d__edge {
  position: absolute;
  right: 0; top: 0.8%; bottom: 0.8%;
  width: var(--bk-thick);
  transform-origin: right center;
  transform: rotateY(-90deg);
  background: repeating-linear-gradient(180deg, #f4f1e9 0 0.7cqw, #d9d5c8 0.7cqw 0.95cqw);
  border-radius: 0.4cqw;
}

/* Front cover: in flow, so the real image sets the box (native ratio). */
.bk3d__cover {
  position: relative;
  display: block;
  border-radius: 0.5cqw 2cqw 2cqw 0.5cqw;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 7cqw 16cqw rgba(20, 18, 44, 0.35);
  transform: translateZ(0);
}
.bk3d__img,
.bk3d__ph {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.bk3d__ph {
  aspect-ratio: 1 / 1.4;
  display: flex; align-items: center; justify-content: center;
  padding: 8%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; text-align: center;
  font-family: var(--font-display); font-weight: 600; font-size: 7cqw; line-height: 1.2;
}
/* Hinge shade down the spine — the video's left gradient on the cover. */
.bk3d__hinge {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5cqw;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0));
  pointer-events: none;
}

@keyframes bk-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2.2cqw); }
}
@keyframes bk-sway {
  0%, 100% { transform: rotateY(calc(var(--bk-yaw) - 1.2deg)) rotateX(var(--bk-pitch)); }
  50%      { transform: rotateY(calc(var(--bk-yaw) + 1.2deg)) rotateX(var(--bk-pitch)); }
}
@keyframes bk-shadow {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  50%      { transform: scaleX(0.94); opacity: 0.78; }
}
@media (prefers-reduced-motion: reduce) {
  .bk3d { transition: none; }
  .bk3d__shadow, .bk3d__float, .bk3d__obj { animation: none; }
}

/* -------------------------------------------------------------- shelf */
.books-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2.75rem 2rem;
  padding: 1.5rem 0 3rem;
}
@media (max-width: 520px) {
  .books-shelf { grid-template-columns: repeat(2, 1fr); gap: 2rem 1.25rem; }
  .book-card .bk3d { width: 82%; }
}
.book-card {
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: inherit;
  position: relative;
}
.book-card .bk3d { width: 74%; }
.book-card__meta { text-align: center; margin-top: 0.9rem; }
.book-card__title {
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  color: var(--ink); margin: 0 0 0.15rem; letter-spacing: -0.01em;
}
.book-card__author { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.5rem; }
.book-card__price {
  display: inline-block; font-weight: 600; font-size: 0.85rem;
  color: var(--accent-strong);
}
.book-card__price.is-free { color: var(--signal); }
.book-card:hover .book-card__title { color: var(--accent-strong); }

/* "Look inside" affordance for cards that open in place. */
.book-card__peek {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin-top: 0.55rem;
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  opacity: 0; transform: translateY(3px);
  transition: opacity 0.2s, transform 0.2s, color 0.2s;
}
.book-card:hover .book-card__peek,
.book-card:focus-visible .book-card__peek { opacity: 1; transform: none; color: var(--accent-strong); }
@media (hover: none) { .book-card__peek { opacity: 1; transform: none; } }

.book-card--soon { cursor: default; }
.book-card--soon[data-bkr] { cursor: pointer; }
.book-card--soon .bk3d__img { filter: saturate(0.85); }
.book-card__ribbon {
  position: absolute; top: -0.4rem; z-index: 3;
  background: var(--warn); color: var(--c-ink);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 0.25rem 0.7rem; border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.books-section-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.35rem; color: var(--ink); letter-spacing: -0.01em;
  margin: 2.5rem 0 0.25rem;
}

/* ------------------------------------------------------------ landing */
.book-landing-hero {
  display: grid;
  grid-template-columns: minmax(240px, 340px) 1fr;
  gap: 3.5rem;
  align-items: center;
  padding: 3rem 0 2.5rem;
}
/* Breadcrumb — same visual language as the guide breadcrumb
   (see guides/base_guide.html): left-aligned, small, muted, accent on hover. */
.book-breadcrumb { padding: 1.75rem 0 0; }
.book-breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1.3;
}
.book-breadcrumb li { display: flex; align-items: center; margin: 0; }
a.book-breadcrumb__link {
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}
a.book-breadcrumb__link:hover { color: var(--accent); text-decoration: none; }
.book-breadcrumb__sep { color: var(--muted); opacity: 0.55; user-select: none; }
.book-breadcrumb__current {
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
}

/* The hero owned the page's top padding before the breadcrumb sat above it. */
.book-breadcrumb + .book-landing-hero { padding-top: 1.25rem; }

.book-landing-hero .bk3d { width: 88%; }
/* Relative so the "Look inside" pill can sit ON the cover. The pill is
   position:absolute, so it leaves the flow and this box stays exactly the
   book's height — no phantom gap under the hero. */
.book-hero-art {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
}
.book-hero-art[data-bkr] { cursor: pointer; }

/* "Look inside" trigger, overlaid on the cover itself rather than parked
   below it — the Amazon cue. Sitting under the book it read as a second
   button competing with the real CTA; on the cover it reads as an affordance
   of the book. Frosted so it stays legible over any cover art, light or dark. */
.book-peek {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  z-index: 2;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.44rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  color: var(--ink);
  font-family: var(--font-body); font-size: 0.8rem; font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(26, 26, 46, 0.22);
  transition: background 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.book-peek:hover,
.book-peek:focus-visible,
.book-hero-art:hover .book-peek {
  background: #fff;
  color: var(--accent-strong);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 6px 18px rgba(26, 26, 46, 0.28);
}
@media (prefers-reduced-motion: reduce) {
  .book-peek { transition: background 0.18s, color 0.18s; }
  .book-peek:hover,
  .book-peek:focus-visible,
  .book-hero-art:hover .book-peek { transform: translateX(-50%); }
}
@media (max-width: 800px) {
  .book-landing-hero { grid-template-columns: 1fr; gap: 2rem; }
  .book-hero-art { max-width: 260px; margin: 0 auto; }
}
.book-hero-title {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em;
  line-height: 1.08; font-size: clamp(1.9rem, 3.5vw, 2.8rem);
  color: var(--ink); margin: 0.7rem 0 0.4rem;
}
.book-hero-sub { font-size: 1.15rem; color: var(--muted); margin: 0 0 0.5rem; line-height: 1.4; }
.book-hero-author { font-size: 0.95rem; color: var(--muted); margin: 0 0 1.2rem; }
.book-hero-author b { color: var(--ink); font-weight: 600; }
.book-hero-tagline { font-size: 1.02rem; color: var(--ink); line-height: 1.6; margin: 0 0 1.5rem; max-width: 34rem; }

/* buy / download box */
.book-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; }
.book-price { display: flex; align-items: baseline; gap: 0.5rem; }
.book-price__now { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; color: var(--ink); }
.book-price__was { font-size: 1.05rem; color: var(--muted); text-decoration: line-through; }
.book-note { font-size: 0.85rem; color: var(--muted); margin-top: 0.6rem; }
.book-owned-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.85rem; font-weight: 600; color: var(--signal);
}
.book-upsell {
  margin-top: 1.1rem; padding: 0.9rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 0.9rem; color: var(--muted);
}
.book-upsell a { color: var(--accent-strong); font-weight: 600; text-decoration: none; }
.book-upsell a:hover { text-decoration: underline; }

/* facts strip */
.book-facts {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem;
  margin: 1.75rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--line);
  font-size: 0.85rem; color: var(--muted);
}
.book-facts b { color: var(--ink); font-weight: 600; }

/* sections */
.book-section { padding: 2.5rem 0; border-top: 1px solid var(--line); }
.book-section__h {
  font-family: var(--font-display); font-weight: 600; font-size: 1.5rem;
  letter-spacing: -0.01em; color: var(--ink); margin: 0 0 1.25rem;
}
.book-prose { color: var(--ink); line-height: 1.7; max-width: 44rem; }
.book-prose p { margin: 0 0 1rem; }
.book-prose h2, .book-prose h3 { font-family: var(--font-display); color: var(--ink); margin: 1.6rem 0 0.6rem; }
.book-prose ul, .book-prose ol { margin: 0 0 1rem 1.25rem; }
.book-prose a { color: var(--accent-strong); }

/* ------------------------------------------------- the open-book reader
   static/js/books/reader.js builds this DOM on demand and appends it to
   <body> (so <main>'s stacking context can't trap it under the sticky nav).

   The stage is the video's BrandBg — paper, a soft top glow, the dot grid —
   so the book opens on the same set it floated on in the video, not in a
   generic dark lightbox. Page/flip geometry comes from two custom properties
   the JS sets from the viewport and the sample's real page ratio:
     --pw  page width   --ph  page height
   In "single" mode (narrow screens) the book box is one page wide and the
   left half lives off-stage (clipped at the spine). */
body.bkr-open { overflow: hidden; }

.bkr {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column;
  font-family: var(--font-body);
  color: var(--ink);
  --pw: 300px; --ph: 424px;
  --bkr-r: 8px;
  --bkr-thick: 26px;
}
.bkr[hidden] { display: none; }
.bkr__bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(1300px 700px at 50% -12%, rgba(99, 102, 241, 0.16), transparent 60%),
    var(--c-paper);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.bkr__bg::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(#e7e3da 1.5px, transparent 1.5px);
  background-size: 46px 46px;
  opacity: 0.45;
}
.bkr.is-in .bkr__bg { opacity: 1; }

/* top bar */
.bkr__bar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.25rem;
  opacity: 0; transform: translateY(-6px);
  transition: opacity 0.3s ease 0.15s, transform 0.3s ease 0.15s;
}
.bkr.is-in .bkr__bar { opacity: 1; transform: none; }
.bkr__eyebrow {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent-strong);
}
.bkr__title {
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  color: var(--ink); margin: 0.1rem 0 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bkr__title small { font-family: var(--font-body); font-weight: 500; color: var(--muted); }
.bkr__close {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%;
  background: rgba(255, 255, 255, 0.7); color: var(--ink); cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.bkr__close:hover { background: #fff; color: var(--accent-strong); transform: rotate(90deg); }
.bkr__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* stage */
.bkr__stage {
  position: relative; z-index: 1;
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
.bkr__book {
  position: relative;
  width: calc(var(--pw) * 2);
  height: var(--ph);
  perspective: calc(var(--pw) * 5.2);
  perspective-origin: 50% 50%;
}
.bkr__book--single {
  width: var(--pw);
  clip-path: inset(-80px -80px -120px 0);
}
/* Everything that IS the book rides in here so the fly-in/out can move it as
   one object; the JS toggles preserve-3d on/off (3D only while it's a
   closed, yawed mockup — flat while reading so DOM order paints the pages). */
.bkr__obj {
  position: absolute; inset: 0;
  transform-origin: calc(var(--pw) * 1.5) 50%;
  will-change: transform;
}
.bkr__book--single .bkr__obj { transform-origin: 50% 50%; }
.bkr__obj.is-3d { transform-style: preserve-3d; }

/* the floor shadow: under the closed book while it flies in, widening under
   the whole spread as the cover opens */
.bkr__shadow {
  position: absolute; left: var(--pw); right: -2%; top: calc(var(--ph) - 8px); height: 40px;
  border-radius: 50%;
  background: rgba(24, 20, 50, 0.30);
  filter: blur(18px);
  pointer-events: none;
  transition: left 0.74s cubic-bezier(0.37, 0, 0.63, 1);
}
.bkr.is-spread .bkr__shadow { left: -2%; }
.bkr__book--single .bkr__shadow { left: 0 !important; }
.bkr__obj.is-3d .bkr__shadow { display: none; }
.bkr:not(.is-open) .bkr__nav { opacity: 0 !important; pointer-events: none; }

/* The closed book's body (back cover + fore-edge) — sits under the right
   page; the front cover swings off it. */
.bkr__body {
  position: absolute; top: 0; left: var(--pw);
  width: var(--pw); height: var(--ph);
  transform-style: preserve-3d;
}
.bkr__body-back {
  position: absolute; inset: 0;
  border-radius: 2px var(--bkr-r) var(--bkr-r) 2px;
  background: #12122a;
  transform: translateZ(calc(-1 * var(--bkr-thick)));
}
.bkr__body-edge {
  position: absolute; right: 0; top: 4px; bottom: 4px;
  width: var(--bkr-thick);
  transform-origin: right center;
  transform: rotateY(-90deg);
  background: repeating-linear-gradient(180deg, #f4f1e9 0 3px, #d9d5c8 3px 4px);
  border-radius: 2px;
}

/* pages */
.bkr__page {
  position: absolute; top: 0;
  width: var(--pw); height: var(--ph);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(20, 18, 44, 0.30);
  visibility: hidden;
}
.bkr__page.is-on { visibility: visible; }
.bkr__page--left  { left: 0; border-radius: var(--bkr-r) 0 0 var(--bkr-r); }
.bkr__page--right { left: var(--pw); border-radius: 0 var(--bkr-r) var(--bkr-r) 0; }
.bkr__page img,
.bkr__face img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  user-select: none; -webkit-user-drag: none;
}
/* gutter shading toward the spine */
.bkr__page--left::after,
.bkr__page--right::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 34px; pointer-events: none;
}
.bkr__page--left::after  { right: 0; background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.14)); }
.bkr__page--right::after { left: 0;  background: linear-gradient(90deg, rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0)); }
.bkr__gutter {
  position: absolute; left: calc(var(--pw) - 3px); top: 2px; width: 6px; height: calc(var(--ph) - 4px);
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.10), rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.10));
  pointer-events: none;
  opacity: 0; transition: opacity 0.3s;
}
.bkr.is-open .bkr__gutter { opacity: 1; }
.bkr__book--single .bkr__gutter { display: none; }

/* the leaf in motion (page turn) and the swinging cover share one anatomy:
   two backface-hidden faces on a preserve-3d hinge. */
.bkr__flip,
.bkr__cover {
  position: absolute; top: 0;
  width: var(--pw); height: var(--ph);
  transform-style: preserve-3d;
  will-change: transform;
}
.bkr__flip--fwd,
.bkr__cover { left: var(--pw); transform-origin: left center; }
.bkr__flip--back { left: 0; transform-origin: right center; }
.bkr__face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  background: #fff;
}
.bkr__face--back { transform: rotateY(180deg); }
.bkr__flip .bkr__face { box-shadow: 0 18px 44px rgba(20, 18, 44, 0.25); }
.bkr__flip--fwd .bkr__face { border-radius: 0 var(--bkr-r) var(--bkr-r) 0; }
.bkr__flip--back .bkr__face { border-radius: var(--bkr-r) 0 0 var(--bkr-r); }

/* single mode: the book box is one page wide; the "right" page fills it and
   the left half (turned leaves, the opened cover) lives off-stage to the
   left, clipped at the spine by the box's clip-path. */
.bkr__book--single .bkr__page--right,
.bkr__book--single .bkr__flip--fwd,
.bkr__book--single .bkr__cover,
.bkr__book--single .bkr__body { left: 0; }
.bkr__book--single .bkr__page--left,
.bkr__book--single .bkr__flip--back { left: calc(-1 * var(--pw)); }
.bkr__book--single .bkr__page--right { border-radius: var(--bkr-r); }
.bkr__book--single .bkr__page--right::after { display: none; }

/* the cover: real cover art on the front, cream board on the back */
.bkr__cover .bkr__face--front {
  border-radius: 2px var(--bkr-r) var(--bkr-r) 2px;
  box-shadow: 0 30px 70px rgba(20, 18, 44, 0.35);
}
.bkr__cover .bkr__face--front::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 22px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0));
}
.bkr__cover .bkr__face--back {
  border-radius: var(--bkr-r) 2px 2px var(--bkr-r);
  background: #f6f4ec;
}
.bkr__cover-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center; padding: 10%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; text-align: center;
  font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; line-height: 1.2;
}

/* blank leaves: inside cover / filler */
.bkr__blank {
  width: 100%; height: 100%;
  background: #f6f4ec;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 8%;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: rgba(26, 26, 46, 0.35);
}

/* the last leaf: what the sample was for */
.bkr__end {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 10% 9%;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(99, 102, 241, 0.10), transparent 60%),
    #fffef7;
}
.bkr__end-eyebrow {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent-strong);
}
.bkr__end-title {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em;
  font-size: clamp(1.15rem, calc(var(--pw) * 0.075), 1.7rem); line-height: 1.15;
  color: var(--ink); margin: 0.6rem 0 0.5rem;
}
.bkr__end-sub { color: var(--muted); font-size: clamp(0.8rem, calc(var(--pw) * 0.04), 0.95rem); line-height: 1.5; margin: 0 0 1.4rem; max-width: 26ch; }
.bkr__end .lw-btn { font-size: clamp(0.8rem, calc(var(--pw) * 0.042), 0.95rem); }
.bkr__end-soon {
  display: inline-block; padding: 0.5rem 1rem; border-radius: var(--radius-pill);
  background: var(--warn); color: var(--c-ink); font-weight: 700; font-size: 0.85rem;
}
.bkr__end-more { margin-top: 0.9rem; font-size: 0.8rem; }
.bkr__end-more a { color: var(--accent-strong); font-weight: 600; text-decoration: none; }
.bkr__end-more a:hover { text-decoration: underline; }

/* nav arrows */
.bkr__nav {
  position: absolute; top: 50%; z-index: 3;
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(26, 26, 46, 0.14);
  transform: translateY(-50%);
  transition: background 0.15s, color 0.15s, opacity 0.2s, box-shadow 0.15s;
  opacity: 0;
}
.bkr.is-open .bkr__nav { opacity: 1; }
.bkr__nav--prev { left: max(0.75rem, calc(50% - var(--pw) - 4.5rem)); }
.bkr__nav--next { right: max(0.75rem, calc(50% - var(--pw) - 4.5rem)); }
.bkr__book--single ~ .bkr__nav--prev,
.bkr__stage.is-single .bkr__nav--prev { left: max(0.5rem, calc(50% - var(--pw) / 2 - 3.5rem)); }
.bkr__stage.is-single .bkr__nav--next { right: max(0.5rem, calc(50% - var(--pw) / 2 - 3.5rem)); }
.bkr__nav:hover:not(:disabled) { background: #fff; color: var(--accent-strong); box-shadow: 0 10px 24px rgba(26, 26, 46, 0.18); }
.bkr__nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bkr__nav:disabled { opacity: 0.25 !important; cursor: default; }

/* footer */
.bkr__foot {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 1rem 1.25rem; flex-wrap: wrap;
  padding: 0.8rem 1.25rem 1rem;
  font-size: 0.85rem; color: var(--muted);
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.3s ease 0.2s, transform 0.3s ease 0.2s;
}
.bkr.is-in .bkr__foot { opacity: 1; transform: none; }
.bkr__counter b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bkr__hint { color: var(--muted); }
.bkr__foot-actions { margin-left: auto; display: flex; align-items: center; gap: 0.75rem 1rem; }
.bkr__link { color: var(--accent-strong); font-weight: 600; text-decoration: none; white-space: nowrap; }
.bkr__link:hover { text-decoration: underline; }
.bkr__cta {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.15rem; border-radius: var(--radius-pill);
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.28);
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s;
}
.bkr__cta:hover { background: var(--accent-strong); color: #fff; transform: translateY(-1px); text-decoration: none; }
.bkr__cta--soon { background: var(--warn); color: var(--c-ink); box-shadow: none; pointer-events: none; }

@media (max-width: 700px) {
  .bkr__bar { padding: 0.75rem 0.9rem; }
  .bkr__hint { display: none; }
  .bkr__foot { padding: 0.6rem 0.9rem 0.85rem; gap: 0.5rem 0.75rem; }
  .bkr__foot-actions { margin-left: auto; min-width: 0; }
  .bkr__cta { padding: 0.55rem 0.95rem; font-size: 0.85rem; }
  .bkr__link { font-size: 0.8rem; }
  .bkr__nav { width: 40px; height: 40px; }
  .bkr__nav--prev { left: 0.4rem; }
  .bkr__nav--next { right: 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .bkr__bg, .bkr__bar, .bkr__foot, .bkr__nav, .bkr__gutter, .bkr__close, .bkr__cta { transition: none; }
}

/* table of contents */
.book-toc { list-style: none; margin: 0; padding: 0; max-width: 44rem; }
.book-toc li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0; border-bottom: 1px dashed var(--line);
  color: var(--ink);
}
.book-toc li .pg { color: var(--muted); font-variant-numeric: tabular-nums; }

/* final CTA band */
.book-cta-band {
  margin: 3rem 0 4rem; padding: 2.5rem;
  border-radius: var(--radius);
  background: var(--surface-ink); color: var(--c-paper);
  text-align: center;
  box-shadow: var(--shadow);
}
.book-cta-band h2 {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em;
  font-size: clamp(1.4rem, 2.5vw, 1.9rem); margin: 0 0 0.4rem;
}
.book-cta-band p { color: rgba(255, 255, 255, 0.72); margin: 0 0 1.4rem; }
