/* Сброс, типографика, элементы форм. */

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p { margin: 0 0 var(--gap-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 2px;
}

a:hover { text-decoration-color: currentColor; }

ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

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

img {
  height: auto;
  background: var(--surface-2);   /* пока картинка грузится, не мигает белым */
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--gap-6) 0;
}

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Фокус виден всегда и везде: без этого сайт неуправляем с пульта телевизора. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- элементы форм --- */

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

button { cursor: pointer; }

/* --- утилиты --- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gap-4);
  top: -100px;
  z-index: 100;
  padding: var(--gap-3) var(--gap-4);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus { top: var(--gap-3); }

.text-block {
  max-width: var(--wrap-text);
  color: var(--ink-2);
}

.muted { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
