/* Literate Chinese — "reading practice by level" hubs
   (chinese/reading-practice/hsk-N/, beginner/, intermediate/, hsk-5-6/).
   Loaded AFTER /css/styles.css and /assets/css/reader.css; reuses their tokens.
   Generator: generate_level_hubs.py */

.lv-main { padding-bottom: 10px; }

/* ---------- hero ---------- */
.lv-hero {
  background: linear-gradient(180deg, var(--primary-tint) 0%, #f7fbf8 70%, #fff 100%);
  border-bottom: 1px solid var(--border);
  padding: 26px 0 22px;
}
.lv-hero .breadcrumb { font-size: .9rem; color: var(--muted); margin-bottom: 12px; }
.lv-hero h1 { font-size: clamp(1.7rem, 4.2vw, 2.5rem); font-weight: 800; margin-bottom: .35em; max-width: 860px; }
.lv-hero-sub { font-size: 1.08rem; color: #34404d; max-width: 780px; margin-bottom: 18px; }
.lv-stats { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-width: 820px; margin: 0 0 18px; }
.lv-stats li { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .86rem; color: var(--muted); line-height: 1.3; }
.lv-stats b { display: block; font-size: 1.35rem; color: var(--primary-dark); font-weight: 800; margin-bottom: 2px; }

/* level selector */
.lv-levels { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lv-levels-label { font-weight: 700; color: var(--muted); font-size: .9rem; margin-right: 2px; }
.lv-levels a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; color: var(--ink); font-weight: 700; font-size: .9rem;
}
.lv-levels a .n { color: var(--muted); font-weight: 600; font-size: .8rem; }
.lv-levels a:hover { border-color: var(--primary); color: var(--primary-dark); }
.lv-levels a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.lv-levels a.active .n { color: rgba(255,255,255,.85); }

/* ---------- body sections ---------- */
.lv-body { max-width: 980px; padding-top: 10px; }
.lv-section { margin: 38px 0; }
.lv-section h2, .lv-try h2, .lv-app h2 { font-size: 1.6rem; font-weight: 800; }
.lv-section h3 { font-size: 1.2rem; margin-top: 1.4em; }
.lv-section > p, .lv-intro p { max-width: 780px; }
.lv-note { color: var(--muted); font-size: .95rem; }
.lv-body .answer-box { max-width: 780px; }

.lv-tips { padding-left: 1.3em; max-width: 780px; }
.lv-tips li { margin-bottom: .6em; padding-left: .2em; }

/* ---------- embedded story ---------- */
.lv-try {
  margin: 34px 0; padding: 24px 24px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow-sm);
}
.lv-try-head { display: flex; gap: 18px; align-items: center; max-width: 760px; margin: 0 auto; }
.lv-try-img { width: 150px; height: 100px; object-fit: cover; border-radius: 12px; flex: 0 0 auto; }
.lv-try-head h2 { margin-bottom: .25em; }
.lv-try-meta { color: var(--muted); font-size: .95rem; margin-bottom: .4em; }
.lv-try-meta strong { color: var(--ink); }
.lv-try-head p:last-child { margin-bottom: 0; }
.lv-try .reader-controls { max-width: 760px; margin-left: auto; margin-right: auto; top: 70px; }
.lv-try #smart-reader { margin-bottom: 4px; font-size: 1.4rem; }
.lv-try-more { text-align: center; margin: 6px 0 12px; font-weight: 700; }

/* quiz (inside #smart-reader so the pinyin/script toggles apply) */
.lv-quiz { font-size: 1rem; line-height: 1.6; border-top: 1px dashed var(--border); padding-top: 16px; margin-top: 4px; }
.lv-quiz-title { font-weight: 800; font-size: 1.05rem; margin-bottom: 8px; font-family: 'Nunito', sans-serif; }
.lv-quiz ol { padding-left: 1.2em; }
.lv-q { margin-bottom: 14px; }
.lv-q-text { font-size: 1.3rem; margin-bottom: 6px; line-height: 2.1; }
#smart-reader .lv-q-text ruby rt, #smart-reader .lv-choice rt { font-size: .45em; }
.lv-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.lv-choice {
  font: inherit; font-size: 1.15rem; line-height: 2; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-soft); border-radius: 12px;
  padding: 2px 14px; color: var(--ink);
}
.lv-choice:hover { border-color: var(--primary); }
.lv-choice.right { background: var(--primary); border-color: var(--primary); color: #fff; }
.lv-choice.right rt { color: rgba(255,255,255,.85); }
.lv-choice.wrong { background: #fdecec; border-color: #e7a3a3; color: #8a2b2b; }
.lv-q-result { font-size: .95rem; color: var(--muted); margin: 4px 0 0; min-height: 1.2em; font-family: 'Nunito', sans-serif; }
.lv-q.done .lv-q-result { color: var(--primary-dark); font-weight: 700; }

/* ---------- story cards ---------- */
.lv-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.lv-jump .chip .n { color: var(--muted); font-size: .8rem; margin-left: 2px; }
.lv-group { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 28px 0 12px; scroll-margin-top: 80px; }
.lv-group .n { font-size: .85rem; color: var(--muted); font-weight: 700; }
.lv-cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 12px; }
.lv-card a {
  display: flex; gap: 12px; align-items: stretch; height: 100%;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 9px;
  color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.lv-card a:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); color: var(--ink); }
.lv-thumb { flex: 0 0 96px; width: 96px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--primary-tint); display: block; align-self: center; }
.lv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lv-noimg { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; font-size: 1.6rem; color: var(--primary-dark); font-weight: 700; }
.lv-card-body, .path-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lv-card-title { font-weight: 800; line-height: 1.25; font-size: .98rem; }
.lv-card-zhtitle { font-weight: 600; color: var(--muted); margin-left: 6px; }
.lv-card-zh { font-size: .95rem; color: #3b4652; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-card-meta { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.lv-card-series { display: block; color: var(--primary-dark); font-weight: 700; }
.lv-cards-tight { grid-template-columns: 1fr; }

/* ---------- key words ---------- */
.kw-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.kw-grid li { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; line-height: 1.3; }
.kw-hz { font-size: 1.5rem; font-weight: 700; }
.kw-trad { font-size: .85rem; color: var(--muted); }
.kw-py { color: var(--primary-dark); font-weight: 700; font-size: .92rem; margin-top: 2px; }
.kw-en { font-size: .88rem; }
.kw-n { font-size: .75rem; color: var(--muted); margin-top: 4px; }

/* ---------- grammar list ---------- */
.gp-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 10px; }
.gp-list li { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: #fff; }
.gp-list li > a { display: flex; flex-direction: column; color: var(--ink); }
.gp-pat { font-weight: 800; color: var(--primary-dark); }
.gp-title { font-weight: 600; font-size: .95rem; }
.gp-story { font-size: .82rem; color: var(--muted); }

/* ---------- beginner path ---------- */
.path-week { margin: 26px 0; }
.path-week h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.path-week .wk { background: var(--primary); color: #fff; font-size: .8rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; letter-spacing: .02em; }
.path-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 12px; margin-top: 10px; }
.path-step { position: relative; }
.path-step > a { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px 10px 44px; color: var(--ink); height: 100%; transition: border-color .15s ease, box-shadow .15s ease; }
.path-step > a:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); color: var(--ink); }
.step-n { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--primary-tint); color: var(--primary-dark); font-weight: 800; font-size: .85rem; display: flex; align-items: center; justify-content: center; z-index: 1; }
.path-note { font-size: .88rem; color: #34404d; line-height: 1.35; }
.lv-next-step { font-weight: 700; margin-top: 18px; }

/* ---------- intermediate ---------- */
.lv-compare { display: table; width: 100%; max-width: 780px; margin: 16px 0 18px; font-size: .95rem; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.lv-compare th, .lv-compare td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.lv-compare thead th { background: var(--bg-soft); font-weight: 800; }
.lv-compare tbody th { font-weight: 600; color: #34404d; width: 40%; }
.lv-compare tr:last-child th, .lv-compare tr:last-child td { border-bottom: 0; }
.ser-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 12px; }
.ser-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.ser-top { display: block; color: var(--ink); }
.ser-top img { width: 100%; height: 130px; object-fit: cover; display: block; }
.ser-title { display: block; font-weight: 800; padding: 10px 12px 2px; line-height: 1.25; }
.ser-card .lv-card-meta { padding: 0 12px; }
.ser-parts { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 12px; margin-top: auto; }
.ser-parts a { font-size: .8rem; font-weight: 700; border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; }
.ser-parts a:hover { border-color: var(--primary); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr)); gap: 8px 18px; }
.pick-col h3 { margin: 18px 0 2px; }

/* ---------- app box ---------- */
.lv-app {
  display: flex; gap: 28px; align-items: center; margin: 44px 0;
  background: linear-gradient(135deg, #f1faf4 0%, #eaf6fd 100%);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px;
}
.lv-app-text { flex: 1 1 auto; min-width: 0; }
.lv-app img { width: 190px; height: auto; border-radius: 22px; box-shadow: var(--shadow); flex: 0 0 auto; }
.lv-app .store-badges { margin-top: 6px; }
.lv-applist { margin: 0 0 1rem 1.2em; }
.lv-applist li { margin-bottom: .35em; }

/* ---------- FAQ + nav ---------- */
.lv-faq .faq details { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; background: #fff; max-width: 820px; }
.lv-faq .faq summary { font-weight: 800; cursor: pointer; }
.lv-faq .faq details p { margin: 10px 0 0; }
.lv-prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 34px 0 16px; }
.lv-prevnext a { display: block; border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; font-weight: 800; color: var(--ink); background: #fff; }
.lv-prevnext a span { display: block; font-size: .8rem; color: var(--muted); font-weight: 700; }
.lv-prevnext a:last-child { text-align: right; }
.lv-prevnext a:hover { border-color: var(--primary); }
.lv-also { color: var(--muted); font-size: .95rem; margin-bottom: 30px; }

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .lv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lv-try { padding: 16px 12px 8px; border-radius: 14px; margin-left: -6px; margin-right: -6px; }
  .lv-try-head { gap: 12px; align-items: flex-start; }
  .lv-try-img { width: 92px; height: 64px; }
  .lv-try-head h2 { font-size: 1.3rem; }
  .lv-app { flex-direction: column-reverse; padding: 20px 16px; gap: 16px; }
  .lv-app img { width: 150px; }
  .path-list { grid-template-columns: 1fr; }
  .lv-cards { grid-template-columns: 1fr; }
  .lv-section h2, .lv-try h2, .lv-app h2 { font-size: 1.35rem; }
  .lv-compare { font-size: .85rem; }
  .lv-compare th, .lv-compare td { padding: 7px 8px; }
  .lv-prevnext { grid-template-columns: 1fr; }
  .lv-prevnext a:last-child { text-align: left; }
}
@media (max-width: 400px) {
  .lv-thumb { flex-basis: 80px; width: 80px; height: 62px; }
}

/* grid children must be allowed to shrink below their nowrap content */
.lv-cards > li, .kw-grid > li, .gp-list > li, .path-list > li, .ser-grid > li, .pick-grid > div, .lv-stats > li { min-width: 0; }
.lv-body, .lv-hero .container { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .gp-list { gap: 6px; }
  .gp-list li { padding: 8px 10px; }
  .gp-list li > a { flex-direction: row; flex-wrap: wrap; gap: 0 8px; align-items: baseline; }
  .gp-title { font-size: .88rem; }
}
