/* ChinaAPI site stylesheet — v20260719a
   Data-first restyle: calmer type scale, real cards, global code/table styles,
   mobile nav that stays visible, overflow guards for long model IDs.
   Class vocabulary is unchanged — hand-written and generated pages share it. */

:root {
  --navy: #0b1426;
  --ink: #16233c;
  --blue: #146bff;
  --blue-deep: #0f56d0;
  --cyan: #00d6c7;
  --muted: #5b6474;
  --line: #e5e9f1;
  --line-strong: #d7ddea;
  --soft: #f6f8fb;
  --code-bg: #0d1830;
  --white: #ffffff;
  --max: 1160px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-menu: 0 18px 44px rgba(11, 20, 38, .14);
  --shadow-card: 0 1px 2px rgba(11, 20, 38, .04);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
::selection { background: rgba(20, 107, 255, .16); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 18px;
  align-items: center;
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 24px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand img { display: block; width: 178px; height: auto; }
.nav-links {
  display: flex;
  justify-content: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
}
.nav-links a, .nav-cta { text-decoration: none; }
.nav-links a {
  padding: 7px 11px;
  border-radius: 8px;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--navy); background: var(--soft); }
.nav-links a[aria-current="page"] {
  color: var(--blue);
  background: var(--soft);
  font-weight: 700;
}

.language-menu {
  position: relative;
  justify-self: end;
  font-size: 14px;
  color: var(--muted);
}
.language-menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}
.language-menu summary:hover { border-color: var(--line-strong); color: var(--navy); }
.language-menu summary::-webkit-details-marker { display: none; }
.language-menu summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.language-menu[open] summary::after { transform: translateY(2px) rotate(225deg); }
.language-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  display: grid;
  width: min(240px, calc(100vw - 48px));
  max-height: min(420px, 70vh);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: var(--shadow-menu);
}
.language-menu-list a {
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--navy);
  text-decoration: none;
}
.language-menu-list a:hover,
.language-menu-list a[aria-current="page"],
.language-menu-list a[aria-current="true"] {
  background: var(--soft);
  color: var(--blue);
}
.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}
.nav-cta:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- Layout & typography ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 24px 64px; }

.hero {
  padding: 76px 0 60px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1100px 380px at 15% -12%, rgba(20, 107, 255, .07), transparent 60%),
    radial-gradient(800px 300px at 90% -18%, rgba(0, 214, 199, .06), transparent 55%);
}
.page-hero {
  padding: 56px 0 44px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1100px 340px at 15% -14%, rgba(20, 107, 255, .06), transparent 60%),
    radial-gradient(800px 280px at 90% -20%, rgba(0, 214, 199, .05), transparent 55%);
}

.eyebrow, .section-kicker {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}
h1, h2, h3 { color: var(--navy); overflow-wrap: anywhere; }
h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(34px, 4.6vw, 52px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.015em;
}
.page-hero h1 { max-width: 920px; font-size: clamp(28px, 3.8vw, 42px); }
h2 {
  margin: 0;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h3 { margin: 0 0 8px; font-size: 16.5px; line-height: 1.35; font-weight: 650; }
p { margin: 0 0 1em; }

.hero-copy {
  max-width: 720px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 18.5px;
  line-height: 1.6;
}
.page-copy { max-width: 740px; margin-top: 18px; font-size: 17px; line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  background: var(--blue);
  color: white;
  border: 1px solid var(--blue);
  text-decoration: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.button:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.button.ghost { background: white; color: var(--navy); border-color: var(--line-strong); }
.button.ghost:hover { border-color: var(--blue); color: var(--blue); background: white; }

/* ---------- Sections ---------- */
.split-section {
  display: grid;
  grid-template-columns: minmax(260px, .72fr) minmax(0, 1.28fr);
  gap: 40px;
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
}
.content-band, .resources { padding: 56px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: grid; gap: 10px; max-width: 760px; margin-bottom: 28px; }
.article-section { padding: 48px 0; border-bottom: 1px solid var(--line); }
.article-section h2 { font-size: clamp(21px, 2.4vw, 28px); margin-bottom: 16px; }
.article-section p { color: var(--muted); max-width: 78ch; }
.article-section > p:last-child { margin-bottom: 0; }

/* ---------- Cards & grids ---------- */
.model-grid, .three-col, .steps, .resource-list, .catalog-grid { display: grid; gap: 14px; }
.model-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.catalog-grid { grid-template-columns: 1fr; }
.model-card, .three-col article, .steps div, .catalog-card, .catalog-note {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  min-width: 0;
}
.model-card h3 code { font-size: .92em; }
.catalog-card h3, .catalog-note h3 { margin-bottom: 12px; }
.catalog-note p { color: var(--muted); margin: 0; max-width: 720px; }
.model-card p, .three-col p, .steps p, .request-section p, .page-copy, .faq-answer {
  color: var(--muted);
  margin: 0;
}
.steps span { display: block; color: var(--blue); font-weight: 700; margin-bottom: 10px; font-size: 13px; letter-spacing: .06em; }

.model-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.model-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* ---------- Language link rows ---------- */
.language-section { padding: 44px 0; border-bottom: 1px solid var(--line); }
.language-links { display: flex; flex-wrap: wrap; gap: 10px; }
.language-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.language-links a:hover { border-color: var(--line-strong); color: var(--navy); }
.language-links a[aria-current="page"] { border-color: var(--blue); color: var(--blue); }

/* ---------- Agents strip ---------- */
.agents-lead { margin: 0; color: var(--muted); font-size: 16.5px; }
.agent-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); margin-top: 4px; }
.agent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-card);
}
.agent-item img { width: 26px; height: 26px; object-fit: contain; flex: none; }
.agent-item span { font-size: 14.5px; font-weight: 600; color: var(--navy); }
.agents-cta { margin: 24px 0 0; }
.agents-cta a { color: var(--blue); font-weight: 600; font-size: 15px; text-decoration: none; }
.agents-cta a:hover { text-decoration: underline; }

/* ---------- Resource lists ---------- */
.resource-list { border-top: 1px solid var(--line); gap: 0; }
.resource-list a {
  display: grid;
  grid-template-columns: minmax(0, .75fr) minmax(0, 1fr);
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.resource-list a:hover span { color: var(--blue); }
.resource-list span { font-size: 17px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.resource-list small { color: var(--muted); font-size: 14px; line-height: 1.5; min-width: 0; }
.compact-list { margin-top: 16px; border-top: 1px solid var(--line); }
.compact-list a {
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  justify-content: start;
  gap: 12px;
  padding: 11px 0;
  align-items: baseline;
}
.compact-list span { font-size: 15px; }
.compact-list small { white-space: normal; text-align: right; justify-self: end; }

/* ---------- Update wall ---------- */
.update-wall { display: grid; gap: 0; border-top: 1px solid var(--line); }
.update-entry {
  display: grid;
  grid-template-columns: minmax(92px, 140px) 24px minmax(0, 1fr);
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.update-date { padding: 22px 0; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.update-line { position: relative; min-height: 100%; }
.update-line::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 11px;
  width: 2px;
  background: var(--line);
}
.update-line::after {
  content: "";
  position: absolute;
  top: 27px; left: 5px;
  width: 14px; height: 14px;
  border: 3px solid var(--blue);
  border-radius: 50%;
  background: var(--white);
}
.update-body { padding: 20px 0; }
.update-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; min-width: 0; }
.update-title strong, .update-title a {
  color: var(--navy);
  font-size: 16.5px;
  font-weight: 650;
  line-height: 1.3;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.update-title a:hover { color: var(--blue); text-decoration: underline; }
.update-vendor { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.update-body p { margin: 0 0 10px; color: var(--muted); }
.update-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.type-tag, .availability-badge, .source-link {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}
.availability-badge.on {
  border-color: rgba(0, 156, 111, .24);
  background: rgba(0, 214, 199, .12);
  color: #06785f;
}
.availability-badge.off { background: var(--soft); color: var(--muted); }
.source-link { color: var(--blue); }
.source-link:hover { border-color: var(--blue); }

/* ---------- Code & tables (global) ---------- */
pre {
  background: var(--code-bg);
  color: #e7edf8;
  border: 1px solid rgba(20, 107, 255, .16);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 1em 0;
  font-size: 13.5px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; color: inherit; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  overflow-wrap: anywhere;
}
:not(pre) > code {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .08em .4em;
  color: var(--ink);
}

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: .6em .8em; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th {
  background: var(--soft);
  color: var(--navy);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--line-strong);
}
tbody tr:hover { background: rgba(20, 107, 255, .025); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table-wrap table { min-width: 760px; }
.rank-explainer { margin: 12px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; max-width: 82ch; }
.agent-name { display: inline-flex; align-items: center; gap: 9px; min-width: 140px; font-weight: 650; color: var(--navy); }
.agent-brand-logo, .agent-brand-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
}
.agent-brand-logo img { display: block; width: 22px; height: 22px; object-fit: contain; }
.agent-brand-fallback { background: var(--soft); color: var(--blue-deep); font-size: 11px; font-weight: 800; letter-spacing: .02em; }

/* ---------- FAQ ---------- */
.faq-list { border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); padding: 22px 0; }
.faq-item h2 { font-size: 18.5px; margin: 0 0 8px; letter-spacing: 0; }

/* ---------- Request / contact ---------- */
.request-section {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(320px, 1.18fr);
  gap: 42px;
  padding: 56px 0 0;
}
.contact-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.contact-chips a, .contact-chips span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
}
.contact-chips .mail-link { color: var(--navy); border-color: rgba(11, 20, 38, .18); background: rgba(11, 20, 38, .04); }
.contact-chips .whatsapp-link { color: var(--navy); border-color: rgba(37, 211, 102, .35); background: rgba(37, 211, 102, .08); }
.contact-chips .telegram-chip { color: var(--navy); border-color: rgba(34, 158, 217, .3); background: rgba(34, 158, 217, .07); }
.contact-chips .mail-icon, .contact-chips .whatsapp-icon, .contact-chips .telegram-icon { width: 18px; height: 18px; flex: 0 0 auto; }

.lead-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(20, 107, 255, .45); outline-offset: 0; border-color: var(--blue); }
textarea { min-height: 118px; resize: vertical; }
.wide { grid-column: 1 / -1; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 36px 24px 52px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.site-footer img { width: 160px; height: auto; display: block; margin-bottom: 14px; }
.footer-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  padding-bottom: 30px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.footer-col { display: grid; gap: 7px; align-content: start; }
.footer-col-title { margin: 0 0 4px; font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--navy); }
.footer-col a { color: var(--muted); text-decoration: none; font-size: 13.5px; line-height: 1.5; }
.footer-col a:hover { color: var(--blue); text-decoration: underline; }

.mobile-copy { display: none; }

/* ---------- Insights (shared with gen_insights.py) ---------- */
.insight-meta { color: var(--muted); font-size: 14.5px; margin-top: 8px; }
.insight-body h2 { margin: 2.1em 0 .6em; }
.insight-body h3 { margin: 1.6em 0 .5em; }
.insight-body p, .insight-body li { line-height: 1.7; color: var(--ink); }
.insight-body p { max-width: 78ch; }
.insight-body ul, .insight-body ol { padding-left: 1.4rem; margin: .8em 0 1.1em; }
.insight-body .table-wrap { overflow-x: auto; margin: 1.1em 0 1.4em; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.insight-body .table-wrap table { font-size: 14px; }
.insight-body .table-wrap th, .insight-body .table-wrap td { white-space: nowrap; }
.insight-body blockquote {
  border-left: 3px solid var(--cyan);
  margin: 1.1em 0;
  padding: .3em 1.1em;
  color: var(--muted);
}
.insight-cta {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 2em 0;
  background: var(--soft);
}
.insight-cta p { margin: 0 0 12px; max-width: none; }
.methodology {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 2.2em 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 0;
  }
  .brand { order: 1; margin-right: auto; }
  .brand img { width: 124px; }
  .language-menu { order: 2; }
  .language-menu summary { min-height: 34px; padding: 0 9px; font-size: 13px; }
  .nav-cta { order: 3; min-height: 34px; padding: 0 10px; font-size: 13px; }
  .nav-links {
    order: 4;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0;
    padding: 2px 0 8px;
    overflow: visible;
  }
  .nav-links a { padding: 6px 8px; font-size: 13px; }
  main { padding: 0 18px 56px; }
  .hero { padding: 44px 0 40px; }
  .page-hero { padding: 36px 0 32px; }
  h1 { font-size: clamp(27px, 7.4vw, 34px); line-height: 1.14; }
  .page-hero h1 { font-size: clamp(24px, 6.8vw, 30px); }
  h2 { font-size: clamp(20px, 5.6vw, 24px); }
  .hero-copy { font-size: 16.5px; }
  .page-copy { font-size: 16px; }
  .split-section, .request-section { grid-template-columns: 1fr; gap: 24px; padding: 40px 0; }
  .content-band, .resources { padding: 40px 0; }
  .article-section { padding: 36px 0; }
  .resource-list a { grid-template-columns: 1fr; gap: 4px; padding: 14px 0; }
  .compact-list a { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .compact-list small { text-align: left; justify-self: start; }
  .update-entry { grid-template-columns: 1fr; gap: 0; padding: 18px 0; }
  .update-date, .update-body { padding: 0; }
  .update-date { margin-bottom: 6px; }
  .update-line { display: none; }
  .model-grid, .three-col, .lead-form { grid-template-columns: 1fr; }
  .desktop-copy { display: none; }
  .mobile-copy { display: inline; }
  .hero-actions .button { flex: 1 1 100%; }
  table { display: block; overflow-x: auto; }
  pre { font-size: 12.5px; padding: 14px; }
}
@media (max-width: 860px) { .footer-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .footer-nav { grid-template-columns: 1fr; } }
