/* News Chinese — free sample lesson pages (/lessons/…). Loaded after site.css on lesson pages only.
   Tokens and dark mode come from site.css; no literal colours here. No inline styles (strict CSP). */

/* Pinyin: its own lang tag so it does not inherit the Korean font (which may lack ǎ / ǚ). */
[lang="zh-Latn-pinyin"] { font-family: var(--font); word-break: normal; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- breadcrumb */

.crumbs { padding-top: 18px; font-size: 0.9rem; color: var(--muted); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0; padding: 0; list-style: none; }
.crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.crumbs li + li::before { content: "›"; padding-inline: 8px; color: var(--muted); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- hero */

.lesson-hero { padding-block: clamp(28px, 5vw, 56px) clamp(40px, 6vw, 64px); }
.lesson-hero h1 { font-size: clamp(1.8rem, 1.3rem + 2.4vw, 2.7rem); font-weight: 800; letter-spacing: -0.02em; }
.eyebrow-text { font-size: 0.9rem; font-weight: 700; color: var(--seal-text); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.lesson-meta li {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 600;
}
.lm-label { font-weight: 500; opacity: 0.8; }
.lesson-lead { margin-top: 18px; font-size: 1.06rem; color: var(--ink-2); }
.lesson-source {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------- key grammar */

.lesson-grammar { padding-block: clamp(40px, 6vw, 64px); background: var(--band); border-block: 1px solid var(--line); }
.gp-list { display: grid; gap: 12px; margin: 22px 0 0; }
.gp {
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.gp-pattern { font-size: 1.2rem; font-weight: 700; color: var(--accent-strong); }
.gp dd { margin: 6px 0 0; color: var(--ink-2); }

/* ---------------------------------------------------------------- sentences */

.sentence { padding-block: clamp(40px, 6vw, 64px); border-bottom: 1px solid var(--line); }
.sentence-title {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--seal);
  color: var(--seal-ink);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.sentence-card {
  margin-top: 16px;
  padding: 20px 20px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.zh-line { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.6rem); line-height: 1.6; font-weight: 600; color: var(--ink); }
.py-line { margin-top: 8px; font-size: 0.98rem; line-height: 1.6; color: var(--accent-strong); }
.tr-line { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); color: var(--ink-2); }

.part-title {
  margin-top: 28px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}
.part-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 0.95em;
  margin-right: 8px;
  vertical-align: -0.1em;
  border-radius: 2px;
  background: var(--accent);
}

/* Literal reading: one cell per chunk — characters, pinyin, gloss. */
.chunks { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.chunk {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.chunk-zh { font-size: 1.15rem; font-weight: 600; line-height: 1.4; color: var(--ink); }
.chunk-py { font-size: 0.8rem; line-height: 1.3; color: var(--accent-strong); }
.chunk-gloss { font-size: 0.86rem; line-height: 1.35; color: var(--ink-2); }

/* Sentence structure: role label + the Chinese it covers. */
.skeleton { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.skeleton li {
  display: inline-flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--accent-soft);
}
.sk-role { font-size: 0.76rem; font-weight: 700; color: var(--accent-strong); }
.sk-zh { font-size: 1rem; color: var(--ink); }

.grammar-note { margin-top: 10px; color: var(--ink-2); }
.gx { font-weight: 700; color: var(--accent-strong); }

/* Vocabulary table: scrolls sideways on narrow phones instead of widening the page. */
.table-scroll { margin-top: 12px; overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.lesson-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.lesson-table th, .lesson-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.lesson-table thead th { background: var(--bg-alt); color: var(--muted); font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.lesson-table tbody tr:last-child :is(th, td) { border-bottom: 0; }
.lesson-table tbody th { font-size: 1.05rem; font-weight: 600; white-space: nowrap; }
.lesson-table td:nth-child(2) { color: var(--accent-strong); white-space: nowrap; }
.lesson-table .v-level { white-space: nowrap; color: var(--muted); }
.lesson-table td:last-child { min-width: 14em; color: var(--ink-2); }
/* Phones: one block per word — word · pinyin · level on top, the meaning underneath at full width. */
@media (max-width: 599px) {
  .table-scroll { overflow-x: visible; }
  .lesson-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lesson-table, .lesson-table tbody { display: block; }
  .lesson-table tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 2px 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  .lesson-table tbody tr:last-child { border-bottom: 0; }
  .lesson-table th, .lesson-table td { display: block; padding: 0; border: 0; }
  .lesson-table tbody th { white-space: normal; }
  .lesson-table td:nth-child(2) { white-space: normal; }
  .lesson-table td:last-child { grid-column: 1 / -1; min-width: 0; margin-top: 4px; }
}

/* ---------------------------------------------------------------- quiz */

.quiz { padding-block: clamp(48px, 7vw, 80px); }
.quiz .lead { margin-top: 14px; color: var(--ink-2); }
.quiz-prompt {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}
.quiz-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.quiz-label { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.quiz-answer, .quiz-pool { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.quiz-answer { min-height: 54px; padding: 8px; border-radius: 12px; border: 2px dashed var(--line); }
.quiz-box.is-correct .quiz-answer { border-style: solid; border-color: var(--accent); }
.quiz-box.is-wrong .quiz-answer { border-style: solid; border-color: var(--seal); }
.tile {
  appearance: none;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  color: var(--ink);
  font: inherit;
  font-family: var(--font-zh);
  font-size: 1.1rem;
  line-height: 1.3;
  cursor: pointer;
}
.tile:hover { border-color: var(--accent); }
.quiz-answer .tile { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.quiz-status { min-height: 1.6em; font-weight: 700; }
.quiz-box.is-correct .quiz-status { color: var(--accent-strong); }
.quiz-box.is-wrong .quiz-status { color: var(--seal-text); }
.quiz-reset {
  appearance: none;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.quiz-reset:hover { border-color: var(--accent); color: var(--accent); }
.quiz-solution { margin-top: 16px; }
.quiz-solution summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.quiz-solution .zh-line { margin-top: 8px; font-size: 1.15rem; }

/* ---------------------------------------------------------------- lesson cards (hub, "more lessons") */

.lesson-list { padding-block: clamp(40px, 6vw, 72px); }
.lesson-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin: 24px 0 0; padding: 0; list-style: none; }
@media (min-width: 720px) { .lesson-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lesson-card a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  text-decoration: none;
}
.lesson-card a:hover { border-color: var(--accent); }
.lc-topic { font-size: 0.82rem; font-weight: 700; color: var(--seal-text); }
.lc-title { font-size: 1.15rem; font-weight: 800; line-height: 1.35; }
.lc-zh { font-size: 0.98rem; color: var(--ink-2); line-height: 1.55; }
.lc-grammar { margin-top: auto; padding-top: 8px; font-size: 0.86rem; color: var(--accent-strong); }
.lc-label { color: var(--muted); font-weight: 600; }
