/* TOCFL hub, levels guide and band word lists (generate_tocfl_pages.py).
   Loaded after /css/styles.css and /css/hsk.css; reuses their tokens and
   the .hsk-* components. Traditional characters lead on these pages. */

.tocfl-page .hsk-wrap h2 { scroll-margin-top: 90px; }
.tocfl-page .hsk-sec h3 { font-size: 1.15rem; margin: 22px 0 8px; }
.tocfl-page .answer-box { background: var(--bg-soft); border: 1px solid var(--border); border-left: 4px solid var(--primary-dark);
  border-radius: 12px; padding: 14px 18px; margin: 18px 0 8px; }
.tocfl-page .answer-box ul { margin: 8px 0 2px; padding-left: 20px; }
.tocfl-page .answer-box li { margin: 5px 0; }
.updated { font-size: .85rem; color: var(--muted); margin: -6px 0 14px; }

/* hsk.css hardcodes light colors; on TOCFL pages use the theme tokens so
   dark mode (styles.css) reads correctly */
.tocfl-page .lede { color: var(--ink); }
.tocfl-page .btn-ghost, .tocfl-page .hsk-q, .tocfl-page .qz { background: var(--card); }
.tocfl-page .hsk-tools { background: var(--card); }
.tocfl-page .hsk-table tbody tr:hover { background: var(--bg-soft); }
.tocfl-page .hsk-table td:nth-child(1)::before { color: var(--muted); }
.tocfl-page .hsk-table td:nth-child(2) { color: var(--primary-ink, var(--primary-dark)); }
.tocfl-page .hsk-table td:nth-child(2) i, .tocfl-page .qz-py i { color: var(--muted); }
.tocfl-page .qz-py { color: var(--primary-ink, var(--primary-dark)); }
.rd-h .tocfl-page .hsk-table tbody td:nth-child(2), .mn-h .tocfl-page .hsk-table tbody td:nth-child(3) {
  background: repeating-linear-gradient(135deg, var(--bg-soft) 0 6px, var(--card) 6px 12px); }
.tocfl-page .lvl-tabs a.on { color: var(--on-primary, #fff); }
.tocfl-page .band-card .bs, .tocfl-page .band-card .bgo, .tc-table .band-row th, .tc-table .band-row td,
.tocfl-page .pos-key summary { color: var(--primary-ink, var(--primary-dark)); }
.tc-table .band-row td, .tc-table .band-row th { background: var(--primary-tint); }

/* word cell: traditional first, simplified second and grey in "both" mode */
.tocfl-page .hsk-table td:nth-child(1) b.t { color: inherit; font-size: 1em; margin: 0; }
.tocfl-page .hsk-table td:nth-child(1) b.s { color: var(--muted); font-size: .8em; margin-left: .35em; }
.scr-s .tocfl-page .hsk-table td:nth-child(1) b.s { color: inherit; font-size: 1em; margin: 0; }
.scr-b .tocfl-page .qz-word .t { margin: 0; color: inherit; font-size: 1em; }
.scr-b .tocfl-page .qz-word .s { margin-left: .25em; color: var(--muted); font-size: .6em; }
.scr-t .tocfl-page .qz .s { display: none; }
.scr-s .tocfl-page .qz .t { display: none; }
.tocfl-page .hsk-table small.pos, .qz small.pos { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--muted); font: 700 .7rem 'Nunito', sans-serif;
  vertical-align: 1px; }
.tocfl-page .hsk-table td:nth-child(4) { font-weight: 700; }
.qz-lv { font-size: .82rem; color: var(--muted); margin: 2px 0 0; }

/* tables in the guide sections */
.tocfl-page .tbl-scroll { margin: 12px 0 6px; }
.tc-table { width: 100%; border-collapse: collapse; font-size: .94rem; min-width: 620px; }
.tc-table th, .tc-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tc-table thead th { background: var(--bg-soft); font-size: .78rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: .03em; vertical-align: bottom; }
.tc-table td.n, .tc-table th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tc-table tbody th { font-weight: 800; white-space: nowrap; }
.tc-table .band-row td, .tc-table .band-row th { background: var(--tc-band-bg, #f3f8f5); font-weight: 800; color: var(--primary-dark); }
.tc-table .zh { white-space: nowrap; }
.tc-table .muted { color: var(--muted); }
.tc-table.compact { min-width: 0; }

/* band cards on the hub */
.band-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 18px 0 6px; }
.band-card { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); color: var(--ink);
  transition: transform .2s ease, border-color .2s ease; }
.band-card:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--ink); }
.band-card .bn { font-size: 1.35rem; font-weight: 800; }
.band-card .bl { font-size: .9rem; color: var(--muted); font-weight: 700; }
.band-card .bc { font-size: .95rem; }
.band-card .bs { margin-top: 6px; font-size: 1.25rem; color: var(--primary-dark); display: flex; flex-wrap: wrap; gap: 2px 10px; }
.band-card .bgo { margin-top: 6px; font-weight: 800; color: var(--primary-dark); }

/* sample passages */
.passages { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 14px 0; padding: 0; list-style: none; }
.passages li { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.passages .pt { font-weight: 800; display: block; }
.passages .pm { font-size: .82rem; color: var(--muted); display: block; margin: 2px 0 8px; }
.passages .pz { font-size: 1.08rem; line-height: 1.7; margin: 0 0 6px; }
.passages .pe { font-size: .88rem; color: var(--muted); margin: 0 0 8px; }
.passages a.go { font-weight: 800; font-size: .92rem; }
.band-stories h3 { margin-top: 26px; }

.link-list { columns: 2 260px; column-gap: 28px; padding-left: 18px; }
.link-list li { margin: 0 0 8px; break-inside: avoid; }
.pos-key { margin: 6px 0 0; font-size: .88rem; color: var(--muted); }
.pos-key summary { cursor: pointer; font-weight: 700; color: var(--primary-dark); }
.pos-key dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 10px 0 4px; }
.pos-key dt { font-weight: 800; color: var(--ink); }
.pos-key dd { margin: 0; }
.steps li { margin: 0 0 10px; }

@media (max-width: 680px) {
  /* word rows become cards (hsk.css); keep every card inside the viewport */
  .tc-list-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tocfl-page .hsk-table tbody tr { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tocfl-page .hsk-table td:nth-child(1) { white-space: normal; max-width: 48vw; overflow-wrap: anywhere; }
  .tocfl-page .hsk-table td:nth-child(2), .tocfl-page .hsk-table td:nth-child(3) { white-space: normal; min-width: 0; overflow-wrap: anywhere; }
  .tocfl-page .hsk-table td:nth-child(1) b.t { display: inline; }
  .tocfl-page .hsk-table td:nth-child(1) b.s { display: block; margin: 0; font-size: .7em; }
  .scr-t .tocfl-page .hsk-table td:nth-child(1) b.s { display: none; }
  .scr-s .tocfl-page .hsk-table td:nth-child(1) b.s { font-size: 1em; }
  .tc-table { font-size: .88rem; }
  .band-cards { grid-template-columns: 1fr; }
}

@media print {
  .tocfl-page .lede::after { content: " · literatelanguages.com/chinese/tocfl/"; }
  .tocfl-page .updated, .tocfl-page .pos-key, .tocfl-page .answer-box, .tocfl-page .hsk-src { display: none !important; }
  .tocfl-page .hsk-table small.pos { border: 0; padding: 0; }
}

@media (prefers-color-scheme: dark) {
  :root { --tc-band-bg: #1a2a22; }
}
