/* Literate Chinese — reading comprehension pages
   (chinese/reading-comprehension/ and its level pages).
   Loaded after /css/styles.css, /assets/css/reader.css (level pages) and
   /css/levels.css (hero, stats, app box, FAQ, prev/next).
   Generator: generate_comprehension_pages.py */

.cq-section { margin: 38px 0; }
.cq-section > h2 { font-size: 1.6rem; font-weight: 800; }
.cq-section .reader-controls { top: 8px; margin: 14px 0 22px; }
.cq-section #smart-reader { max-width: 820px; font-size: 1.4rem; line-height: 2.2; }
.cq-section #smart-reader.show-pinyin { line-height: 2.45; }

/* ---------- passage card ---------- */
.cq-passage {
  border: 1px solid var(--border); border-radius: var(--radius, 16px); background: var(--card);
  box-shadow: var(--shadow-sm); padding: 20px 24px 14px; margin: 0 0 26px; scroll-margin-top: 90px;
}
.cq-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif; }
.cq-thumb { width: 96px; height: 64px; object-fit: cover; border-radius: 10px; flex: 0 0 auto; }
.cq-head h3 { font-size: 1.22rem; line-height: 1.3; margin: 0; font-weight: 800; }
.cq-num {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary, #fff); font-size: .9rem; margin-right: 4px; vertical-align: 2px;
}
.cq-zhtitle { font-weight: 600; color: var(--muted); margin-left: 4px; }
.cq-meta { color: var(--muted); font-size: .88rem; margin: 2px 0 0; line-height: 1.4; }
#smart-reader .cq-text p { margin: 0 0 .9em; }

/* ---------- questions ---------- */
.cq-quiz {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif; font-size: 1rem; line-height: 1.6;
  border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 14px;
}
.cq-quiz-title { font-weight: 800; font-size: .82rem; letter-spacing: .07em; text-transform: uppercase; color: var(--primary-ink, var(--primary-dark)); margin: 0 0 6px; }
.cq-qs { padding-left: 1.4em; margin: 0; }
.cq-q { margin: 0 0 16px; }
.cq-q::marker { font-weight: 800; color: var(--muted); }
.cq-q-text { font-size: 1.22rem; line-height: 2; margin: 0 0 4px; font-weight: 600; }
.cq-q-text [lang="en"], .cq-choices [lang="en"] { font-family: 'Nunito', sans-serif; }
#smart-reader .cq-q-text rt, #smart-reader .cq-choices rt { font-size: .45em; }
.cq-choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cq-choices label {
  display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative;
  border: 1px solid var(--border); border-radius: 12px; padding: 4px 12px; background: var(--bg-soft, #f4f7f5);
  font-size: 1.15rem; line-height: 1.9; transition: border-color .15s ease, background .15s ease;
}
.cq-choices label:hover { border-color: var(--primary); }
.cq-choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cq-letter {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--muted); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center;
  font: 800 .8rem/1 'Nunito', sans-serif; color: var(--muted);
}
.cq-choices input:checked + .cq-letter { background: var(--primary); border-color: var(--primary); color: var(--on-primary, #fff); }
.cq-choices input:focus-visible + .cq-letter { outline: 2px solid var(--primary); outline-offset: 2px; }
.cq-choices label:has(input:checked) { border-color: var(--primary); background: var(--primary-tint, #e7f4ec); }
.cq-choices label.cq-correct { border-color: var(--primary); background: var(--primary-tint, #e7f4ec); }
.cq-choices label.cq-correct .cq-letter { background: var(--primary); border-color: var(--primary); color: var(--on-primary, #fff); }
.cq-choices label.cq-picked-wrong, .cq-choices label.cq-picked-wrong:has(input:checked) { border-color: var(--danger, #c94b4b); background: var(--danger-tint, #fdecec); }
.cq-choices label.cq-picked-wrong .cq-letter, .cq-choices label.cq-picked-wrong input:checked + .cq-letter { background: #c94b4b; border-color: #c94b4b; color: #fff; }
.cq-choices input:disabled ~ * { cursor: default; }
.cq-explain {
  margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--primary); background: var(--bg-soft);
  border-radius: 0 10px 10px 0; font-size: 1.05rem; line-height: 1.7;
}
.cq-q.is-wrong .cq-explain { border-left-color: var(--danger, #c94b4b); }
.cq-ex-label { font-weight: 800; font-size: .85rem; color: var(--primary-ink, var(--primary-dark)); margin-right: 4px; }
.cq-ex-en { display: block; color: var(--muted); font-size: .92rem; }
.cq-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 4px 0 10px; }
.cq-check, .cq-reset {
  font: 800 1rem 'Nunito', sans-serif; border-radius: 999px; padding: 9px 22px; cursor: pointer;
  border: 2px solid var(--primary); background: var(--primary); color: var(--on-primary, #fff);
}
.cq-check:hover { background: var(--btn-hover, var(--primary-dark)); border-color: var(--btn-hover, var(--primary-dark)); }
.cq-reset { background: var(--card); color: var(--primary-ink, var(--primary-dark)); }
.cq-score { font-weight: 700; color: var(--primary-ink, var(--primary-dark)); }
.cq-links { font-size: .9rem; color: var(--muted); margin: 0 0 4px; }

/* ---------- answer key, PDFs ---------- */
.cq-key { border-collapse: collapse; width: 100%; max-width: 640px; font-size: .97rem; margin-top: 10px; }
.cq-key th, .cq-key td { padding: 7px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.cq-key thead th { background: var(--bg-soft); font-weight: 800; }
.cq-key td { font-weight: 800; color: var(--primary-ink, var(--primary-dark)); text-align: center; width: 56px; }
.cq-key thead th:not(:first-child) { text-align: center; }
.cq-key tbody th { font-weight: 600; }
.cq-pdf-row { display: flex; flex-wrap: wrap; gap: 10px; }
.cq-pdf {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 800; border-radius: 999px; padding: 10px 20px;
  background: var(--primary); color: var(--on-primary, #fff); border: 2px solid var(--primary);
}
.cq-pdf::before { content: "PDF"; font-size: .7rem; letter-spacing: .05em; background: rgba(255,255,255,.22); border-radius: 6px; padding: 2px 6px; }
.cq-pdf + .cq-pdf { background: var(--card); color: var(--primary-ink, var(--primary-dark)); }
.cq-pdf + .cq-pdf::before { background: var(--primary-tint, #e7f4ec); }
.cq-pdf:hover { color: var(--on-primary, #fff); background: var(--btn-hover, var(--primary-dark)); border-color: var(--btn-hover, var(--primary-dark)); }
.cq-inline { font-weight: 700; }
.cq-inline + .cq-inline::before { content: " and "; color: var(--ink); font-weight: 400; }

/* ---------- hub ---------- */
.cq-tablewrap { overflow-x: auto; margin: 14px 0 20px; border: 1px solid var(--border); border-radius: 12px; }
.cq-levels { border-collapse: collapse; width: 100%; font-size: .95rem; min-width: 640px; }
.cq-levels th, .cq-levels td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.cq-levels thead th { background: var(--bg-soft); font-weight: 800; white-space: nowrap; }
.cq-levels tbody tr:last-child th, .cq-levels tbody tr:last-child td { border-bottom: 0; }
.cq-levels tbody th a { font-weight: 800; white-space: nowrap; }
.cq-pdfcell { white-space: nowrap; }
.cq-cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 12px; margin: 0; padding: 0; }
.cq-card a {
  display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--card); color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
.cq-card a:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); color: var(--ink); }
.cq-card-lv { align-self: flex-start; background: var(--primary); color: var(--on-primary, #fff); font-weight: 800; font-size: .78rem; border-radius: 999px; padding: 2px 10px; }
.cq-card-title { font-weight: 800; line-height: 1.3; }
.cq-card-zh { font-size: 1.05rem; color: var(--ink); opacity: .85; }
.cq-card-meta { font-size: .82rem; color: var(--muted); line-height: 1.4; }

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .cq-passage { padding: 16px 14px 10px; margin-left: -6px; margin-right: -6px; border-radius: 14px; }
  .cq-section #smart-reader { font-size: 1.3rem; }
  .cq-thumb { width: 72px; height: 48px; }
  .cq-head h3 { font-size: 1.1rem; }
  .cq-q-text { font-size: 1.12rem; }
  .cq-choices label { font-size: 1.05rem; }
  .cq-qs { padding-left: 1.2em; }
}

/* ---------- dark theme: the levels.css pieces these pages borrow ----------
   (levels.css still hardcodes light surfaces; scoped to .cq-page so it can't
   affect the level hubs.) */
@media (prefers-color-scheme: dark) {
  .cq-page .lv-hero { background: linear-gradient(180deg, var(--primary-tint) 0%, var(--bg) 100%); }
  .cq-page .lv-hero-sub { color: var(--ink); }
  .cq-page .lv-stats li, .cq-page .lv-levels a, .cq-page .lv-faq .faq details, .cq-page .lv-prevnext a { background: var(--card); }
  .cq-page .lv-levels a.active { background: var(--primary); }
}

/* ---------- printing the web page ---------- */
@media print {
  header, footer, .cta-box, .reader-controls, .lv-levels, .lv-app, .cq-actions, .cq-links, .lv-prevnext, #definition-box { display: none !important; }
  .cq-passage { box-shadow: none; break-inside: avoid; }
  #smart-reader rt { visibility: hidden; }
}
