/* =========================================================================
   Book finder (/book-finder, src/routes/books.js): big tappable choice chips,
   the "A book I loved" type-ahead, and the result cards. Builds on content.css.
   Cards without a cover get a drawn one in one of six brand colours (.bf-cover--0…5,
   chosen from the title on the server).
   ========================================================================= */

.bf-hero { padding-bottom: 120px; }
.bf-hero .c-hero__intro { max-width: 620px; }
/* a little row of book spines under the intro (decorative) */
.bf-hero__books { display: flex; justify-content: center; align-items: flex-end; gap: 6px; height: 64px; margin-top: 26px; }
.bf-hero__books i { display: block; width: 18px; border-radius: 4px 4px 2px 2px; box-shadow: inset -4px 0 0 rgba(0, 0, 0, 0.12); }
.bf-hero__books i:nth-child(1) { height: 46px; background: #ffc93c; }
.bf-hero__books i:nth-child(2) { height: 60px; background: #fff; width: 22px; }
.bf-hero__books i:nth-child(3) { height: 40px; background: #8ec5d1; transform: rotate(-8deg); transform-origin: bottom left; margin-left: 4px; }
.bf-hero__books i:nth-child(4) { height: 54px; background: #c7d77e; }
.bf-hero__books i:nth-child(5) { height: 48px; background: #f4a4bf; width: 20px; }
@media (prefers-reduced-motion: no-preference) {
  .bf-hero__books i:nth-child(odd) { animation: bf-bob 3.6s ease-in-out infinite; }
  .bf-hero__books i:nth-child(even) { animation: bf-bob 3.6s ease-in-out 1.8s infinite; }
  .bf-hero__books i:nth-child(3) { animation: none; }
}
@keyframes bf-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }

.bf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- the form ---------------- */
.bf-form {
  max-width: 980px; margin: -10px auto 0; padding: 34px 38px 28px;
  border-radius: 28px; background: #fff; box-shadow: var(--c-shadow);
}
.bf-step { min-width: 0; margin: 0 0 30px; padding: 0; border: 0; }
.bf-step legend, .bf-step__label {
  display: flex; align-items: center; gap: 12px; padding: 0;
  color: var(--c-ink); font-size: clamp(1.25rem, 2.4vw, 1.5rem); font-weight: 800; line-height: 1.25;
}
.bf-step__n {
  display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px;
  border-radius: 50%; background: var(--c-sun); color: var(--c-indigo); font-size: 1.1rem; font-weight: 800;
}
.bf-opt { color: var(--c-muted); font-size: 1rem; font-weight: 700; }
.bf-hint { margin: 6px 0 14px 50px; color: var(--c-muted); font-size: 1rem; }

/* choice chips: a real radio or checkbox inside each label (keyboard and screen reader
   friendly); chosen ones fill in and get a tick, so it's not shown by colour alone */
.bf-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.bf-chips--years { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.bf-chip { position: relative; display: flex; }
.bf-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.bf-chip__in {
  display: inline-flex; align-items: center; gap: 9px; width: 100%; min-height: 52px; padding: 9px 18px;
  border: 2px solid #767c94; border-radius: 999px; background: #fff;
  color: var(--c-ink); font-size: 1.02rem; font-weight: 700; line-height: 1.2;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.bf-chip__emoji { font-size: 1.45rem; line-height: 1; }
.bf-chip__text small { display: block; margin-top: 2px; color: var(--c-muted); font-size: 0.86rem; font-weight: 700; }
.bf-chip__tick { display: none; flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.bf-chip--year .bf-chip__in { justify-content: center; border-radius: 18px; padding: 12px 10px; text-align: center; }
.bf-chip--year .bf-chip__text { font-size: 1.1rem; }
.bf-chip input:hover + .bf-chip__in { border-color: var(--c-indigo); transform: translateY(-2px); }
.bf-chip input:checked + .bf-chip__in { border-color: var(--c-indigo); background: var(--c-indigo); color: #fff; }
.bf-chip input:checked + .bf-chip__in small { color: rgba(255, 255, 255, 0.9); }
.bf-chip input:checked + .bf-chip__in .bf-chip__tick { display: block; color: var(--c-sun); }
.bf-chip input:focus-visible + .bf-chip__in { outline: 3px solid var(--c-raspberry-dark); outline-offset: 3px; }

/* "A book you loved" */
.bf-combo { position: relative; max-width: 560px; margin-left: 50px; }
.bf-combo__icon { position: absolute; left: 16px; top: 50%; width: 22px; height: 22px; translate: 0 -50%; fill: none; stroke: var(--c-muted); stroke-width: 2.4; stroke-linecap: round; pointer-events: none; }
.bf-combo input {
  width: 100%; min-height: 56px; padding: 12px 16px 12px 50px;
  border: 2px solid #767c94; border-radius: 16px; background: #fff;
  color: var(--c-ink); font: 700 1.08rem "Red Hat Display", "Segoe UI", Arial, sans-serif;
}
.bf-combo input::placeholder { color: #6f758a; font-weight: 600; }
.bf-combo input:focus-visible { outline: 3px solid var(--c-raspberry-dark); outline-offset: 2px; border-color: var(--c-indigo); }
.bf-combo__list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20;
  max-height: 330px; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  border: 1px solid var(--c-line); border-radius: 16px; background: #fff; box-shadow: 0 18px 40px rgba(33, 39, 113, 0.18);
}
.bf-combo__list li { padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.bf-combo__list li strong { display: block; color: var(--c-ink); }
.bf-combo__list li span { color: var(--c-muted); font-size: 0.92rem; }
.bf-combo__list li[aria-selected="true"], .bf-combo__list li:hover { background: #e9ecf7; }
.bf-combo__list li[aria-selected="true"] { box-shadow: inset 4px 0 0 var(--c-indigo); }
.bf-combo__list li.bf-combo__none { color: var(--c-muted); cursor: default; background: none; box-shadow: none; }
.bf-picked {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: 50px; padding: 10px 12px 10px 18px;
  border-radius: 18px; background: #e9ecf7; color: var(--c-ink); font-weight: 700;
}
.bf-picked[hidden] { display: none; }
.bf-picked button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px;
  border: 2px solid var(--c-indigo); border-radius: 999px; background: #fff; color: var(--c-indigo);
  font: 700 0.95rem "Red Hat Display", "Segoe UI", Arial, sans-serif; cursor: pointer;
}
.bf-picked button:focus-visible { outline: 3px solid var(--c-raspberry-dark); outline-offset: 2px; }

.bf-go { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 8px; }
.bf-go__btn { min-height: 60px; padding: 14px 34px; font-size: 1.2rem; }
.bf-go__btn svg, .bf-actions svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bf-err { min-height: 1.4em; margin: 0; color: var(--c-raspberry-dark); font-weight: 800; text-align: center; }
.bf-privacy { display: flex; gap: 10px; align-items: flex-start; max-width: 640px; margin: 14px auto 0; color: var(--c-muted); font-size: 0.95rem; line-height: 1.5; }
.bf-privacy svg { flex: none; width: 22px; height: 22px; margin-top: 1px; fill: none; stroke: var(--c-green); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- results ---------------- */
.bf-results { max-width: 1120px; margin: 44px auto 0; }
.bf-results__h { margin-bottom: 10px; text-align: center; }
.bf-results__h:focus { outline: none; }
.bf-results__h:focus-visible { outline: 3px solid var(--c-ink); outline-offset: 4px; }
.bf-note { max-width: 680px; margin: 0 auto 22px; padding: 12px 18px; border-radius: 14px; background: #fff4d6; color: #5c4300; font-weight: 700; text-align: center; }
.bf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 22px; margin: 22px 0 0; padding: 0; list-style: none; }
.bf-card {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; align-items: start;
  padding: 20px; border-radius: 22px; background: #fff; box-shadow: var(--c-shadow);
}
@media (prefers-reduced-motion: no-preference) {
  html:not(.br-still) .bf-card { animation: bf-in 360ms ease both; }
}
@keyframes bf-in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
.bf-card__img { display: block; width: 112px; aspect-ratio: 2 / 3; height: auto; object-fit: cover; border-radius: 8px; box-shadow: 0 6px 16px rgba(33, 39, 113, 0.18); }
.bf-card__body { min-width: 0; }
.bf-card__title { margin: 0; color: var(--c-ink); font-size: 1.22rem; font-weight: 800; line-height: 1.25; }
.bf-card__title:focus { outline: none; }
.bf-card__title:focus-visible { outline: 3px solid var(--c-ink); outline-offset: 3px; }
.bf-card__by { margin: 4px 0 0; color: var(--c-text); font-weight: 700; }
.bf-card__series { margin: 2px 0 0; color: var(--c-muted); font-size: 0.92rem; }
.bf-card__desc { margin: 10px 0 0; line-height: 1.55; }
.bf-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.bf-tags li { padding: 4px 10px; border-radius: 999px; background: #eef0f6; color: var(--c-ink); font-size: 0.85rem; font-weight: 700; }
.bf-tags li.bf-tag--age { background: var(--c-sun); color: var(--c-indigo); }
.bf-tags li.bf-tag--new { background: #536816; color: #fff; }
.bf-why { margin: 12px 0 0; padding: 10px 14px; border-left: 4px solid var(--c-raspberry); border-radius: 0 12px 12px 0; background: #fbe9ef; color: #5a1830; font-size: 0.97rem; line-height: 1.45; }

/* the drawn cover for books without a picture */
.bf-cover {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  width: 112px; aspect-ratio: 2 / 3; padding: 12px 10px 10px 16px; overflow: hidden;
  border-radius: 6px 10px 10px 6px; color: #fff; box-shadow: 0 6px 16px rgba(33, 39, 113, 0.18);
}
.bf-cover::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: rgba(0, 0, 0, 0.18); }
.bf-cover::after { content: ""; position: absolute; right: -18px; bottom: -18px; width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.bf-cover__title { position: relative; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.86rem; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.bf-cover__author { position: relative; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.7rem; font-weight: 700; opacity: 0.92; }
.bf-cover--0 { background: #212771; }
.bf-cover--0 .bf-cover__title { color: #ffc93c; }
.bf-cover--1 { background: #b9335f; }
.bf-cover--2 { background: #536816; }
.bf-cover--3 { background: #0a6a79; }
.bf-cover--4 { background: #5b3aa6; }
.bf-cover--5 { background: #c25408; }

/* "Surprise me" */
.bf-surprise { max-width: 760px; margin: 24px auto 6px; padding: 16px; border: 3px dashed var(--c-sun); border-radius: 28px; background: #fffbea; }
.bf-surprise__h { margin: 0 0 12px; color: var(--c-indigo); font-size: 1.15rem; font-weight: 800; text-align: center; }
.bf-surprise .bf-card { box-shadow: none; }
.bf-grid--one { grid-template-columns: 1fr; margin: 0; }
.bf-err--more { margin-top: 12px; }

.bf-end { margin: 24px auto 0; max-width: 620px; color: var(--c-text); font-weight: 700; text-align: center; }
.bf-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }
.bf-btn--sun { border-color: var(--c-sun); background: var(--c-sun); color: var(--c-indigo); }
.bf-btn--sun:hover { border-color: #f0b400; background: #f0b400; }
.bf-actions .c-btn[aria-busy="true"], .bf-go__btn[aria-busy="true"] { cursor: wait; opacity: 0.75; }
.bf-library { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 30px auto 0; color: var(--c-ink); font-size: 1.05rem; font-weight: 700; text-align: center; }
.bf-library svg { flex: none; width: 26px; height: 26px; fill: none; stroke: var(--c-green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bf-credit { margin: 10px 0 0; color: var(--c-muted); font-size: 0.85rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .bf-chip__in { transition: none; }
  .bf-chip input:hover + .bf-chip__in { transform: none; }
}
html.br-still .bf-chip input:hover + .bf-chip__in { transform: none; }

/* phones: a 16px gutter, and room for every chip without sideways scrolling */
@media (max-width: 600px) {
  .bf-hero { padding-bottom: 84px; }
  .bf-hero__books { height: 46px; margin-top: 16px; scale: 0.8; }
  .bf { padding-left: 16px; padding-right: 16px; }
  .bf-form { padding: 24px 16px 20px; border-radius: 22px; }
  .bf-hint, .bf-combo, .bf-picked { margin-left: 0; }
  .bf-chips { gap: 8px; }
  .bf-chips--years { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bf-chip__in { padding: 8px 14px; font-size: 0.98rem; }
  .bf-card { grid-template-columns: 88px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .bf-card__img, .bf-cover { width: 88px; }
  .bf-cover { padding: 10px 8px 8px 13px; }
  .bf-cover__title { font-size: 0.74rem; }
  .bf-cover__author { display: none; }
  .bf-surprise { padding: 10px; }
  .bf-actions .c-btn { flex: 1 1 100%; }
}

/* Recommended reads (grown-ups' list, /recommended-reads) */
.rr-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 18px; }
.rr-filters label { display: grid; gap: 4px; font-weight: 700; color: var(--c-ink); }
.rr-filters select { min-width: 220px; max-width: 100%; padding: 10px 12px; border: 2px solid var(--c-line, #d9dcea); border-radius: 12px; background: #fff; font: inherit; }
.rr-disclosure { margin: 0 0 14px; padding: 12px 16px; border-left: 5px solid var(--c-raspberry, #b9335f); border-radius: 10px; background: #fff; line-height: 1.5; }
.rr-count { margin: 0; font-weight: 700; color: var(--c-muted); }
.rr-meta { margin: 8px 0 0; color: var(--c-muted); font-size: 0.92rem; font-weight: 700; }
.rr-buy { margin-top: 12px; }
@media (max-width: 520px) { .rr-filters label, .rr-filters select { width: 100%; } }

/* Release radar (grown-ups, /new-books) and its strip on Recommended reads */
.nb-sec + .nb-sec { margin-top: 44px; }
.nb-sec__h { margin: 0; }
.nb-sec__intro { margin: 6px 0 0; color: var(--c-muted); }
.nb-when { margin: 0 0 6px; color: #536816; font-size: 0.86rem; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
.nb-when--soon { color: var(--c-raspberry, #b9335f); }
.nb-debut { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: var(--c-sun); color: var(--c-indigo); font-size: 0.78rem; font-weight: 800; vertical-align: 1px; }
.nb-strip { margin: 0 0 24px; padding: 18px 20px; border-radius: 18px; background: #fff; box-shadow: var(--c-shadow); }
.nb-strip h2 { margin: 0 0 8px; color: var(--c-ink); font-size: 1.15rem; }
.nb-strip ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px 18px; margin: 0; padding: 0; list-style: none; }
.nb-strip li { display: grid; min-width: 0; line-height: 1.35; overflow-wrap: anywhere; }
.nb-strip li span { color: var(--c-text); font-size: 0.93rem; }
.nb-strip li small { color: var(--c-muted); font-weight: 700; }
.nb-strip__all { display: inline-block; margin-top: 12px; font-weight: 800; }
