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

:root {
  --bg: #0b0d17;
  --bg-soft: #11131f;
  --bg-card: #161927;
  --bg-elev: #1c2032;
  --border: #262a3d;
  --border-soft: #1f2335;
  --text: #e7e9f3;
  --text-soft: #aab0c6;
  --text-mut: #767d96;
  --primary: #7c8bff;
  --primary-strong: #6366f1;
  --primary-soft: rgba(124, 139, 255, 0.12);
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --warn: #fbbf24;
  --danger: #f87171;
  --good: #34d399;
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1080px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.55);
  --mono: "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  -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.16), 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; }

img { max-width: 100%; }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 0.5em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 2.2em 0 0.7em; }
h3 { font-size: 1.25rem; margin: 1.8em 0 0.5em; }
p { margin: 0 0 1.1em; }

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: #c7d0ff;
}

pre {
  background: #0c0e18;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.6;
}
pre code { background: none; border: none; padding: 0; color: #d7ddff; }

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(12px);
  background: rgba(11, 13, 23, 0.72);
  border-bottom: 1px solid var(--border-soft);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px; gap: 1rem;
}
.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;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  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.35rem; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--text-soft); padding: 0.45rem 0.7rem; border-radius: 8px; font-size: 0.95rem; font-weight: 500;
}
.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;
}

.lang-toggle {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-soft);
  height: 36px; min-width: 50px; padding: 0 0.7rem; border-radius: 9px; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em; transition: all 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
}
.lang-toggle::before { content: "🌐"; font-size: 0.85rem; }
.lang-toggle:hover { color: var(--text); border-color: var(--primary); background: var(--bg-elev); }
.nav-right { display: flex; align-items: center; gap: 0.5rem; }

@media (max-width: 780px) {
  .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;
  }
  .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;
}
.hero h1 { background: linear-gradient(120deg, #fff 20%, #aab0ff 60%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: clamp(1.05rem, 2.2vw, 1.3rem); 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.7rem 1.3rem; border-radius: 10px; font-weight: 600; font-size: 0.98rem;
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease; text-decoration: none;
}
.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); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 1.1rem; }
.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.4rem 1.4rem; transition: border-color 0.15s, transform 0.15s;
}
a.card { color: inherit; display: block; }
a.card:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-2px); }
.card h3 { margin-top: 0; }
.card .ico { font-size: 1.6rem; margin-bottom: 0.4rem; display: block; }
.card p { color: var(--text-soft); margin-bottom: 0; font-size: 0.96rem; }
.card .tag-row { margin-top: 0.9rem; }

.section { padding: 2.5rem 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.6rem; border-radius: 999px;
  background: var(--bg-elev); color: var(--text-soft); border: 1px solid var(--border); margin-right: 0.3rem;
}
.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.3); background: var(--primary-soft); }

/* ---------- 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: 1.18rem; 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.4rem 0 0.4rem 1.2rem;
  color: var(--text-soft); background: var(--bg-soft); border-radius: 0 8px 8px 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; }

/* 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); }

/* ---------- 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.7rem 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; }
tr:last-child td { border-bottom: none; }
td { color: var(--text-soft); }
tbody tr:hover { background: var(--bg-soft); }

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

/* ---------- Demo ---------- */
.demo-wrap { padding: 2rem 0 3rem; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; align-items: start; }
@media (max-width: 880px) { .demo-grid { grid-template-columns: 1fr; } }

.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; }
textarea, input[type="text"], 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;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 160px; line-height: 1.5; }
select { font-family: var(--mono); font-size: 0.85rem; }

.demo-toolbar { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }

.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); } }

.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; }

/* 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-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; margin-right: 0.6rem;
}
.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-text { color: var(--text-soft); font-size: 0.93rem; }
.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; }
.delta { font-size: 0.78rem; color: var(--text-mut); margin-left: 0.5rem; }
.delta.up { color: var(--good); }
.delta.down { color: var(--danger); }

/* ---------- 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: linear-gradient(135deg, rgba(99,102,241,0.14), rgba(45,212,191,0.1));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 2.2rem; text-align: center; margin: 2.5rem 0;
}
.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; }
