:root {
  --bg: #f6f6fb;
  --surface: #ffffff;
  --surface-2: #eeeef8;
  --text: #1c1b2e;
  --muted: #5d5b75;
  --line: #dcdcec;
  --brand: #5b4ae0;
  --brand-2: #8a6cf0;
  --brand-ink: #ffffff;
  --shadow: 0 10px 30px rgba(40, 30, 120, .12);
  --radius: 14px;
  --hero-glow: radial-gradient(60rem 30rem at 70% -10%, rgba(91,74,224,.18), transparent 60%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12111f; --surface: #1b1a2e; --surface-2: #242340; --text: #ececf8; --muted: #a3a1c0;
    --line: #2f2e4d; --brand: #8b7bff; --brand-2: #b19bff; --brand-ink: #11101f;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --hero-glow: radial-gradient(60rem 30rem at 70% -10%, rgba(139,123,255,.22), transparent 60%);
  }
}
:root[data-theme="dark"] {
  --bg: #12111f; --surface: #1b1a2e; --surface-2: #242340; --text: #ececf8; --muted: #a3a1c0;
  --line: #2f2e4d; --brand: #8b7bff; --brand-2: #b19bff; --brand-ink: #11101f;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --hero-glow: radial-gradient(60rem 30rem at 70% -10%, rgba(139,123,255,.22), transparent 60%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
img { max-width: 100%; display: block; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.nav a.ext { color: var(--text); }
.theme-btn, .menu-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; margin-left: 6px; }
.theme-btn:hover, .menu-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }
@media (max-width: 820px) {
  .menu-btn { display: grid; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .theme-btn { align-self: flex-start; margin: 8px 0 0; }
}

/* Generic */
main { outline: none; min-height: 70vh; }
section { padding: 64px 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 40rem; }
.center { text-align: center; }
.center .lead { margin-inline: auto; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 10px; font-weight: 600; text-decoration: none; border: 1px solid var(--line); color: var(--text); background: var(--surface); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

/* Hero */
.hero { background: var(--hero-glow); padding: 72px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: center; }
.hero .shot { margin-top: 8px; }
@media (min-width: 980px) { .hero-grid { grid-template-columns: 5fr 7fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.chip { background: var(--surface); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; font-size: .88rem; color: var(--muted); }

/* Browser frame screenshots */
.frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.frame .dots { display: flex; gap: 6px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.frame .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: block; }
.frame img { width: 100%; height: auto; cursor: zoom-in; }
.frame button { all: unset; display: block; width: 100%; cursor: zoom-in; }

/* Cards */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; text-decoration: none; color: inherit; display: block; transition: transform .15s, box-shadow .15s, border-color .15s; }
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.card h3 { display: flex; align-items: center; gap: 10px; }
.card p { color: var(--muted); margin: 0; }
.ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 1.15rem; flex: none; }

.band { background: var(--surface); border-block: 1px solid var(--line); }
.points { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.points h3 { margin-bottom: .3em; }
.points p { color: var(--muted); }

/* Features page */
.feat-layout { display: grid; gap: 28px; grid-template-columns: 1fr; padding-top: 40px; }
@media (min-width: 900px) { .feat-layout { grid-template-columns: 230px 1fr; } }
.side { display: flex; flex-wrap: wrap; gap: 6px; align-self: start; }
@media (min-width: 900px) { .side { flex-direction: column; position: sticky; top: 80px; } }
.side a { text-decoration: none; color: var(--muted); padding: 9px 12px; border-radius: 9px; font-weight: 500; display: flex; gap: 10px; align-items: center; border: 1px solid transparent; }
.side a:hover { background: var(--surface-2); color: var(--text); }
.side a.active { background: var(--surface); border-color: var(--line); color: var(--brand); box-shadow: var(--shadow); }
.side .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.feat h2 { margin-top: 0; }
.feat ul { padding-left: 1.2em; }
.feat li { margin-bottom: .5em; }
.feat .frame { margin: 24px 0; }
.note { border-left: 4px solid var(--brand); background: var(--surface); padding: 12px 16px; border-radius: 0 10px 10px 0; color: var(--muted); }

/* Gallery */
.gallery { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.gallery figure { margin: 0; }
.gallery figcaption { padding: 10px 4px 0; color: var(--muted); font-size: .95rem; }
.gallery figcaption strong { color: var(--text); display: block; }

/* Install */
.steps { counter-reset: s; display: grid; gap: 20px; max-width: 52rem; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 22px 70px; position: relative; }
.step::before { counter-increment: s; content: counter(s); position: absolute; left: 20px; top: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
.step h3 { margin-bottom: .3em; }
.step p:last-child { margin-bottom: 0; }
.codebox { position: relative; margin: 12px 0; }
.codebox pre { margin: 0; background: #14132a; color: #e8e8ff; padding: 14px 16px; padding-right: 76px; border-radius: 10px; overflow-x: auto; font: .88rem/1.55 ui-monospace, "Cascadia Code", Consolas, monospace; }
.codebox pre code { background: none; padding: 0; color: inherit; font-size: inherit; white-space: pre; }
.copy { position: absolute; right: 8px; top: 8px; background: #2b2a4d; color: #fff; border: 0; border-radius: 7px; padding: 5px 10px; font-size: .8rem; cursor: pointer; }
.copy:hover { background: #3a3965; }
table.tbl { border-collapse: collapse; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: var(--surface-2); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tbl tr:last-child td { border-bottom: 0; }

/* Architecture */
.arch { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: stretch; margin: 28px 0; }
@media (min-width: 900px) { .arch { grid-template-columns: 1fr auto 1.2fr auto 1.2fr auto 1.2fr; } }
.node { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.node strong { display: block; font-size: 1.05rem; }
.node small { color: var(--muted); display: block; margin-top: 6px; }
.node.root { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.arrow { display: grid; place-items: center; color: var(--muted); font-size: .8rem; text-align: center; padding: 0 4px; }
.arrow span { display: block; }
@media (max-width: 899px) { .arrow { transform: rotate(90deg); height: 40px; } .arrow span { transform: rotate(-90deg); white-space: nowrap; } }

.footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .92rem; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.foot-links { display: flex; gap: 18px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(8, 7, 20, .92); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: min(1500px, 92vw); text-align: center; }
.lightbox img { max-height: 82vh; width: auto; margin-inline: auto; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.lightbox figcaption { color: #d9d8f2; margin-top: 12px; }
.lb-close, .lb-nav { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 50%; width: 44px; height: 44px; font-size: 1.7rem; cursor: pointer; line-height: 1; }
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.25); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; }
.lb-next { right: 16px; top: 50%; }

.fade { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fade { animation: none; } html { scroll-behavior: auto; } }
