/* reranker.uk — shared design system
   Zero-build static site. Tokens, layout, components. */

:root {
  /* Surfaces — a deliberate 4-step elevation ramp rather than ad-hoc greys */
  --bg: #090b13;
  --bg-soft: #0f111c;
  --bg-card: #141726;
  --bg-elev: #1b1f31;
  --border: #272c40;
  --border-soft: #1e2233;
  --border-strong: #343b55;

  --text: #eceef7;
  --text-soft: #b6bcd2;
  --text-mut: #939bb4;

  --hero-title-gradient: linear-gradient(120deg, #ffffff 0%, #b8c2ff 52%, #5eead4 100%);
  --primary: #8592ff;
  --primary-strong: #6366f1;
  --primary-soft: rgba(124, 139, 255, 0.13);
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --warn: #fbbf24;
  --danger: #f87171;
  --good: #34d399;
  --header-bg: rgba(9, 11, 19, 0.72);
  --pre-bg: #0b0d16;
  --code-fg: #c7d0ff;
  --pre-fg: #d7ddff;

  /* Type scale — fluid, so headings stay proportional without breakpoints */
  --step--1: clamp(0.82rem, 0.79rem + 0.14vw, 0.89rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-1: clamp(1.15rem, 1.08rem + 0.35vw, 1.33rem);
  --step-2: clamp(1.4rem, 1.26rem + 0.7vw, 1.85rem);
  --step-3: clamp(1.75rem, 1.5rem + 1.25vw, 2.6rem);
  --step-4: clamp(2.1rem, 1.65rem + 2.2vw, 3.15rem);

  /* Spacing rhythm */
  --sp-1: 0.35rem;
  --sp-2: 0.65rem;
  --sp-3: 1rem;
  --sp-4: 1.5rem;
  --sp-5: 2.25rem;
  --sp-6: 3.5rem;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --maxw: 1080px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --ring: 0 0 0 3px var(--primary-soft), 0 0 0 1px var(--primary);

  --mono: "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Inter",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

html[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-soft: #eceef6;
  --bg-card: #ffffff;
  --bg-elev: #f1f3f9;
  --border: #d7dceb;
  --border-soft: #e4e8f2;
  --border-strong: #bcc4da;
  --text: #101320;
  --text-soft: #333950;
  --text-mut: #535a72;
  --hero-title-gradient: linear-gradient(120deg, #12151f 0%, #3730a3 48%, #0f766e 100%);
  --primary: #4f46e5;
  --primary-strong: #4338ca;
  --primary-soft: rgba(79, 70, 229, 0.1);
  --accent: #0d9488;
  --accent-soft: rgba(13, 148, 136, 0.1);
  --warn: #b45309;
  --danger: #dc2626;
  --good: #047857;
  --header-bg: rgba(246, 247, 251, 0.85);
  --pre-bg: #f0f2f8;
  --code-fg: #3730a3;
  --pre-fg: #1e1b4b;
  --shadow-sm: 0 1px 2px rgba(30, 41, 59, 0.08);
  --shadow: 0 10px 40px -12px rgba(30, 41, 59, 0.15);
  --shadow-lg: 0 24px 60px -20px rgba(30, 41, 59, 0.22);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 78px; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.68;
  font-size: var(--step-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient background glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(800px 460px at 92% 4%, rgba(45, 212, 191, 0.10), transparent 55%);
  pointer-events: none;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* A single, consistent keyboard-focus treatment for every interactive element */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

img { max-width: 100%; }

h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); margin: 0 0 0.5em; }
h2 { font-size: var(--step-2); margin: 2.2em 0 0.7em; }
h3 { font-size: var(--step-1); margin: 1.8em 0 0.5em; }
p { margin: 0 0 1.1em; text-wrap: pretty; }

kbd {
  font-family: var(--mono);
  font-size: 0.8em;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.1em 0.4em;
  color: var(--text-soft);
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  padding: 0.12em 0.4em;
  border-radius: 6px;
  color: var(--code-fg);
  overflow-wrap: break-word;
}

pre {
  background: var(--pre-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.05rem 1.2rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.6;
  tab-size: 2;
}
pre code { background: none; border: none; padding: 0; color: var(--pre-fg); }

hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--primary-strong); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 200;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-soft);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px; gap: 0.65rem; flex-wrap: nowrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-weight: 800; font-size: 1.12rem; color: var(--text); letter-spacing: -0.02em;
  margin-right: auto; flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary-strong), var(--accent));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 0.9rem;
  box-shadow: 0 4px 14px -4px rgba(99,102,241,0.6);
}
.brand .tld { color: var(--text-mut); font-weight: 600; }

.nav-links {
  display: flex; align-items: center; gap: 0.2rem; list-style: none; margin: 0; padding: 0;
  flex-shrink: 0;
}
.nav-links a {
  color: var(--text-soft); padding: 0.4rem 0.65rem; border-radius: 8px;
  font-size: 0.88rem; font-weight: 500; white-space: nowrap; line-height: 1.2;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-card); text-decoration: none; }
.nav-links a.active { color: var(--text); background: var(--primary-soft); }
.nav-cta {
  background: linear-gradient(135deg, var(--primary-strong), #8b5cf6) !important;
  color: #fff !important; font-weight: 600 !important;
  box-shadow: 0 6px 18px -6px rgba(99,102,241,0.7);
}
.nav-cta:hover { filter: brightness(1.08); }

.nav-toggle {
  display: none; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); width: 40px; height: 40px; border-radius: 9px; cursor: pointer; font-size: 1.2rem;
}

/* Locale + theme switches share one control shape */
.lang-toggle, .theme-toggle {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-soft);
  height: 36px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.lang-toggle {
  min-width: 50px; padding: 0 0.7rem; gap: 0.3rem;
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em;
  font-family: inherit; text-decoration: none;
}
.lang-toggle::before { content: "🌐"; font-size: 0.85rem; }
.lang-toggle:hover { color: var(--text); border-color: var(--primary); background: var(--bg-elev); text-decoration: none; }
.theme-toggle { width: 36px; font-size: 1rem; }
.theme-toggle:hover { color: var(--text); border-color: var(--primary); background: var(--bg-elev); }
.nav-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

@media (max-width: 900px) {
  .nav-toggle { display: grid; place-items: center; }
  .nav-links {
    position: absolute; top: 62px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0.2rem;
    background: var(--bg-soft); border-bottom: 1px solid var(--border);
    padding: 0.6rem 16px 1rem; display: none;
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.7rem 0.8rem; }
}

/* ---------- Hero ---------- */
.hero { padding: 4.5rem 0 3rem; text-align: center; }
.hero .eyebrow {
  display: inline-block; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 0.35rem 0.85rem; border-radius: 999px;
  margin-bottom: 1.2rem; border: 1px solid rgba(45, 212, 191, 0.22);
}
.hero h1 {
  background: var(--hero-title-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-fill-color: transparent;
  max-width: 20ch; margin-inline: auto;
}
/* Chinese glyphs + gradient text = uneven contrast; use solid high-contrast title */
html[lang="zh-Hans"] .hero h1 {
  background: none; color: var(--text); -webkit-text-fill-color: var(--text);
  max-width: 24ch;
}
html[lang="zh-Hans"] .hero .eyebrow {
  text-transform: none; letter-spacing: 0.02em;
  color: var(--primary-strong); background: var(--primary-soft);
  border-color: rgba(124, 139, 255, 0.25);
}
html[lang="zh-Hans"] .hero .lead { color: var(--text-soft); max-width: 42em; }
html[lang="zh-Hans"] .hero .muted { color: var(--text-soft); }
html[lang="zh-Hans"] .section-head p,
html[lang="zh-Hans"] .card p,
html[lang="zh-Hans"] .cta-band .soft,
html[lang="zh-Hans"] .feature-list li { color: var(--text-soft); }
/* Chinese has no word spaces — let the browser break lines anywhere sensible */
html[lang="zh-Hans"] body { line-height: 1.8; }
html[lang="zh-Hans"] h1,
html[lang="zh-Hans"] h2,
html[lang="zh-Hans"] h3 { letter-spacing: 0; }

.hero .lead { font-size: var(--step-1); color: var(--text-soft); max-width: 660px; margin: 0 auto 1.8rem; }
.hero-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.72rem 1.35rem; border-radius: 11px; font-weight: 600; font-size: 0.98rem;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary-strong), #8b5cf6); color: #fff;
  box-shadow: 0 8px 22px -8px rgba(99,102,241,0.7);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-elev); border-color: var(--primary); transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; filter: none; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 1.15rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.45rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
a.card { color: inherit; display: block; }
a.card:hover {
  text-decoration: none; border-color: var(--primary);
  transform: translateY(-3px); box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.card .ico { font-size: 1.6rem; margin-bottom: 0.4rem; display: block; line-height: 1; }
.card p { color: var(--text-soft); margin-bottom: 0; font-size: 0.96rem; }
.card .tag-row { margin-top: 0.9rem; }
.card-takeaway {
  font-size: 0.88rem; font-weight: 600; color: var(--primary);
  border-left: 2px solid var(--primary); padding-left: 0.7rem;
  margin: 0.75rem 0 0.5rem !important;
}
html[data-theme="light"] .card-takeaway { color: var(--primary-strong); border-left-color: var(--primary-strong); }
html[lang="zh-Hans"] .card-takeaway { color: var(--primary); }
html[data-theme="light"][lang="zh-Hans"] .card-takeaway { color: var(--primary-strong); }

.section { padding: 2.75rem 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 2rem; }
.section-head h2 { margin-top: 0; }
.section-head p { color: var(--text-soft); }

/* ---------- Tags / pills ---------- */
.pill {
  display: inline-block; font-size: 0.74rem; font-weight: 600; padding: 0.22rem 0.62rem; border-radius: 999px;
  background: var(--bg-elev); color: var(--text-soft); border: 1px solid var(--border); margin-right: 0.3rem;
  white-space: nowrap;
}
.pill.good { color: var(--good); border-color: rgba(52,211,153,0.3); background: rgba(52,211,153,0.08); }
.pill.warn { color: var(--warn); border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.08); }
.pill.info { color: var(--primary); border-color: rgba(124,139,255,0.35); background: var(--primary-soft); }
html[data-theme="light"] .pill.info { color: #3730a3; }
html[data-theme="light"] .pill.good { color: var(--good); border-color: rgba(4,120,87,0.28); background: rgba(4,120,87,0.08); }
html[data-theme="light"] .pill.warn { color: var(--warn); border-color: rgba(180,83,9,0.28); background: rgba(180,83,9,0.08); }

/* ---------- Article ---------- */
.article { padding: 2.5rem 0 3.5rem; }
.article .meta { color: var(--text-mut); font-size: 0.9rem; margin-bottom: 1.5rem; }
.article .lead { font-size: var(--step-1); color: var(--text-soft); }
.article ul, .article ol { padding-left: 1.3rem; }
.article li { margin-bottom: 0.5rem; }
.article blockquote {
  border-left: 3px solid var(--primary); margin: 1.5rem 0; padding: 0.5rem 0 0.5rem 1.2rem;
  color: var(--text-soft); background: var(--bg-soft); border-radius: 0 10px 10px 0;
}
.callout {
  background: var(--primary-soft); border: 1px solid rgba(124,139,255,0.25); border-radius: var(--radius-sm);
  padding: 1rem 1.2rem; margin: 1.5rem 0;
}
.callout.accent { background: var(--accent-soft); border-color: rgba(45,212,191,0.25); }
.callout strong { color: var(--text); }
.callout p:last-child { margin-bottom: 0; }

/* Inline figures (e.g. the pipeline diagram) */
figure { margin: 1.6rem 0; }
.pipeline-figure { text-align: center; }
.pipeline-figure svg { width: 100%; max-width: 560px; height: auto; display: inline-block; }
.pipeline-figure figcaption { margin-top: 0.7rem; font-size: 0.85rem; color: var(--text-mut); }

/* Table of contents */
.toc {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 1rem 1.3rem; margin: 1.5rem 0 2rem; font-size: 0.95rem;
}
.toc strong { display: block; margin-bottom: 0.5rem; color: var(--text-mut); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc li { margin-bottom: 0.3rem; }
.toc a { color: var(--text-soft); }
.toc a:hover { color: var(--primary); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 0.72rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border-soft); }
th { background: var(--bg-elev); font-weight: 600; color: var(--text); white-space: nowrap; }
/* Wide tables scroll inside their wrapper instead of crushing every column */
.table-wrap table { min-width: 640px; }
.th-hint { font-weight: 400; color: var(--text-mut); font-size: 0.78rem; }
tr:last-child td { border-bottom: none; }
td { color: var(--text-soft); }
tbody tr:hover { background: var(--bg-soft); }

/* Chooser grid (models/index.html "How to choose") */
.chooser-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.15rem; }
@media (max-width: 720px) { .chooser-grid { grid-template-columns: 1fr; } }
.chooser-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.35rem 1.45rem; position: relative; box-shadow: var(--shadow-sm);
}
.chooser-card h3 { margin: 0.3rem 0 0.2rem; font-size: 1.05rem; }
.chooser-card h3 a { color: var(--text); text-decoration: none; }
.chooser-card h3 a:hover { color: var(--primary); }
.chooser-tagline { color: var(--accent); font-size: 0.84rem; font-weight: 600; margin: 0 0 0.8rem; }
html[data-theme="light"] .chooser-tagline { color: var(--accent); }
.chooser-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 0.2rem 0.55rem; border-radius: 999px; margin-bottom: 0.5rem;
}
.chooser-open  { background: rgba(52,211,153,0.15); color: var(--good); }
.chooser-api   { background: rgba(124,139,255,0.15); color: var(--primary); }
.chooser-both  { background: rgba(45,212,191,0.12); color: var(--accent); }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: 0.85rem; color: var(--text-mut); margin-bottom: 1.2rem; }
.breadcrumb a { color: var(--text-soft); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 0.4rem; }

/* ---------- Demo ---------- */
.demo-wrap { padding: 2rem 0 3rem; }
.demo-panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.3rem; box-shadow: var(--shadow-sm);
}
.demo-input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; align-items: stretch; }
@media (max-width: 760px) { .demo-input-grid { grid-template-columns: 1fr; gap: 0; } }

.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.4rem; color: var(--text); }
.field .hint { font-weight: 400; color: var(--text-mut); font-size: 0.82rem; }
.field-fill { display: flex; flex-direction: column; height: 100%; margin-bottom: 0; }
textarea, input[type="text"], input[type="search"], select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; font-family: inherit; font-size: 0.95rem; resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
textarea { min-height: 200px; line-height: 1.55; }
.field-fill textarea { flex: 1; min-height: 230px; }
select { font-family: var(--mono); font-size: 0.85rem; }
.model-meta { margin: 0.45rem 0 0; font-size: 0.78rem; color: var(--text-mut); line-height: 1.4; }

/* Scenario / preset chips */
.preset-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.preset-btn {
  display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-soft);
  padding: 0.4rem 0.7rem; border-radius: 999px; font-size: 0.84rem; font-weight: 600;
  font-family: inherit; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.preset-btn:hover { color: var(--text); border-color: var(--primary); }
.preset-btn.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary-strong), #8b5cf6); }
.preset-diff {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.05rem 0.4rem; border-radius: 999px; background: var(--bg-elev); color: var(--text-mut);
}
.preset-btn.active .preset-diff { background: rgba(255,255,255,0.22); color: #fff; }
@media (max-width: 560px) {
  .preset-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }
  .preset-btn {
    justify-content: center;
    padding: 0.35rem 0.5rem;
    font-size: 0.76rem;
    border-radius: var(--radius-sm);
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }
  .preset-diff { font-size: 0.62rem; }
}
@media (max-width: 380px) {
  .preset-row { grid-template-columns: 1fr; }
}

.demo-toolbar { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; margin: 1rem 0 0.6rem; }
.btn-sm { padding: 0.42rem 0.85rem; font-size: 0.82rem; }

.status {
  font-size: 0.88rem; color: var(--text-soft); display: flex; align-items: center; gap: 0.5rem;
  min-height: 1.4rem;
}
.spinner {
  width: 15px; height: 15px; border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.load-panel {
  margin-top: 0.75rem; padding: 0.85rem 1rem; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.load-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.55rem; }
.load-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-mut); }
.load-model { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.load-meta { display: flex; flex-wrap: wrap; gap: 0.65rem 1rem; margin-top: 0.45rem; font-size: 0.8rem; font-family: var(--mono); color: var(--text-soft); }
.load-file { font-family: var(--sans); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress-bar { height: 6px; background: var(--bg-elev); border-radius: 999px; overflow: hidden; margin-top: 0.4rem; }
.progress-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary-strong), var(--accent)); transition: width 0.25s; }

.docs-editor textarea { display: block; }
@media (max-width: 760px) {
  .docs-editor > textarea { display: none; }
  .docs-editor .docs-list { display: block; }
}
.docs-list-items { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 0.55rem; max-height: 280px; overflow-y: auto; }
.docs-list-row { display: grid; grid-template-columns: 1.6rem 1fr 2rem; gap: 0.45rem; align-items: start; }
.docs-list-num { font-size: 0.78rem; color: var(--text-mut); font-weight: 700; padding-top: 0.55rem; text-align: center; }
.docs-list-input {
  min-height: 0; resize: vertical; font-size: 0.88rem; padding: 0.5rem 0.65rem;
}
.docs-list-del {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-mut);
  border-radius: 7px; width: 2rem; height: 2rem; cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.docs-list-del:hover { color: var(--danger); border-color: var(--danger); }
.docs-add-btn { width: 100%; }

/* Results output region */
.demo-output { margin-top: 2rem; }
.results-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.results-bar h3 { margin-bottom: 0.2rem; }
.results-sub { font-size: 0.88rem; margin: 0; }

/* Stat chips */
.stat-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.9rem 0 1.2rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.3rem 0.75rem; font-size: 0.82rem; color: var(--text); font-family: var(--mono);
}
.chip-k { color: var(--text-mut); font-family: var(--sans); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; }
.chip-soft { color: var(--text-soft); font-family: var(--sans); }

/* Before / after comparison */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.compare-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 960px) { .compare-grid-3 { grid-template-columns: 1fr; gap: 1.6rem; } }
@media (max-width: 760px) { .compare-grid { grid-template-columns: 1fr; gap: 1.6rem; } }

.check-row {
  display: flex; align-items: flex-start; gap: 0.55rem; cursor: pointer;
  font-weight: 600; font-size: 0.9rem; color: var(--text);
}
.check-row input { margin-top: 0.2rem; accent-color: var(--primary-strong); }
.doc-char-stats { font-size: 0.78rem; margin-top: 0.45rem; line-height: 1.4; }
.doc-char-stats.warn-chars { color: var(--warn); }
.doc-warning {
  font-size: 0.82rem; color: var(--warn); margin-top: 0.35rem; line-height: 1.4;
}
.docs-list-chars { display: block; font-size: 0.65rem; color: var(--text-mut); font-weight: 400; margin-top: 0.15rem; }
.docs-list-chars.over { color: var(--warn); font-weight: 700; }
.dual-compare { margin-top: 1.8rem; padding-top: 1.4rem; border-top: 1px solid var(--border-soft); }
.dual-diff { margin-top: 1.6rem; padding-top: 1.2rem; border-top: 1px solid var(--border-soft); }
.diff-empty { text-align: center; color: var(--text-mut); padding: 1rem 0.5rem; font-size: 0.9rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.dual-head { font-size: 1rem; margin: 0 0 1rem; color: var(--text-soft); }
.diff-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.diff-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.diff-table th, .diff-table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; }
.diff-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-mut); background: var(--bg-soft); }
.diff-table tr:last-child td { border-bottom: none; }
.diff-idx { color: var(--text-mut); font-weight: 700; white-space: nowrap; }
.diff-text { color: var(--text-soft); max-width: 28ch; }
.diff-score { font-size: 0.82rem; white-space: nowrap; }
.diff-up { color: var(--good); font-family: var(--mono); font-weight: 700; }
.diff-down { color: var(--danger); font-family: var(--mono); font-weight: 700; }
.mono { font-family: var(--mono); }

.models-toolbar { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; margin-bottom: 1rem; }
.models-filter {
  flex: 1; min-width: 180px; max-width: 320px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 0.55rem 0.75rem; font-size: 0.9rem;
}
/* Selects sit inline with the filter box rather than inheriting the full-width
   form-control rule and wrapping onto their own rows. */
.models-toolbar select { width: auto; min-width: 152px; flex: 0 0 auto; }
.models-count { font-size: 0.82rem; margin-left: auto; }
/* Nine columns need real room; the wrapper scrolls when the viewport can't give it. */
#models-table { min-width: 900px; }
#models-table td:first-child { white-space: nowrap; }
#models-table th[data-sort] { cursor: pointer; user-select: none; }
#models-table th[data-sort]::after { content: " ⇅"; opacity: 0.35; font-size: 0.75em; }
#models-table th.sort-asc::after { content: " ↑"; opacity: 1; }
#models-table th.sort-desc::after { content: " ↓"; opacity: 1; }
.demo-link-cell { white-space: nowrap; }

.changelog-entry { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border-soft); }
.changelog-entry:last-of-type { border-bottom: none; }
.footer-legal a { color: var(--text-mut); }
.footer-legal a:hover { color: var(--text); }
.benchmark-meta a { color: var(--primary); }

.compare-head {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mut); margin-bottom: 0.6rem;
}

/* Result rows */
.results { display: flex; flex-direction: column; gap: 0.65rem; }
.result-item {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.85rem 1rem; position: relative; overflow: hidden;
  animation: rise 0.35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.result-rankline { display: inline-flex; align-items: center; gap: 0.45rem; }
.result-item .rank {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  background: var(--bg-elev); color: var(--text-soft); font-weight: 700; font-size: 0.82rem;
}
.result-item.top .rank { background: linear-gradient(135deg, var(--primary-strong), var(--accent)); color: #fff; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.4rem; }
.result-score { font-family: var(--mono); font-weight: 700; font-size: 0.95rem; color: var(--accent); }
.result-score.lvl-good { color: var(--good); }
.result-score.lvl-mid { color: var(--warn); }
.result-score.lvl-low { color: var(--danger); }
.result-text { color: var(--text-soft); font-size: 0.93rem; }
.was { font-size: 0.78rem; }
.score-track { height: 5px; background: var(--bg-elev); border-radius: 999px; margin-top: 0.55rem; overflow: hidden; }
.score-track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-strong), var(--accent)); border-radius: 999px; transition: width 0.5s ease; }
.score-track.lvl-good > i { background: linear-gradient(90deg, #059669, var(--good)); }
.score-track.lvl-mid > i { background: linear-gradient(90deg, #d97706, var(--warn)); }
.score-track.lvl-low > i { background: linear-gradient(90deg, #dc2626, var(--danger)); }
.delta { font-size: 0.78rem; color: var(--text-mut); }
.delta.up { color: var(--good); }
.delta.down { color: var(--danger); }

/* Copy actions */
.copy-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.3rem; }
.copy-label { font-size: 0.84rem; color: var(--text-mut); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border-soft); padding: 2.5rem 0 3rem; margin-top: 3rem; color: var(--text-mut); font-size: 0.92rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 1.3rem; } }
.site-footer h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); margin: 0 0 0.7rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.4rem; }
.site-footer a { color: var(--text-mut); }
.site-footer a:hover { color: var(--text); }
.footer-bottom { border-top: 1px solid var(--border-soft); padding-top: 1.3rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }

/* ---------- Utilities ---------- */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.muted { color: var(--text-mut); }
.soft { color: var(--text-soft); }
.stack > * + * { margin-top: 1rem; }
.cta-band {
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(99,102,241,0.18), transparent 60%),
    radial-gradient(120% 140% at 100% 100%, rgba(45,212,191,0.14), transparent 60%),
    var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 2.4rem; text-align: center; margin: 2.5rem 0;
  box-shadow: var(--shadow-sm);
}
.cta-band h2 { margin-top: 0; }
.feature-list { list-style: none; padding: 0; }
.feature-list li { padding-left: 1.7rem; position: relative; margin-bottom: 0.6rem; color: var(--text-soft); }
.feature-list li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .result-item { animation: none; }
  a.card:hover, .btn-primary:hover, .btn-ghost:hover { transform: none; }
}
