/* ============================================================================
   vakas.ru — design system
   Заметка: используется в прототипе вместе с Tailwind CDN.
   На прод: либо собранный Tailwind + этот файл, либо чистый CSS без Tailwind.
   ============================================================================ */


/* ── 1. TOKENS ─────────────────────────────────────────────────────────── */

:root {
  /* color */
  --accent:        #4f46e5;   /* indigo-600 */
  --accent-soft:   #eef2ff;   /* indigo-50 */
  --accent-dark:   #3730a3;   /* indigo-800 */
  --ink:           #0a0a0a;
  --ink-soft:      #525252;
  --ink-mute:      #737373;
  --line:          #e5e5e5;
  --line-strong:   #d4d4d4;
  --bg:            #ffffff;
  --bg-soft:       #fafafa;
  --bg-dark:       #0a0a0a;
  --success:       #10b981;
  --danger:        #ef4444;

  /* radii */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-full: 9999px;

  /* shadow */
  --shadow-card:  0 18px 40px -20px rgba(0,0,0,.18);
  --shadow-glow:  0 12px 30px -10px rgba(79,70,229,.6);
  --shadow-glow-strong: 0 16px 36px -10px rgba(79,70,229,.7);

  /* typography */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* motion */
  --t-fast: .15s;
  --t-base: .25s;
  --t-slow: .8s;
  --easing: cubic-bezier(.4, 0, .2, 1);

  /* layout */
  --nav-h: 72px;
}


/* ── 2. BASE ───────────────────────────────────────────────────────────── */

html {
  font-family: var(--font-sans);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  color: var(--ink);
  background: var(--bg);
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

/* h1 — display, slightly tighter. Меньшие заголовки и body — нейтральный tracking. */
h1 { letter-spacing: -0.022em; }
h2, h3 { letter-spacing: -0.012em; }

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

/* Skip-link для screen reader / keyboard */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--bg-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 var(--r-md) 0;
  z-index: 100;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

/* Глобальный focus-visible */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}


/* ── 3. UTILITIES ──────────────────────────────────────────────────────── */

.ink-soft  { color: var(--ink-soft); }
.ink-mute  { color: var(--ink-mute); }
.accent-text { color: var(--accent); }
.accent-bg   { background: var(--accent); }
.accent-soft-bg { background: var(--accent-soft); }
.line-bg     { background: var(--line); }

.marker {
  background: linear-gradient(transparent 65%, rgba(79,70,229,.18) 65%);
  padding: 0 .1em;
}

.dots {
  background-image: radial-gradient(rgba(0,0,0,0.08) 1px, transparent 1px);
  background-size: 20px 20px;
}


/* ── 4. COMPONENTS ─────────────────────────────────────────────────────── */

/* AI gradient — для USP-маркеров. Использовать умеренно. */
.ai-badge {
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
  color: #fff;
}

/* Glow button */
.btn-glow {
  box-shadow: var(--shadow-glow);
  transition: box-shadow var(--t-base) var(--easing), transform var(--t-base) var(--easing);
}
.btn-glow:hover { box-shadow: var(--shadow-glow-strong); }

/* Card hover (тонкое поднятие) */
.card {
  transition: transform var(--t-base) var(--easing),
              box-shadow var(--t-base) var(--easing),
              border-color var(--t-base) var(--easing);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: var(--line-strong);
}

/* Chip (для категорий, тегов) */
.chip {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: #f5f5f5;
  color: var(--ink-soft);
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base);
}
.chip:hover { background: #ececec; color: var(--ink); }
.chip-active { background: var(--accent); color: #fff; }
.chip-active:hover { background: var(--accent-dark); color: #fff; }

/* Decorative gradient orb. Используем умеренно. */
.orb {
  position: absolute;
  border-radius: var(--r-full);
  filter: blur(80px);
  opacity: .45;
  pointer-events: none;
}
/* На мобильных blur очень дорогой — отключаем */
@media (max-width: 640px) {
  .orb { filter: blur(40px); opacity: .25; }
}

/* Header nav (sticky + transparent → solid on scroll) */
.site-nav {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 50;
  transition: background var(--t-base) var(--easing),
              border-color var(--t-base) var(--easing);
  background: transparent;
  border-bottom: 1px solid transparent;
}
.site-nav.is-solid {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}
/* На мобильных backdrop-filter дорогой — простой fallback */
@media (max-width: 640px) {
  .site-nav.is-solid {
    background: rgba(255,255,255,.95);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* Mobile burger toggle */
.burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  width: 40px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.burger:hover { background: rgba(0,0,0,.06); }
.burger-icon, .burger-icon::before, .burger-icon::after {
  display: block;
  height: 2px;
  width: 22px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform var(--t-base) var(--easing), opacity var(--t-fast);
}
.burger-icon::before, .burger-icon::after {
  content: '';
  position: absolute;
}
.burger-icon { position: relative; }
.burger-icon::before { transform: translateY(-7px); }
.burger-icon::after  { transform: translateY(7px); }
.burger[aria-expanded="true"] .burger-icon            { background: transparent; }
.burger[aria-expanded="true"] .burger-icon::before    { transform: rotate(45deg); }
.burger[aria-expanded="true"] .burger-icon::after     { transform: rotate(-45deg); }

/* Mobile menu drawer */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 49;
  padding: calc(var(--nav-h) + 24px) 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity var(--t-base) var(--easing),
              transform var(--t-base) var(--easing),
              visibility 0s linear var(--t-base);
  overflow-y: auto;
}
.mobile-menu.is-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--t-base) var(--easing),
              transform var(--t-base) var(--easing),
              visibility 0s linear 0s;
}
.mobile-menu a {
  display: block;
  padding: 16px 12px;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--r-md);
}
.mobile-menu a:hover, .mobile-menu a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}
.mobile-menu .menu-meta {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
body.menu-open { overflow: hidden; }

/* Marquee (бегущая строка логотипов) */
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee {
  display: flex;
  width: max-content;
  animation: marquee-scroll 30s linear infinite;
  will-change: transform;
}
.marquee:hover { animation-play-state: paused; }


/* ── 5. PROSE (типографика статьи) ─────────────────────────────────────── */

.prose {
  color: #262626;
  line-height: 1.75;
  max-width: 720px;
}
.prose h2 {
  font-size: 1.875rem;
  line-height: 1.2;
  font-weight: 700;
  margin: 3rem 0 1rem;
  letter-spacing: -0.012em;
}
.prose h3 {
  font-size: 1.5rem;
  line-height: 1.3;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.012em;
}
.prose p { margin: 1.25rem 0; font-size: 1.0625rem; }
.prose ul, .prose ol { margin: 1.25rem 0; padding-left: 1.5rem; }
.prose li { margin: .5rem 0; font-size: 1.0625rem; }
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.prose a:hover { text-decoration-thickness: 2px; }
.prose code {
  background: #f5f5f5;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, monospace;
}
.prose pre {
  background: var(--bg-dark);
  color: #e5e5e5;
  padding: 1.5rem;
  border-radius: var(--r-md);
  overflow-x: auto;
  font-size: .9em;
  line-height: 1.6;
}
.prose pre code { background: transparent; padding: 0; color: inherit; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  font-style: italic;
  color: var(--ink-soft);
  margin: 1.5rem 0;
}
.prose img {
  border-radius: var(--r-md);
  margin: 2rem 0;
  height: auto;
}

/* TOC */
.toc-item {
  display: block;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--t-fast);
  padding: 4px 0;
}
.toc-item:hover, .toc-item:focus-visible { color: var(--accent); }
.toc-item.is-active {
  color: var(--accent);
  font-weight: 600;
}
/* Mobile TOC accordion */
.toc-mobile { display: none; }
@media (max-width: 1023px) {
  .toc-desktop { display: none; }
  .toc-mobile { display: block; }
  .toc-mobile summary {
    cursor: pointer;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    font-weight: 600;
    list-style: none;
  }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile[open] summary { border-color: var(--accent); color: var(--accent); }
  .toc-mobile .toc-list { padding: 12px 16px 4px; }
}


/* ── 6. FORM ──────────────────────────────────────────────────────────── */

.form-control {
  width: 100%;
  padding: 16px 20px;
  border-radius: var(--r-full);
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--t-base);
}
.form-control::placeholder { color: rgba(255,255,255,.4); }
.form-control:focus { outline: none; border-color: #fff; }
.form-control:invalid:not(:placeholder-shown) { border-color: var(--danger); }
.form-control.is-valid { border-color: var(--success); }

.form-success {
  background: rgba(16,185,129,.12);
  color: #d1fae5;
  border: 1px solid rgba(16,185,129,.3);
  border-radius: var(--r-md);
  padding: 16px 20px;
  display: none;
}
.form-success.is-shown { display: block; }
.form-error {
  display: none;
  color: #fecaca;
  font-size: .875rem;
  margin-top: 8px;
}
.form-error.is-shown { display: block; }


/* ── 7. MOTION ────────────────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--t-slow) var(--easing),
              transform var(--t-slow) var(--easing);
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* Reduced motion preference: останавливаем все анимации */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
  .marquee {
    animation: none;
  }
}


/* ── 8. AUX ───────────────────────────────────────────────────────────── */

/* visually-hidden, но доступен скринридерам */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
