/* ── Variables ──────────────────────────────────────────────── */
:root {
  --blue: #3B6EE8; --blue-dark: #2855C4; --blue-light: #EEF3FD;
  --ink: #0F1523;  --ink-2: #2D3748;    --ink-3: #64748B; --ink-4: #94A3B8;
  --border: #E2E8F0; --bg: #FAFBFD; --white: #FFFFFF;
  --green: #10B981; --amber: #F59E0B; --red: #EF4444;
  --r: 12px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'DM Mono', monospace; font-size: 13px; background: rgba(59,110,232,.08); color: var(--blue); padding: .15rem .4rem; border-radius: 4px; }

/* ── Nav ────────────────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 100; background: rgba(250,251,253,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 0 2rem; }
.nav-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; height: 56px; gap: 1.5rem; }
.logo { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--blue); flex-shrink: 0; }
.logo svg { height: 24px; width: auto; }
.nav-sep { color: var(--border); font-size: 18px; line-height: 1; }
.nav-section { font-size: 14px; font-weight: 500; color: var(--ink-3); }
.nav-links { display: flex; gap: .25rem; margin-left: auto; list-style: none; }
.nav-links a { display: block; padding: .35rem .8rem; font-size: 13px; font-weight: 500; color: var(--ink-3); text-decoration: none; border-radius: 6px; transition: color .15s, background .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--blue); background: var(--blue-light); }

/* ── Language switcher ──────────────────────────────────────── */
.lang-bar { display: flex; gap: .25rem; margin-left: 1rem; }
.lang-btn { padding: .3rem .55rem; font-size: 12px; font-weight: 500; color: var(--ink-4); background: none; border: none; cursor: pointer; border-radius: 4px; transition: all .15s; }
.lang-btn.active { color: var(--blue); background: var(--blue-light); }

/* ── Layout (sidebar + content) ─────────────────────────────── */
.layout { max-width: 1200px; margin: 0 auto; padding: 2rem; display: grid; grid-template-columns: 240px 1fr; gap: 3rem; align-items: start; }
.sidebar { position: sticky; top: 72px; }
.sidebar-section { margin-bottom: 1.75rem; }
.sidebar-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); margin-bottom: .6rem; padding-left: .5rem; }
.sidebar-links { list-style: none; display: flex; flex-direction: column; gap: .15rem; }
.sidebar-links a { display: block; padding: .4rem .5rem; font-size: 13px; color: var(--ink-3); text-decoration: none; border-radius: 6px; transition: all .15s; border-left: 2px solid transparent; }
.sidebar-links a:hover { color: var(--ink); background: var(--blue-light); }
.sidebar-links a.active { color: var(--blue); border-left-color: var(--blue); background: var(--blue-light); font-weight: 500; }
.content { min-width: 0; padding-bottom: 5rem; }

/* ── Page header ────────────────────────────────────────────── */
.page-header { margin-bottom: 3rem; }
.page-tag { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--blue); margin-bottom: .5rem; }
.page-title { font-size: 2rem; font-weight: 600; letter-spacing: -.03em; color: var(--ink); margin-bottom: .75rem; line-height: 1.2; }
.page-sub { font-size: 1rem; color: var(--ink-3); line-height: 1.7; max-width: 560px; }

/* ── Steps ──────────────────────────────────────────────────── */
.step-block { margin-bottom: 3.5rem; }
.step-header { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.step-num { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-title { font-size: 1.2rem; font-weight: 600; color: var(--ink); padding-top: .4rem; }
.step-body p { font-size: 15px; color: var(--ink-2); line-height: 1.75; margin-bottom: 1rem; }
.step-body p:last-child { margin-bottom: 0; }

/* ── Screenshot placeholder ─────────────────────────────────── */
.screenshot { background: var(--white); border: 2px dashed var(--border); border-radius: var(--r); padding: 2.5rem 2rem; text-align: center; margin: 1.5rem 0; position: relative; }
.screenshot-label { position: absolute; top: .6rem; left: .75rem; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-4); }
.screenshot-icon { font-size: 1.75rem; margin-bottom: .5rem; }
.screenshot-hint { font-size: 13px; color: var(--ink-4); font-style: italic; }
.screenshot-filename { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--blue); margin-top: .3rem; display: block; }

/* ── Notes ──────────────────────────────────────────────────── */
.note { display: flex; gap: .75rem; padding: 1rem 1.25rem; border-radius: 8px; margin: 1.25rem 0; font-size: 14px; line-height: 1.6; }
.note--info  { background: var(--blue-light); border: 1px solid rgba(59,110,232,.2); color: var(--ink-2); }
.note--tip   { background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.25); color: var(--ink-2); }
.note--warn  { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.25); color: var(--ink-2); }
.note-icon { flex-shrink: 0; font-size: 16px; margin-top: .1rem; }

/* ── Tags ───────────────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.tag { font-size: 12px; font-weight: 500; padding: .3rem .75rem; border-radius: 4px; border: 1px solid var(--border); color: var(--ink-3); background: var(--white); }
.tag.green  { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: #059669; }
.tag.amber  { background: rgba(245,158,11,.1);  border-color: rgba(245,158,11,.3);  color: #B45309; }
.tag.blue   { background: var(--blue-light);     border-color: rgba(59,110,232,.3);  color: var(--blue); }

/* ── Divider ────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 2.5rem 0; }
.section-anchor { font-size: 1.1rem; font-weight: 600; color: var(--ink); margin: 1.5rem 0 .75rem; letter-spacing: -.02em; }

/* ── Field tables ───────────────────────────────────────────── */
.field-table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin: 1.25rem 0; }
.field-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.field-table th { padding: .65rem 1rem; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-4); background: var(--bg); border-bottom: 1px solid var(--border); }
.field-table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); color: var(--ink-2); line-height: 1.5; vertical-align: top; }
.field-table tr:last-child td { border-bottom: none; }

/* ── Code blocks ────────────────────────────────────────────── */
.cb { background: #0F1523; border-radius: var(--r); padding: 1.25rem 1.5rem; overflow-x: auto; margin: 1.25rem 0; }
.cb pre { font-family: 'DM Mono', monospace; font-size: 12px; line-height: 1.8; color: #CBD5E1; }
.cb .h    { color: #6B93F0; }
.cb .ok   { color: #86EFAC; }
.cb .err  { color: #FCA5A5; }
.cb .warn { color: #FCD34D; }
.cb .cm   { color: #64748B; }

/* ── Convergence scale (results page) ───────────────────────── */
.conv-bar { background: var(--border); border-radius: 999px; height: 10px; margin: 1rem 0; overflow: hidden; }
.conv-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--red), var(--amber) 50%, var(--green)); }
.conv-scale { display: grid; grid-template-columns: repeat(5,1fr); gap: .5rem; margin: 1rem 0; }
.conv-tier { padding: .55rem; border-radius: 6px; text-align: center; }
.conv-val { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 600; margin-bottom: .2rem; }
.conv-lbl { font-size: 11px; }
.t-poor  { background: rgba(239,68,68,.08);   color: var(--red); }
.t-low   { background: rgba(245,158,11,.1);   color: #B45309; }
.t-fair  { background: rgba(245,158,11,.06);  color: #92400E; }
.t-good  { background: rgba(16,185,129,.08);  color: #047857; }
.t-great { background: rgba(16,185,129,.12);  color: #065F46; }

/* ── Diff colour coding (results page) ──────────────────────── */
.dc { display: inline-block; padding: .15rem .5rem; border-radius: 4px; font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 600; }
.dc-ok   { background: rgba(16,185,129,.12);  color: #065F46; }
.dc-fail { background: rgba(239,68,68,.1);    color: #991B1B; }
.dc-null { background: #F1F5F9; color: var(--ink-4); }

/* ── index.html cards ───────────────────────────────────────── */
.cards { max-width: 1100px; margin: 0 auto; padding: 0 2rem 5rem; display: grid; grid-template-columns: repeat(3,1fr); gap: 1.5rem; }
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); padding: 2rem; text-decoration: none; color: inherit; transition: all .2s; display: flex; flex-direction: column; gap: 1.25rem; }
.card:hover { border-color: var(--blue); box-shadow: 0 4px 24px rgba(59,110,232,.1); transform: translateY(-2px); }
.card-icon { width: 48px; height: 48px; border-radius: 10px; background: var(--blue-light); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.card-body { flex: 1; }
.card-title { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: .5rem; }
.card-desc { font-size: 14px; color: var(--ink-3); line-height: 1.6; }
.card-footer { display: flex; align-items: center; gap: .4rem; font-size: 13px; font-weight: 500; color: var(--blue); }
.card-arrow { font-size: 16px; transition: transform .15s; }
.card:hover .card-arrow { transform: translateX(3px); }

/* ── index.html quick links ─────────────────────────────────── */
.quick { max-width: 1100px; margin: 0 auto; padding: 0 2rem 5rem; }
.quick-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); margin-bottom: 1.25rem; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: .75rem; }
.quick-link { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; background: var(--white); border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 500; transition: all .15s; }
.quick-link:hover { border-color: var(--blue); color: var(--blue); }
.quick-link-icon { width: 32px; height: 32px; border-radius: 6px; background: var(--blue-light); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }

/* ── index.html hero ────────────────────────────────────────── */
.hero { max-width: 1100px; margin: 0 auto; padding: 4rem 2rem 3rem; text-align: center; }
.hero-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--blue); margin-bottom: .75rem; }
.hero h1 { font-size: clamp(2rem,4vw,3rem); font-weight: 600; letter-spacing: -.03em; color: var(--ink); margin-bottom: 1rem; line-height: 1.15; }
.hero p { font-size: 1.05rem; color: var(--ink-3); max-width: 520px; margin: 0 auto 2.5rem; line-height: 1.7; }
.search-box { display: flex; align-items: center; max-width: 460px; margin: 0 auto; background: var(--white); border: 1.5px solid var(--border); border-radius: 10px; padding: .6rem 1rem; gap: .75rem; box-shadow: 0 1px 3px rgba(15,21,35,.06); }
.search-box input { border: none; outline: none; background: transparent; font-family: inherit; font-size: 14px; color: var(--ink); flex: 1; }
.search-icon { color: var(--ink-4); flex-shrink: 0; }

/* ── index.html nav extras ──────────────────────────────────── */
.btn-nav { display: inline-flex; align-items: center; padding: .4rem 1rem; border-radius: 7px; font-size: 13px; font-weight: 600; background: var(--blue); color: #fff; text-decoration: none; margin-left: 1rem; transition: background .15s; }
.btn-nav:hover { background: var(--blue-dark); }
.nav-badge { font-size: 11px; font-weight: 600; background: var(--blue-light); color: var(--blue); padding: .2rem .6rem; border-radius: 4px; letter-spacing: .04em; }

/* ── faq.html empty state ───────────────────────────────────── */
.empty-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 2rem; text-align: center; }
.empty-icon { font-size: 3rem; margin-bottom: 1.5rem; opacity: .5; }
.empty-title { font-size: 1.5rem; font-weight: 600; color: var(--ink); margin-bottom: .75rem; letter-spacing: -.02em; }
.empty-sub { font-size: 1rem; color: var(--ink-3); line-height: 1.7; max-width: 480px; margin-bottom: 2rem; }
.empty-links { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.btn-outline { display: inline-flex; align-items: center; gap: .4rem; padding: .65rem 1.25rem; border-radius: 8px; border: 1.5px solid var(--border); color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; transition: all .15s; }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-primary { display: inline-flex; align-items: center; gap: .4rem; padding: .65rem 1.25rem; border-radius: 8px; background: var(--blue); color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; transition: background .15s; border: none; cursor: pointer; }
.btn-primary:hover { background: var(--blue-dark); }

/* ── faq.html accordion ─────────────────────────────────────── */
.faq-section { max-width: 760px; margin: 0 auto; padding: 3rem 2rem; display: none; }
.faq-item { border-bottom: 1px solid var(--border); padding: 1.25rem 0; }
.faq-item:last-child { border-bottom: none; }
.faq-q { font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer; display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; user-select: none; }
.faq-q:hover { color: var(--blue); }
.faq-chevron { flex-shrink: 0; transition: transform .2s; font-style: normal; margin-top: .15rem; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-a { font-size: 14px; color: var(--ink-3); line-height: 1.75; max-height: 0; overflow: hidden; transition: max-height .3s ease, padding .2s; }
.faq-item.open .faq-a { max-height: 500px; padding-top: .75rem; }

/* ── api.html specifics ─────────────────────────────────────── */
.api-toolbar { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1.5rem; background: var(--white); border-bottom: 1px solid var(--border); gap: 1rem; flex-wrap: wrap; }
.api-toolbar-left { display: flex; align-items: center; gap: 1rem; }
.api-server-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-4); }
.api-server-select { font-family: 'DM Mono', monospace; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; padding: .35rem .75rem; background: var(--bg); color: var(--ink); cursor: pointer; outline: none; }
.api-server-select:focus { border-color: var(--blue); }
.api-badge { display: inline-flex; align-items: center; gap: .4rem; font-size: 12px; font-weight: 600; padding: .3rem .75rem; border-radius: 4px; background: var(--blue-light); color: var(--blue); border: 1px solid rgba(59,110,232,.2); }
.api-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.btn-spec { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .9rem; font-size: 13px; font-weight: 500; color: var(--ink-3); border: 1.5px solid var(--border); border-radius: 6px; text-decoration: none; transition: all .15s; }
.btn-spec:hover { border-color: var(--blue); color: var(--blue); }
#api-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; padding: 4rem 2rem; text-align: center; gap: 1rem; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#api-loading p { font-size: 14px; color: var(--ink-3); }
#api-error { display: none; flex-direction: column; align-items: center; justify-content: center; flex: 1; padding: 4rem 2rem; text-align: center; gap: 1rem; }
#api-error h2 { font-size: 1.25rem; font-weight: 600; color: var(--ink); }
#api-error p { font-size: 14px; color: var(--ink-3); max-width: 440px; line-height: 1.7; }
#api-error code { font-family: 'DM Mono', monospace; font-size: 13px; background: var(--blue-light); color: var(--blue); padding: .2rem .5rem; border-radius: 4px; }
.btn-retry { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1.25rem; font-size: 14px; font-weight: 600; background: var(--blue); color: #fff; border: none; border-radius: 8px; cursor: pointer; transition: background .15s; }
.btn-retry:hover { background: var(--blue-dark); }
#redoc-container { flex: 1; }
redoc-container, redoc { display: block; }

/* ── footer ─────────────────────────────────────────────────── */
footer { padding: 2rem; border-top: 1px solid var(--border); text-align: center; }
footer p { font-size: 13px; color: var(--ink-4); }
footer a { color: var(--ink-3); text-decoration: none; }
footer a:hover { color: var(--blue); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .nav-links { display: none; }
  .conv-scale { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 768px) {
  .cards { grid-template-columns: 1fr; }
}

/* ── ft-wrap / ft aliases (results.html shorthand) ────── */
.ft-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin: 1.25rem 0; }
.ft { width: 100%; border-collapse: collapse; font-size: 14px; }
.ft th { padding: .65rem 1rem; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-4); background: var(--bg); border-bottom: 1px solid var(--border); }
.ft td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); color: var(--ink-2); line-height: 1.5; vertical-align: top; }
.ft tr:last-child td { border-bottom: none; }
.ft td.type { font-size: 12px; color: var(--ink-4); white-space: nowrap; }
