/* ==========================================================================
   BookBuzz design system

   Set like the front matter of a well-made book: warm paper ground, ink-black
   text, hairline rules instead of drop-shadowed cards, one measured column for
   prose.

   The recurring motif is the second-hand bookseller's endpaper annotation —
   the price pencilled inside the front cover. Offers are ruled rows: retailer
   in sans, condition in mono small caps, price right-aligned in graphite mono,
   the best one marked with an oxblood rule rather than a coloured badge. That
   motif belongs to the used-book market, which is the part of this product no
   competitor has.

   Loaded on every page, independent of the Tailwind build.
   ========================================================================== */

:root {
    /* Ground and ink. Bright and high-contrast — the audience is on social
       media, not reading a literary quarterly. White ground, vivid indigo
       brand, emerald for money, and the bee's yellow kept as a highlight. */
    --paper:      #FFFFFF;
    --paper-deep: #F4F6FF;  /* faint indigo tint for recessed sections */
    --ink:        #111827;
    --ink-soft:   #4B5563;
    --ink-faint:  #8B93A3;
    --rule:       #E4E7EC;

    /* Brand */
    --brand:      #4F46E5;
    --brand-deep: #4338CA;
    --brand-soft: #EEF2FF;
    --honey:      #FFC629;  /* the bee — logo and highlights */
    --wing:       #67E8F9;

    /* Money gets its own colour and is never set in body grey. */
    --money:      #059669;
    --money-soft: #ECFDF5;

    /* Retained so older rules keep resolving after the palette change. */
    --oxblood:      #4F46E5;
    --oxblood-deep: #4338CA;
    --graphite:     #4B5563;
    --sage:         #059669;
    --honey-deep:   #F0AC00;

    /* Type */
    --display: 'Newsreader', Georgia, 'Times New Roman', serif;
    --ui:      'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --data:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    /* Measure — prose stays readable */
    --measure: 34rem;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

body {
    background-color: var(--paper);
    color: var(--ink);
    font-family: var(--ui);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--oxblood);
    color: var(--paper);
}

/* Headings take the display face by default, so pages that haven't been
   hand-converted to the .bb-* classes still read as part of the same system.
   Tailwind's size and weight utilities continue to apply on top. */
h1, h2, h3, h4,
.font-display {
    font-family: var(--ui);
    font-weight: 700;
    letter-spacing: -0.012em;
    color: var(--ink);
}

/* Tailwind's rounded-full on buttons and pills reads as SaaS chrome; the
   editorial direction wants near-square edges. Images keep their rounding. */
a.rounded-full,
button.rounded-full { border-radius: 8px; }

/* Drop-shadowed floating cards are the look we're moving away from. */


/* Keyboard focus must stay visible everywhere. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--oxblood);
    outline-offset: 2px;
    border-radius: 1px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --------------------------------------------------------------------------
   Type scale
   -------------------------------------------------------------------------- */

.bb-display {
    font-family: var(--ui);
    font-weight: 700;
    font-size: clamp(2.25rem, 1.4rem + 3.6vw, 4rem);
    line-height: 1.04;
    letter-spacing: -0.021em;
    color: var(--ink);
}

.bb-h1 {
    font-family: var(--ui);
    font-weight: 700;
    font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem);
    line-height: 1.1;
    letter-spacing: -0.017em;
}

.bb-h2 {
    font-family: var(--ui);
    font-weight: 700;
    font-size: clamp(1.45rem, 1.1rem + 1.3vw, 2rem);
    line-height: 1.18;
    letter-spacing: -0.012em;
}

.bb-h3 {
    font-family: var(--ui);
    font-weight: 600;
    font-size: 1.15rem;
    line-height: 1.3;
}

/* Newsreader's italic carries the personality — used for asides and pull quotes. */
.bb-aside {
    font-family: var(--display);
    font-style: italic;
    font-size: 1.2rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

.bb-lede {
    font-family: var(--ui);
    font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
    line-height: 1.5;
    color: var(--ink-soft);
    max-width: var(--measure);
}

.bb-prose {
    max-width: var(--measure);
    color: var(--ink-soft);
}

.bb-prose p + p {
    margin-top: 1rem;
}

.bb-prose strong {
    color: var(--ink);
    font-weight: 600;
}

/* Running head — a section label, set like the header of a printed page. */
.bb-eyebrow {
    font-family: var(--data);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

/* --------------------------------------------------------------------------
   Rules — structure comes from hairlines, not boxes
   -------------------------------------------------------------------------- */

.bb-rule {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 0;
}

.bb-rule-strong {
    border: 0;
    border-top: 1.5px solid var(--ink);
    margin: 0;
}

.bb-section {
    padding-block: clamp(3rem, 2rem + 4vw, 5.5rem);
}

.bb-wrap {
    width: 100%;
    max-width: 64rem;
    margin-inline: auto;
    padding-inline: 1.5rem;
}

.bb-wrap-narrow {
    width: 100%;
    max-width: 44rem;
    margin-inline: auto;
    padding-inline: 1.5rem;
}

/* --------------------------------------------------------------------------
   The signature: bookseller's endpaper annotation
   -------------------------------------------------------------------------- */

.bb-offers {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--ui);
}

.bb-offers caption {
    text-align: left;
    font-family: var(--data);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding-bottom: 0.75rem;
}

.bb-offers th {
    font-family: var(--data);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    text-align: left;
    padding: 0 0 0.5rem;
    border-bottom: 1px solid var(--ink);
}

.bb-offers th.bb-num,
.bb-offers td.bb-num {
    text-align: right;
    /* Two adjacent right-aligned money columns collide without this. */
    padding-left: 1.25rem;
}

.bb-offers td {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--rule);
    vertical-align: baseline;
}

/* Give the retailer column room so prices never crowd the name. */
.bb-offers td:first-child,
.bb-offers th:first-child {
    padding-right: 1rem;
}

.bb-retailer {
    font-weight: 500;
    color: var(--ink);
}

/* Condition, in the shorthand a second-hand bookseller would use. */
.bb-condition {
    font-family: var(--data);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

/* Seller names are proper nouns — the uppercase shorthand treatment makes
   them shout, so they keep their own capitalisation. */
.bb-seller {
    font-family: var(--data);
    font-size: 0.72rem;
    text-transform: none;
    letter-spacing: 0.01em;
    color: var(--ink-faint);
}

/* The pencilled price. */
.bb-price {
    font-family: var(--data);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    color: var(--graphite);
    white-space: nowrap;
}

.bb-earn {
    font-family: var(--data);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    color: var(--sage);
    white-space: nowrap;
}

/* The marked row — the one the bookseller circled. An oxblood rule, not a badge. */
.bb-offers tr.bb-best td {
    border-bottom-color: var(--oxblood);
}

.bb-offers tr.bb-best .bb-price {
    color: var(--oxblood);
    font-weight: 500;
}

/* The bookseller's note beside the circled price. Set on its own line so it
   never crowds the figure it annotates. */
.bb-mark {
    display: block;
    font-family: var(--data);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--oxblood);
    margin-top: 0.15rem;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Offer rows — the same endpaper motif, built by JavaScript as results stream
   in. A ruled line per copy: who has it and in what state on the left, the
   price pencilled at the right.
   -------------------------------------------------------------------------- */

.bb-offer-group {
    border-bottom: 1px solid var(--rule);
}

.bb-offer-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.8rem 0;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--rule);
    transition: background-color 0.12s ease;
}

/* Rows inside a group are ruled by the group itself. */
.bb-offer-group > .bb-offer-row,
.bb-offer-group .bb-offer-row:last-child {
    border-bottom: 0;
}

.bb-offer-row:hover {
    background: var(--paper-deep);
}

.bb-offer-row:hover .bb-price {
    color: var(--oxblood);
}

.bb-offer-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.bb-offer-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    text-align: right;
    white-space: nowrap;
}

/* Indented, quiet — a marginal note rather than a control. */
.bb-offer-more {
    font-family: var(--data);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0 0 0.8rem;
}

.bb-offer-more:hover {
    color: var(--oxblood);
}

.bb-offer-group .bb-offer-row {
    padding-left: 1.25rem;
}

.bb-offer-group > .bb-offer-row:first-child {
    padding-left: 0;
}

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.bb-btn {
    display: inline-block;
    font-family: var(--ui);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    padding: 0.85rem 1.4rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
}

.bb-btn-primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.bb-btn-primary:hover {
    background: var(--oxblood-deep);
    border-color: var(--oxblood-deep);
}

.bb-btn-quiet {
    background: transparent;
    color: var(--ink);
    border-color: var(--ink);
}

.bb-btn-quiet:hover {
    background: var(--ink);
    color: var(--paper);
}

.bb-link {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--rule);
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
    transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

.bb-link:hover {
    color: var(--oxblood);
    text-decoration-color: var(--oxblood);
}

.bb-field {
    width: 100%;
    font-family: var(--ui);
    font-size: 0.95rem;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: 0.7rem 0.85rem;
}

.bb-field:focus {
    border-color: var(--ink);
    outline: none;
}

/* --------------------------------------------------------------------------
   Chrome
   -------------------------------------------------------------------------- */

.bb-masthead {
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
}

.bb-wordmark {
    font-family: var(--ui);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    text-decoration: none;
}

.bb-nav-link {
    font-family: var(--ui);
    font-size: 0.875rem;
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.15s ease;
}

.bb-nav-link:hover,
.bb-nav-link[aria-current="page"] {
    color: var(--oxblood);
}

.bb-colophon {
    border-top: 1px solid var(--rule);
    color: var(--ink-faint);
    font-size: 0.85rem;
}

.bb-colophon a {
    color: var(--ink-soft);
    text-decoration: none;
}

.bb-colophon a:hover {
    color: var(--oxblood);
}

/* Panels: recessed paper, never a floating card with a shadow. */
.bb-panel {
    background: var(--paper-deep);
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: 1.5rem;
}

/* --------------------------------------------------------------------------
   Tables inside long-form guide pages
   -------------------------------------------------------------------------- */

.bb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.bb-table th {
    font-family: var(--data);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    text-align: left;
    padding: 0 0.75rem 0.5rem 0;
    border-bottom: 1px solid var(--ink);
}

.bb-table td {
    padding: 0.7rem 0.75rem 0.7rem 0;
    border-bottom: 1px solid var(--rule);
    color: var(--ink-soft);
    vertical-align: top;
}

.bb-table td:first-child {
    color: var(--ink);
    font-weight: 500;
}

.bb-table .bb-num {
    font-family: var(--data);
    font-variant-numeric: tabular-nums;
    color: var(--graphite);
}

/* ==========================================================================
   Bold commercial layer

   The first pass was too austere for a page whose job is to make someone
   want something — restraint reads as credibility to an audience that
   judges, and as "nothing here" to an audience being sold to. This layer
   adds scale, full-bleed colour and the product's own imagery: book covers,
   which are the most persuasive asset the catalogue holds and were missing
   entirely.
   ========================================================================== */

/* Full-bleed brand bands. Vivid indigo ground, white type. */
.bb-band {
    background: var(--brand);
    color: #fff;
}

.bb-band .bb-eyebrow { color: rgba(255, 255, 255, 0.72); }
.bb-band .bb-prose,
.bb-band .bb-lede   { color: rgba(255, 255, 255, 0.9); }
.bb-band .bb-display,
.bb-band .bb-h1, .bb-band .bb-h2, .bb-band .bb-h3,
.bb-band h1, .bb-band h2, .bb-band h3 { color: #fff; }
.bb-band .bb-prose strong { color: #fff; }
.bb-band hr { border-color: rgba(255, 255, 255, 0.25); }

.bb-band .bb-btn-primary {
    background: var(--honey);
    color: var(--ink);
    border-color: var(--honey);
}
.bb-band .bb-btn-primary:hover { background: #FFD65C; border-color: #FFD65C; }

.bb-band .bb-btn-quiet { color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.bb-band .bb-btn-quiet:hover { background: #fff; color: var(--brand); border-color: #fff; }

/* Dark counterpoint, used sparingly. */
.bb-band-ink { background: var(--ink); color: #fff; }
.bb-band-ink .bb-eyebrow { color: rgba(255, 255, 255, 0.6); }
.bb-band-ink .bb-prose,
.bb-band-ink .bb-lede { color: rgba(255, 255, 255, 0.85); }
.bb-band-ink .bb-display,
.bb-band-ink .bb-h1, .bb-band-ink .bb-h2, .bb-band-ink .bb-h3,
.bb-band-ink h1, .bb-band-ink h2, .bb-band-ink h3 { color: #fff; }
.bb-band-ink .bb-prose strong { color: var(--honey); }
.bb-band-ink .bb-btn-primary { background: var(--honey); color: var(--ink); border-color: var(--honey); }
.bb-band-ink .bb-btn-quiet { color: #fff; border-color: rgba(255,255,255,0.5); }
.bb-band-ink .bb-btn-quiet:hover { background: #fff; color: var(--ink); }

/* The headline number. This is the one place the page shouts. */
.bb-figure {
    font-family: var(--ui);
    font-weight: 600;
    font-size: clamp(3.5rem, 2rem + 9vw, 7.5rem);
    line-height: 0.9;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
}

.bb-figure-was {
    font-family: var(--ui);
    font-weight: 600;
    font-size: clamp(1.5rem, 1rem + 2.4vw, 2.5rem);
    line-height: 1;
    letter-spacing: -0.02em;
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    opacity: 0.55;
    font-variant-numeric: tabular-nums;
}

/* Covers — the imagery the first pass left out. */
.bb-cover {
    display: block;
    border-radius: 2px;
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.45);
    background: var(--paper-deep);
}

.bb-cover-hero {
    width: clamp(9rem, 22vw, 15rem);
    height: auto;
    transform: rotate(-2.5deg);
}

/* A wall of real covers. Scrolls horizontally rather than wrapping, so it
   reads as a shelf and never dictates the section's height. */
.bb-shelf {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-block: 0.5rem 1.5rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.bb-shelf::-webkit-scrollbar { height: 6px; }
.bb-shelf::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

.bb-shelf img {
    flex: 0 0 auto;
    width: 6.5rem;
    height: 9.75rem;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.4);
    background: var(--paper-deep);
}

@media (min-width: 768px) {
    .bb-shelf img { width: 7.5rem; height: 11.25rem; }
}

/* Receipt: the price ladder beside the cover in the hero. */
.bb-receipt {
    background: #fff;
    border: 1px solid rgba(17, 24, 39, 0.1);
    box-shadow: 0 18px 40px -18px rgba(17, 24, 39, 0.45);
    border-radius: 3px;
    padding: 1.1rem 1.25rem;
}

.bb-receipt-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.45rem 0;
    font-family: var(--data);
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.bb-receipt-row + .bb-receipt-row {
    border-top: 1px solid var(--rule);
}

.bb-receipt-row.is-best { color: var(--ink); font-weight: 600; }

/* Hero grid. Written as real CSS rather than a Tailwind arbitrary value
   (lg:grid-cols-[1.05fr_0.95fr]) — that class did not survive the CDN build,
   collapsing the text column to a width that broke the headline one word
   per line. */
.bb-hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
}

@media (min-width: 62rem) {
    .bb-hero-grid {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
        gap: 4rem;
    }
}

/* Headline measure. Long words at display size need room; too tight a
   max-width forces one word per line. */
.bb-hero-grid h1 { max-width: 22ch; }

/* Smaller in the restructured hero, where the cover sits beside the receipt
   rather than beside the headline figure. */
.bb-cover-hero { width: clamp(7rem, 15vw, 10.5rem); }

/* ==========================================================================
   Money

   Earnings are the reason anyone does this, so they get their own colour and
   their own components rather than being set in body grey inside a table.
   ========================================================================== */

.bb-money {
    font-family: var(--ui);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--money);
    letter-spacing: -0.02em;
}

.bb-money-zero { color: var(--ink-faint); }

/* The earnings ledger: what the same reader is worth, by how they buy.
   The row that reads $0.00 is the entire argument, so it is a row rather
   than a sentence. */
.bb-ledger {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--ui);
}

.bb-ledger th {
    font-family: var(--data);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    text-align: left;
    padding: 0 0 0.6rem;
    border-bottom: 1.5px solid var(--ink);
}

.bb-ledger th:last-child,
.bb-ledger td:last-child { text-align: right; }

.bb-ledger td {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--rule);
    vertical-align: baseline;
}

.bb-ledger .bb-ledger-how { font-weight: 600; color: var(--ink); }
.bb-ledger .bb-ledger-note {
    display: block;
    font-family: var(--data);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    margin-top: 0.15rem;
}

.bb-ledger td:last-child { font-size: 1.15rem; }

/* The row that currently earns nothing. */
.bb-ledger tr.is-zero td { background: rgba(20, 18, 16, 0.035); }

/* Trust strip — why handing over your links is safe. */
.bb-trust {
    display: grid;
    gap: 1.75rem;
    grid-template-columns: 1fr;
}

@media (min-width: 48rem) {
    .bb-trust { grid-template-columns: repeat(4, 1fr); }
}

.bb-trust h3 {
    font-family: var(--ui);
    font-size: 0.95rem;
    font-weight: 600;
    color: inherit;
}

.bb-trust p {
    font-size: 0.88rem;
    line-height: 1.5;
    margin-top: 0.35rem;
    opacity: 0.8;
}

/* Bee — the brand mark, restored to the masthead. */
.bb-bee {
    width: 1.9rem;
    height: 1.9rem;
    object-fit: contain;
    flex-shrink: 0;
}

/* ==========================================================================
   Offer rows, bright treatment

   The endpaper styling — mono small caps, graphite prices, hairline rules —
   belonged to the editorial direction. On the bright palette prices should
   read as prices: large, dark, with the cheapest in the money colour.
   ========================================================================== */

.bb-offers th,
.bb-table th,
.bb-ledger th { border-bottom-color: var(--rule); }

.bb-price {
    font-family: var(--ui);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.bb-offers tr.bb-best .bb-price,
.bb-offer-row:hover .bb-price { color: var(--money); }

.bb-offers tr.bb-best td { border-bottom-color: var(--money); }

.bb-mark {
    display: inline-block;
    margin-top: 0.2rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: var(--money-soft);
    color: var(--money);
    font-family: var(--ui);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bb-retailer { font-weight: 600; }

.bb-condition {
    font-family: var(--ui);
    font-size: 0.78rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-faint);
}

.bb-seller { font-family: var(--ui); font-size: 0.78rem; }

.bb-offer-row {
    border-radius: 10px;
    padding-inline: 0.75rem;
}

.bb-offer-row:hover { background: var(--brand-soft); }

.bb-offer-more {
    font-family: var(--ui);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--brand);
    padding-left: 0.75rem;
}

.bb-offer-more:hover { color: var(--brand-deep); }

/* --------------------------------------------------------------------------
   Book page header and buy panel

   Built phone-first: most visitors arrive from a social post on a phone, so
   the cover sits beside the title rather than above it, and the buy panel
   lands on the first screen. On desktop the panel takes the right column.
   -------------------------------------------------------------------------- */

/* Desktop type on the book page was too small to read comfortably. Scaling
   the root scales every rem on the page; media queries are unaffected. */
@media (min-width: 60rem) {
    html:has(.bb-book-head) { font-size: 112.5%; }
}

.bb-book-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

@media (min-width: 60rem) {
    .bb-book-head { grid-template-columns: minmax(0, 1fr) 23rem; gap: 2.5rem; }
}

/* Cover beside the title, wrapping the title underneath whenever its column
   would fall below 13rem. Without the wrap, widths just past the two-column
   breakpoint squeezed the title to a word or two per line. */
.bb-book-id {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.bb-book-id > .min-w-0 { flex: 1 1 13rem; }

.bb-book-cover {
    flex-shrink: 0;
    width: 5.5rem;
    height: auto;
}

@media (min-width: 40rem) {
    .bb-book-id { gap: 1.75rem; }
    .bb-book-cover { width: 9rem; }
}

.bb-book-title {
    font-size: clamp(1.45rem, 1.1rem + 2vw, 2.6rem);
    line-height: 1.1;
    margin-top: 0.35rem;
}

.bb-book-author {
    font-family: var(--ui);
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
    font-weight: 500;
    color: #fff;
    margin-top: 0.4rem;
}

.bb-book-meta {
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.78);
    margin-top: 0.6rem;
}

.bb-book-copy {
    font-size: 0.8rem;
    margin-top: 0.85rem;
    padding: 0.4rem 0.8rem;
}

/* The panel is white on the band so prices and seller names read at full
   contrast. */
.bb-buy {
    background: var(--paper);
    color: var(--ink);
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.45);
}

@media (min-width: 40rem) {
    .bb-buy { padding: 1.25rem 1.4rem; }
}

.bb-buy-loading {
    font-size: 0.95rem;
    color: var(--ink-soft);
}

/* New and used, side by side: the two things a reader is choosing between.
   One tile spans the row when only one condition is on offer. */
.bb-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.bb-tiles:has(> .hidden) > :not(.hidden) { grid-column: 1 / -1; }

.bb-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    height: 100%;
    padding: 0.8rem 0.9rem 0.85rem;
    border: 1px solid var(--rule);
    border-radius: 0.75rem;
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.bb-tile:hover,
.bb-tile:focus-visible {
    border-color: var(--brand);
    box-shadow: 0 6px 18px -10px rgba(79, 70, 229, 0.55);
}

.bb-tile-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 0.5rem;
}

.bb-tile-cond {
    font-weight: 700;
    font-size: 0.95rem;
}

/* Shown only on the cheaper of the two tiles. */
.bb-tile-badge {
    display: none;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--ink);
    color: var(--honey);
}

.bb-tile-price {
    font-size: clamp(1.35rem, 1.1rem + 1vw, 1.6rem);
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    margin-top: 0.2rem;
}

.bb-tile-from {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink-soft);
}

.bb-tile-seller {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--brand);
}

.bb-tile-about {
    font-size: 0.75rem;
    line-height: 1.3;
    color: var(--ink-soft);
    /* Two lines at most, so the tiles stay a glanceable size. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* The cheaper tile wears the bee's yellow. */
.bb-tile-best .bb-tile {
    background: var(--honey);
    border-color: var(--honey);
}

.bb-tile-best .bb-tile:hover,
.bb-tile-best .bb-tile:focus-visible {
    background: var(--honey-deep);
    border-color: var(--honey-deep);
}

.bb-tile-best .bb-tile-badge { display: inline-block; }
.bb-tile-best .bb-tile-from,
.bb-tile-best .bb-tile-about { color: var(--ink); }
.bb-tile-best .bb-tile-seller { color: var(--ink); }

.bb-buy-nudge {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sage);
    margin-top: 0.6rem;
}

/* Stores we link but can't price, as two rounded buttons. */
.bb-stores {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.bb-stores-label {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.bb-store {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.6rem;  /* comfortable tap target */
    padding: 0.4rem 1rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.bb-store:hover,
.bb-store:focus-visible {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.bb-buy-foot {
    font-size: 0.8rem;
    color: var(--ink-soft);
    margin-top: 0.9rem;
}

/* Links inside the white panel. The band's link styles are white-on-indigo,
   which left "Change" unreadable here. */
.bb-buy .bb-buy-link {
    color: var(--brand);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.bb-buy-all {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Selection inside the panel: the site default is indigo, which is fine on
   white, but stated here so a band-level override can't make it vanish. */
.bb-buy ::selection {
    background: var(--brand);
    color: #fff;
}
