/* Рой — ИИ‑студия. Пока только тёмная тема; цвета — токены, светлая тема ляжет на [data-theme="light"]. */
:root {
  --bg: #0B0B0C;
  --bg-2: #111113;
  --surface: #151517;
  --line: #26262A;
  --line-2: #34343A;
  --text: #F2F1EE;
  --muted: #9A9893;
  --faint: #66645F;
  --accent: #FF4D2E;
  --accent-ink: #0B0B0C;
  --glow: rgba(255, 77, 46, .16);
  /* цвета агентов */
  --ag1: #FF8A7A; --ag2: #FFC46B; --ag3: #7FE0C4; --ag4: #8AB4FF;
  --ag5: #C9A2FF; --ag6: #F59AD0; --ag7: #B8E986;
  --sans: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --r: 14px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; overflow-x: hidden; position: relative;
}
body::before {   /* тёплое свечение сверху + сетка точек, как экран «рабочего стола» агентов */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1100px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(60% 50% at 30% 0%, var(--glow), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1px, transparent 1.4px) 0 0 / 28px 28px;
  -webkit-mask: linear-gradient(#000 40%, transparent);
          mask: linear-gradient(#000 40%, transparent);
}
main, .nav, .foot { position: relative; z-index: 1; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.03em; }
p { margin: 0; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.eyebrow { font: 600 13px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.hl { color: var(--accent); }
.dim { color: var(--faint); }

.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 16px 26px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -10px var(--accent); }
.btn-ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.btn-sm { padding: 10px 18px; font-size: 15px; }

/* ---------- шапка ---------- */
.nav { display: flex; align-items: center; gap: 32px; height: 76px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 22px; letter-spacing: -.03em; }
.logo svg { width: 22px; height: 22px; fill: var(--accent); }
.nav-links { display: flex; gap: 28px; margin-left: auto; font-size: 15px; }
.nav-links a { text-decoration: none; color: var(--muted); }
.nav-links a:hover { color: var(--text); }

/* ---------- 1. первый экран ---------- */
.hero {
  min-height: calc(100svh - 76px); display: grid; grid-template-columns: 1.25fr .75fr;
  align-content: center; gap: 56px 48px; padding-top: 40px; padding-bottom: 96px;
}
.hero h1 { font-size: clamp(44px, 6.6vw, 96px); line-height: .98; margin: 22px 0 26px; }
.lead { font-size: clamp(17px, 1.45vw, 20px); color: var(--muted); max-width: 580px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

.log {
  align-self: center; background: rgba(21,21,23,.82); border: 1px solid var(--line); border-radius: var(--r);
  font: 400 13px/1.5 var(--mono); overflow: hidden; backdrop-filter: blur(6px);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.8);
}
.log-bar { display: flex; align-items: center; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--muted); }
.log-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.log-bar span { margin-left: 8px; }
.live { margin-left: auto; color: var(--ag7); font-weight: 400; animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.log-lines { -webkit-mask: linear-gradient(transparent, #000 34%); mask: linear-gradient(transparent, #000 34%); list-style: none; margin: 0; padding: 14px 16px 16px; height: 262px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 7px; }
.log-lines li { display: flex; gap: 10px; color: var(--muted); animation: logIn .35s ease-out; white-space: nowrap; }
.log-lines li b { flex: none; width: 46px; font-weight: 600; color: var(--c); }
.log-lines li span { overflow: hidden; text-overflow: ellipsis; }
.log-lines li.ok span { color: var(--text); }
@keyframes logIn { from { opacity: 0; transform: translateY(8px); } }

.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border-top: 1px solid var(--line); }
.stats > div { padding: 24px 24px 0 0; }
.stats > div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.stats dt { font-size: clamp(34px, 3.4vw, 48px); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.stats dd { margin: 10px 0 0; color: var(--muted); font-size: 15px; max-width: 260px; }

/* ---------- 2. как работаем ---------- */
.how, .work { padding-top: 120px; padding-bottom: 40px; }
.how h2, .work h2 { font-size: clamp(34px, 4.6vw, 64px); line-height: 1.02; margin: 18px 0 48px; max-width: 900px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.step {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px 22px 26px; min-height: 290px; display: flex; flex-direction: column; overflow: hidden;
}
.step::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--a); opacity: .9; }
.step-n { font: 600 13px var(--mono); color: var(--faint); }
.agent-chip {
  position: absolute; top: 18px; right: 18px; font: 600 12px var(--mono); padding: 4px 9px; border-radius: 6px;
  color: var(--bg); background: var(--a);
}
.step h3 { font-size: 28px; margin-top: auto; padding-top: 48px; }
.step p { color: var(--muted); font-size: 15.5px; margin-top: 12px; }
.lead-person { margin-top: 28px; color: var(--muted); font-size: 18px; max-width: 760px; }
.lead-person b { color: var(--text); font-weight: 600; }

/* ---------- 3. проекты ---------- */
.cases { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
.case { grid-column: span 4; display: flex; flex-direction: column; gap: 18px; }
.case.c-wide { grid-column: span 8; }
.case:nth-child(2) { grid-column: span 4; }
.shot {
  display: block; position: relative; border-radius: var(--r); overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); text-decoration: none; transition: border-color .25s, transform .35s;
}
.shot:hover { border-color: var(--line-2); transform: translateY(-3px); }
.shot-bar { display: flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; border-bottom: 1px solid var(--line); font: 400 12px var(--mono); color: var(--faint); }
.shot-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.shot-bar span { margin-left: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; transition: transform .6s; }
.shot:hover img { transform: scale(1.025); }
.case-body h3 { font-size: 24px; }
.case-body p { color: var(--muted); font-size: 15.5px; margin-top: 8px; max-width: 560px; }
.tags { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font: 400 12px var(--mono); padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); }
.tags .t-ai { border-color: transparent; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tags .t-part { border-color: var(--ag2); color: var(--ag2); }

.final {
  margin-top: 72px; padding: 40px; border: 1px dashed var(--line-2); border-radius: var(--r);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.final p { font-size: clamp(22px, 2.4vw, 32px); font-weight: 700; letter-spacing: -.02em; max-width: 640px; }

.foot { display: flex; justify-content: space-between; gap: 16px; padding-top: 48px; padding-bottom: 110px; color: var(--faint); font: 400 13px var(--mono); }

/* ---------- строка состояния ---------- */
.status {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 999px;
  background: rgba(17,17,19,.86); border: 1px solid var(--line); backdrop-filter: blur(10px);
  font: 400 12.5px var(--mono); color: var(--muted); white-space: nowrap;
  box-shadow: 0 10px 40px -10px rgba(0,0,0,.9);
}
.status b { color: var(--text); font-weight: 600; }
.status .dots { display: flex; }
.status .dots i { width: 9px; height: 9px; border-radius: 50%; margin-left: -3px; border: 1.5px solid var(--bg-2); }
.status .sep { width: 1px; height: 14px; background: var(--line-2); }
.status .bar { width: 72px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.status .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.status.done .bar i { background: var(--ag7); }
html:not(.swarm) .status { display: none; }

/* ---------- рой: агенты, рамки, сборка ---------- */
#agents { position: fixed; inset: 0; pointer-events: none; z-index: 55; overflow: hidden; }
.agent { position: absolute; left: 0; top: 0; will-change: transform; }
.agent svg { width: 20px; height: 24px; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
.agent svg path { fill: var(--c); stroke: #0B0B0C; stroke-width: 1.4; stroke-linejoin: round; }
.agent .tag {
  position: absolute; left: 16px; top: 20px; font: 600 11px var(--mono); padding: 2px 7px; border-radius: 5px;
  background: var(--c); color: #0B0B0C; opacity: 0; transform: scale(.7); transform-origin: 0 0; transition: opacity .2s, transform .2s;
}
.agent.busy .tag { opacity: 1; transform: none; }

#wf { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 54; pointer-events: none; }
.wf {
  position: absolute; border: 1px dashed var(--c); background: color-mix(in srgb, var(--c) 7%, transparent);
  transition: width .32s cubic-bezier(.2,.8,.2,1), height .32s cubic-bezier(.2,.8,.2,1), opacity .45s, background .3s;
}
.wf::before, .wf::after, .wf i::before, .wf i::after {   /* уголки‑ручки */
  content: ""; position: absolute; width: 6px; height: 6px; background: var(--bg); border: 1px solid var(--c);
}
.wf::before { left: -4px; top: -4px; } .wf::after { right: -4px; bottom: -4px; }
.wf i::before { right: -4px; top: -4px; } .wf i::after { left: -4px; bottom: -4px; }
.wf b {
  position: absolute; left: -1px; top: -21px; font: 600 10.5px var(--mono); padding: 2px 6px; border-radius: 4px 4px 4px 0;
  background: var(--c); color: #0B0B0C; white-space: nowrap;
}
.wf.sel { background: color-mix(in srgb, var(--c) 16%, transparent); border-style: solid; }
.wf.out { opacity: 0; }

.swarm [data-build]:not(.go) { visibility: hidden; }
.swarm [data-build="fade"].go { animation: buildIn .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes buildIn { from { opacity: 0; transform: translateY(10px) scale(.985); filter: blur(4px); } }
.typing { min-height: var(--h); }
.typing .scr { color: var(--accent); opacity: .8; }

/* ---------- адаптив ---------- */
@media (max-width: 1080px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
  .case, .case.c-wide, .case:nth-child(2) { grid-column: span 6; }
  .case.c-wide { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 24px; gap: 40px; }
  .log-lines { height: 200px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  body { font-size: 16px; }
  .nav { height: 64px; gap: 16px; }
  .nav-links { display: none; }
  .nav .btn-sm { margin-left: auto; }
  .hero { min-height: auto; padding-bottom: 64px; }
  .cta .btn { flex: 1 1 auto; justify-content: center; }
  .stats { grid-template-columns: 1fr; }
  .stats > div, .stats > div + div { padding: 18px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .stats dd { max-width: none; }
  .how, .work { padding-top: 80px; }
  .steps { grid-template-columns: 1fr; }
  .step { min-height: 0; }
  .step h3 { padding-top: 28px; }
  .case, .case.c-wide, .case:nth-child(2) { grid-column: 1 / -1; }
  .final { padding: 24px; }
  .final .btn { width: 100%; justify-content: center; }
  .foot { flex-direction: column; }
  .status { bottom: 12px; gap: 8px; padding: 8px 12px; font-size: 11.5px; }
  .status .bar { width: 44px; }
  .status .dots { display: none; }
  .agent .tag { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .shot, .shot img { transition: none; }
}
