/* BidVariance recommended-reading (ebook) placements.
   Ledger-native: ruled bands and hairlines, existing type scale, the book's
   own cover as the only colour. Vermilion is the cover's red line, which is
   also the site's "bid line" accent, so the book and the product read as
   one family. No glows, no gradients, no side-stripe accents. */

/* ---- cover image (flat) -------------------------------------------------- */
.ebook-cover {
  display: block;
  width: 8.5rem;
  flex: none;
  border: 0;
  line-height: 0;
}
.ebook-cover:hover {
  border: 0;
}
.ebook-cover-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #fbf8f1;
  /* hard offset, like a book resting on the page: no blur, no glow */
  box-shadow: 0.28rem 0.28rem 0 var(--line);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.ebook-cover:hover .ebook-cover-img {
  transform: translate(-0.1rem, -0.1rem);
  box-shadow: 0.38rem 0.38rem 0 var(--line-strong);
}

/* ---- ruled editorial panel (blog end, methodology, docs, tools) --------- */
.ebook-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.1rem 1.9rem;
  align-items: center;
  border-top: 2px solid var(--ink);
  margin-top: 2.4rem;
  padding-top: 1.3rem;
}
.ebook-panel .eyebrow {
  margin: 0 0 0.55rem;
}
.ebook-panel h2 {
  margin: 0 0 0.55rem;
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
  text-wrap: balance;
}
.ebook-panel p {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.93rem;
  max-width: 68ch;
}
.ebook-meta {
  font-family: var(--mono);
  font-size: 0.74rem !important;
  letter-spacing: 0.02em;
  color: var(--ink-2) !important;
}
.ebook-panel .ebook-cta {
  margin: 0;
}
.ebook-panel .button {
  text-decoration: none;
}

/* ---- mid-article pull-note: hairlines, quiet, compact ------------------- */
.ebook-mid {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 1.8rem 0;
  padding: 0.85rem 0;
}
.ebook-mid p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 72ch;
}
.ebook-mid strong {
  color: var(--ink);
  font-weight: 600;
}
.ebook-mid em {
  font-style: italic;
}

/* ---- single-line note for the foot of existing sections ----------------- */
.ebook-note {
  font-size: 0.88rem !important;
  color: var(--muted);
  max-width: 72ch;
}
.ebook-note em {
  font-style: italic;
}

/* ---- homepage shelf: 3D book + copy + ledger facts ---------------------- */
.ebook-shelf {
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) minmax(0, 1.5fr) minmax(14rem, 1fr);
  gap: 2.4rem;
  align-items: center;
  border-top: 2px solid var(--ink);
  padding-top: 1.6rem;
}
.ebook-shelf h2 {
  margin: 0.55rem 0 0.6rem;
  font-size: clamp(1.45rem, 2.8vw, 1.8rem);
  letter-spacing: -0.02em;
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}
.ebook-shelf-copy > p {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 56ch;
}
.ebook-facts {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  overflow: hidden;
}
.ebook-facts > div {
  padding: 0.65rem 0.95rem;
  border-top: 1px solid var(--line);
}
.ebook-facts > div:first-child {
  border-top: 0;
}
.ebook-facts dt {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: 0.15rem;
}
.ebook-facts dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-2);
}
.ebook-shelf-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

/* The book: a real 3D object built from the cover, a spine, a page block and
   a back board. Resting angle shows the spine; hover/focus squares it up. */
.book3d {
  --w: 11.5rem;
  --t: 1.7rem;
  display: block;
  width: var(--w);
  margin: 0.4rem auto 0.9rem;
  perspective: 1100px;
  border: 0;
  line-height: 0;
}
.book3d:hover {
  border: 0;
}
.book3d-body {
  position: relative;
  display: block;
  width: var(--w);
  aspect-ratio: 3 / 4;
  transform-style: preserve-3d;
  transform: rotateY(28deg) rotateX(3deg);
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.book3d:hover .book3d-body,
.book3d:focus-visible .book3d-body {
  transform: rotateY(8deg) rotateX(1deg);
}
.book3d-face {
  position: absolute;
  display: block;
}
.book3d-front {
  inset: 0;
  transform: translateZ(calc(var(--t) / 2));
}
.book3d-front .ebook-cover-img {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0 2px 2px 0;
  box-shadow: none;
}
.book3d-back {
  inset: 0;
  background: #2a2c31;
  transform: translateZ(calc(var(--t) / -2));
}
.book3d-spine {
  top: 0;
  bottom: 0;
  left: calc(var(--t) / -2);
  width: var(--t);
  transform: rotateY(-90deg);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0) 40%),
    #191b1f;
}
.book3d-spine::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 14%;
  bottom: 14%;
  width: 2px;
  margin-left: -1px;
  background: var(--bid);
}
.book3d-pages {
  top: 0.18rem;
  bottom: 0.18rem;
  left: calc(var(--w) - var(--t) / 2);
  width: calc(var(--t) - 0.14rem);
  transform: rotateY(90deg);
  background: repeating-linear-gradient(
    90deg,
    #f7f3ea 0 2px,
    #e1dccf 2px 3px
  );
}
.book3d-shadow {
  position: absolute;
  left: 8%;
  right: -6%;
  bottom: -0.9rem;
  height: 0.8rem;
  background: rgba(25, 27, 31, 0.16);
  border-radius: 50%;
  filter: blur(7px);
  transform: translateZ(-2rem);
}

@media (max-width: 62rem) {
  .ebook-shelf {
    grid-template-columns: minmax(10rem, 13rem) minmax(0, 1fr);
    gap: 1.6rem 2rem;
  }
  .ebook-facts {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  }
  .ebook-facts > div {
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .ebook-facts > div:first-child {
    border-left: 0;
  }
}
@media (max-width: 40rem) {
  .ebook-shelf {
    grid-template-columns: 1fr;
  }
  .book3d {
    --w: 9.5rem;
  }
  .ebook-facts > div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .ebook-facts > div:first-child {
    border-top: 0;
  }
  .ebook-panel {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .ebook-panel .ebook-cover {
    width: 6.5rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .book3d-body,
  .ebook-cover-img {
    transition: none;
  }
}
