/* 梯子范 — the whole stylesheet. No build step, no framework, no webfont.
   A Chinese webfont is several MB and there is no acceptable way to serve one
   to a throttled mainland connection (BUILD-PLAN.md §3.2). System stack only. */

:root {
  --bg: #fbfaf8;
  --surface: #fff;
  --ink: #16181d;
  --muted: #5c6370;
  --line: #e3e1dc;
  --accent: #1c5d4a;
  --accent-soft: #e8f1ee;
  --warn: #8a5a12;
  --measure: 42rem;
  --wide: 66rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1b1e24;
    --ink: #e9eaec;
    --muted: #9aa2ae;
    --line: #2c313a;
    --accent: #6fd3b0;
    --accent-soft: #17302a;
    --warn: #d8a54a;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.75 system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  text-rendering: optimizeLegibility;
}

/* ── skip link ─────────────────────────────────────────────── */
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: .6rem 1rem; z-index: 10;
}
.skip:focus { left: 0; }

/* ── chrome ────────────────────────────────────────────────── */
header.site {
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: baseline;
  max-width: var(--wide); margin: 0 auto; padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; text-decoration: none; color: var(--ink); }
header.site nav { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .92rem; }
header.site nav a { color: var(--muted); text-decoration: none; }
header.site nav a:hover { color: var(--accent); }
header.site nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

.crumbs {
  max-width: var(--wide); margin: 0 auto; padding: .75rem 1.25rem 0;
  font-size: .85rem; color: var(--muted);
}
.crumbs a { color: var(--muted); }
.crumbs .sep { padding: 0 .4rem; opacity: .5; }

main {
  max-width: var(--wide); margin: 0 auto; padding: 1.5rem 1.25rem 4rem;
}

footer.site {
  border-top: 1px solid var(--line);
  max-width: var(--wide); margin: 0 auto; padding: 2rem 1.25rem 3rem;
  font-size: .88rem; color: var(--muted);
}
footer.site nav { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: .75rem 0; }
footer.site a { color: var(--muted); }
.tagline { margin: 0; font-weight: 600; color: var(--ink); }
.fineprint { margin: .75rem 0 0; font-size: .82rem; line-height: 1.65; }

/* ── type ──────────────────────────────────────────────────── */
h1 { font-size: clamp(1.55rem, 1.1rem + 2vw, 2.1rem); line-height: 1.3; letter-spacing: -.01em; margin: .5rem 0 1rem; }
h2 { font-size: 1.3rem; line-height: 1.4; margin: 2.5rem 0 .75rem; padding-top: .5rem; border-top: 1px solid var(--line); }
h3 { font-size: 1.05rem; margin: 1.75rem 0 .5rem; }
p, li { max-width: var(--measure); }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: 2px; }
ul, ol { padding-left: 1.3rem; }
li { margin: .3rem 0; }
strong { font-weight: 650; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em;
       background: var(--accent-soft); padding: .1em .35em; border-radius: 3px; }

.lede { font-size: 1.05rem; color: var(--ink); max-width: var(--measure); }

/* ── tables (wide content must scroll inside itself) ───────── */
.scroll { overflow-x: auto; margin: 1.25rem 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--accent-soft); font-weight: 650; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 14rem; }

.missing { color: var(--warn); font-size: .85em; }

/* ── notes ─────────────────────────────────────────────────── */
.note {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: .9rem 1.1rem; margin: 1.25rem 0; border-radius: 0 6px 6px 0;
}
.note p:last-child { margin-bottom: 0; }
.note.caution { border-left-color: var(--warn); }

/* ── FAQ (details counts as visible for FAQPage schema) ────── */
details { border-bottom: 1px solid var(--line); padding: .85rem 0; }
summary { cursor: pointer; font-weight: 600; list-style-position: outside; }
summary::marker { color: var(--muted); }
details[open] summary { margin-bottom: .5rem; }
details > :not(summary) { max-width: var(--measure); }

/* ── verification stamp ────────────────────────────────────── */
.stamp { font-size: .85rem; color: var(--muted); margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ── related links ─────────────────────────────────────────── */
.related { display: flex; flex-wrap: wrap; gap: .5rem .9rem; padding: 0; list-style: none; margin: 1rem 0; }
.related li { margin: 0; }

@media (max-width: 32rem) {
  th, td { padding: .5rem .55rem; font-size: .88rem; }
  main { padding: 1rem 1rem 3rem; }
}

/* qualifier under a figure — the traffic, cycle or upfront cost that stops
   a bare number misleading (see partials/rankTable.mjs) */
.qual { display: block; font-weight: 400; font-size: .78em; color: var(--muted); white-space: nowrap; }
th .qual { font-weight: 400; }

/* Telegram button, top right of the header. Inline SVG — no external asset,
   because a third-party icon host is unreachable from the mainland (§3.1). */
.tg {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; flex: none;
  color: var(--accent); text-decoration: none;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface);
}
.tg:hover { border-color: var(--accent); background: var(--accent-soft); }
.tg svg { flex: none; }

/* visually hidden but read by screen readers and kept as the link's name */
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── sticky section nav ────────────────────────────────────────
   Opt-in per page (`toc: true`), for pages long enough to get lost in.
   Pure CSS sticky: this site ships no client JavaScript, so there is no
   scroll-spy and no collapse toggle — the nav is just anchors that work
   with JS off, which is also what Bing reads for jump links.
   The grid stays inside --wide so the sidebar lines up with the header
   and footer rather than pushing the page wider than the rest of the site. */
main.has-toc {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  gap: 0 2.75rem;
  align-items: start;
}
main.has-toc > h1 { grid-column: 1 / -1; }
main.has-toc > .prose { min-width: 0; }

.toc {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: .88rem;
  line-height: 1.45;
  border-left: 2px solid var(--line);
  padding: .1rem 0 .1rem .9rem;
}
.toc-h {
  margin: 0 0 .55rem; font-size: .78rem; font-weight: 650;
  letter-spacing: .04em; color: var(--muted); text-transform: uppercase;
}
.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.toc li { margin: 0 0 .45rem; max-width: none; }
.toc a {
  color: var(--muted); text-decoration: none; display: block;
  border-left: 2px solid transparent; margin-left: -.9rem; padding-left: .9rem;
}
.toc a::before {
  counter-increment: toc; content: counter(toc) ". ";
  color: var(--muted); opacity: .6; font-variant-numeric: tabular-nums;
}
.toc a:hover, .toc a:focus-visible { color: var(--accent); border-left-color: var(--accent); }

/* Anchored headings must not land under anything, and on a page with a sticky
   nav the jump should leave a little breathing room above the heading. */
main.has-toc h2 { scroll-margin-top: 1rem; }

/* Below the two-column threshold the sidebar becomes a normal block at the top
   of the page — a sticky rail on a phone costs more screen than it returns. */
@media (max-width: 60rem) {
  main.has-toc { display: block; }
  .toc {
    position: static; max-height: none; overflow: visible;
    border-left: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    padding: .9rem 0; margin: 0 0 1.5rem;
  }
  .toc ol { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
  .toc li { margin: 0; }
  .toc a { margin-left: 0; padding-left: 0; border-left: 0; }
  .toc a:hover, .toc a:focus-visible { border-left-color: transparent; }
}

/* Nested entries — the per-provider sections under their parent heading. On the
   money pages this takes the nav past 40 entries, which is exactly why .toc
   carries max-height + overflow-y: auto. The rail scrolls on its own
   (overscroll-behavior keeps that from grabbing the page scroll at the ends). */
.toc-sub {
  list-style: none; margin: .4rem 0 .7rem; padding: 0 0 0 .85rem;
  border-left: 1px solid var(--line);
}
.toc-sub li { margin: 0 0 .3rem; }
.toc-sub a {
  font-size: .84rem; margin-left: 0; padding-left: 0; border-left: 0;
  opacity: .92;
}
.toc-sub a::before { content: none; }
.toc-sub a:hover, .toc-sub a:focus-visible { border-left-color: transparent; text-decoration: underline; }

@media (max-width: 60rem) {
  /* Wrapped inline at the top of the page, 40+ provider links would bury the
     content. Sections only; the in-page provider list already covers the rest. */
  .toc-sub { display: none; }
}

/* ── back to top ───────────────────────────────────────────────
   A plain anchor to #top (the header), because this site ships no client
   JavaScript. Rendered only on pages past a length threshold — see layout.mjs.

   Browsers with scroll-driven animations fade it in after the first viewport,
   so it is not sitting there while you are already at the top. Everywhere else
   the @supports block simply never applies and the button stays visible, which
   is the correct fallback: always usable, never broken. */
.totop {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 5;
  width: 2.6rem; height: 2.6rem; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent); text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 50%;
  box-shadow: 0 1px 6px rgb(0 0 0 / .09);
}
.totop:hover { border-color: var(--accent); background: var(--accent-soft); }
.totop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@supports (animation-timeline: scroll()) {
  .totop {
    opacity: 0; pointer-events: none;
    animation: totop-in linear both;
    animation-timeline: scroll();
    animation-range: 55vh 95vh;
  }
  @keyframes totop-in { to { opacity: 1; pointer-events: auto; } }
}

/* Smooth the jump for both this and the section nav, but never against the
   reader's stated preference. */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .totop { animation: none; opacity: 1; pointer-events: auto; }
}
