/* =========================================================
   base.css — токены, типографика и общие компоненты
   Демо-лендинги переопределяют переменные в :root
   ========================================================= */
:root {
  --bg: #09090b;
  --bg-2: #111116;
  --surface: #16161c;
  --line: rgba(255, 255, 255, 0.09);
  --fg: #f3f1ec;
  --muted: #9a98a3;
  --accent: #7b6cff;
  --accent-2: #33e6c4;
  --accent-3: #ff7a4a;
  --on-accent: #0b0b0f;
  --curtain: #7b6cff;
  --radius: 22px;
  --radius-sm: 14px;
  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --container: 1280px;
  --gutter: clamp(16px, 4vw, 48px);
  --section: clamp(90px, 12vw, 170px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: clamp(16px, 1.05vw, 18px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
::selection { background: var(--accent); color: var(--on-accent); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}
p { margin: 0; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section); position: relative; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 16px var(--accent);
}
.h-xl { font-size: clamp(38px, 6.6vw, 104px); }
.h-lg { font-size: clamp(34px, 5.4vw, 80px); }
.h-md { font-size: clamp(26px, 3.2vw, 46px); }
.h-sm { font-size: clamp(19px, 1.6vw, 24px); line-height: 1.2; }
@media (max-width: 560px) {
  .h-lg { font-size: clamp(24px, 7.3vw, 40px); }
  h1, h2 { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
}
.lead { font-size: clamp(17px, 1.35vw, 21px); color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.grad {
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 55%, var(--accent-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.grad.grad--split { background: none; color: var(--fg); }
.section-head { display: grid; gap: 22px; margin-bottom: clamp(44px, 6vw, 80px); max-width: 900px; }

/* ---------- Кнопки ---------- */
.btn {
  --b-bg: var(--surface); --b-fg: var(--fg);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 18px 30px; border-radius: 100px; overflow: hidden; isolation: isolate;
  background: var(--b-bg); color: var(--b-fg);
  font-weight: 700; font-size: 16px; line-height: 1; white-space: nowrap;
  border: 1px solid var(--line);
  transition: color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--fg); transform: translateY(101%); transition: transform 0.6s var(--ease);
}
.btn:hover::before { transform: translateY(0); }
.btn:hover { color: var(--bg); }
.btn--primary { --b-bg: var(--accent); --b-fg: var(--on-accent); border-color: transparent; }
.btn--ghost { --b-bg: transparent; }
.btn .arrow { transition: transform 0.5s var(--ease); }
.btn:hover .arrow { transform: translateX(4px) rotate(-45deg); }
.btn.is-loading { opacity: 0.6; pointer-events: none; }

/* ---------- Состояния до анимации (только при работающем JS) ---------- */
html.js [data-reveal], html.js [data-stagger] > *, html.js [data-split] { visibility: hidden; }
html.js [data-img-reveal] { clip-path: inset(100% 0 0 0); }
@media (prefers-reduced-motion: reduce) {
  html.js [data-reveal], html.js [data-stagger] > *, html.js [data-split] { visibility: visible; }
  html.js [data-img-reveal] { clip-path: none; }
}

/* ---------- Шторка переходов ---------- */
html.js body::before {
  content: ''; position: fixed; inset: 0; z-index: 9997; background: var(--curtain); pointer-events: none;
}
html.js.curtain-ready body::before { display: none; }
.curtain { position: fixed; inset: 0; z-index: 9998; display: flex; pointer-events: none; visibility: hidden; }
.curtain__panel { flex: 1; background: var(--curtain); margin-right: -1px; }
.curtain__panel:nth-child(2) { filter: brightness(0.88); }
.curtain__panel:nth-child(3) { filter: brightness(0.76); }

/* ---------- Прелоадер ---------- */
#preloader {
  position: fixed; inset: 0; z-index: 9999; background: var(--bg);
  display: grid; place-items: center;
}
html:not(.js) #preloader { display: none; }
.preloader__inner { display: grid; gap: 20px; justify-items: center; }
.preloader__num { font-family: var(--font-display); font-size: clamp(64px, 12vw, 160px); font-weight: 600; line-height: 1; }
.preloader__num::after { content: '%'; font-size: 0.35em; color: var(--accent); margin-left: 6px; vertical-align: top; }
.preloader__bar { width: min(320px, 70vw); height: 2px; background: var(--line); overflow: hidden; }
.preloader__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left; transform: scaleX(0); }
.preloader__label { font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }

/* ---------- Курсор ---------- */
.cursor-dot, .cursor-ring { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 10000; border-radius: 50%; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--accent); }
.cursor-ring {
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border: 1px solid color-mix(in srgb, var(--fg) 40%, transparent);
  display: grid; place-items: center;
  transition: width 0.4s var(--ease), height 0.4s var(--ease), margin 0.4s var(--ease), background 0.4s var(--ease), border-color 0.4s;
}
.cursor-ring.is-hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cursor-ring.has-label { width: 96px; height: 96px; margin: -48px 0 0 -48px; background: var(--accent); border-color: var(--accent); }
.cursor-ring.has-label::after { content: attr(data-label); font-size: 12px; font-weight: 800; color: var(--on-accent); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Шум ---------- */
.noise {
  position: fixed; inset: -50%; z-index: 9990; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: noise 1s steps(4) infinite;
}
@keyframes noise { 0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-1%, 3%); } }

/* ---------- Бегущая строка ---------- */
.marquee { display: flex; overflow: hidden; user-select: none; gap: 0; }
.marquee__track { display: flex; flex-shrink: 0; align-items: center; gap: 48px; padding-right: 48px; animation: marquee 32s linear infinite; }
.marquee--rev .marquee__track { animation-direction: reverse; }
@keyframes marquee { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .marquee__track { animation: none; } .noise { animation: none; } }

/* ---------- Форма заявки ---------- */
.lead-form { display: grid; gap: 14px; }
.lead-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { position: relative; display: block; }
.field input, .field textarea, .field select {
  width: 100%; padding: 26px 20px 12px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--fg) 4%, transparent); border: 1px solid var(--line); color: var(--fg);
  font: inherit; font-size: 16px; outline: none; transition: border-color 0.3s, background 0.3s;
  appearance: none;
}
.field select { cursor: pointer; }
.field select option { background: var(--bg-2); color: var(--fg); }
.field textarea { min-height: 120px; resize: vertical; }
.field span { position: absolute; left: 20px; top: 9px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; pointer-events: none; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.lead-form__status { font-size: 15px; min-height: 1em; }
.lead-form__status a { color: var(--accent); text-decoration: underline; }
.lead-form__status.is-ok { color: var(--accent-2); }
.lead-form__status.is-error { color: #ff6b6b; }
.lead-form__note { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .lead-form__row { grid-template-columns: 1fr; } }

/* ---------- Плашка демо (для лендингов ниш) ---------- */
.demo-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 900;
  display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 18px; border-radius: 100px;
  background: rgba(12, 12, 16, 0.78); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14); color: #f3f1ec;
  font-family: 'Manrope', system-ui, sans-serif; font-size: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  max-width: calc(100vw - 24px);
}
.demo-bar b { font-weight: 800; white-space: nowrap; }
.demo-bar .demo-bar__txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 8px; }
.demo-bar a { padding: 10px 16px; border-radius: 100px; font-weight: 700; white-space: nowrap; transition: background 0.3s; }
.demo-bar a:hover { background: rgba(255, 255, 255, 0.1); }
.demo-bar a.demo-bar__cta { background: #7b6cff; color: #fff; }
.demo-bar a.demo-bar__cta:hover { background: #8e81ff; }
@media (max-width: 640px) { .demo-bar .demo-bar__txt { display: none; } .demo-bar { padding-left: 6px; } }

/* ---------- Мокапы устройств ---------- */
.phone {
  position: relative; width: 280px; aspect-ratio: 9 / 19.2; border-radius: 44px; padding: 10px;
  background: linear-gradient(145deg, #2a2a31, #0e0e12); box-shadow: 0 40px 80px rgba(0, 0, 0, 0.45), inset 0 0 0 1.5px rgba(255, 255, 255, 0.12);
}
.phone__screen { position: relative; width: 100%; height: 100%; border-radius: 35px; overflow: hidden; background: #fff; color: #111; }
.phone__screen::before { content: ''; position: absolute; top: 9px; left: 50%; width: 88px; height: 24px; margin-left: -44px; border-radius: 20px; background: #000; z-index: 5; }
.browser {
  border-radius: 16px; overflow: hidden; background: #fff; color: #111;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.browser__bar { display: flex; align-items: center; gap: 7px; padding: 12px 14px; background: #eceef2; }
.browser__bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.browser__bar i:nth-child(2) { background: #febc2e; }
.browser__bar i:nth-child(3) { background: #28c840; }
.browser__bar span { margin-left: 12px; flex: 1; max-width: 340px; padding: 5px 12px; border-radius: 8px; background: #fff; font-size: 12px; color: #6b6f7a; font-family: var(--font-body); }

/* Фото-плейсхолдер: градиент виден, пока картинка грузится или если её нет */
.ph { position: relative; overflow: hidden; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 40%, #222), color-mix(in srgb, var(--accent-2) 30%, #111)); }
.ph img { width: 100%; height: 100%; object-fit: cover; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
html.has-cursor, html.has-cursor a, html.has-cursor button { cursor: none; }
html.has-cursor input, html.has-cursor textarea, html.has-cursor select { cursor: text; }
