/* ============================================
   msk.estate — Design Tokens v3
   High-end · спокойный · технологический
   Палитра: градация чёрного + красный + изумруд (≤5%)
   ============================================ */

:root {
  /* ====================
     GRADIENT OF BLACK
     ==================== */
  --color-fg:        #0A0A0A;  /* чистый чёрный */
  --color-fg-1:      #1A1A1A;
  --color-fg-2:      #2A2A2A;
  --color-fg-3:      #404040;
  --color-fg-4:      #525252;
  --color-fg-5:      #737373;
  --color-fg-6:      #8A8A8A;
  --color-fg-7:      #B3B3B3;
  --color-fg-8:      #D4D4D4;

  /* ====================
     SURFACES
     ==================== */
  --color-bg:        #FFFFFF;
  --color-bg-1:      #FAFAFA;
  --color-bg-2:      #F5F5F5;
  --color-bg-3:      #EFEFEF;
  --color-bg-4:      #E8E8E8;
  --color-bg-elev:   #FFFFFF;

  /* ====================
     BORDERS
     ==================== */
  --color-border:        #ECECEC;
  --color-border-2:      #E5E5E5;
  --color-border-strong: #D4D4D4;
  --color-border-dark:   #2A2A2A;

  /* ====================
     BRAND RED (основной акцент)
     ==================== */
  --color-brand:        #e7342a;
  --color-brand-hover:  #cf2a22;
  --color-brand-active: #b21f17;
  --color-brand-soft:   #fff1ef;
  --color-brand-softer: #fef6f5;
  --color-brand-deep:   #8a1f17;

  /* ====================
     SYSTEM ACCENT — изумруд (≤5% использования)
     Применяется ТОЛЬКО в семантических success/verified/secure контекстах:
     - бейджи статусов "Готово/Одобрено/Безопасно"
     - success-дельта KPI
     - эскроу-блок (безопасная сделка)
     - verified-индикатор
     В остальных местах — тёмный (--color-fg).
     ==================== */
  --color-accent:        #047857;
  --color-accent-hover:  #065F46;
  --color-accent-active: #064E3B;
  --color-accent-soft:   #D1FAE5;
  --color-accent-softer: #ECFDF5;

  /* ====================
     GRAPHITE — второй акцент (≤5% использования)
     Применяется в:
     - hover-состояниях тонких линий и иконок
     - secondary-CTA на тёмных секциях (замена --color-fg)
     - фоне premium-бейджей "Pro" / "Бизнес" / "Элит"
     - график-акценты в инфографике
     НЕ заменяет основной бренд-красный и изумруд.
     ==================== */
  --color-graphite:        #3F3F46;
  --color-graphite-hover:  #2A2A2A;
  --color-graphite-soft:   #F4F4F5;
  --color-graphite-border: #D4D4D8;

  /* ====================
     SEMANTIC
     ==================== */
  --color-success:       #047857;
  --color-success-soft:  #ECFDF5;
  --color-warning:       #B45309;
  --color-warning-soft:  #FEF3C7;
  --color-danger:        #DC2626;
  --color-danger-soft:   #FEE2E2;
  --color-info:          #1E40AF;
  --color-info-soft:     #DBEAFE;

  /* ====================
     GRADIENTS (high-end)
     ==================== */
  --grad-hero:
    radial-gradient(60% 50% at 80% 0%, rgba(231, 52, 42, 0.05), transparent 60%),
    radial-gradient(50% 50% at 0% 60%, rgba(4, 120, 87, 0.03), transparent 60%),
    linear-gradient(180deg, #FAFAFA 0%, #FFFFFF 100%);

  --grad-cta:
    linear-gradient(135deg, #0A0A0A 0%, #1A1A1A 100%);

  --grad-card-glow:
    linear-gradient(135deg, rgba(231, 52, 42, 0.04), rgba(4, 120, 87, 0.02));

  /* ====================
     SHADOWS
     ==================== */
  --shadow-xs: 0 1px 2px rgba(10, 10, 10, 0.04);
  --shadow-sm: 0 1px 3px rgba(10, 10, 10, 0.05), 0 1px 2px rgba(10, 10, 10, 0.04);
  --shadow-md: 0 4px 12px rgba(10, 10, 10, 0.06), 0 2px 4px rgba(10, 10, 10, 0.04);
  --shadow-lg: 0 12px 32px rgba(10, 10, 10, 0.08), 0 4px 8px rgba(10, 10, 10, 0.04);
  --shadow-xl: 0 24px 64px rgba(10, 10, 10, 0.10), 0 8px 16px rgba(10, 10, 10, 0.06);
  --shadow-2xl: 0 32px 80px rgba(10, 10, 10, 0.12);
  --shadow-brand: 0 8px 24px rgba(231, 52, 42, 0.25);
  --shadow-inset: inset 0 1px 2px rgba(10, 10, 10, 0.04);
  --shadow-ring-focus: 0 0 0 4px rgba(10, 10, 10, 0.06);

  /* ====================
     RADIUS
     ==================== */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-2xl: 36px;
  --radius-3xl: 48px;
  --radius-full: 9999px;

  /* ====================
     SPACING (8px grid)
     ==================== */
  --space-px: 1px;
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;
  --space-11: 44px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-28: 112px;
  --space-32: 128px;
  --space-40: 160px;

  /* ====================
     TYPE
     ==================== */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro Display",
    "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro Display",
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Roboto Mono", Menlo, monospace;
  --font-num: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Type scale */
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 32px;
  --text-4xl: 40px;
  --text-5xl: 56px;
  --text-6xl: 72px;
  --text-7xl: 88px;
  --text-display: 104px;

  --leading-tight: 1.05;
  --leading-snug: 1.2;
  --leading-normal: 1.45;
  --leading-relaxed: 1.6;
  --leading-loose: 1.75;

  --tracking-tight: -0.02em;
  --tracking-snug: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;
  --tracking-wider: 0.08em;
  --tracking-widest: 0.12em;

  /* ====================
     LAYOUT
     ==================== */
  --container-narrow: 920px;
  --container-default: 1280px;
  --container-wide: 1440px;
  --container-full: 1680px;
  --header-h: 72px;
  --header-h-mobile: 64px;
  --tabbar-h: 64px;

  /* ====================
     MOTION
     ==================== */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 160ms;
  --duration-base: 240ms;
  --duration-slow: 400ms;
  --duration-slower: 600ms;

  /* ====================
     Z-INDEX
     ==================== */
  --z-base: 0;
  --z-header: 50;
  --z-tabbar: 50;
  --z-overlay: 90;
  --z-modal: 100;
  --z-toast: 200;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-fg);
  background: var(--color-bg);
  font-feature-settings: "ss01", "cv11", "cv02";
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

::selection {
  background: var(--color-fg);
  color: #fff;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--color-fg);
  text-wrap: balance;
}

p { margin: 0; }
ul { list-style: none; padding: 0; margin: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 999px;
  border: 2px solid var(--color-bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-fg-6); }
::-webkit-scrollbar-track { background: transparent; }

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--color-fg);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Body states */
body.scroll-locked { overflow: hidden; }

/* =========================
   ANIMATIONS (high-end)
   ========================= */
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(2.4); opacity: 0; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes blob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -20px) scale(1.05); }
}

@keyframes ping {
  0% { transform: scale(1); opacity: 0.6; }
  80%, 100% { transform: scale(2.2); opacity: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Reveal on scroll (init via JS) — по умолчанию видимы, JS добавляет класс для анимации */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}

.js-reveal .reveal:not(.is-visible) {
  opacity: 0;
  transform: translateY(16px);
}

.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > * {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}

.js-reveal .reveal-stagger:not(.is-visible) > * {
  opacity: 0;
  transform: translateY(12px);
}

.js-reveal .reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: translateY(0); }
.js-reveal .reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 60ms; opacity: 1; transform: translateY(0); }
.js-reveal .reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 120ms; opacity: 1; transform: translateY(0); }
.js-reveal .reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 180ms; opacity: 1; transform: translateY(0); }
.js-reveal .reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 240ms; opacity: 1; transform: translateY(0); }
.js-reveal .reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 300ms; opacity: 1; transform: translateY(0); }
