/* =======================================================================
   RESPONSIVE LAYER
   Подключается ПОСЛЕ main.css и только переопределяет отдельные правила.
   Ничего в main.css не трогалось — при обновлении шаблона этот файл
   можно просто отключить.
   ======================================================================= */

:root {
    /* ширина колонки лендинга задаётся в одном месте */
    --landing-width: 480px;
    --sticky-header-h: 64px;
}

/* ---------- 1. Базовые фиксы ---------- */

html {
    scroll-behavior: smooth;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;           /* убирает горизонтальный свайп от абсолютных блоков */
    -webkit-text-size-adjust: 100%;
}

* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.08);
}

/* reset.css вешает text-wrap: balance на ВСЁ — на длинных абзацах это
   тормозит рендер и рвёт строки. Балансируем только заголовки. */
p,
li,
td,
th,
label,
.text {
    text-wrap: pretty;
}

h1,
h2,
h3 {
    text-wrap: balance;
}

/* якорные переходы не уезжают под липкую шапку */
[id] {
    scroll-margin-top: var(--sticky-header-h);
}

/* ---------- 2. Ширина макета в одном месте ---------- */

main.wrapper,
header.header-style-1,
header.header-style-1 .header-top,
section.bottom-panel-style-1 {
    max-width: var(--landing-width);
}

main.wrapper {
    min-height: 100svh;
}

/* ---------- 3. Фиксированная нижняя панель ---------- */
/* В main.css она position: fixed без left — на ПК прилипала к левому краю
   экрана вместо колонки лендинга. */

section.bottom-panel-style-1 {
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    /* безопасная зона под «домашнюю полоску» iPhone */
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

/* ---------- 4. Медиа: без скачков вёрстки (CLS) ---------- */

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

.offer-img-slide-item img,
section.img-style-1 img {
    aspect-ratio: 3 / 4;
    object-fit: cover;
}

.video_block .youtube {
    aspect-ratio: 16 / 9;
}

/* иконки не должны растягиваться на всю ширину из-за img{width:100%} в reset.css */
img[src$="star.png"],
img[src*="_icon"] {
    width: auto;
    max-width: 100%;
}

/* ---------- 5. Формы и кликабельные зоны ---------- */

section.form-style-1 input,
section.form-style-1 select {
    min-height: 56px;
    font-size: 17px;              /* ≥16px, иначе iOS зумит страницу при фокусе */
    -webkit-appearance: none;
    appearance: none;
}

section.form-style-1 input:focus,
section.form-style-1 select:focus {
    border-color: var(--Style1Color1);
    box-shadow: 0 0 0 3px rgba(164, 50, 179, 0.18);
}

section.form-style-1 input:invalid:not(:placeholder-shown) {
    border-color: #e02c2c;
}

section.button-style-1 a,
section.button-style-1 button,
section.bottom-panel-style-1 a,
header.header-style-1 .header-bottom li a {
    min-height: 48px;             /* минимальная тач-зона */
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.1s ease;
}

section.button-style-1 button:active,
section.bottom-panel-style-1 a:active {
    transform: scale(0.985);
}

/* ---------- 6. Планшет / ПК ---------- */

@media (min-width: 768px) {
    body.body-style-1 {
        background: #2f2f33;
        background-image: radial-gradient(
            120% 80% at 50% 0%,
            #4a4a52 0%,
            #232327 70%
        );
        background-attachment: fixed;
    }

    main.wrapper {
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.45);
    }

    /* на мышке даём hover, на тачах его нет */
    section.button-style-1 a:hover,
    section.button-style-1 button:hover,
    section.bottom-panel-style-1 a:hover {
        filter: brightness(1.1);
    }
}

@media (min-width: 1024px) {
    :root {
        --landing-width: 540px;   /* колонка чуть шире, читать комфортнее */
    }

    body.body-style-1 {
        font-size: 18px;
    }

    section.button-style-1 a,
    section.button-style-1 button,
    section.bottom-panel-style-1 a {
        font-size: 26px;
    }
}

/* ---------- 7. Телефоны ---------- */

@media (max-width: 480px) {
    header.header-style-1 .header-bottom li a {
        font-size: 12px;
    }

    section.button-style-1 a,
    section.button-style-1 button {
        font-size: 20px;
        padding: 16px 0;
    }

    .bottom-panel-style-1 .price-and-sale-block .price-new {
        font-size: 21px;
    }

    footer.footer-style-1 {
        padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 360px) {
    body.body-style-1 {
        font-size: 13px;
    }

    section.form-style-1,
    section.button-style-1 {
        padding-left: 12px;
        padding-right: 12px;
    }

    section.bottom-panel-style-1 a {
        font-size: 17px;
        padding: 12px 14px;
    }

    .bottom-panel-style-1 .price-and-sale-block {
        width: calc(100% - 120px);
    }

    .offer-style-2 .sale {
        width: 74px;
        height: 74px;
    }

    .offer-style-2 .sale p:nth-child(2) {
        font-size: 20px;
    }
}

/* ---------- 8. Альбомная ориентация телефона ---------- */

@media (max-height: 480px) and (orientation: landscape) {
    header.header-style-1 {
        position: static;         /* липкая шапка съедает пол-экрана */
    }

    section.bottom-panel-style-1 {
        position: static;
        transform: none;
        left: auto;
        margin: 0 auto;
    }

    footer.footer-style-1 {
        padding-bottom: 20px;
    }
}

/* ---------- 9. Доступность и печать ---------- */

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

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

@media print {
    header.header-style-1,
    section.bottom-panel-style-1 {
        display: none !important;
    }
}
