/* ===========================================================
   Appify KZ — modern.css
   Слой современных эффектов и UX-полировки поверх base/site.css.
   Подключается ПОСЛЕДНИМ на всех страницах. Прогрессивное
   улучшение: без effects.js страница выглядит как раньше.

   Здесь же — единая ДИЗАЙН-СИСТЕМА «Obsidian Tech»: шрифты, токены,
   типографика, фон и зерно. Так как файл грузится последним, его :root
   переопределяет токены из base.css и инлайновых :root на всех страницах.
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Hanken+Grotesk:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  /* ===== Дизайн-система Obsidian Tech ===== */
  --bg: #0a0c10;
  --panel: #0e1117;
  --muted: #8b97a4;
  --text: #e9eef2;
  --text-bright: #ffffff;
  --brand: #2dd4bf;
  --brand-2: #38bdf8;
  --brand-glow: rgba(45, 212, 191, 0.30);
  --stroke: rgba(255, 255, 255, .07);
  --stroke-bright: rgba(255, 255, 255, .14);
  --card: #0e1117;
  --card-2: #0f141c;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, "SF Mono", Menlo, monospace;
}

/* ===== Глобальная типографика и фон (Obsidian Tech) ===== */
body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, var(--bg), #07090d 55%, #050709);
}
/* Фоновая сетка + свечение — как в макете №4: видно у верха, плавно гаснет (маска) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(62% 55% at 82% -8%, rgba(56,189,248,.14), transparent 60%),
    radial-gradient(52% 46% at 0% 2%, rgba(45,212,191,.10), transparent 60%),
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: auto, auto, 64px 64px, 64px 64px;
  -webkit-mask-image: radial-gradient(125% 90% at 50% 0%, #000 38%, transparent 100%);
  mask-image: radial-gradient(125% 90% at 50% 0%, #000 38%, transparent 100%);
}
/* Убраны свечения-разделители над секциями (выглядели как разделение блоков) */
.section-sep::before { display: none !important; }
h1, h2, h3, h4,
.title, .section h2, .card h3, .pricing h4, .step h4,
.direction-body h3, .why-head h3, .case-body h3, .why-block h3,
.trust-item b, .pricing .price-main b, .hv-stat b {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.tag, .form-label, .meta-label, .hv-pill, .chip-tech, .dir-tag,
.dir-num, .meta-num, .step::before {
  font-family: var(--font-mono);
}
.eyebrow { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .3px; font-weight: 500; }
.eyebrow::before { content: "// "; opacity: .55; }
.input, .textarea, .select { font-family: var(--font-body); }
/* Логотип в шапке и бренд в футере — фирменным Space Grotesk (как в макете) */
.logo { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; }
.footer-grid > div:first-child div { font-family: var(--font-display); }
.footer-grid > div:first-child .small { font-family: var(--font-body); }

/* Плёночное зерно поверх всего — премиальная текстура (не мешает кликам) */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: .04; mix-blend-mode: overlay;
  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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Базовая UX-гигиена ---------- */
html { scroll-padding-top: 84px; }
::selection { background: rgba(20, 184, 166, .35); color: #fff; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 3px; border-radius: 4px; }

@media (hover: hover) {
  ::-webkit-scrollbar { width: 10px; }
  ::-webkit-scrollbar-track { background: #070a0f; }
  ::-webkit-scrollbar-thumb { background: #1f2937; border-radius: 5px; border: 2px solid #070a0f; }
  ::-webkit-scrollbar-thumb:hover { background: #2a3a4f; }
}

/* ---------- Плавная типографика (mobile → desktop без ступенек) ---------- */
.title { font-size: clamp(30px, 5.6vw, 58px); letter-spacing: clamp(-1.8px, -0.03em, -1px); }
.section h2 { font-size: clamp(25px, 3.6vw, 39px); }
.subtitle { font-size: clamp(15.5px, 1.7vw, 18px); }

/* ---------- Планшеты: 3–4 колонки не влезают на 768–1023px ---------- */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Reveal v2: мягче, со стаггером ---------- */
.animate-fade-in {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .75s var(--ease-out), transform .75s var(--ease-out);
  transition-delay: var(--rd, 0s);
}
.animate-fade-in.visible { opacity: 1; transform: none; }

/* ---------- Прогресс-бар скролла ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; z-index: 120;
  width: 100%; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transform-origin: 0 50%;
  transform: scaleX(var(--scroll-p, 0));
}

/* ---------- Aurora-фон в hero (только desktop + motion ok) ---------- */
.hero > .container { position: relative; z-index: 1; }
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
  .hero::before, .hero::after {
    content: ''; position: absolute; z-index: 0; pointer-events: none;
    width: 520px; height: 520px; border-radius: 50%;
    filter: blur(90px); opacity: .35;
    animation: aurora-a 18s ease-in-out infinite alternate;
  }
  .hero::before {
    top: -180px; right: -80px;
    background: radial-gradient(circle, rgba(34, 211, 238, .5), transparent 65%);
  }
  .hero::after {
    bottom: -240px; left: -140px;
    background: radial-gradient(circle, rgba(20, 184, 166, .45), transparent 65%);
    animation-name: aurora-b; animation-duration: 22s;
  }
  @keyframes aurora-a {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-90px, 70px) scale(1.18); }
  }
  @keyframes aurora-b {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(110px, -60px) scale(1.12); }
  }
}

/* ---------- Spotlight: подсветка карточек за курсором ----------
   effects.js вставляет <span class="spot"> и ведёт --mx/--my */
.card, .case-card, .pricing, .step, .direction, .lp-other-card, .testi { position: relative; }
.spot {
  position: absolute; inset: 0; z-index: 0;
  border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity .35s ease;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%),
              rgba(34, 211, 238, .09), transparent 65%);
}
@media (hover: hover) {
  .card:hover .spot, .case-card:hover .spot, .pricing:hover .spot,
  .step:hover .spot, .direction:hover .spot,
  .lp-other-card:hover .spot, .testi:hover .spot { opacity: 1; }
}
/* контент карточек поверх подсветки */
.card > *:not(.spot), .pricing > *:not(.spot), .step > *:not(.spot) { position: relative; z-index: 1; }

/* ---------- Кнопки: отклик на нажатие ---------- */
.btn:active, .nav-cta:active { transform: translateY(0) scale(.97); transition-duration: .08s; }

/* ---------- Hero-визуал: 3D tilt (ведёт effects.js) ---------- */
@media (hover: hover) and (pointer: fine) {
  .hero-grid { perspective: 1200px; }
  .hero-visual {
    transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg));
    transition: transform .25s ease-out;
    will-change: transform;
  }
}
/* плавающий toast в hero */
@media (prefers-reduced-motion: no-preference) {
  .tg-toast { animation: float 5s ease-in-out 1.5s infinite; }
}

/* ---------- Бегущая строка логотипов (включает effects.js) ----------
   effects.js оборачивает #clientsRow в .marquee-viewport и дублирует сет. */
.marquee-viewport {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.clients-row.is-marquee {
  flex-wrap: nowrap; justify-content: flex-start;
  width: max-content; gap: 0;
  animation: clients-marquee var(--marquee-dur, 36s) linear infinite;
}
/* margin вместо gap — чтобы сдвиг на -50% давал бесшовный цикл */
.clients-row.is-marquee .client-logo { flex: 0 0 auto; margin-right: 56px; }
/* SVG-логотипы без width/height схлопываются в max-content-контексте —
   фиксируем высоту, ширина выводится из viewBox */
.clients-row.is-marquee .client-logo img { height: 46px; width: auto; max-width: none; max-height: none; }
.clients-row.is-marquee:hover { animation-play-state: paused; }
@keyframes clients-marquee { to { transform: translateX(-50%); } }

/* ---------- FAQ: плавный индикатор ---------- */
.faq summary::after { transition: transform .3s var(--ease-out), color .3s ease; }
.faq details[open] summary::after { transform: rotate(180deg); }
.faq details { transition: border-color .25s ease, background .25s ease; }
.faq details:hover { border-color: var(--stroke-bright); }

/* ---------- Мобильное меню: появление пунктов каскадом ---------- */
@media (max-width: 768px) {
  .nav-links.active { animation: menu-drop .25s var(--ease-out) both; }
  @keyframes menu-drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: no-preference) {
    .nav-links.active > a, .nav-links.active > .nav-dd {
      animation: menu-item .3s var(--ease-out) both;
      animation-delay: calc(var(--i, 0) * 45ms);
    }
    @keyframes menu-item { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
  }
  body.menu-open { overflow: hidden; }
}

/* ---------- Активный пункт навигации (по секциям) ---------- */
.nav-links a.is-active { color: var(--brand-2); }

/* ---------- Кнопка «наверх» ---------- */
.to-top {
  position: fixed; right: 22px; bottom: 90px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--stroke-bright); cursor: pointer;
  background: rgba(11, 18, 27, .85); color: var(--brand-2);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease, visibility .3s, border-color .2s ease;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: var(--brand); }
.to-top svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- FAB WhatsApp: единое определение для всех страниц ----------
   Лежит здесь (modern.css подключён на всех 12 страницах), чтобы кнопка
   выглядела одинаково даже на standalone-страницах без base.css. */
.fab-wa {
  position: fixed; right: 20px; z-index: 60;
  bottom: max(20px, env(safe-area-inset-bottom, 0px) + 12px);
  width: 56px; height: 56px; border-radius: 50%;
  background: #25D366; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
  transition: transform .2s ease;
}
.fab-wa:hover { transform: scale(1.07); }
.fab-wa svg { display: block; width: 28px; height: 28px; fill: currentColor; }

/* ---------- Мелкая полировка ---------- */
/* Убрана анимированная точка у логотипа (в шапке, футере и мобильном меню) */
.logo-dot { display: none !important; }
.stack-chip { transition: transform .2s ease, border-color .2s ease; }
.stack-chip:hover { transform: translateY(-2px); border-color: rgba(20, 184, 166, .45); }
.tag { transition: border-color .2s ease, color .2s ease; }
.tag:hover { border-color: var(--stroke-bright); color: #e5e7eb; }
img { max-width: 100%; height: auto; }

/* ---------- Доступность: отключаем всё для reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .animate-fade-in { opacity: 1; transform: none; }
}
