/*
 * The book page: the cover beside the offer, the contents list, and the free
 * chapter. Loaded by book.html only; everything else comes from site.css.
 */

.book-hero {
  display: grid;
  grid-template-columns: minmax(0, 13rem) minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
  margin: var(--space-lg) 0 var(--space-xl);
}
.book-hero__cover { margin: 0; }
.book-hero__cover img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.18), 0 10px 28px rgb(0 0 0 / 0.14);
}
.book-hero .buy { margin: 0; }

@media (max-width: 40rem) {
  .book-hero { grid-template-columns: minmax(0, 1fr); }
  .book-hero__cover { max-width: 11rem; }
}

.book-toc { padding-left: 1.6em; }
.book-toc li { margin: 0.15em 0; }

.book-sample {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: var(--rule-hair) solid var(--color-rule);
}
.book-sample__note {
  font-size: var(--text-sm);
  color: var(--color-ink-3);
}
.book-sample blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-2xs) 0 var(--space-2xs) var(--space-md);
  border-left: 3px solid var(--color-accent);
  color: var(--color-ink-2);
}

.table-scroll { overflow-x: auto; margin: var(--space-md) 0 var(--space-lg); }
.book-sample table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.book-sample th,
.book-sample td {
  padding: 0.5em 0.6em;
  border-bottom: var(--rule-hair) solid var(--color-rule-soft);
  text-align: left;
  vertical-align: top;
}
.book-sample th { color: var(--color-ink-3); font-weight: 600; }

.book-sources { padding-left: 1.2em; }
.book-sources li { margin: 0 0 var(--space-sm); }
.book-sources cite { display: block; }

/*
 * The buy bar. The free chapter is about twelve thousand pixels long and the
 * two offer boxes sit at its two ends, so for most of the read no way to buy
 * was on screen. This bar is fixed to the bottom edge while neither box is in
 * view. js/buybar.js decides when; without it the bar stays hidden.
 */
.buybar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--color-paper-2);
  border-top: var(--rule-hair) solid var(--color-rule);
  box-shadow: 0 -6px 18px oklch(24% 0.014 60 / 0.08);
}
.buybar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-md);
  padding-top: var(--space-sm);
  padding-bottom: var(--space-sm);
}
.buybar p { margin: 0; }
.buybar__text {
  font-size: var(--text-sm);
  color: var(--color-ink-2);
}
.buybar__text strong {
  font-family: var(--font-display);
  font-size: var(--text-base);
  letter-spacing: 0.02em;
  color: var(--color-ink);
  margin-right: var(--space-xs);
}
.buybar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); }
.buybar .buy__msg { margin: 0; }

/* Phone: one full-width button and nothing else, so the bar stays one row
   high. The safe-area inset keeps the button above the home indicator. */
@media (max-width: 40rem) {
  .buybar__text { display: none; }
  .buybar__inner {
    padding-top: var(--space-xs);
    padding-bottom: max(var(--space-xs), env(safe-area-inset-bottom));
  }
  .buybar__actions { flex: 1 1 100%; }
  .buybar__actions .btn { flex: 1 1 100%; text-align: center; justify-content: center; }
}
