/* ================================================================
   WOW EFFECTS — wow-минимализм, тёплый Anthropic-inspired стиль
   Импортируется из src/input.css
   Все классы новые, не перекрывают nav.css
   ================================================================ */

/* ----------------------------------------------------------------
   1. Dot-grid hero фон (Vercel-style, 10% opacity)
   ---------------------------------------------------------------- */
.dot-grid {
  background-image: radial-gradient(
    circle,
    rgba(20, 17, 11, 0.10) 1px,
    transparent 1px
  );
  background-size: 24px 24px;
}

/* ----------------------------------------------------------------
   2. Mesh gradient hero (Linear-style через radial-gradient)
   ---------------------------------------------------------------- */
.mesh-bg {
  background: var(--bg-base);
}

/* Версия для тёмных секций. !important — фон не должен перебиваться tailwind preflight */
.mesh-bg-dark {
  background-color: #0a0a0a !important;
  background-image:
    radial-gradient(at 20% 50%, rgba(34, 197, 94, 0.22) 0px, transparent 60%),
    radial-gradient(at 80% 20%, rgba(217, 119, 87, 0.12) 0px, transparent 50%) !important;
}

/* ----------------------------------------------------------------
   3. Glow border на hover карточек (premium glass-style)
   ---------------------------------------------------------------- */
.card-glow {
  position: relative;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  will-change: transform;
}
@media (hover: hover) {
  .card-glow:hover {
    border-color: var(--brand);
    box-shadow:
      0 0 0 1px rgba(22, 163, 74, 0.18),
      0 8px 24px -4px rgba(20, 17, 11, 0.10),
      0 24px 48px -12px rgba(20, 17, 11, 0.08),
      0 0 40px rgba(34, 197, 94, 0.08);
    transform: translateY(-4px) scale(1.01);
  }
}

/* ----------------------------------------------------------------
   4. Magnetic button (CSS-base; JS от motion-designer добавит pull)
   ---------------------------------------------------------------- */
.btn-magnetic {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 14px 24px;
  min-height: 48px; /* WCAG tap target ≥44, наш стандарт 48 */
  border-radius: 999px;
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease,
              background 0.2s ease,
              border-color 0.2s ease;
  will-change: transform;
  cursor: pointer;
  border: none;
  outline: none;
  box-sizing: border-box;
}
.btn-magnetic:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

/* Primary: flat green, единая стилистика без градиентов */
.btn-magnetic--primary,
.btn-magnetic--green {
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
}
@media (hover: hover) {
  .btn-magnetic--primary:hover,
  .btn-magnetic--green:hover {
    background: var(--brand-dim);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.18);
  }
}
.btn-magnetic--primary:active,
.btn-magnetic--green:active {
  transform: scale(0.98);
}

/* Ghost: прозрачный */
.btn-magnetic--ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.btn-magnetic--ghost:hover {
  border-color: var(--text-primary);
  background: var(--bg-elevated);
}

/* Ghost для тёмных секций */
.section-dark .btn-magnetic--ghost,
.section-dark-wrap .btn-magnetic--ghost {
  color: var(--bg-base);
  border-color: rgba(248, 245, 240, 0.30);
}
.section-dark .btn-magnetic--ghost:hover,
.section-dark-wrap .btn-magnetic--ghost:hover {
  border-color: var(--bg-base);
  background: rgba(255, 255, 255, 0.08);
}

/* ----------------------------------------------------------------
   5. Stat counters — большие цифры метрик
   ---------------------------------------------------------------- */
.stat-num {
  font-size: clamp(48px, 6vw, 72px);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--brand-text);
  font-family: Manrope, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.stat-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-subdued);
  letter-spacing: 0.01em;
  margin-top: 4px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ----------------------------------------------------------------
   6. Bento-grid услуги (6 колонок)
   ---------------------------------------------------------------- */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(160px, auto);
  gap: 12px;
}
.bento-cell {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
@media (hover: hover) {
  .bento-cell:hover {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand-glow), 0 16px 32px -8px rgba(20, 17, 11, 0.10);
    transform: translateY(-2px);
  }
}
.bento-cell--featured {
  grid-column: span 4;
  grid-row: span 2;
}
.bento-cell--md {
  grid-column: span 3;
  grid-row: span 2;
}
.bento-cell--sm {
  grid-column: span 2;
}

@media (max-width: 1023px) {
  .bento { grid-template-columns: repeat(4, 1fr); }
  .bento-cell--featured { grid-column: span 4; grid-row: span 1; }
  .bento-cell--md { grid-column: span 2; grid-row: span 1; }
  .bento-cell--sm { grid-column: span 2; }
}
@media (max-width: 640px) {
  .bento { grid-template-columns: 1fr; }
  .bento-cell--featured,
  .bento-cell--md,
  .bento-cell--sm { grid-column: span 1; grid-row: span 1; }
}

/* ----------------------------------------------------------------
   7. Marquee infinite scroll (новый класс .marquee, не конфликтует
      с существующим .marquee-container / .marquee-track)
   ---------------------------------------------------------------- */
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent 0%,
    black 10%,
    black 90%,
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    transparent 0%,
    black 10%,
    black 90%,
    transparent 100%
  );
}
.marquee-inner {
  display: flex;
  gap: 48px;
  animation: marquee-flow 40s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-inner {
  animation-play-state: paused;
}
@keyframes marquee-flow {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ----------------------------------------------------------------
   8. Section-dark (Apple-style скруглённая тёмная секция)
      Используется для CTA и Pricing
   ---------------------------------------------------------------- */
.section-dark,
section.section-dark,
.pricing-wrap.section-dark,
.cta-final-wrap.section-dark {
  background-color: #0a0a0a !important;
  color: #fafaf7;
  border-radius: 32px;
  margin: 0 16px;
  padding: 96px 48px;
  position: relative;
  overflow: hidden;
}
.section-dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    at 20% 50%,
    rgba(34, 197, 94, 0.18) 0%,
    transparent 60%
  );
  pointer-events: none;
  z-index: 0;
}
/* Содержимое поверх псевдо-элемента */
.section-dark > * { position: relative; z-index: 1; }
.section-dark h2,
.section-dark h3 { color: #ffffff; }
.section-dark p   { color: rgba(248, 245, 240, 0.72); }

@media (max-width: 767px) {
  .section-dark {
    border-radius: 20px;
    margin: 0 8px;
    padding: 64px 24px;
  }
}
@media (max-width: 479px) {
  .section-dark {
    border-radius: 16px;
    margin: 0 4px;
    padding: 48px 16px;
  }
}

/* ----------------------------------------------------------------
   9. Scroll-reveal (data-reveal, JS добавляет .is-visible)
   Fallback: animation auto-completes через 2s даже если IO не сработал.
   ---------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
  /* Fail-safe: если JS не повесит is-visible — keyframe форсирует видимость через 400ms */
  animation: revealFallback 0.01s 0.4s forwards;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  animation: none;
}
@keyframes revealFallback {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
/* Stagger для детей: ставь --i на каждый дочерний элемент */
[data-reveal-stagger] > * {
  transition-delay: calc(var(--i, 0) * 0.06s);
}
/* Fallback: если JS не загрузился — контент виден */
.no-js [data-reveal] {
  opacity: 1;
  transform: none;
  animation: none;
}
/* Reduced motion: контент сразу виден без анимации */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* ----------------------------------------------------------------
   10. Pill badge с анимированной зелёной точкой
   ---------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: nowrap;
}
.pill-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand);
  animation: pill-pulse 2s ease-in-out infinite;
}
@keyframes pill-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 var(--brand-glow);
  }
  50% {
    opacity: 0.6;
    box-shadow: 0 0 0 5px transparent;
  }
}

/* Акцентная pill (например «AI-студия») */
.pill--accent {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(22, 163, 74, 0.20);
  color: var(--brand-text);
}
.pill--accent .pill-dot {
  background: var(--brand);
}

/* Тёплый акцент-оранжевый */
.pill--warm {
  background: rgba(217, 119, 87, 0.06);
  border-color: rgba(217, 119, 87, 0.20);
  color: var(--accent-warm);
}
.pill--warm .pill-dot {
  background: var(--accent-warm);
  animation: none;
}

/* ----------------------------------------------------------------
   11. Kbd / tech-stack badge
   ---------------------------------------------------------------- */
.kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.6;
  letter-spacing: 0.01em;
}

/* ----------------------------------------------------------------
   12. Eyebrow расширенный (hero-level, крупнее базового)
   ---------------------------------------------------------------- */
.eyebrow-hero {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-text);
  line-height: 1.4;
}

/* ----------------------------------------------------------------
   13. Lead text (podзаголовок секции)
   ---------------------------------------------------------------- */
.lead {
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 640px;
  font-weight: 400;
}
.section-dark .lead {
  color: rgba(248, 245, 240, 0.65);
}

/* ----------------------------------------------------------------
   14. Section-tight (компактные секции)
   ---------------------------------------------------------------- */
.section-tight {
  padding-top: var(--sp-16);
  padding-bottom: var(--sp-16);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--sp-6);
  padding-right: var(--sp-6);
}
@media (max-width: 767px) {
  .section-tight {
    padding-top: var(--sp-12);
    padding-bottom: var(--sp-12);
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }
}

/* ----------------------------------------------------------------
   15. Headline утилита (H2 в секции без переопределения глобальных h2)
   ---------------------------------------------------------------- */
.headline {
  font-family: Manrope, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--text-primary);
}
.section-dark .headline { color: #ffffff; }

/* ----------------------------------------------------------------
   16. Hero H1 clamp (дополняет базовый h1 из input.css)
   ---------------------------------------------------------------- */
.h1-hero {
  font-size: clamp(48px, 7vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.04em;
  font-weight: 700;
  font-family: Manrope, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
}

/* ----------------------------------------------------------------
   17. Tabular nums helper
   ---------------------------------------------------------------- */
.tabular { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------
   18. Divider с тёплым тоном
   ---------------------------------------------------------------- */
.divider-warm {
  height: 1px;
  background: var(--border-subtle);
  border: none;
  margin: 0;
}

/* ----------------------------------------------------------------
   REDUCED MOTION — дублируем для новых классов
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-reveal].is-visible {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .btn-magnetic,
  .card-glow,
  .bento-cell {
    transition: none !important;
  }
  .marquee-inner {
    animation: none !important;
  }
  .pill-dot {
    animation: none !important;
  }
  .btn-magnetic--green,
  .btn-magnetic--primary {
    transform: none !important;
  }
}

/* ================================================================
   INTERACTIVE COMPARE TABLE (compare-interactive.js)
   ================================================================ */

/* Row hover highlight */
.compare-table tbody tr.compare-row--hovered td,
.compare-table tbody tr.compare-row--hovered th,
.comparison-table tbody tr.compare-row--hovered td {
  background: rgba(22, 163, 74, 0.04);
  transition: background 0.15s ease;
}

/* Highlight-колонка в hovered-строке - чуть ярче */
.compare-table tbody tr.compare-row--hovered .compare-cell--highlight {
  background: rgba(22, 163, 74, 0.10);
}

/* Колонка-победитель GrizzlyLab в hovered-строке */
.comparison-table tbody tr.compare-row--hovered .comparison-td--gl {
  background: rgba(22, 163, 74, 0.08);
}

/* Скрытая колонка (мобильный tab-switch) */
.compare-col--hidden {
  display: none;
}

/* Fade-in при переключении таба */
.compare-col--fade-in {
  animation: compare-fade 0.2s ease;
}
@keyframes compare-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Tab bar (показывается только на мобиле) */
.compare-tabs {
  display: none;
  gap: 6px;
  margin-bottom: var(--sp-4);
}
@media (max-width: 767px) {
  .compare-tabs {
    display: flex;
  }
  /* На мобиле убираем overflow scroll, таблица занимает нужную ширину */
  .packages-compare .compare-wrap {
    overflow-x: unset;
  }
}

.compare-tab {
  flex: 1;
  padding: 8px 4px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.compare-tab--active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.compare-tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Pulse badge */
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.05); }
}
.pkg-badge--pulse {
  animation: badge-pulse 2s ease-in-out infinite;
}

/* Glow на highlight-колонке при reveal */
.compare-wrap--revealed .compare-th--highlight,
.compare-wrap--revealed .compare-cell--highlight {
  position: relative;
}
.compare-wrap--revealed .compare-th--highlight::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 60% 80% at 50% 0%,
    rgba(22, 163, 74, 0.10) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

/* ================================================================
   FEATURE BENTO INTERACTIVE (feature-bento.js)
   ================================================================ */

/* Tilt: убираем translate при tilt чтобы не конфликтовал с card-glow hover */
@media (hover: hover) and (min-width: 768px) {
  .fb-card {
    transition: transform 0.1s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  }
}

/* Mini-kanban */
.fb-kanban {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: var(--sp-3);
}

.fb-kanban__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 5px;
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  min-height: 60px;
}

.fb-kanban__col-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subdued);
  margin-bottom: 3px;
  white-space: nowrap;
}

.fb-kanban__dot {
  height: 14px;
  border-radius: 3px;
}
.fb-kanban__dot--accent  { background: rgba(217, 119, 87, 0.55); }
.fb-kanban__dot--neutral { background: var(--border-subtle); width: 80%; }
.fb-kanban__dot--brand   { background: rgba(22, 163, 74, 0.55); }
.fb-kanban__dot--success { background: var(--brand); }

/* Dot-flow animation: New col dot переходит в Work, потом Won */
.fb-kanban__col--new .fb-kanban__dot--accent {
  animation: kanban-flow 3s ease-in-out infinite;
  transform-origin: center;
}
@keyframes kanban-flow {
  0%, 30%  { opacity: 1; transform: none; }
  40%      { opacity: 0; transform: translateX(8px); }
  41%      { opacity: 0; transform: translateX(-8px); }
  50%, 80% { opacity: 1; transform: none; }
  90%      { opacity: 0; }
  100%     { opacity: 1; transform: none; }
}

/* Chips интеграции */
.fb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: var(--sp-2);
}

.fb-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-subdued);
  opacity: 0.4;
  transition: opacity 0.3s ease, color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
  white-space: nowrap;
}

.fb-chip--active {
  opacity: 1;
  color: var(--brand-text);
  border-color: rgba(22, 163, 74, 0.30);
  background: rgba(22, 163, 74, 0.06);
}

/* Pulse иконок карточек 4-6 */
@keyframes icon-ring-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
  60%  { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.fb-card-icon--pulsing {
  animation: icon-ring-pulse 3s ease-in-out infinite;
}

/* Transition для chat bubbles */
.fb-chat-bubble {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Reduced motion: выключаем все новые анимации */
@media (prefers-reduced-motion: reduce) {
  .fb-card { transition: none !important; }
  .fb-kanban__dot--accent { animation: none !important; }
  .fb-chip { transition: none !important; }
  .fb-card-icon--pulsing { animation: none !important; }
  .pkg-badge--pulse { animation: none !important; }
  .compare-col--fade-in { animation: none !important; }
  .fb-chat-bubble { transition: none !important; }
}
