/*
 * components.css — переиспользуемые UI-слои v2.
 * Phase 2: site-wide sprint — scroll-reveal, magnetic, haptic-click
 * (на всех primary CTA и кнопках). Остальное наполняется по фазам.
 */

/* ========== SCROLL-REVEAL (.js-reveal) ==========
 * Родитель получает .js-reveal → начальное состояние opacity:0, y:24.
 * При входе в viewport animations.js initReveals() анимирует детей со stagger.
 * Fallback noscript: видно сразу. */
.js-reveal {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition: opacity 0.6s var(--ease-brand),
              transform 0.6s var(--ease-brand);
  will-change: opacity, transform;
}
.js-reveal.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
.js-reveal[data-stagger] > * {
  opacity: 0;
  transform: translate3d(0, 16px, 0);
  transition: opacity 0.6s var(--ease-brand),
              transform 0.6s var(--ease-brand);
}
.js-reveal.is-visible[data-stagger] > * {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* ========== HAPTIC-CLICK (pure CSS :active) ==========
 * scale 1 → 1.04 → 1 за --dur-snap. На reduce-motion — только opacity-фидбек.
 * Применяем к примарным CTA по классам, чтобы не ломать form-submit UX. */
.cta,
.btn-primary,
.hero-cta,
.service-btn,
.contact-btn,
.nav-cta,
.form-submit,
.cookie-btn {
  transition: background 0.25s var(--ease-quart),
              border-color 0.25s var(--ease-quart),
              box-shadow 0.25s var(--ease-quart),
              transform var(--dur-snap, 120ms) var(--ease-quart);
  will-change: transform;
}
.cta:active,
.btn-primary:active,
.hero-cta:active,
.service-btn:active,
.contact-btn:active,
.nav-cta:active,
.form-submit:active,
.cookie-btn:active {
  transform: scale(1.04);
}

/* ========== MAGNETIC (hover-only, desktop) ==========
 * JS-часть (initMagnetic) работает ТОЛЬКО при hover:hover && pointer:fine.
 * CSS-флаг: разрешаем transform: translate3d(var(--mx), var(--my), 0).
 * На touch-девайсах JS не навешивает listener — класс присутствует, но
 * ничего не делает. */
@media (hover: hover) and (pointer: fine) {
  .magnetic {
    --mx: 0px;
    --my: 0px;
    transform: translate3d(var(--mx), var(--my), 0);
    transition: transform 0.4s var(--ease-quart);
  }
  /* При hover на magnetic-CTA отключаем haptic-transition (чтобы не конфликтовало). */
  .magnetic:active {
    transform: translate3d(var(--mx), var(--my), 0) scale(0.98);
  }
}

/* ========== Reduce-motion guards ==========
 * Всё выше переходит в статику / без трансформов. */
@media (prefers-reduced-motion: reduce) {
  .js-reveal,
  .js-reveal[data-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .cta:active,
  .btn-primary:active,
  .hero-cta:active,
  .service-btn:active,
  .contact-btn:active,
  .nav-cta:active,
  .form-submit:active,
  .cookie-btn:active {
    transform: none;
    opacity: 0.85;
  }
  .magnetic {
    transform: none !important;
  }
}

/* ===== LEAD TOAST ===== */
.lead-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 16px 22px 16px 18px;
  border-radius: 12px;
  background: rgba(20, 20, 35, 0.98);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 320ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 320ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999999;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.lead-toast::before {
  content: '';
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
}
.lead-toast-success {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.96) 0%, rgba(22, 101, 52, 0.96) 100%);
  border-color: rgba(74, 222, 128, 0.5);
}
.lead-toast-success::before {
  background-color: rgba(255,255,255,0.95);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2316a34a'%3E%3Cpath d='M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z'/%3E%3C/svg%3E");
}
.lead-toast-error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.96) 0%, rgba(127, 29, 29, 0.96) 100%);
  border-color: rgba(248, 113, 113, 0.5);
}
.lead-toast-error::before {
  background-color: rgba(255,255,255,0.95);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23dc2626'%3E%3Cpath d='M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z'/%3E%3C/svg%3E");
}
.lead-toast-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (max-width: 600px) {
  .lead-toast {
    top: 12px;
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

/* ===== HONEYPOT ===== */
.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ===== QUICK FORM ROW ===== */
.quick-form-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}
.quick-form-row input[type="email"] {
  flex: 1;
  min-width: 0;
}
.quick-form-row button {
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .quick-form-row {
    flex-direction: column;
  }
}

/* ===== QUICK FORM INLINE-STYLE CLEANUP ===== */
#contactFormQuick textarea.form-input {
  min-height: 80px;
  resize: none;
}
#contactFormQuick .quick-form-row button,
#contactFormQuick .quick-form-row .cta {
  background: linear-gradient(135deg, #6D28D9 0%, #EC4899 100%);
  color: #fff !important;
  border: none;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 200ms ease, box-shadow 200ms ease, opacity 200ms ease;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.25);
}
#contactFormQuick .quick-form-row button:hover,
#contactFormQuick .quick-form-row .cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(109, 40, 217, 0.4);
}
#contactFormQuick .quick-form-row button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ===== HERO PROOF LIST ===== */
.hero__proof-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 32px;
  max-width: 900px;
  margin: 32px auto 0;
}
.hero__proof-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text-color, #fff);
  opacity: 0.92;
}
.hero__proof-item::before {
  content: "✓";
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6D28D9, #EC4899);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}
@media (max-width: 768px) {
  .hero__proof-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}


/* ===== FAB CONTACT — hide when #contact is in viewport ===== */
.contact-fab--hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.9);
  transition: opacity 280ms ease, transform 280ms ease;
}

/* ===== QUIZ CONTACT FIELDS ===== */
.quiz-contact-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}
.quiz-contact-fields .quiz-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 200ms ease, background 200ms ease;
}
.quiz-contact-fields .quiz-input:focus {
  outline: none;
  border-color: rgba(236, 72, 153, 0.5);
  background: rgba(255,255,255,0.07);
}
.quiz-contact-fields .quiz-input::placeholder {
  color: rgba(255,255,255,0.4);
}

/* ===== CASES BANNER (CTA to partner Figma) ===== */
.cases-banner-section { padding: 64px 24px 0; max-width: 1200px; margin: 0 auto; }
.cases-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 28px 32px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(109,40,217,0.18), rgba(236,72,153,0.12));
  border: 1px solid rgba(236,72,153,0.25);
  text-decoration: none; color: #fff;
  transition: transform 250ms ease, border-color 250ms ease, box-shadow 250ms ease;
}
.cases-banner:hover { transform: translateY(-3px); border-color: rgba(236,72,153,0.55); box-shadow: 0 16px 40px rgba(109,40,217,0.28); }
.cases-banner__text h3 { margin: 0 0 6px; font-size: 22px; font-weight: 700; background: linear-gradient(135deg, #6D28D9, #EC4899); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.cases-banner__text p { margin: 0; font-size: 14px; opacity: 0.75; line-height: 1.5; }
.cases-banner__arrow { font-size: 32px; font-weight: 300; opacity: 0.6; transition: transform 250ms ease; flex-shrink: 0; }
.cases-banner:hover .cases-banner__arrow { transform: translateX(6px); opacity: 1; }
@media (max-width: 600px) {
  .cases-banner { flex-direction: column; align-items: flex-start; padding: 22px 24px; }
  .cases-banner__text h3 { font-size: 18px; }
  .cases-banner__arrow { font-size: 24px; align-self: flex-end; }
}

/* ===== TEAM MORE LINK ===== */
.team-more { text-align: center; margin-top: 40px; }
.team-more__link {
  display: inline-block; padding: 12px 24px; border-radius: 10px;
  border: 1px solid rgba(236,72,153,0.35);
  color: #fff; text-decoration: none; font-weight: 600; font-size: 15px;
  background: rgba(255,255,255,0.02);
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
}
.team-more__link:hover { transform: translateY(-2px); border-color: rgba(236,72,153,0.7); background: rgba(236,72,153,0.08); }

/* ===== CASES BANNER INLINE VARIANT (lives inside #cases between filters and grid) ===== */
.cases-banner--inline {
  margin: 0 0 40px 0;
  max-width: 100%;
}
@media (max-width: 600px) {
  .cases-banner--inline { margin-bottom: 28px; }
}

/* ===== CASES BANNER — HERO VARIANT (with shimmer + CTA pill) ===== */
.cases-banner--hero { position: relative; overflow: hidden; }
.cases-banner__shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.07) 50%, transparent 70%);
  pointer-events: none;
  border-radius: inherit;
  animation: cases-banner-shimmer 5s linear infinite;
}
@keyframes cases-banner-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .cases-banner__shimmer { animation: none; opacity: 0; }
}
.cases-banner__text,
.cases-banner__cta { position: relative; z-index: 1; }
.cases-banner__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6D28D9, #EC4899);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  transition: transform 250ms ease, box-shadow 250ms ease;
  box-shadow: 0 8px 20px rgba(109,40,217,0.35);
}
.cases-banner--hero:hover .cases-banner__cta {
  transform: translateX(4px);
  box-shadow: 0 12px 28px rgba(236,72,153,0.45);
}
.cases-banner__cta-text { letter-spacing: 0.02em; }
.cases-banner--hero .cases-banner__arrow {
  font-size: 18px;
  font-weight: 600;
  opacity: 1;
}
@media (max-width: 600px) {
  .cases-banner--hero .cases-banner__cta { align-self: flex-end; }
}
