/*
 * Базовые стили лендинга: reset, типографика, контейнер. Шрифт и переменные — в tokens.css.
 */

/* Reset */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-base);
    font-size: var(--fs-body);
    font-weight: 300;
    line-height: 1.38;
    color: var(--color-text);
    background: var(--color-white);
    -webkit-font-smoothing: antialiased;
}

body.is-scroll-locked {
    overflow: hidden;
}

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

h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
    color: var(--color-ink);
}

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

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

img {
    height: auto;
}

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

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

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

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

/* Контент растягивается, чтобы подвал на коротких страницах был внизу экрана */
.page {
    flex: 1 0 auto;
}

/* Утилиты */

.container {
    width: 100%;
    max-width: calc(var(--container) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

/* На планшете контент — колонкой 640px по центру, как на Тильде */
@media (min-width: 640px) and (max-width: 979px) {
    .container {
        max-width: 640px;
    }
}

/* Маркированный список с маленькими точками */
.dot-list li {
    position: relative;
    padding-left: 20px;
}

.dot-list li::before {
    content: '';
    position: absolute;
    top: 0.6em;
    left: 6px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: currentColor;
}

/* Секции страницы разделены тонкой линией на всю ширину */
.section + .section {
    border-top: 1px solid var(--color-line);
}

/* Типографика */

.title-xl,
.title-l,
.title-m,
.title-s {
    font-weight: 500;
    line-height: 1.08;
    color: var(--color-ink);
}

.title-xl {
    font-size: var(--fs-h3);
}

.title-l,
.title-m {
    font-size: var(--fs-h5);
}

.title-s {
    font-size: var(--fs-lead);
    line-height: 1.15;
}

.text-lead {
    font-size: var(--fs-lead);
    line-height: 1.35;
    color: var(--color-ink);
}

.text-caption {
    font-size: var(--fs-caption);
    font-weight: 400;
    line-height: 1.38;
    color: var(--color-muted);
}

@media (min-width: 980px) {
    .title-xl {
        font-size: var(--fs-h1);
    }

    .title-l {
        font-size: var(--fs-h2);
    }

    .title-m {
        font-size: var(--fs-h3);
    }

    .title-s {
        font-size: var(--fs-h5);
    }

    .text-lead {
        font-size: 24px;
        line-height: 1.33;
    }
}

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

/*
 * Картинка, которая при наведении на ссылку сменяется другой:
 * <span class="swap"><img><img class="swap__hover"></span>
 */
.swap {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    vertical-align: middle;
}

.swap__hover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.2s;
}

a:hover .swap__hover {
    opacity: 1;
}

.icon {
    flex-shrink: 0;
    width: 1em;
    height: 1em;
    fill: currentColor;
}

/*
 * Анимации появления: элемент с data-animate проявляется, когда попадает в экран (js/animate.js).
 * Класс .js ставится на <html> инлайн-скриптом — без JS контент виден сразу.
 */

.js [data-animate] {
    opacity: 0;
    transition: opacity 1s ease, transform 1s ease;
    transition-delay: var(--animate-delay, 0s);
}

.js [data-animate='fade-up'] {
    transform: translateY(var(--animate-distance, 50px));
}

/* Короткое появление снизу — так на Тильде проявляются блоки при прокрутке */
.js [data-animate='rise'] {
    transform: translateY(var(--animate-distance, 20px));
    transition-duration: 0.4s;
    transition-timing-function: ease-out;
}

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

@media (prefers-reduced-motion: reduce) {
    .js [data-animate] {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
