/* Synapse docs site. Dark-first, brand violet/indigo. */
:root {
  --brand: #6d5bff;
  --brand-2: #4f79ff;
  --brand-3: #9b6bff;
  --violet: #6056a5;
  --bg: #08080c;
  --bg-2: #0b0b12;
  --panel: #101019;
  --panel-2: #14141f;
  --border: #22222e;
  --border-2: #2c2c3c;
  --fg: #f4f4f8;
  --fg-muted: #a6a6b8;
  --fg-faint: #6f6f82;
  --code-bg: #0e0e17;
  --critical: #f2555a;
  --high: #ff8b3d;
  --medium: #f5c451;
  --low: #52b6ff;
  --ok: #46d19e;
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1180px;
  --shadow: 0 24px 60px -20px rgba(0,0,0,.7);
  --grad: linear-gradient(115deg, var(--brand-3), var(--brand) 45%, var(--brand-2));
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--font);
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
[data-theme="light"] {
  --bg: #f7f7fb;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f4f4f9;
  --border: #e6e6ef;
  --border-2: #d8d8e6;
  --fg: #14141d;
  --fg-muted: #55556a;
  --fg-faint: #8a8a9e;
  --code-bg: #14141d;
  --shadow: 0 24px 60px -24px rgba(60,50,120,.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { color: var(--brand-3); }
h1,h2,h3,h4 { font-family: var(--display); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
code, pre, kbd { font-family: var(--mono); font-size: .875em; }
img { max-width: 100%; display: block; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 20px; height: 64px; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand img { height: 26px; width: auto; }
.brand .logo-light { display: none; }
[data-theme="light"] .brand .logo-dark { display: none; }
[data-theme="light"] .brand .logo-light { display: block; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a { color: var(--fg-muted); font-size: .9rem; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.nav-links a:hover { color: var(--fg); background: var(--panel-2); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel); color: var(--fg-muted);
  cursor: pointer; transition: .15s;
}
.icon-btn:hover { color: var(--fg); border-color: var(--border-2); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-sun { display: none; }
[data-theme="light"] .theme-sun { display: block; }
[data-theme="light"] .theme-moon { display: none; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: .9rem;
  cursor: pointer; border: 1px solid transparent; transition: .18s; white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 24px -8px var(--brand); }
.btn-primary:hover { color: #fff; filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: var(--panel); border-color: var(--border); color: var(--fg); }
.btn-ghost:hover { border-color: var(--border-2); color: var(--fg); }
.nav-toggle { display: none; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 96px 0 72px; text-align: center; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(60% 60% at 50% -10%, color-mix(in srgb, var(--brand) 34%, transparent), transparent 70%),
    radial-gradient(40% 50% at 85% 10%, color-mix(in srgb, var(--brand-2) 22%, transparent), transparent 70%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: .5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 0%, #000, transparent 75%);
  mask-image: radial-gradient(70% 60% at 50% 0%, #000, transparent 75%);
}
.hero > .container { position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 26px;
  padding: 6px 14px; border-radius: 999px; font-size: .8rem; font-weight: 500;
  color: var(--fg-muted); background: var(--panel); border: 1px solid var(--border);
}
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.hero-logo { height: 120px; width: auto; margin: 0 auto 8px; filter: drop-shadow(0 12px 40px color-mix(in srgb, var(--brand) 50%, transparent)); }
.hero .logo-light { display: none; }
[data-theme="light"] .hero .logo-dark { display: none; }
[data-theme="light"] .hero .logo-light { display: block; margin: 0 auto 8px; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin: 18px 0 0; }
.hero .tagline {
  font-family: var(--mono); letter-spacing: .28em; text-transform: uppercase;
  font-size: clamp(.7rem, 1.6vw, .92rem); color: var(--brand-3); margin-top: 14px; font-weight: 500;
}
.hero p.lead { max-width: 640px; margin: 22px auto 0; font-size: 1.12rem; color: var(--fg-muted); }
.hero-cta { display: flex; gap: 12px; justify-content: center; margin-top: 34px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 34px; justify-content: center; margin-top: 52px; flex-wrap: wrap; }
.hero-stats .stat .n { font-family: var(--display); font-size: 1.7rem; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-stats .stat .l { font-size: .82rem; color: var(--fg-faint); margin-top: 2px; }

/* ---------- section scaffolding ---------- */
section { padding: 74px 0; border-top: 1px solid var(--border); }
.section-tag { font-family: var(--mono); font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--brand-3); font-weight: 500; }
.section-head { max-width: 720px; margin-bottom: 44px; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 12px 0 0; }
.section-head p { color: var(--fg-muted); font-size: 1.05rem; margin: 14px 0 0; }
.section-alt { background: var(--bg-2); }

/* ---------- pill row ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 9px; padding: 9px 15px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); font-size: .9rem; font-weight: 500; color: var(--fg); }
.pill svg { width: 16px; height: 16px; color: var(--brand-3); }

/* ---------- feature grid ---------- */
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; transition: .2s;
}
.card:hover { border-color: var(--border-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.card .ico {
  width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand-3); margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
}
.card .ico svg { width: 21px; height: 21px; }
.card h3 { font-size: 1.08rem; margin: 0 0 8px; }
.card p { margin: 0; color: var(--fg-muted); font-size: .93rem; }

/* ---------- showcase ---------- */
.shot-group { margin-top: 40px; }
.shot-group h3 { font-size: 1.15rem; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.shot-group h3 .n { font-family: var(--mono); font-size: .8rem; color: var(--brand-3); border: 1px solid var(--border-2); border-radius: 6px; padding: 1px 7px; }
.shot-group > p { color: var(--fg-muted); margin: 0 0 20px; font-size: .95rem; }
.frame {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  background: var(--panel); box-shadow: var(--shadow);
}
.frame .bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.frame .bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--border-2); display: inline-block; }
.frame .bar i:nth-child(1){ background:#f2555a; } .frame .bar i:nth-child(2){ background:#f5c451; } .frame .bar i:nth-child(3){ background:#46d19e; }
.frame .bar .u { margin-left: 10px; font-family: var(--mono); font-size: .74rem; color: var(--fg-faint); }
.frame img { width: 100%; height: auto; display: block; background: #0a0a0f; }
.frame + .cap { text-align: center; color: var(--fg-faint); font-size: .84rem; margin-top: 10px; }
.shot-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---------- steps / code ---------- */
.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: start; }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 20px; }
.step { display: flex; gap: 16px; }
.step .num { counter-increment: s; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff; font-family: var(--display); font-weight: 700; font-size: .9rem; display: flex; align-items: center; justify-content: center; }
.step .num::before { content: counter(s); }
.step h4 { margin: 3px 0 4px; font-size: 1rem; }
.step p { margin: 0; color: var(--fg-muted); font-size: .92rem; }
pre {
  background: var(--code-bg); color: #e6e6f0; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px 20px; overflow-x: auto; margin: 0; font-size: .84rem; line-height: 1.7;
}
[data-theme="light"] pre { color: #e6e6f0; }
pre .c { color: #6f6f82; }
pre .k { color: var(--brand-3); }
pre .s { color: #7fd6a6; }
.codeblock { position: relative; }
.codeblock .lbl { font-family: var(--mono); font-size: .72rem; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; min-width: 640px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--panel-2); font-family: var(--display); font-weight: 600; font-size: .82rem; color: var(--fg); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
td code { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand-3); padding: 2px 6px; border-radius: 5px; white-space: nowrap; }
td .def { color: var(--fg-faint); font-family: var(--mono); font-size: .8rem; }
.cfg-cat { margin-top: 30px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.cfg-cat .req { font-family: var(--font); font-size: .7rem; font-weight: 600; color: var(--critical); border: 1px solid color-mix(in srgb, var(--critical) 40%, transparent); background: color-mix(in srgb, var(--critical) 12%, transparent); padding: 2px 8px; border-radius: 999px; letter-spacing: .04em; }

/* ---------- requirements list ---------- */
.req-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.req-item { display: flex; gap: 14px; padding: 18px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.req-item .ico { flex: none; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand-3); }
.req-item .ico svg { width: 19px; height: 19px; }
.req-item h4 { margin: 0 0 3px; font-size: .98rem; }
.req-item p { margin: 0; color: var(--fg-muted); font-size: .88rem; }
.callout { display: flex; gap: 13px; padding: 16px 18px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--brand) 9%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent); margin-top: 22px; }
.callout svg { flex: none; width: 19px; height: 19px; color: var(--brand-3); margin-top: 2px; }
.callout p { margin: 0; font-size: .9rem; color: var(--fg-muted); }
.callout strong { color: var(--fg); }

/* ---------- architecture ---------- */
.arch-flow { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 30px; font-family: var(--mono); }
.arch-flow .node { padding: 12px 20px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--panel); font-weight: 500; font-size: .9rem; }
.arch-flow .arrow { color: var(--brand-3); font-size: 1.2rem; }

/* ---------- contributors ---------- */
.contrib-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; }
.contrib {
  text-align: center; padding: 26px 18px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border); transition: .2s;
}
.contrib:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow); }
.contrib .av { position: relative; width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px; background: var(--grad); font-family: var(--display); font-weight: 700; font-size: 1.5rem; color: #fff; }
.contrib .av::before { content: attr(data-initials); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.contrib .av img { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); border-radius: 50%; object-fit: cover; background: var(--panel); }
.contrib .name { font-family: var(--display); font-weight: 600; font-size: 1rem; }
.contrib .role { font-size: .82rem; color: var(--fg-muted); margin-top: 2px; }
.contrib .gh { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; font-size: .82rem; color: var(--fg-faint); }
.contrib .gh svg { width: 14px; height: 14px; }
.contrib .tag { display: inline-block; margin-top: 12px; font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; letter-spacing: .03em; }
.tag-eng { background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--brand-3); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.tag-design { background: color-mix(in srgb, var(--brand-2) 15%, transparent); color: var(--brand-2); border: 1px solid color-mix(in srgb, var(--brand-2) 30%, transparent); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 48px 0 40px; background: var(--bg-2); }
.footer-top { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; align-items: flex-start; }
.footer img { height: 30px; width: auto; }
.footer .logo-light { display: none; }
[data-theme="light"] .footer .logo-dark { display: none; }
[data-theme="light"] .footer .logo-light { display: block; }
.footer p { color: var(--fg-faint); font-size: .88rem; max-width: 340px; margin: 14px 0 0; }
.footer-links { display: flex; gap: 60px; flex-wrap: wrap; }
.footer-col h5 { font-family: var(--display); font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--fg-faint); margin: 0 0 14px; }
.footer-col a { display: block; color: var(--fg-muted); font-size: .9rem; margin-bottom: 9px; }
.footer-col a:hover { color: var(--fg); }
.footer-bottom { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--fg-faint); font-size: .84rem; }
.warn-banner { background: color-mix(in srgb, var(--high) 12%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--high) 30%, transparent); color: var(--fg); font-size: .84rem; text-align: center; padding: 9px 16px; }
.warn-banner b { color: var(--high); }

/* ---------- overflow hardening (all viewports) ---------- */
/* Grid/flex items default to min-width:auto and refuse to shrink below their content
   (a long code line, a wide table). That forces the whole page wider than a phone and
   clips it. min-width:0 lets the item shrink so its content wraps or scrolls in-place. */
html { overflow-x: hidden; }
.split, .steps, .step, .grid, .req-grid, .contrib-grid, .shot-2, .footer-top, .hero-cta, .pills, .arch-flow { min-width: 0; }
.split > *, .step > div, .grid > *, .card, .codeblock, .frame, .table-wrap, .contrib, .req-item, .pill { min-width: 0; }
pre { max-width: 100%; }
.hero .lead, .section-head p, .card p, .step p, .req-item p, .callout p, .shot-group > p, .contrib .role { overflow-wrap: break-word; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid-3, .grid-2, .req-grid, .shot-2, .split { grid-template-columns: 1fr; }
  .contrib-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 12px; gap: 2px; max-height: calc(100vh - 64px); overflow-y: auto; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 14px; }
  .nav-toggle { display: inline-flex; }
  .hero { padding: 60px 0 48px; }
  section { padding: 54px 0; }
  .split { gap: 28px; }
  .footer-links { gap: 36px; }
}
@media (max-width: 640px) {
  .container { padding: 0 18px; }
  .nav-inner { padding: 0 18px; gap: 12px; }
  .hero-stats { gap: 18px 26px; }
  .hero .tagline { letter-spacing: .16em; }
  .frame .bar .u { display: none; }
  .cfg-cat { flex-wrap: wrap; }
  .section-head h2, .hero h1 { overflow-wrap: break-word; }
}
@media (max-width: 560px) {
  .hero-logo { height: 78px; }
  .btn-github-text { display: none; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { justify-content: center; }
  .contrib-grid { grid-template-columns: 1fr; }
  /* clean 2x2 stats instead of an uneven 3 + 1 */
  .hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .hero-stats .stat { text-align: center; }
}
@media (max-width: 400px) {
  .hero .tagline { letter-spacing: .1em; font-size: .66rem; }
  .hero-stats { gap: 16px 20px; }
}
