/* =============================================================================
   booktalk.club — book club questions (/book-club-questions/ and one page per book)

   Loaded after styles.css (colours, fonts) and guide.css (top bar, article sheet, header,
   "short version" box, booktalk note, copy buttons, footer). The pages themselves are
   written by tools/question-pages/build.py.

   Sections in this file (search for the ==== headings):
     1. Drawn book covers
     2. Book page header
     3. The reading stops and their questions
     4. The spoilers fold (questions about the whole book)
     5. Related books & links
     6. The list of all books
     7. Search box & "not found" message
     8. Phone layouts
   ============================================================================= */


/* ==== 1. Drawn book covers ================================================== */
/* A simple cover in the book's colour with its title and author (no publisher artwork) */
.q-cover {
  --c: #30495e;
  position: relative; flex: none;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  width: 150px; aspect-ratio: 2 / 3; padding: 18px 14px 14px 20px;
  border-radius: 4px 10px 10px 4px;
  container-type: inline-size;   /* lets the title size follow the cover's width */
  background: linear-gradient(105deg, rgba(0, 0, 0, .22) 0 7px, rgba(255, 255, 255, .08) 7px 9px, transparent 9px), var(--c);
  color: #fff;
  box-shadow: 0 1px 2px rgba(20, 20, 40, .12), 0 14px 28px -14px rgba(20, 20, 40, .55);
}
/* Title size: at most 19px, smaller on small covers, and small enough that the longest word (--lw letters) fits */
.q-cover b { font-family: var(--serif); font-weight: 500; font-size: min(19px, 19cqi, calc(160cqi / var(--lw, 8))); line-height: 1.15; overflow-wrap: break-word; }
.q-cover small { font: 500 12px/1.3 var(--font-ui); opacity: .82; }
.q-cover-sm { width: 64px; padding: 8px 6px 6px 10px; border-radius: 2px 6px 6px 2px; }
.q-cover-sm small { display: none; }


/* ==== 2. Book page header =================================================== */
.q-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.q-head h1 span { display: block; font-size: .62em; color: var(--muted); }
.g-kicker a { color: inherit; text-decoration: none; }
.g-kicker a:hover { text-decoration: underline; text-underline-offset: 3px; }
.q-head .q-cover { rotate: 3deg; margin-bottom: 6px; }

.q-plan p { margin-top: 10px; font-size: 17px; line-height: 1.6; }


/* ==== 3. The reading stops and their questions ============================== */
.q-stop { margin-top: 48px; scroll-margin-top: 24px; }
.q-stop-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.q-stop h2 { display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.2; }
.q-badge { display: inline-grid; place-items: center; min-width: 54px; height: 30px; padding: 0 10px; border-radius: 999px; background: #f6f1fd; color: var(--purple); font: 600 14px var(--font-ui); }
.q-upto { margin-top: 8px; font-family: var(--font-ui); font-size: 14px; color: var(--muted); }

.q-list { list-style: none; counter-reset: q; margin: 16px 0 0; padding: 0; }
.q-list li { counter-increment: q; position: relative; padding: 16px 0 16px 44px; border-top: 1px solid var(--line); font-size: 18px; line-height: 1.6; }
.q-list li:last-child { border-bottom: 1px solid var(--line); }
.q-list li::before { content: counter(q); position: absolute; left: 0; top: 16px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-soft); font: 600 14px var(--font-ui); color: var(--muted); }


/* ==== 4. The spoilers fold ================================================== */
.q-spoiler { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 0 20px; background: #fffaf2; }
.q-spoiler summary { cursor: pointer; padding: 16px 0; font: 600 16px var(--font-ui); color: #8a4b12; list-style: none; }
.q-spoiler summary::-webkit-details-marker { display: none; }
.q-spoiler summary::before { content: "▸"; display: inline-block; margin-right: 10px; transition: transform .2s; }
.q-spoiler[open] summary::before { transform: rotate(90deg); }
.q-spoiler .q-list { margin-top: 0; }
.q-spoiler .g-copy { margin: 12px 0 16px; }


/* ==== 5. Related books & links ============================================== */
.q-related { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 40px; }
.q-related a { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--text); transition: border-color .2s, background-color .2s; }
.g-body .q-related a:hover { border-color: rgba(103, 48, 195, .35); background: #fcfaff; }
.q-rel-text small { display: block; font: 600 12px var(--font-ui); color: var(--purple); }
.q-rel-text b { display: block; margin-top: 2px; font-family: var(--serif); font-weight: 500; font-size: 19px; line-height: 1.3; }
.g-body .q-related a:not(.btn) { color: var(--text); }
.g-body > p.q-more { margin-top: 20px; font-family: var(--font-ui); font-size: 15px; line-height: 1.6; color: var(--muted); }


/* ==== 6. The list of all books ============================================== */
.q-list-head { max-width: 760px; padding: 32px 0 36px; }
.q-list-head h1 { margin-top: 14px; font-family: var(--serif); font-weight: 500; font-size: 56px; line-height: 1.05; letter-spacing: -.015em; text-wrap: balance; }
.q-note { max-width: 760px; margin: 56px auto 64px; }
.q-note .g-with { margin: 0; background: var(--bg); border: 1px solid var(--line); }
.q-note a { color: var(--purple); text-underline-offset: 3px; }
.q-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.q-card { display: flex; flex-direction: column; gap: 14px; height: 100%; padding: 22px; border-radius: 18px; background: var(--bg); border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: border-color .2s, transform .2s; }
.q-card:hover { border-color: rgba(103, 48, 195, .35); transform: translateY(-2px); }
.q-card .q-cover { width: 120px; }
.q-card-text b { display: block; font-family: var(--serif); font-weight: 500; font-size: 20px; line-height: 1.25; }
.q-card-text small { display: block; margin-top: 4px; font: 500 13px var(--font-ui); color: var(--muted); }

.q-why { max-width: 760px; margin: 72px auto 0; }
.q-why h2 { font-family: var(--serif); font-weight: 500; font-size: 32px; line-height: 1.2; }
.q-why p { margin-top: 14px; font-size: 18px; line-height: 1.7; }
.q-why a { color: var(--purple); text-underline-offset: 3px; }


/* Link from the list to the questions for any book; that page's headings */
.q-any-link { margin-top: 14px; font-size: 16px; line-height: 1.6; color: var(--muted); }
.q-any-link a { color: var(--purple); font-weight: 600; text-underline-offset: 3px; }
.q-h1-sub { display: block; font-size: .62em; color: var(--muted); }
.g-body > p.q-jump { font-family: var(--font-ui); font-size: 15px; line-height: 1.9; }


/* ==== 7. Search box & "not found" message ================================= */
/* Hidden until questions.js runs (so it never shows if it couldn't work) */
.q-search { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; max-width: 640px; margin: 0 0 28px; }
.q-search[hidden] { display: none; }
.q-search svg { position: absolute; left: 18px; top: 18px; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.q-search input {
  flex: 1 1 320px; min-width: 0; height: 56px; padding: 0 18px 0 50px;
  border: 1px solid #dcdce4; border-radius: 14px; background: #fff;
  font: 400 17px var(--font); color: var(--text);   /* 16px or more: iPhones don't zoom in */
  box-shadow: 0 1px 2px rgba(20, 20, 40, .04);
  transition: border-color .2s, box-shadow .2s;
}
.q-search input:focus { outline: none; border-color: rgba(103, 48, 195, .5); box-shadow: 0 0 0 4px rgba(103, 48, 195, .12); }
.q-search input::placeholder { color: #9a9ca3; }
.q-search-count { font: 500 14px var(--font-ui); color: var(--muted); }
.q-grid li[hidden] { display: none; }

.q-empty { max-width: 640px; padding: 28px; border-radius: 18px; background: var(--bg); border: 1px solid var(--line); }
.q-empty[hidden] { display: none; }
.q-empty p { font-size: 17px; line-height: 1.6; }
.q-empty p + p { margin-top: 6px; }
.q-empty-title { font-family: var(--serif); font-size: 22px !important; font-weight: 500; }
.q-empty a { color: var(--purple); font-weight: 600; text-underline-offset: 3px; }
.q-empty .link-btn { font-size: 17px; padding: 0; }


/* ==== 8. Phone layouts ====================================================== */
@media (max-width: 760px) {
  .q-head { flex-direction: column-reverse; align-items: flex-start; gap: 20px; }
  .q-head .q-cover { width: 110px; rotate: -2deg; }
  .q-stop h2 { font-size: 24px; }
  .q-stop-head { flex-wrap: wrap; }
  .q-list li { font-size: 17px; padding-left: 40px; }
  .q-related { grid-template-columns: minmax(0, 1fr); }
  .q-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .q-card { padding: 14px; }
  .q-card .q-cover { width: 100%; max-width: 130px; }
  .q-card-text b { font-size: 17px; }
  .q-why h2 { font-size: 26px; }
  .q-list-head { padding: 16px 0 24px; }
  .q-list-head h1 { font-size: 38px; }
  .q-search input { height: 52px; }
  .q-search svg { top: 16px; }
}
