/* ATTACH — дизайн-система: токены, сетка, типографика, компоненты */

:root {
  --bg: #05060b;
  --bg-soft: #080a13;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e9edf9;
  --muted: #8a92ac;
  --dim: #5f6780;

  --c1: #22e1ff;
  --c2: #7b5cff;
  --c3: #ff4ecb;
  --c4: #b6ff3d;
  --ok: #34e0a1;
  --warn: #ffc46b;
  --err: #ff6b81;

  --grad: linear-gradient(120deg, var(--c1), var(--c2) 45%, var(--c3));
  --grad-soft: linear-gradient(120deg, rgba(34, 225, 255, 0.16), rgba(123, 92, 255, 0.16));

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --r-xl: 32px;

  --shadow: 0 24px 70px -30px rgba(0, 0, 0, 0.9);
  --glow: 0 0 40px -8px rgba(123, 92, 255, 0.55);

  --font: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --nav-h: 76px;
  --wrap: 1240px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
*::selection { background: rgba(123, 92, 255, 0.4); color: #fff; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 20px); }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul { list-style: none; }

/* ------------------------------------------------------------- фон-эффекты */

.bg-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bg-fx::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 78%);
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: float 22s var(--ease) infinite alternate;
}
.orb.a { width: 620px; height: 620px; top: -220px; left: -140px; background: radial-gradient(circle, #7b5cff, transparent 68%); }
.orb.b { width: 560px; height: 560px; top: 8%; right: -180px; background: radial-gradient(circle, #22e1ff, transparent 68%); animation-delay: -7s; }
.orb.c { width: 520px; height: 520px; bottom: -160px; left: 34%; background: radial-gradient(circle, #ff4ecb, transparent 70%); animation-delay: -13s; opacity: 0.35; }

@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(60px, 70px, 0) scale(1.16); }
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------ layout */

.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }
.section { padding: 110px 0; position: relative; }
.section-head { max-width: 720px; margin-bottom: 54px; }
.section-head.center { margin-inline: auto; text-align: center; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c1);
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  margin-bottom: 20px;
}
.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 12px var(--c1);
  animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }

h1, h2, h3, h4 { line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; }
h1 { font-size: clamp(2.6rem, 6.2vw, 4.7rem); }
h2 { font-size: clamp(2rem, 4.2vw, 3.1rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.45rem); }

.lead { color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.14rem); margin-top: 18px; }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

/* ----------------------------------------------------------------- кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s, border-color 0.25s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--grad);
  color: #06070d;
  box-shadow: 0 10px 40px -12px rgba(123, 92, 255, 0.9);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 50px -12px rgba(123, 92, 255, 1); }
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn-primary:hover::after { transform: translateX(120%); }
.btn-ghost {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
  backdrop-filter: blur(12px);
}
.btn-ghost:hover { border-color: var(--line-strong); background: var(--panel-2); transform: translateY(-2px); }
.btn-sm { padding: 9px 16px; font-size: 13px; }
.btn-lg { padding: 17px 34px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ----------------------------------------------------------------- карточки */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(16px);
  position: relative;
  transition: transform 0.35s var(--ease), border-color 0.35s, background 0.35s;
}
.card:hover { border-color: var(--line-strong); }

.glow-card { position: relative; overflow: hidden; }
.glow-card::before {
  content: '';
  position: absolute;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(123, 92, 255, 0.18), transparent 65%);
  left: var(--mx, 50%);
  top: var(--my, 50%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
.glow-card:hover::before { opacity: 1; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 100px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

/* ------------------------------------------------------------------- формы */

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  font-size: 14.5px;
}
.input::placeholder, .textarea::placeholder { color: var(--dim); }
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(123, 92, 255, 0.75);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(123, 92, 255, 0.12);
}
.textarea { resize: vertical; min-height: 110px; }
.select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238a92ac' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }
.select option { background: #0b0d16; }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch i {
  width: 44px; height: 25px; border-radius: 100px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
  position: relative; transition: background 0.25s;
  flex: none;
}
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 17px; height: 17px; border-radius: 50%;
  background: #fff; transition: transform 0.25s var(--ease);
}
.switch input:checked + i { background: var(--grad); }
.switch input:checked + i::after { transform: translateX(19px); }

/* ------------------------------------------------------------------- прочее */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 100px; text-transform: uppercase;
}
.badge.ok { background: rgba(52, 224, 161, 0.14); color: var(--ok); }
.badge.warn { background: rgba(255, 196, 107, 0.14); color: var(--warn); }
.badge.err { background: rgba(255, 107, 129, 0.14); color: var(--err); }
.badge.info { background: rgba(34, 225, 255, 0.14); color: var(--c1); }
.badge.neutral { background: rgba(255, 255, 255, 0.08); color: var(--muted); }

.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }

.modal-close {
  position: absolute; top: 18px; right: 18px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center; font-size: 17px; color: var(--muted);
  transition: 0.25s var(--ease); flex: none;
}
.modal-close:hover { color: var(--text); border-color: var(--line-strong); transform: rotate(90deg); }

.status-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 22px; }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.75s var(--ease), transform 0.75s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--c1);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------- тосты */

#toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 999;
  display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px));
}
.toast {
  padding: 14px 18px;
  border-radius: var(--r);
  background: rgba(12, 14, 24, 0.94);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  font-size: 14px;
  display: flex; gap: 11px; align-items: flex-start;
  animation: toastIn 0.4s var(--ease);
}
.toast.err { border-color: rgba(255, 107, 129, 0.5); }
.toast.ok { border-color: rgba(52, 224, 161, 0.5); }
.toast b { display: block; font-size: 13px; margin-bottom: 2px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } }

/* ------------------------------------------------------------------ скроллбар */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #06070d; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 100px; border: 2px solid #06070d; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.26); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
