/* Сброс и базовые элементы */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

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

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

button {
  cursor: pointer;
}

/* Атрибут hidden всегда скрывает, даже если у элемента задан display */
[hidden] {
  display: none !important;
}

/* Ссылки: подчёркивание только у ссылок внутри абзацев */
a {
  color: inherit;
  text-decoration: none;
}

p a {
  color: var(--color-brand-text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Видимый фокус для клавиатуры не убираем */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Появление блоков при прокрутке.
   Класс .reveal на <html> ставится в <head> только при работающем JS и без «уменьшения движения»,
   .is-visible добавляет js/main.js. Соседние блоки идут с задержкой по --reveal-order. */
.reveal [data-reveal] {
  opacity: 0;
  transform: translateY(var(--reveal-shift));
  transition:
    opacity var(--duration-reveal) var(--easing-reveal),
    transform var(--duration-reveal) var(--easing-reveal);
  transition-delay: calc(var(--reveal-order, 0) * var(--reveal-stagger));
}

.reveal [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Утилиты */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

@media (min-width: 48em) {
  :root {
    --container-pad: var(--space-6);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
