/* WiQuall live demo (simulation) */
:root {
  --bg: #F2F5F4;
  --surface: #FFFFFF;
  --surface2: #E7EDEB;
  --ink: #0B1D2B;
  --muted: #4F626D;
  --line: #CFD9D6;
  --a1: #0E3B66;
  --a2: #3F8068;
  --label: #2E6B55;
  --on-accent: #FFFFFF;
  --err: #B3261E;
  --ribbon-alpha: 0.16;
  --f-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --f-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --grad: linear-gradient(100deg, var(--a1), var(--a2));
}
:root[lang="uk"] { --f-display: 'Onest', 'Manrope', system-ui, sans-serif; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07131C; --surface: #0E2130; --surface2: #122A3C; --ink: #E7EFEC; --muted: #92A7B1;
    --line: #1E3A4C; --a1: #4C8BCB; --a2: #58B190; --label: #6CC4A2; --on-accent: #07131C;
    --err: #FF8A80; --ribbon-alpha: 0.22; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #07131C; --surface: #0E2130; --surface2: #122A3C; --ink: #E7EFEC; --muted: #92A7B1;
  --line: #1E3A4C; --a1: #4C8BCB; --a2: #58B190; --label: #6CC4A2; --on-accent: #07131C;
  --err: #FF8A80; --ribbon-alpha: 0.22; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 17px; line-height: 1.65;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0;
  overflow-x: hidden;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
#ribbons { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--a2); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { margin: 0; text-wrap: balance; hyphens: auto; overflow-wrap: break-word; }
p { margin: 0; }

/* header */
header.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 14px 24px; flex-wrap: wrap; padding-block: 10px; position: relative; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.brand img { width: 40px; height: 40px; border-radius: 50%; display: block; }
.brand b { font-family: var(--f-display); font-weight: 600; font-size: 1.02rem; letter-spacing: .01em; }
nav.main { display: flex; gap: 6px; }
nav.main a { text-decoration: none; font-size: .9rem; color: var(--muted); padding: 8px 12px; border-radius: 999px; transition: color .2s, background .2s; white-space: nowrap; }
nav.main a:hover { color: var(--ink); background: var(--surface2); }
nav.main a[hidden] { display: none !important; }
@media (min-width: 1101px) { nav.main { gap: 0; } nav.main a { padding: 8px 8px; font-size: .84rem; } .bar { gap: 14px 12px; } }
.ctrl { display: flex; gap: 8px; align-items: center; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.lang button { font: 500 .74rem var(--f-mono); letter-spacing: .06em; border: 0; background: transparent; color: var(--muted); padding: 6px 10px; border-radius: 999px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--grad); color: var(--on-accent); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn svg[hidden] { display: none; }
.menu-btn { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -80px; z-index: 100; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 700; text-decoration: none; transition: top .15s; }
.skip:focus { top: 12px; }
/* below 1101px the section links collapse into a menu (no hidden horizontal scrolling) */
@media (max-width: 1100px) {
  .menu-btn { display: grid; }
  .bar { flex-wrap: nowrap; gap: 8px; padding-block: 6px; }
  .brand { gap: 8px; min-width: 0; }
  .brand img { width: 32px; height: 32px; }
  .brand b { font-size: .92rem; }
  .ctrl { gap: 6px; flex: none; }
  .icon-btn { width: 40px; height: 40px; }
  .lang button { padding: 8px 9px; min-height: 34px; }
  nav.main { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 2px; padding: 8px 12px 14px; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 22px 34px -24px rgba(0, 0, 0, .45); }
  nav.main.open { display: flex; }
  nav.main a { font-size: 1rem; padding: 0 14px; min-height: 46px; display: flex; align-items: center; border-radius: 12px; }
}
@media (max-width: 370px) { .brand b { display: none; } }


.eyebrow { font: 500 .78rem var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--label); display: flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--grad); border-radius: 2px; }
.lead { margin-top: 22px; max-width: 54ch; color: var(--muted); font-size: 1.08rem; }
.btn { font: 700 .95rem var(--f-body); text-decoration: none; min-height: 46px; padding: 12px 24px; border-radius: 999px; display: inline-flex; align-items: center; gap: 10px; border: 1px solid transparent; cursor: pointer; transition: transform .25s, box-shadow .25s, background .25s; }
.btn.primary { background: var(--grad); color: var(--on-accent); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px -10px var(--a2); }
.btn.ghost { border-color: var(--line); background: var(--surface); }
.btn.ghost:hover { border-color: var(--a2); }
footer { margin-top: clamp(56px, 8vw, 100px); border-top: 1px solid var(--line); padding-block: 28px calc(34px + env(safe-area-inset-bottom, 0px)); display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; color: var(--muted); font-size: .9rem; }
footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
footer a { text-decoration: none; border-bottom: 1px solid var(--line); }
footer a:hover { color: var(--ink); border-color: var(--a2); }
html { scroll-padding-top: calc(var(--hdr, 64px) + 10px); }
/* ===================== presentation page: scroll = workflow execution ===================== */
.lang a { font: 500 .74rem var(--f-mono); letter-spacing: .06em; border: 0; background: transparent; color: var(--muted); padding: 6px 10px; border-radius: 999px; text-decoration: none; display: block; }
.lang a[aria-current="page"] { background: var(--grad); color: var(--on-accent); }
@media (max-width: 1100px) { .lang a { padding: 8px 9px; min-height: 34px; display: flex; align-items: center; } }
nav.main a[aria-current="page"] { color: var(--ink); background: var(--surface2); }
.btn svg { width: 16px; height: 16px; }

/* ===================== live demo: chat + animated n8n-style chain (simulation) ===================== */
.demo-hero { padding: clamp(34px, 6vw, 64px) 0 26px; }
.demo-hero h1 { font-family: var(--f-display); font-weight: 600; letter-spacing: -.01em; font-size: clamp(1.9rem, 4.6vw, 3.2rem); line-height: 1.12; margin: 16px 0 0; max-width: 20ch; text-wrap: balance; }
.demo-hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.demo-hero .lead { max-width: 62ch; margin-top: 16px; }
.beta { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--a2); color: var(--label); font: 600 .7rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; vertical-align: middle; }
.beta::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--a2); animation: bpulse 1.8s ease-in-out infinite; }
@keyframes bpulse { 50% { opacity: .3; } }

.demo-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 22px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font: 600 .74rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--label); }
.panel-h button { font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer; min-height: 30px; }
.panel-h button:hover { color: var(--ink); border-color: var(--a2); }

/* chat */
.chat-log { list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; height: 340px; overflow-y: auto; overscroll-behavior: contain; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: .94rem; line-height: 1.5; overflow-wrap: anywhere; animation: msgIn .35s ease both; }
.msg.bot { align-self: flex-start; background: var(--surface2); border-bottom-left-radius: 5px; }
.msg.me { align-self: flex-end; background: var(--grad); color: var(--on-accent); border-bottom-right-radius: 5px; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.chip { font: 500 .82rem var(--f-body); color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; min-height: 36px; cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--a2); background: var(--surface2); }
.chat-form { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; font: 500 .95rem var(--f-body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; min-height: 46px; }
.chat-form input:focus-visible { outline: 2px solid var(--a2); outline-offset: 2px; }
.chat-form .btn { min-height: 46px; padding-inline: 18px; }
.chat-form .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* canvas */
.flow-wrap { position: relative; padding: clamp(18px, 3vw, 30px); min-height: 280px; background-image: radial-gradient(color-mix(in srgb, var(--muted) 30%, transparent) 1px, transparent 1.4px); background-size: 20px 20px; background-color: var(--bg); }
.flow { position: relative; display: grid; gap: 44px 52px; z-index: 1; }
.edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.e-base { fill: none; stroke: var(--line); stroke-width: 2.5; }
.e-fill { fill: none; stroke: var(--a2); stroke-width: 3; stroke-linecap: round; }
.e-dot { fill: var(--a2); filter: drop-shadow(0 0 6px var(--a2)); }
.fnode { position: relative; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; grid-template-columns: 40px 1fr; gap: 4px 12px; align-items: center; cursor: pointer; transition: border-color .3s, box-shadow .3s, opacity .3s, transform .3s; min-height: 78px; }
.fnode:focus-visible { outline: 2px solid var(--a2); outline-offset: 3px; }
.fnode::before, .fnode::after { content: ""; position: absolute; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); transition: border-color .3s, background .3s; }
.fnode::before { left: -6px; } .fnode::after { right: -6px; }
.fnode.first::before, .fnode.last::after { display: none; }
.fnode.rev::before { left: auto; right: -6px; } .fnode.rev::after { right: auto; left: -6px; }
.fnode.in-v::before { left: 50%; right: auto; top: -6px; margin: 0 0 0 -5px; }
.fnode.out-v::after { left: 50%; right: auto; top: auto; bottom: -6px; margin: 0 0 0 -5px; }
.fnode .ni { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface2); color: var(--muted); transition: background .3s, color .3s; grid-row: span 3; }
.fnode .ni svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fnode .nk { font: 600 .66rem var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--label); }
.fnode .nt { font: 600 .92rem/1.25 var(--f-body); overflow-wrap: anywhere; }
.fnode .ns { font: 500 .74rem var(--f-mono); color: var(--muted); min-height: 1.1em; }
.fnode.ghost { opacity: .5; }
.fnode.run { border-color: var(--a2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--a2) 20%, transparent), 0 0 30px -6px var(--a2); transform: translateY(-2px); }
.fnode.run .ni { background: var(--grad); color: var(--on-accent); animation: spin 1.1s linear infinite; }
.fnode.run .ni svg { animation: spin 1.1s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.fnode.ok { border-color: var(--a2); }
.fnode.ok .ni { background: color-mix(in srgb, var(--a2) 18%, var(--surface)); color: var(--a2); }
.fnode.ok::before, .fnode.ok::after, .fnode.run::before { border-color: var(--a2); background: var(--a2); }
.fnode.sel { box-shadow: 0 0 0 3px color-mix(in srgb, var(--a1) 40%, transparent); }
.fnode .chk { position: absolute; top: -9px; right: -9px; width: 22px; height: 22px; border-radius: 50%; background: var(--a2); color: var(--on-accent); display: grid; place-items: center; transform: scale(0); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.fnode .chk svg { width: 13px; height: 13px; }
.fnode.ok .chk { transform: scale(1); }
.empty-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font: 500 .76rem var(--f-mono); color: var(--muted); z-index: 2; pointer-events: none; }
.prog { height: 3px; background: var(--line); }
.prog i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .5s ease; }
.run-status { padding: 10px 16px; font: 500 .8rem var(--f-mono); color: var(--muted); border-top: 1px solid var(--line); min-height: 40px; }

.lower { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--line); }
.lower > div { min-width: 0; }
.lower > div + div { border-left: 1px solid var(--line); }
.lower h2 { margin: 0; padding: 10px 16px; font: 600 .7rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--label); border-bottom: 1px solid var(--line); }
.out-json { margin: 0; padding: 12px 16px; height: 170px; overflow: auto; font: 500 .76rem/1.55 var(--f-mono); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.exec-log { list-style: none; margin: 0; padding: 10px 16px; height: 170px; overflow: auto; font: 500 .76rem/1.6 var(--f-mono); color: var(--muted); }
.exec-log li { display: flex; gap: 10px; animation: msgIn .3s ease both; }
.exec-log time { color: var(--label); flex: none; }
.exec-log .ok { color: var(--a2); }

.demo-note { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; justify-content: space-between; padding: 16px 20px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); font-size: .92rem; }
.demo-note p { margin: 0; max-width: 70ch; }
.demo-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.demo-sec { padding-bottom: clamp(48px, 7vw, 90px); }

@media (max-width: 960px) {
  .demo-grid { grid-template-columns: minmax(0, 1fr); }
  .chat-log { height: 280px; }
}
@media (max-width: 640px) {
  .lower { grid-template-columns: 1fr; }
  .lower > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .flow { gap: 40px; }
  .beta { margin: 8px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .beta::before, .fnode.run .ni, .fnode.run .ni svg, .msg, .exec-log li { animation: none; }
  .fnode, .prog i, .fnode .chk { transition: none; }
}
