/* ==========================================================================
   Базовая типографика, контейнеры, секции, утилиты
   ========================================================================== */

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

body {
  font-family: var(--font-base);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Заголовки ---------- */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-base); }

p {
  line-height: var(--lh-relaxed);
  color: var(--color-text-muted);
}

p + p { margin-top: var(--space-3); }

a {
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-accent); }

strong { font-weight: var(--fw-semibold); color: var(--color-text); }
em { font-style: italic; }

::selection {
  background-color: var(--color-accent);
  color: var(--color-white);
}

/* ---------- Контейнер ---------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.container--narrow {
  max-width: var(--container-narrow);
}

/* ---------- Секции ---------- */

.section {
  padding-block: var(--space-16);
  position: relative;
}

.section--alt {
  background-color: var(--color-surface-alt);
}

.section--inverse {
  /* Адаптивный фон: в light — светлый, в dark — тёмный.
     Раньше был привязан к --color-graphite-800 (бренд-нейтральный),
     из-за чего в светлой теме выглядел тёмным пятном. */
  background-color: var(--tg-bg-inverse);
  color: var(--tg-text-inverse);
}

.section--inverse h1,
.section--inverse h2,
.section--inverse h3,
.section--inverse h4,
.section--inverse p { color: inherit; }

.section__header {
  max-width: var(--prose-max);
  margin-bottom: var(--space-10);
}

.section__header--center {
  margin-inline: auto;
  text-align: center;
}

.section__eyebrow {
  display: inline-block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent-text);
  margin-bottom: var(--space-3);
}

.section__title {
  font-size: var(--fs-4xl);
  margin-bottom: var(--space-3);
}

.section__subtitle {
  font-size: var(--fs-lg);
  color: var(--color-text-muted);
}

/* ---------- Утилитарные классы ---------- */

.text-center   { text-align: center; }
.text-left     { text-align: left; }
.text-right    { text-align: right; }
.text-muted    { color: var(--color-text-muted); }
.text-accent   { color: var(--color-accent); }
.text-strong   { color: var(--color-text); }

.mb-0  { margin-bottom: 0 !important; }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }

.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* ---------- Доступность ---------- */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Анимация появления (для JS) ---------- */

[data-animate] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease, transform 600ms ease;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  [data-animate] { opacity: 1; transform: none; }
}
