/* ============================================
   BASE
   Сброс стилей, базовая типографика, общие правила.
   ============================================ */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Чтобы якорные ссылки не уезжали под sticky-header */
  scroll-padding-top: var(--header-height);
}

body {
  min-height: 100vh;
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* ---------- Typography ---------- */
.h1 {
  font-family: var(--font-heading);
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 700;
  color: var(--color-text);
}

.h2 {
  font-family: var(--font-heading);
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--color-text);
}

.h3 {
  font-family: var(--font-heading);
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--color-text);
}

.h4 {
  font-family: var(--font-heading);
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--color-text);
}

.text-lg {
  font-size: 18px;
  line-height: 1.6;
}

.text-md {
  font-size: 16px;
  line-height: 1.6;
}

.text-sm {
  font-size: 14px;
  line-height: 1.5;
}

.text-xs {
  font-size: 12px;
  line-height: 1.4;
}

/* ---------- Accessibility utilities ---------- */

/* Скрыть визуально, но оставить для скринридеров */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link — для клавиатурной навигации */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: var(--z-modal);
  padding: 12px 20px;
  background: var(--color-primary-dark);
  color: var(--color-text-inverse);
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 16px;
}

/* Единый стиль фокуса для клавиатуры */
:focus-visible {
  outline: 2px solid var(--color-primary-dark);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Уважаем prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   UTILITY CLASSES
   Минимальный набор утилит для отступов.
   Использовать только в исключительных случаях,
   когда невозможно вынести стили в компонент.
   ============================================ */

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}
