:root {
  --bg: #fbfbfd; --surface: #ffffff; --text: #16161d; --muted: #5d5d6c; --line: #e6e6ee;
  --accent: #5b5bd6; --accent-ink: #ffffff; --accent-soft: #eeeeff; --ok: #1f9d6b;
  --radius: 16px; --shadow: 0 1px 2px rgba(20,20,40,.04), 0 8px 24px rgba(20,20,40,.06);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f0f14; --surface: #17171f; --text: #ececf3; --muted: #a0a0b2; --line: #2a2a36;
  --accent: #8b8bff; --accent-ink: #0f0f14; --accent-soft: #23234a; --ok: #4fd1a1;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f14; --surface: #17171f; --text: #ececf3; --muted: #a0a0b2; --line: #2a2a36;
    --accent: #8b8bff; --accent-ink: #0f0f14; --accent-soft: #23234a; --ok: #4fd1a1;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* иначе display: flex у виджета перебивает hidden */
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 Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
main { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
section { padding: 56px 0; }
h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.1; letter-spacing: -0.02em; margin: 12px 0 18px; max-width: 22ch; }
h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.01em; margin: 0 0 20px; }
h3 { font-size: 18px; margin: 0 0 8px; }
p { margin: 0 0 12px; }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 14px 20px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.logo { font-weight: 700; text-decoration: none; }
.top nav { display: flex; gap: 18px; margin-left: auto; }
.top nav a { text-decoration: none; color: var(--muted); font-size: 15px; }
.top nav a:hover { color: var(--text); }
.switches { display: flex; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 14px; cursor: pointer;
}

.hero { padding-top: 72px; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 14px; }
.lead { font-size: 19px; color: var(--muted); max-width: 60ch; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-weight: 600;
  font: inherit; font-weight: 600; cursor: pointer; color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(1.05); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card p { color: var(--muted); margin: 0; }
.card.accent { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--surface)); }

.note { color: var(--muted); max-width: 70ch; }
.project { display: flex; flex-direction: column; gap: 12px; }
.project .head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 8px; }
.project .head h3 { flex: 1 0 auto; max-width: 100%; }
.badge {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.badge.live { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tags span { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.project .links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; font-weight: 600; }
.project .links a { color: var(--accent); text-decoration: none; }
.project .links .soon { color: var(--muted); font-weight: 500; }

.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.steps li::before { content: counter(s); font-weight: 700; color: var(--accent); font-size: 22px; }
.steps span { color: var(--muted); }

.contact { text-align: center; }
.contact p { color: var(--muted); max-width: 56ch; margin: 0 auto; }
.contact .cta { justify-content: center; }
footer { text-align: center; color: var(--muted); font-size: 14px; padding: 32px 20px 96px; border-top: 1px solid var(--line); }

/* чат-виджет демо-ассистента */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 20; border: 0; border-radius: 999px;
  padding: 14px 20px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600;
  box-shadow: var(--shadow); cursor: pointer;
}
.chat {
  position: fixed; right: 20px; bottom: 20px; z-index: 21; width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 40px)); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.chat header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat .x { border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.chat-hint { font-size: 13px; color: var(--muted); padding: 10px 16px 0; }
.msgs { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; font-size: 15px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--accent-soft); border-bottom-left-radius: 4px; }
.msg.typing { opacity: .6; }
.chat form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; }
.chat .btn { padding: 10px 14px; }

@media (max-width: 720px) {
  .top { gap: 12px; }
  .top nav { display: none; }
  .switches { margin-left: auto; }
  section { padding: 40px 0; }
  .hero { padding-top: 40px; }
}

.project .note { display: block; margin-top: -4px; font-size: 13px; }
