/* =========================================================
   Thriveee — site styles
   Plain CSS, no build step. Colours and fonts live in :root.
   ========================================================= */

:root {
  /* Palette */
  --ink: #070C22;        /* page background, deepest navy */
  --navy: #0D1533;       /* section tint */
  --surface: #121C44;    /* panels */
  --surface-2: #19255A;  /* raised elements */
  --line: rgba(185, 168, 255, 0.14);
  --line-strong: rgba(185, 168, 255, 0.28);
  --purple: #7B61FF;     /* primary */
  --purple-hover: #8F79FF;
  --violet: #A48BFF;
  --lilac: #CFC4FF;
  --teal: #4FD1B5;       /* "done / live" status only */
  --text: #EAEDFA;
  --muted: #9AA3C7;
  --danger: #FF8A9A;

  /* Type */
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Radii: large for containers, small for controls */
  --r-xl: 24px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;

  --container: 1180px;
  --header-h: 72px;
  --ease: cubic-bezier(.22, .8, .24, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--lilac); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #fff; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.1; margin: 0 0 .5em; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }

:focus-visible { outline: 2px solid var(--lilac); outline-offset: 3px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--purple); color: #fff; padding: 10px 16px; border-radius: var(--r-sm);
}
.skip-link:focus { top: 12px; }

.container { width: min(100% - 40px, var(--container)); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 1rem; line-height: 1; text-decoration: none; cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .2s var(--ease), box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--purple); color: #fff;
  box-shadow: 0 8px 28px -10px rgba(123, 97, 255, .8), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { background: var(--purple-hover); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--lilac); color: #fff; }
.btn-sm { padding: 10px 16px; font-size: .92rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.text-link { font-weight: 600; color: var(--lilac); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(7, 12, 34, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background-color .3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); background: rgba(7, 12, 34, .9); }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; }
.brand:hover { color: #fff; }
.brand-mark { width: 32px; height: 32px; }

.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav ul { display: flex; gap: 4px; list-style: none; }
.main-nav ul a {
  display: block; padding: 8px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: .97rem;
  transition: color .2s, background-color .2s;
}
.main-nav ul a:hover { color: var(--text); }
.main-nav ul a.is-active { color: var(--text); background: rgba(123, 97, 255, .16); }

.nav-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--line-strong); background: transparent; border-radius: 12px; cursor: pointer; padding: 0; position: relative; }
.nav-toggle span { position: absolute; left: 12px; right: 12px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 27px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(56px, 9vw, 112px) 0 clamp(72px, 9vw, 120px); }
.hero::before { /* faint dot grid, the "circuit board" the page sits on */
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(207, 196, 255, .12) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 30%, transparent 75%);
  pointer-events: none;
}
.hero-glow {
  position: absolute; width: 760px; height: 760px; right: -160px; top: -220px;
  background: radial-gradient(circle, rgba(123, 97, 255, .35), rgba(123, 97, 255, 0) 65%);
  filter: blur(10px); pointer-events: none;
}
.hero-grid { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(32px, 5vw, 72px); align-items: center; }

.hero-kicker { display: inline-flex; align-items: center; gap: 10px; color: var(--lilac); font-weight: 500; margin-bottom: 22px; font-size: .98rem; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(79, 209, 181, .18); display: inline-block; flex: none; }

.hero h1 {
  font-size: clamp(2.4rem, 4.6vw, 3.9rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.02;
  max-width: 14em;
  margin-bottom: 24px;
  font-variation-settings: "opsz" 96;
}
.lead { font-size: clamp(1.08rem, 1.4vw, 1.2rem); color: #C5CBE6; max-width: 36em; margin-bottom: 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 36px; }
.hero-points { list-style: none; display: grid; gap: 10px; color: var(--muted); font-size: .97rem; }
.hero-points li { position: relative; padding-left: 26px; }
.hero-points li::before {
  content: ""; position: absolute; left: 2px; top: .5em; width: 12px; height: 7px;
  border-left: 2px solid var(--teal); border-bottom: 2px solid var(--teal); transform: rotate(-45deg);
}

/* Hero console: chat + behind-the-scenes log */
.hero-console {
  position: relative;
  display: grid; grid-template-columns: 1.35fr 1fr;
  background: linear-gradient(180deg, rgba(25, 37, 90, .9), rgba(18, 28, 68, .9));
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255,255,255,.02) inset;
}
.console-chat { padding: 18px; border-right: 1px solid var(--line); min-height: 430px; display: flex; flex-direction: column; }
.console-head { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.console-head strong { display: block; font-size: .95rem; }
.console-head small { color: var(--muted); font-size: .8rem; }
.console-msgs { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.console-log { padding: 18px 16px; }
.console-log-title { font-family: var(--font-display); font-weight: 600; font-size: .95rem; margin-bottom: 14px; color: var(--lilac); }
.console-log ul { list-style: none; display: grid; gap: 12px; }
.console-log li { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--text); line-height: 1.35; }
.console-note { margin: 0; font-size: .78rem; color: var(--muted); }
.hero-console .console-note { position: absolute; left: 0; right: 0; bottom: -28px; text-align: center; }

.tick {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(79, 209, 181, .16); border: 1px solid rgba(79, 209, 181, .5); position: relative; margin-top: 1px;
}
.tick::after { content: ""; position: absolute; left: 5px; top: 4px; width: 7px; height: 4px; border-left: 2px solid var(--teal); border-bottom: 2px solid var(--teal); transform: rotate(-45deg); }

/* Hero animation states (JS adds .is-shown in sequence) */
.js .console-msgs .msg,
.js #hero-log li { opacity: 0; transform: translateY(8px); transition: opacity .45s var(--ease), transform .45s var(--ease); }
.js .console-msgs .msg.is-shown,
.js #hero-log li.is-shown { opacity: 1; transform: none; }

/* ---------- Chat bubbles (shared by hero + demo) ---------- */
.msg {
  max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: .92rem; line-height: 1.45;
  overflow-wrap: anywhere;
}
.msg-user { align-self: flex-end; background: var(--purple); color: #fff; border-bottom-right-radius: 5px; }
.msg-bot { align-self: flex-start; background: #22306A; color: var(--text); border-bottom-left-radius: 5px; }

.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700;
  background: linear-gradient(140deg, var(--teal), #3E9BD6); color: #062031;
}
.avatar-sm { width: 32px; height: 32px; font-size: .9rem; }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 9vw, 120px) 0; }
.section-tint { background: var(--navy); border-block: 1px solid var(--line); }
.section-head { max-width: 640px; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head h2 { font-size: clamp(2rem, 3.6vw, 2.9rem); letter-spacing: -0.03em; }
.section-head p { color: var(--muted); font-size: 1.1rem; margin: 0; }

/* Gentle reveal for section intros only */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Services ---------- */
.services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas:
    "feat feat a"
    "b    c    cta";
  gap: 20px;
}
.services .service:nth-child(2) { grid-area: a; }
.services .service:nth-child(3) { grid-area: b; }
.services .service:nth-child(4) { grid-area: c; }
.service.service-cta {
  grid-area: cta; justify-content: center;
  background: transparent; border-style: dashed; border-color: var(--line-strong);
}
.service-cta h3 { margin-top: 0; }
.service-cta .btn { align-self: flex-start; margin-top: 8px; }
.service {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  display: flex; flex-direction: column;
}
.service h3 { font-size: 1.4rem; margin-top: 18px; }
.service > p { color: #C2C8E3; }
.service-feature {
  grid-area: feat;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(123, 97, 255, .28), transparent 55%),
    var(--surface-2);
  border-color: var(--line-strong);
  border-radius: var(--r-xl);
  padding: 36px;
}
.service-feature h3 { font-size: clamp(1.6rem, 2.4vw, 2rem); }
.service-feature > p { max-width: 40em; font-size: 1.05rem; }
.service-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin: 8px 0 24px; }
.service h4 { font-family: var(--font-body); font-size: .9rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-bottom: 12px; }
.service .text-link { margin-top: auto; }

.service-icon { width: 46px; height: 46px; border-radius: 12px; background: rgba(123, 97, 255, .16); border: 1px solid var(--line-strong); display: grid; place-items: center; }
.service-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--lilac); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.checks { list-style: none; display: grid; gap: 8px; margin-bottom: 20px; font-size: .96rem; }
.checks li { position: relative; padding-left: 22px; }
.checks li::before { content: ""; position: absolute; left: 0; top: .62em; width: 8px; height: 8px; border-radius: 2px; background: var(--violet); transform: rotate(45deg); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 6px 12px; border-radius: 999px; font-size: .84rem; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.chips-quiet { margin-top: auto; }
.chips-quiet li { font-size: .78rem; color: var(--muted); padding: 4px 10px; }

/* ---------- Process ---------- */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; counter-reset: none; position: relative; }
.step { position: relative; padding: 0 24px 0 0; }
.step::before { /* connecting line */
  content: ""; position: absolute; top: 21px; left: 52px; right: 8px; height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
.step:last-child::before { display: none; }
.step-num {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
  background: var(--ink); border: 1px solid var(--violet); color: var(--lilac); margin-bottom: 22px;
}
.step h3 { font-size: 1.2rem; }
.step p { color: var(--muted); font-size: .97rem; margin: 0; }

/* ---------- Tabs ---------- */
.tabs {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; margin-bottom: 24px;
}
.tab {
  border: 0; background: transparent; color: var(--muted); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: .95rem; cursor: pointer; transition: color .2s, background-color .25s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--purple); color: #fff; }
.tab-panel { animation: panelIn .45s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Chatbot demo ---------- */
.demo-chat-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.chat-window {
  display: flex; flex-direction: column; height: 620px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-xl); overflow: hidden;
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-head strong { display: block; font-size: 1rem; }
.chat-head small { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; }
.chat-head small .dot-live { width: 7px; height: 7px; box-shadow: 0 0 0 3px rgba(79, 209, 181, .18); }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; display: grid; place-items: center; transition: border-color .2s; }
.icon-btn:hover { border-color: var(--lilac); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.chat-log { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.chat-log .msg { animation: msgIn .35s var(--ease); max-width: 82%; font-size: .96rem; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.chat-log .msg p { margin: 0 0 .5em; }
.chat-log .msg p:last-child { margin-bottom: 0; }
.chat-log .msg ul { margin: .3em 0 .5em; padding-left: 1.1em; }
.chat-log .msg li { margin: 2px 0; }
.chat-log .msg strong { color: #fff; }
.price-table { width: 100%; border-collapse: collapse; margin: .4em 0 .6em; font-size: .9rem; }
.price-table td { padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.price-table td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; }
.summary-card { background: rgba(7, 12, 34, .45); border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px; margin: .4em 0; }
.summary-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .9rem; }
.summary-card dt { color: var(--muted); }
.summary-card dd { margin: 0; }
.msg-meta { display: block; font-size: .76rem; color: var(--muted); margin-top: 6px; }

.typing { align-self: flex-start; background: #22306A; padding: 12px 14px; border-radius: 16px; border-bottom-left-radius: 5px; display: inline-flex; gap: 5px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--lilac); opacity: .4; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 12px; }
.chat-quick:empty { display: none; }
.quick {
  border: 1px solid var(--line-strong); background: rgba(123, 97, 255, .1); color: var(--lilac);
  padding: 8px 14px; border-radius: 999px; font-size: .88rem; font-weight: 500; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.quick:hover { background: var(--purple); border-color: var(--purple); color: #fff; }

.chat-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: var(--surface-2); }
.chat-input input {
  flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--ink); outline: none; transition: border-color .2s;
}
.chat-input input:focus { border-color: var(--violet); }
.chat-input input::placeholder { color: #6E78A0; }
.send-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--purple); cursor: pointer; display: grid; place-items: center; transition: background-color .2s; }
.send-btn:hover { background: var(--purple-hover); }
.send-btn svg { width: 20px; height: 20px; fill: #fff; }

.chat-inspector {
  background: var(--navy); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px;
  display: flex; flex-direction: column; height: 620px;
}
.chat-inspector h3 { font-size: 1.15rem; }
.inspector-log { list-style: none; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; margin: 6px 0 16px; padding-right: 4px; }
.inspector-log li { font-size: .86rem; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); animation: msgIn .35s var(--ease); line-height: 1.4; }
.inspector-log li b { display: block; color: var(--lilac); font-weight: 600; margin-bottom: 2px; }
.inspector-log li.is-action { border-color: rgba(79, 209, 181, .4); }
.inspector-log li.is-action b { color: var(--teal); }
.inspector-log .inspector-empty { color: var(--muted); background: transparent; border-style: dashed; }
.try-list { border-top: 1px solid var(--line); padding-top: 14px; }
.try-list p { margin-bottom: 6px; }
.try-list ul { padding-left: 1.1em; color: var(--muted); display: grid; gap: 2px; }

/* ---------- Workflow demo ---------- */
.flow-demo, .mkt-demo { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-xl); padding: clamp(20px, 3vw, 32px); }
.flow-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 28px; }
.segmented { border: 0; margin: 0; padding: 4px; display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--ink); border-radius: 14px; border: 1px solid var(--line); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 9px 14px; border-radius: 10px; font-size: .92rem; font-weight: 500; color: var(--muted); transition: background-color .2s, color .2s; }
.segmented input:checked + span { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.segmented input:focus-visible + span { outline: 2px solid var(--lilac); outline-offset: 2px; }

.flow-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; margin-bottom: 16px; }
.flow-steps { list-style: none; display: flex; flex-direction: column; gap: 0; position: relative; }
.flow-step {
  position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start;
  padding: 12px 12px; border-radius: 12px; cursor: default; transition: background-color .3s;
}
.flow-step + .flow-step::before { /* vertical connector */
  content: ""; position: absolute; left: 31px; top: -12px; height: 24px; width: 2px; background: var(--line-strong);
  transition: background-color .4s;
}
.flow-step.is-done + .flow-step::before, .flow-step.is-done + .flow-step.is-running::before { background: var(--teal); }
.flow-node {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--ink); border: 1px solid var(--line-strong); transition: border-color .3s, background-color .3s;
}
.flow-node svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: stroke .3s; }
.flow-step strong { display: block; font-size: .98rem; }
.flow-step span.flow-sub { font-size: .85rem; color: var(--muted); }
.flow-step.is-running { background: rgba(123, 97, 255, .12); }
.flow-step.is-running .flow-node { border-color: var(--violet); animation: pulse 1s infinite; }
.flow-step.is-running .flow-node svg { stroke: var(--lilac); }
.flow-step.is-done .flow-node { border-color: var(--teal); background: rgba(79, 209, 181, .12); }
.flow-step.is-done .flow-node svg { stroke: var(--teal); }
.flow-step.is-done { cursor: pointer; }
.flow-step.is-done:hover { background: rgba(255,255,255,.03); }
.flow-step.is-selected { background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px var(--line-strong); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(164, 139, 255, .45); } 50% { box-shadow: 0 0 0 8px rgba(164, 139, 255, 0); } }

.flow-output, .mkt-output { background: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; min-height: 320px; }
.flow-output-title { font-family: var(--font-display); font-weight: 600; color: var(--lilac); margin-bottom: 12px; }
.flow-output-body { font-size: .93rem; animation: panelIn .35s var(--ease); }
.flow-output-body h4 { font-family: var(--font-body); font-size: 1rem; font-weight: 600; margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.mock-email { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.mock-email p { margin: 0 0 .4em; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: rgba(79, 209, 181, .14); color: var(--teal); border: 1px solid rgba(79, 209, 181, .35); }
.badge-purple { background: rgba(123, 97, 255, .16); color: var(--lilac); border-color: var(--line-strong); }

/* ---------- Marketing demo ---------- */
.mkt-demo { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 28px; }
.mkt-form { display: flex; flex-direction: column; gap: 16px; }
.mkt-output-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.mkt-output-head .flow-output-title { margin: 0; }
.mkt-result { white-space: normal; font-size: .97rem; }
.mkt-result .draft { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px 0; }
.mkt-result .draft.is-typing::after { content: ""; display: inline-block; width: 2px; height: 1em; background: var(--lilac); margin-left: 2px; vertical-align: text-bottom; animation: caret .8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.mkt-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: .88rem; }
.mkt-notes div { padding: 12px; border-radius: 10px; border: 1px dashed var(--line-strong); }
.mkt-notes b { display: block; color: var(--lilac); font-weight: 600; margin-bottom: 2px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: .92rem; font-weight: 500; color: #C8CEE8; }
.optional { color: var(--muted); font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--ink); color: var(--text); outline: none; transition: border-color .2s, box-shadow .2s;
}
.field select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23CFC4FF' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}
.field select option { background: var(--surface); }
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(123, 97, 255, .2); }
.field input::placeholder, .field textarea::placeholder { color: #6E78A0; }
.field.has-error input, .field.has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .84rem; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.about-copy h2 { font-size: clamp(2rem, 3.6vw, 2.9rem); letter-spacing: -0.03em; max-width: 14em; }
.about-copy p { color: #C2C8E3; max-width: 36em; }
.principles { list-style: none; display: grid; gap: 0; border-top: 1px solid var(--line); }
.principles li { padding: 22px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
.principles h3 { font-size: 1.12rem; margin: 0; }
.principles p { margin: 0; color: var(--muted); font-size: .97rem; }

/* ---------- FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; padding: 20px 40px 20px 0; position: relative;
  font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; letter-spacing: -0.01em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 10px; height: 10px; margin-top: -7px;
  border-right: 2px solid var(--lilac); border-bottom: 2px solid var(--lilac); transform: rotate(45deg);
  transition: transform .3s var(--ease);
}
.faq details[open] summary::after { transform: rotate(225deg); margin-top: -2px; }
.faq details p { color: var(--muted); padding-bottom: 20px; margin: 0; max-width: 40em; }
.faq details[open] p { animation: panelIn .35s var(--ease); }

/* ---------- Contact ---------- */
.section-contact { background: linear-gradient(180deg, var(--ink), #0C1438); border-top: 1px solid var(--line); }
.contact-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.contact-copy h2 { font-size: clamp(2rem, 3.6vw, 2.9rem); letter-spacing: -0.03em; }
.contact-copy > p { color: #C2C8E3; max-width: 32em; }
.contact-list { list-style: none; display: grid; gap: 14px; margin-top: 32px; }
.contact-list li { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.contact-label { color: var(--muted); }
.contact-form { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-xl); padding: clamp(22px, 3vw, 36px); display: flex; flex-direction: column; gap: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; color: var(--muted); cursor: pointer; }
.consent input { flex: none; width: 18px; height: 18px; margin-top: 3px; accent-color: var(--purple); }
.consent.has-error span { color: var(--danger); }
.form-status {
  margin: 0; padding: 14px 16px 14px 46px; position: relative;
  border-radius: var(--r-md); font-size: .95rem; line-height: 1.5;
  background: rgba(255, 138, 154, .1); border: 1px solid rgba(255, 138, 154, .45); color: #FFD3DA;
  animation: panelIn .3s var(--ease);
}
.form-status::before {
  content: "!"; position: absolute; left: 14px; top: 14px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: var(--danger); color: var(--ink);
}
.form-status strong { color: #fff; }
.form-status a { color: #fff; }
.form-status[hidden] { display: none; }

.form-success {
  background: var(--surface); border: 1px solid rgba(79, 209, 181, .45); border-radius: var(--r-xl);
  padding: clamp(28px, 4vw, 44px); text-align: left; animation: panelIn .45s var(--ease);
}
.form-success[hidden], .contact-form[hidden] { display: none; }
.form-success h3 { font-size: 1.6rem; margin: 18px 0 8px; outline: none; }
.form-success p { color: #C2C8E3; max-width: 32em; }
.success-icon {
  display: block; width: 52px; height: 52px; border-radius: 50%; position: relative;
  background: rgba(79, 209, 181, .14); border: 1px solid rgba(79, 209, 181, .55);
}
.success-icon::after {
  content: ""; position: absolute; left: 17px; top: 17px; width: 17px; height: 9px;
  border-left: 3px solid var(--teal); border-bottom: 3px solid var(--teal); transform: rotate(-45deg);
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; background: var(--ink); }
.footer-inner { display: grid; grid-template-columns: 1.3fr 2fr; gap: 24px 40px; align-items: start; }
.footer-brand p { margin: 12px 0 0; max-width: 28em; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 24px; }
.footer-nav a { color: var(--muted); text-decoration: none; }
.footer-nav a:hover { color: var(--text); }
.footer-legal { grid-column: 1 / -1; margin: 12px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---------- Simple inner pages (privacy, 404) ---------- */
.page { padding: clamp(48px, 8vw, 96px) 0; }
.prose { max-width: 720px; }
.prose h1 { font-size: clamp(2.2rem, 4.5vw, 3.2rem); letter-spacing: -0.03em; }
.prose h2 { font-size: 1.4rem; margin-top: 2em; }
.prose p, .prose li { color: #C2C8E3; }
.prose ul { padding-left: 1.2em; margin-bottom: 1em; }
.notfound { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.notfound h1 { font-size: clamp(2.4rem, 6vw, 4rem); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-console { max-width: 680px; }
  .services { grid-template-columns: 1fr 1fr; grid-template-areas: "feat feat" "a b" "c cta"; }
  .steps { grid-template-columns: 1fr 1fr; gap: 40px 24px; }
  .step:nth-child(2)::before { display: none; }
  .principles li { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 920px) {
  :root { --header-h: 64px; }
  .site-header, .site-header.is-scrolled { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(7, 12, 34, .97); }
  .nav-toggle { display: block; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 16px;
    padding: 20px 20px 28px; background: var(--ink); box-shadow: 0 30px 60px -20px rgba(0,0,0,.8); border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
  }
  .main-nav.is-open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
  .main-nav ul { flex-direction: column; gap: 2px; }
  .main-nav ul a { padding: 14px 12px; font-size: 1.1rem; border-radius: 12px; }
  .nav-cta { width: 100%; padding: 14px; }

  .demo-chat-layout { grid-template-columns: 1fr; }
  .chat-inspector { height: auto; max-height: 420px; }
  .flow-body { grid-template-columns: 1fr; }
  .mkt-demo { grid-template-columns: 1fr; }
  .about-grid, .faq-grid, .contact-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-nav { justify-content: flex-start; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .hero-console { grid-template-columns: 1fr; }
  .console-chat { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; }
  .console-log ul { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .services { grid-template-columns: 1fr; grid-template-areas: "feat" "a" "b" "c" "cta"; }
  .service, .service-feature { padding: 24px; }
  .service-cols { grid-template-columns: 1fr; gap: 16px; }
  .steps { grid-template-columns: 1fr; gap: 28px; }
  .step::before { display: none; }
  .step { display: grid; grid-template-columns: 44px 1fr; gap: 0 16px; padding: 0; }
  .step-num { grid-row: span 2; margin: 0; }
  .tabs { display: flex; border-radius: 16px; }
  .tab { flex: 1 1 100%; border-radius: 12px; text-align: left; }
  .chat-window { height: 560px; border-radius: var(--r-lg); }
  .chat-log .msg { max-width: 90%; }
  .flow-controls { flex-direction: column; align-items: stretch; }
  .segmented { flex-direction: column; }
  .mkt-notes { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .contact-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* Respect reduced-motion settings */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal, .js .console-msgs .msg, .js #hero-log li { opacity: 1; transform: none; }
}
.mkt-note { grid-column: 1 / -1; }
