/* Сброс и базовая типографика */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

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

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--text-body);
    line-height: var(--leading-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

main {
    flex: 1;
}

main:focus {
    outline: none;
}

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

img {
    height: auto;
}

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

button {
    cursor: pointer;
}

h1,
h2,
h3,
h4 {
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
    hyphens: none;
}

h1 {
    font-size: var(--text-h1);
    line-height: var(--leading-h1);
}

h2 {
    font-size: var(--text-h2);
    line-height: var(--leading-h2);
}

h3 {
    font-size: var(--text-h3);
    line-height: var(--leading-h3);
}

p {
    text-wrap: pretty;
}

a {
    color: var(--color-link);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

ul[role="list"],
ol[role="list"] {
    padding: 0;
    list-style: none;
}

:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 3px;
}

/* На синих фонах фокус и ссылки — белые */
.on-dark {
    --color-focus: var(--color-white);
    --color-link: var(--color-white);
    color: var(--color-white);
}

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

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