/* ── Free book on sign-up ──────────────────────────────────────────
   Picker modal (v2, 2026-10-08) + library banner. See js/free-book.js.
   Desktop: a row of five covers over a detail panel for the selected
   book. Phone: a bottom sheet, all five covers on one row, actions
   pinned at the bottom. */

.fb-modal {
  max-width: 960px; width: 100%; max-height: 92vh; padding: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.fb-grabber { display: none; }

.fb-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 28px 36px 0;
}
.fb-head-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fb-eyebrow {
  margin: 0; font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--success, #7FA377);
}
.fb-head h3 {
  margin: 0; font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.1;
}
.fb-lede { margin: 0; max-width: 560px; color: var(--text-2); font-size: .95rem; line-height: 1.5; }
.fb-close {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
  transition: color .15s, border-color .15s;
}
.fb-close:hover { color: var(--text); border-color: var(--accent-dim); }
.fb-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.fb-scroll { overflow-y: auto; padding: 0 36px; min-height: 0; }

/* Covers: one row of five, the selected one lifted with a check. */
.fb-covers {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px;
  padding-top: 32px; align-items: start;
}
.fb-pick {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 0; background: transparent; border: 0; color: inherit; font: inherit; cursor: pointer;
  opacity: .72; transition: opacity .2s, transform .2s;
}
.fb-pick:hover { opacity: .95; }
/* Selected = gold ring + check, no lift or scale (nothing moves). */
.fb-pick.is-selected { opacity: 1; }
.fb-pick:focus-visible { outline: none; }
/* Keyboard focus is a light dashed outline, never the gold selection ring. */
.fb-pick:focus-visible:not(.is-selected) .fb-pick-cover { outline: 2px dashed rgba(240,230,215,.55); outline-offset: 5px; }
.fb-pick.is-selected:focus-visible .fb-pick-cover { box-shadow: 0 0 0 3px var(--accent), 0 18px 40px rgba(0,0,0,.5); }
.fb-pick-cover {
  position: relative; display: block; width: 100%; aspect-ratio: 2 / 3;
  border-radius: var(--r-sm); background: var(--surface-hi);
  box-shadow: 0 8px 20px rgba(0,0,0,.35); transition: box-shadow .2s;
}
.fb-pick-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit;
}
.fb-pick.is-selected .fb-pick-cover { box-shadow: 0 0 0 2px var(--accent), 0 18px 40px rgba(0,0,0,.5); }
.fb-pick-check {
  position: absolute; top: -9px; right: -9px; width: 28px; height: 28px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  background: var(--accent); color: var(--bg, #171310); box-shadow: 0 0 0 3px var(--surface);
}
.fb-pick.is-selected .fb-pick-check { display: inline-flex; }
.fb-pick-time { font-size: .8rem; color: var(--text-3); margin-top: -6px; }
.fb-pick-name { display: block; min-height: 2.5em; font-family: var(--font-display); font-size: .86rem; line-height: 1.25; color: var(--text-2); text-align: center; text-wrap: balance; }
.fb-pick.is-selected .fb-pick-name { color: var(--text); }
.fb-name-tiny { display: none; }

/* Detail panel for the selected book. */
.fb-detail {
  margin: 24px 0 4px; padding: 24px 26px; min-height: 228px; box-sizing: border-box;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 280px); gap: 28px;
  background: var(--bg, #171310); border: 1px solid var(--border); border-radius: var(--r-md);
}
.fb-detail.is-empty { display: block; padding: 28px 26px; }
.fb-detail-empty { margin: 0; color: var(--text-3); font-size: .92rem; text-align: center; }
.fb-detail-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.fb-chip {
  font-size: .75rem; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2);
}
.fb-chip--accent { border-color: transparent; background: var(--accent-glow); color: var(--accent); }
.fb-detail-title {
  margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 1.6rem; line-height: 1.15;
}
.fb-detail-author { margin: 0; font-size: .88rem; color: var(--text-3); }
.fb-detail-hook { margin: 4px 0 0; font-size: .95rem; line-height: 1.5; color: var(--text); }
.fb-detail-side {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  padding-left: 28px; border-left: 1px solid var(--border);
}
.fb-opening-label {
  margin: 0; font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3);
}
.fb-opening {
  margin: 0; font-family: var(--font-display); font-style: italic;
  font-size: 1rem; line-height: 1.45; color: var(--text);
}
.fb-preview {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 16px 0 6px; border-radius: 22px;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  font: inherit; font-size: .88rem; cursor: pointer; transition: border-color .15s;
}
.fb-preview:hover { border-color: var(--accent-dim); }
.fb-preview:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fb-preview-icon {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--text); color: var(--bg, #171310);
}
.fb-preview.is-playing .fb-preview-icon { background: var(--accent); }

.fb-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 20px; padding: 16px 36px; border-top: 1px solid var(--border);
}
.fb-note { margin: 0; font-size: .82rem; color: var(--text-3); }
.fb-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.fb-actions .btn { justify-content: center; text-align: center; }
.fb-later { border-color: transparent; }
.fb-confirm { min-height: 48px; padding-inline: 26px; }
.fb-confirm:disabled { opacity: .55; cursor: default; }

/* ── Library banner ── */
.fb-banner { padding: 20px 24px 0; }
.fb-banner-inner {
  max-width: 1200px; margin: 0 auto; box-sizing: border-box;
  display: flex; align-items: center; gap: 28px; padding: 18px 20px 18px 28px;
  background: var(--surface); border: 1px solid rgba(201,162,106,.35); border-radius: var(--r-lg, 16px);
}
.fb-banner-fan { display: flex; align-items: flex-end; flex: none; height: 84px; }
.fb-banner-fan:empty { display: none; }
.fb-fan-cover {
  display: block; width: 46px; aspect-ratio: 2 / 3; margin-right: -14px;
  border-radius: 4px; overflow: hidden; background: var(--surface-hi);
  box-shadow: 0 6px 14px rgba(0,0,0,.45);
}
.fb-fan-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-fan-cover:nth-child(1) { transform: rotate(-8deg); }
.fb-fan-cover:nth-child(2) { transform: rotate(-4deg); }
.fb-fan-cover:nth-child(3) { width: 56px; position: relative; z-index: 2; }
.fb-fan-cover:nth-child(4) { transform: rotate(4deg); position: relative; z-index: 1; }
.fb-fan-cover:nth-child(5) { transform: rotate(8deg); margin-right: 0; }
.fb-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fb-banner-title { margin: 0; font-family: var(--font-display); font-size: 1.3rem; font-weight: 500; }
.fb-banner-sub { margin: 0; font-size: .88rem; color: var(--text-2); line-height: 1.45; }
.fb-banner-cta { flex: none; min-height: 44px; }
.fb-banner-hide {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--text-3); cursor: pointer;
}
.fb-banner-hide:hover { color: var(--text); }
.fb-banner-hide:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tablet: stack the detail panel. */
@media (max-width: 820px) {
  .fb-head { padding: 24px 24px 0; }
  .fb-scroll { padding: 0 24px; }
  .fb-footer { padding: 14px 24px; }
  .fb-detail { grid-template-columns: minmax(0, 1fr); gap: 16px; min-height: 350px; }
  .fb-detail-side { padding-left: 0; border-left: 0; padding-top: 16px; border-top: 1px solid var(--border); }
  .fb-covers { gap: 12px; }
}

/* Phone: bottom sheet. All five covers stay on one row; actions pinned. */
@media (max-width: 560px) {
  html.fb-open { overflow: hidden; }
  .modal-overlay.fb-overlay { padding: 0; align-items: flex-end; }
  .fb-modal { max-height: 94vh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .fb-grabber {
    display: block; width: 40px; height: 5px; border-radius: 3px;
    background: var(--border); margin: 10px auto 0; flex: none;
  }
  .fb-head { padding: 14px 20px 0; }
  .fb-head h3 { font-size: 1.6rem; }
  .fb-lede { font-size: .88rem; }
  .fb-close { width: 40px; height: 40px; }
  .fb-scroll { padding: 0 20px; }
  .fb-covers { gap: 8px; padding-top: 22px; }
  .fb-pick { gap: 6px; min-height: 44px; }
  .fb-pick-name { font-family: var(--font-ui); font-size: .7rem; min-height: 2.5em; }
  .fb-name-full { display: none; }
  .fb-name-tiny { display: inline; }
  .fb-pick-time { margin-top: -4px; }
  .fb-pick-check { width: 22px; height: 22px; top: -7px; right: -7px; }
  .fb-pick-check svg { width: 11px; height: 11px; }
  .fb-pick-time { font-size: .72rem; }
  .fb-detail { margin-top: 18px; padding: 18px; gap: 12px; min-height: 276px; }
  .fb-detail-title { font-size: 1.35rem; }
  /* Keep the preview button above the fold: the opening line is desktop-only. */
  .fb-opening-label, .fb-opening { display: none; }
  .fb-detail-side { padding-top: 0; border-top: 0; }
  .fb-footer {
    flex-direction: column-reverse; align-items: stretch; gap: 8px;
    margin-top: 12px; padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
  }
  .fb-note { text-align: center; font-size: .76rem; }
  .fb-actions { flex-direction: column-reverse; align-items: stretch; gap: 4px; }
  .fb-confirm { min-height: 52px; font-size: 1rem; }

  .fb-banner { padding: 12px 16px 0; }
  .fb-banner-inner { flex-wrap: wrap; gap: 14px; padding: 16px; }
  .fb-banner-fan { height: 66px; }
  .fb-fan-cover { width: 36px; margin-right: -12px; }
  .fb-fan-cover:nth-child(3) { width: 44px; }
  .fb-banner-text { flex-basis: calc(100% - 200px); }
  .fb-banner-cta { flex: 1 1 auto; }
  .fb-banner-hide { position: absolute; }
  .fb-banner-inner { position: relative; padding-right: 48px; }
  .fb-banner-hide { top: 6px; right: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .fb-pick, .fb-pick-cover { transition: none; }
}
