/* страница Trade-in в новом дизайне, пока только десктоп. размеры в rem react-шаблона: 1rem = 1px при ширине окна
   от 1440, на 1025-1440 корень масштабируется по ширине окна (html{font-size} в css react).
   макет - под ширину блоков 1400: размеры из него переведены с масштабом 2000px скриншота = 1400rem */

/* ширина блоков - как у .middle (вся ширина страницы), но не больше 1400px.
   .middle - контейнер для cqw: 100cqw = ширина .middle */
#bx-page .middle {
    container-type: inline-size;
}
.ti-page {
    --ti-width: min(1400px, 100cqw);
    /* блоки шире контейнера react (1200rem): выходим из него поровну с обеих сторон */
    width: var(--ti-width);
    margin-left: calc((100% - var(--ti-width)) / 2);
    color: #03142c;
}
.ti-page h1,
.ti-page h2,
.ti-page p {
    margin: 0;
}

/* --- первый экран --- */
.ti-hero {
    position: relative;
    min-height: 494rem;
}
.ti-hero__text {
    position: relative;
    z-index: 1;
    /* отступ 75rem + колонка текста 480rem, как в макете */
    max-width: 555rem;
    padding: 70rem 0 46rem 75rem;
}
.ti-hero__title {
    font-size: 44rem;
    line-height: 45rem;
    font-weight: 700;
    color: #03142c;
}
.ti-hero__lead {
    margin-top: 26rem !important;
    font-size: 25rem;
    line-height: 29rem;
    color: #1b2433;
}
.ti-hero__lead b {
    font-weight: 700;
    color: #03142c;
}
.ti-hero__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 62rem;
    margin-top: 38rem;
    padding: 0 30rem;
    border-radius: 100rem;
    background-color: #1374fa;
    color: #fff;
    font-size: 21rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .2s;
}
.ti-hero__btn:hover {
    background-color: #0b62db;
    color: #fff;
}
.ti-hero__img {
    position: absolute;
    right: 63rem;
    bottom: 0;
    width: 819rem;
    height: auto;
}

/* --- преимущества --- */
.ti-benefits {
    padding: 76rem 28rem;
    border-radius: 51rem;
    color: #fff;
    /* как в макете: темные края и центр, светлее - под крайними карточками */
    background:
        radial-gradient(50% 60% at 50% 45%, rgba(3, 30, 70, .55), rgba(3, 30, 70, 0)),
        linear-gradient(90deg, #01244d 0%, #024694 25%, #033775 50%, #024694 75%, #01244d 100%);
}
.ti-benefits__title {
    font-size: 36rem;
    line-height: 1.1;
    font-weight: 400;
    text-align: center;
    color: #fff;
}
.ti-benefits__list {
    display: grid;
    grid-template-columns: repeat(3, 283rem);
    justify-content: center;
    gap: 96rem;
    margin-top: 55rem;
}
.ti-benefit {
    min-height: 176rem;
    padding: 21rem 24rem 23rem 24rem;
    border: 1.5rem solid #fff;
    border-radius: 35rem;
}
.ti-benefit__head {
    display: flex;
    align-items: flex-start;
    gap: 10rem;
}
.ti-benefit__num {
    flex-shrink: 0;
    font-size: 65rem;
    line-height: .85;
    font-weight: 400;
}
.ti-benefit__name {
    padding-top: 2rem;
    font-size: 22rem;
    line-height: 27rem;
    font-weight: 600;
}
.ti-benefit__text {
    margin-top: 26rem !important;
    font-size: 16rem;
    line-height: 22rem;
}

/* --- калькулятор --- */
.ti-calc {
    display: grid;
    grid-template-columns: 467rem 1fr;
    grid-template-areas:
        "logo ."
        "form result";
    column-gap: 94rem;
    margin-top: 40rem;
    padding: 76rem 75rem 93rem;
    border-radius: 40rem;
    background-color: #1675f9;
    color: #fff;
    /* кнопка "Узнать стоимость" прокручивает сюда - отступ под шапку */
    scroll-margin-top: calc(var(--header-height, 60rem) + 20rem);
}
.ti-calc__logo {
    grid-area: logo;
    width: 43rem;
    margin-bottom: 28rem;
    color: #fff;
}
.ti-calc__logo svg {
    display: block;
    width: 100%;
    height: auto;
}
.ti-calc__form {
    grid-area: form;
}
.ti-calc__result {
    grid-area: result;
}
.ti-calc__title {
    font-size: 36rem;
    line-height: 38rem;
    font-weight: 400;
    color: #fff;
}
.ti-calc__title--result {
    line-height: 42rem;
}
.ti-calc__fields {
    display: grid;
    gap: 12rem;
    margin-top: 26rem;
}
.ti-select {
    display: block;
    width: 100%;
    height: 35rem;
    padding: 0 56rem 0 28rem;
    border: 0;
    border-radius: 100rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 10' fill='none'%3E%3Cpath d='M1 1l8 8 8-8' stroke='%231675f9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 27rem center / 17rem 10rem;
    color: #03142c;
    font-family: inherit;
    font-size: 16rem;
    line-height: 35rem;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    outline: none;
}
.ti-select:disabled {
    /* пока не выбрано предыдущее поле - как в макете, только курсор обычный */
    opacity: 1;
    color: #03142c;
    cursor: default;
}
.ti-select:focus-visible {
    box-shadow: 0 0 0 3rem rgba(255, 255, 255, .5);
}
.ti-calc__price {
    position: relative;
    display: inline-block;
    margin-top: 71rem;
}
.ti-calc__sum {
    display: inline-flex;
    align-items: center;
    min-width: 252rem;
    height: 65rem;
    padding: 0 29rem;
    border-radius: 100rem;
    background-color: #fff;
    color: #1675f9;
    font-size: 44rem;
    line-height: 1;
    font-weight: 700;
    white-space: nowrap;
}
.ti-calc__bonus {
    position: absolute;
    /* как в макете: заходит на правый край суммы и выступает за него */
    right: -56rem;
    top: -43rem;
    display: flex;
    align-items: center;
    height: 46rem;
    padding: 0 18rem;
    border-radius: 100rem;
    background: linear-gradient(90deg, #b6d2f8 0%, #dcecff 100%);
    box-shadow: 0 4rem 12rem rgba(0, 30, 90, .25);
    color: #0a1f44;
    font-size: 25rem;
    line-height: 1;
    font-weight: 500;
    white-space: nowrap;
    transform: rotate(5deg);
}
/* стикер "+ 2 000 ₽" и фраза о нашей скидке - только когда выбран iPhone (calc.js ставит .has-bonus) */
.ti-calc:not(.has-bonus) .ti-calc__bonus,
.ti-calc:not(.has-bonus) .ti-calc__note-bonus {
    display: none;
}
.ti-calc__note {
    max-width: 385rem;
    margin-top: 30rem !important;
    font-size: 15rem;
    line-height: 17rem;
    color: rgba(255, 255, 255, .8);
}

/* --- только десктоп / только мобила --- */
.ti-mob,
.ti-benefits__icon,
.ti-calc__note--mob {
    display: none;
}

/* --- мобила (и планшет до 1025): макет 430 - на мобиле 1rem = 1px макета (корень react считается от 430) --- */
@media (width < 1025px) {
    .ti-mob {
        display: initial;
    }
    .ti-desk {
        display: none;
    }

    /* первый экран: всё по центру, фото на всю ширину под кнопкой */
    .ti-hero {
        min-height: 0;
        text-align: center;
    }
    .ti-hero__text {
        max-width: none;
        padding: 36rem 16rem 0;
    }
    .ti-hero__title {
        font-size: 36rem;
        line-height: 38rem;
        font-weight: 500;
    }
    .ti-hero__lead {
        margin-top: 28rem !important;
        font-size: 19.5rem;
        line-height: 22.5rem;
    }
    .ti-hero__btn {
        height: 43rem;
        margin-top: 29rem;
        padding: 0 26rem;
        font-size: 16rem;
    }
    .ti-hero__pic {
        display: block;
        margin-top: 42rem;
    }
    .ti-hero__img {
        position: static;
        display: block;
        width: 100%;
        height: auto;
    }

    /* преимущества: без рамок и номеров, пункты по центру, между ними иконки */
    .ti-benefits {
        margin-top: 67rem;
        padding: 46rem 16rem 50rem;
        border-radius: 29rem;
        background:
            radial-gradient(70% 45% at 50% 45%, rgba(3, 30, 70, .5), rgba(3, 30, 70, 0)),
            linear-gradient(180deg, #0a2c53 0%, #0c4d97 22%, #083c79 42%, #0a3f7b 58%, #0a4d9a 75%, #053d7c 88%, #0f2f55 100%);
    }
    .ti-benefits__title {
        font-size: 29rem;
        line-height: 33rem;
    }
    .ti-benefits__list {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
        margin-top: 48rem;
    }
    .ti-benefit {
        min-height: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        text-align: center;
    }
    .ti-benefit__head {
        display: block;
    }
    .ti-benefit__num {
        display: none;
    }
    .ti-benefit__name {
        padding: 0;
        font-size: 22rem;
        line-height: 26rem;
        font-weight: 400;
    }
    .ti-benefit__text {
        margin-top: 10rem !important;
        font-size: 17rem;
        line-height: 22rem;
    }
    .ti-benefits__icon {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 36rem;
        margin: 28rem 0 34rem;
        color: #fff;
    }
    .ti-benefits__icon svg {
        width: 50rem;
        height: 42rem;
    }
    .ti-benefits__icon--rub {
        font-size: 50rem;
        line-height: 1;
        font-weight: 700;
    }
}

/* планшет: мобильное фото небольшое - не растягиваем на всю ширину */
@media (768px <= width < 1025px) {
    .ti-hero__img {
        max-width: 560rem;
        margin: 0 auto;
    }
}

/* --- калькулятор на мобиле (и планшете до 1025): одна колонка, без заголовка суммы и бейджа, короткая сноска --- */
@media (width < 1025px) {
    .ti-calc {
        display: block;
        margin-top: 20rem;
        padding: 43rem 22rem 44rem;
        border-radius: 33rem;
    }
    .ti-calc__logo {
        width: 33rem;
        margin: 0 auto 15rem;
    }
    .ti-calc__form .ti-calc__title {
        font-size: 27rem;
        line-height: 31rem;
        text-align: center;
    }
    .ti-calc__fields {
        margin-top: 30rem;
    }
    .ti-select {
        height: 44rem;
        padding: 0 48rem 0 17.5rem;
        line-height: 44rem;
        background-position: right 16rem center;
        background-size: 16rem 9rem;
    }
    .ti-calc__title--result,
    .ti-calc__note--desk {
        display: none;
    }
    .ti-calc__price {
        display: block;
        width: fit-content;
        margin-top: 29rem;
    }
    /* со стикером сумма ниже - иначе стикер упирается в поле "Комплект" */
    .ti-calc.has-bonus .ti-calc__price {
        margin-top: 40rem;
    }
    /* стикер на мобиле (макет): меньше, с белой обводкой, правее и выше суммы */
    .ti-calc__bonus {
        right: -53rem;
        top: -28rem;
        height: 37rem;
        padding: 0 14rem;
        border: 1.5rem solid #fff;
        background: linear-gradient(90deg, #b3cff7 0%, #e6f0ff 100%);
        box-shadow: 0 3rem 8rem rgba(0, 30, 90, .2);
        color: #111;
        font-size: 21rem;
        font-weight: 400;
        transform: rotate(5deg);
    }
    .ti-calc__sum {
        min-width: 171rem;
        height: 47rem;
        padding: 0 18rem;
        font-size: 31rem;
    }
    .ti-calc__note--mob {
        display: block;
        max-width: none;
        margin-top: 31rem !important;
        font-size: 11rem;
        line-height: 13rem;
        text-align: center;
    }
}

/* --- поддомены: форма заявки вместо калькулятора (фон, логотип, селекты - как у калькулятора) --- */
.ti-calc.ti-request {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 79rem 75rem 99rem;
    text-align: center;
}
.ti-request .ti-calc__logo {
    margin-bottom: 26rem;
}
.ti-request__title {
    font-size: 40rem;
    line-height: 41rem;
}
.ti-request__form {
    width: 493rem;
    max-width: 100%;
    margin-top: 38rem;
    text-align: left;
}
.ti-request .ti-calc__fields {
    margin-top: 0;
    gap: 12.5rem;
}
.ti-request .ti-request__selects {
    margin-top: 24rem;
}
.ti-input {
    display: block;
    width: 100%;
    height: 36rem;
    padding: 0 28rem 0 29rem;
    border: 0;
    border-radius: 100rem;
    background-color: #fff;
    color: #03142c;
    font-family: inherit;
    font-size: 17rem;
    line-height: 36rem;
    outline: none;
}
.ti-input::placeholder {
    color: #03142c;
    opacity: 1;
}
.ti-input:focus-visible {
    box-shadow: 0 0 0 3rem rgba(255, 255, 255, .5);
}
.ti-request .ti-select {
    height: 36rem;
    padding: 0 56rem 0 29rem;
    font-size: 17rem;
    line-height: 36rem;
    background-position: right 28rem center;
    background-size: 19rem 11rem;
}
.ti-request__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 395rem;
    max-width: 100%;
    height: 65rem;
    margin: 40rem auto 0;
    border: 0;
    border-radius: 100rem;
    background-color: #fff;
    color: #1675f9;
    font-family: inherit;
    font-size: 24rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s;
}
.ti-request__btn:hover {
    background-color: #e8f1fe;
}
/* кнопка блока на странице - открывает окно с формой */
.ti-request__open {
    width: 374rem;
    height: 61rem;
    margin-top: 38rem;
    font-size: 22rem;
}
/* на странице блок ниже, чем окно с формой */
#trade-in-calc.ti-request {
    padding: 74rem 75rem 94rem;
}

/* окно с формой заявки поверх страницы (переносится в body скриптом страницы) */
html.ti-modal-open,
html.ti-modal-open body {
    overflow: hidden;
}
.ti-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    padding: 40rem 16rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.ti-modal[hidden] {
    display: none;
}
.ti-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 20, 44, .6);
}
.ti-modal__dialog.ti-calc {
    position: relative;
    width: 100%;
    max-width: 860rem;
    /* по центру, а если окно выше экрана - прокручивается целиком */
    margin: auto;
}
.ti-modal h2,
.ti-modal p {
    margin: 0;
}
.ti-modal__close {
    position: absolute;
    top: 24rem;
    right: 24rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40rem;
    height: 40rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    cursor: pointer;
    transition: background-color .2s;
}
.ti-modal__close:hover {
    background: rgba(255, 255, 255, .3);
}
.ti-modal__close svg {
    width: 20rem;
    height: 20rem;
}

@media (width < 1025px) {
    .ti-calc.ti-request {
        display: flex;
        padding: 45rem 23rem 46rem;
    }
    .ti-request .ti-calc__logo {
        width: 35rem;
        margin: 0 auto 22rem;
    }
    .ti-request__title {
        font-size: 27rem;
        line-height: 33rem;
    }
    .ti-request__form {
        width: 100%;
        margin-top: 30rem;
    }
    .ti-request .ti-calc__fields {
        gap: 12rem;
    }
    .ti-request .ti-request__selects {
        margin-top: 25rem;
    }
    .ti-input,
    .ti-request .ti-select {
        height: 46rem;
        padding-left: 19rem;
        font-size: 17rem;
        line-height: 46rem;
    }
    .ti-request .ti-select {
        padding-right: 50rem;
        background-position: right 17rem center;
        background-size: 18rem 10rem;
    }
    .ti-request__btn {
        width: 231rem;
        height: 46rem;
        margin-top: 31rem;
        font-size: 19rem;
    }
    .ti-request__open {
        width: 100%;
        height: 47rem;
        margin-top: 29rem;
        font-size: 17rem;
    }
    #trade-in-calc.ti-request {
        padding: 43rem 22rem 44rem;
    }
    .ti-modal {
        padding: 12rem;
    }
    .ti-modal__close {
        top: 14rem;
        right: 14rem;
        width: 36rem;
        height: 36rem;
    }
}

/* --- «Обновляйтесь на своих условиях» (десктоп) --- */
.ti-terms {
    margin-top: 80rem;
    padding: 0 75rem;
}
.ti-terms__title {
    font-size: 46rem;
    line-height: 1.1;
    font-weight: 400;
    text-align: center;
    color: #000;
}
.ti-terms__list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 38rem 22rem;
    margin-top: 69rem;
}
.ti-term {
    position: relative;
    display: flex;
    align-items: flex-end;
    height: 198rem;
    padding: 0 23rem 21rem;
    border-radius: 28rem;
    overflow: hidden;
    /* фон как в макете: темно-синий, к правому краю светлее */
    background: linear-gradient(90deg, #021329 0%, #021329 55%, #022a5e 100%);
    color: #fff;
}
.ti-term__img {
    position: absolute;
    top: 0;
    right: 0;
    width: auto;
    height: 100%;
    /* картинка вырезана вместе с фоном - левый край растворяем в фоне карточки */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12%);
    mask-image: linear-gradient(90deg, transparent 0, #000 12%);
    pointer-events: none;
}
.ti-term__text {
    position: relative;
    z-index: 1;
}
.ti-term__name {
    margin: 0;
    font-size: 23rem;
    line-height: 25rem;
    font-weight: 400;
    color: #fff;
}
.ti-term__desc {
    margin-top: 6rem !important;
    font-size: 15rem;
    line-height: 17rem;
    color: #fff;
}

/* --- «Обновляйтесь на своих условиях» на мобиле (и планшете до 1025): карточки в одну колонку --- */
@media (width < 1025px) {
    .ti-terms {
        margin-top: 50rem;
        padding: 0 22rem;
    }
    .ti-terms__title {
        font-size: 27rem;
        line-height: 31rem;
    }
    .ti-terms__list {
        grid-template-columns: 1fr;
        gap: 18rem;
        margin-top: 45rem;
    }
    .ti-term {
        height: 155rem;
        padding: 0 18rem 17rem;
        border-radius: 24rem;
    }
    /* мобильные картинки вырезаны из макета с фоном карточки - край почти не растворяем, чтобы не гасить монеты и купон */
    .ti-term__img {
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%);
        mask-image: linear-gradient(90deg, transparent 0, #000 4%);
    }
    .ti-term__name {
        font-size: 18rem;
        line-height: 20rem;
    }
    .ti-term__desc {
        margin-top: 4rem !important;
        font-size: 11.5rem;
        line-height: 13rem;
    }
}

/* --- адреса трейд-ина (последний блок) --- */
.ti-contacts {
    margin-top: 80rem;
    padding: 56rem 40rem;
    border-radius: 40rem;
    background-color: #1675f9;
    color: #fff;
    text-align: center;
}
.ti-contacts__item + .ti-contacts__item {
    margin-top: 56rem;
}
.ti-contacts__title {
    font-size: 33rem;
    line-height: 38rem;
    font-weight: 400;
    color: #fff;
}
.ti-contacts__address {
    margin-top: 12rem !important;
    font-size: 22rem;
    line-height: 27rem;
}
.ti-contacts__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 280rem;
    height: 55rem;
    margin-top: 24rem;
    border-radius: 100rem;
    background-color: #fff;
    color: #1675f9;
    font-size: 23rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .2s;
}
.ti-contacts__btn:hover {
    background-color: #e8f1fe;
    color: #1675f9;
}

@media (width < 1025px) {
    .ti-contacts {
        margin-top: 50rem;
        padding: 44rem 16rem;
        border-radius: 33rem;
    }
    .ti-contacts__item + .ti-contacts__item {
        margin-top: 28rem;
    }
    .ti-contacts__title {
        font-size: 25rem;
        line-height: 29rem;
    }
    .ti-contacts__address {
        margin-top: 12rem !important;
        font-size: 16.3rem;
        line-height: 21rem;
    }
    .ti-contacts__btn {
        width: 219rem;
        height: 44rem;
        margin-top: 20rem;
        font-size: 18rem;
    }
}
.ti-modal__dialog:focus {
    outline: none;
}

/* --- выпадающие списки калькулятора и формы заявки (select.js): белая карточка с вариантами по макету.
   кнопка и шапка карточки берут вид у .ti-select (высота, отступ, стрелка), здесь - только список.
   строка варианта - 2/3 высоты поля, отступ снизу - 1/4 (макет) --- */
.ti-dd {
    position: relative;
}
/* настоящий select только хранит значение - не показываем совсем. !important: правила .ti-select
   (.ti-select:disabled { opacity: 1 }, размеры в форме заявки) сильнее и вытаскивали его наружу полосками */
.ti-dd .ti-dd__native {
    display: none !important;
}
.ti-dd__button {
    overflow: hidden;
    text-align: left;
    white-space: nowrap;
    text-overflow: ellipsis;
}
/* открытый список - поверх полей ниже, начинается на месте поля (его шапка повторяет поле), поля не сдвигаются */
.ti-dd__panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    overflow: hidden;
    border-radius: 18rem;
    background-color: #fff;
}
.ti-dd__panel[hidden] {
    display: none;
}
.ti-dd__head {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
}
.ti-dd__list {
    max-height: 260rem;
    margin: 0;
    padding: 0 0 9rem;
    overflow-y: auto;
    list-style: none;
}
.ti-dd__option {
    padding: 0 24rem 0 28rem;
    font-size: 16rem;
    line-height: 23rem;
    color: #4e4e4e;
    cursor: pointer;
}
.ti-dd__option.is-active {
    background-color: #d9e5ff;
}
.ti-request .ti-dd__option {
    padding-left: 29rem;
    font-size: 17rem;
    line-height: 24rem;
}

@media (width < 1025px) {
    .ti-dd__panel {
        border-radius: 23rem;
    }
    .ti-dd__list {
        padding-bottom: 11rem;
    }
    .ti-dd__option {
        padding-left: 17.5rem;
        font-size: 16rem;
        line-height: 29rem;
    }
    .ti-request .ti-dd__option {
        padding-left: 19rem;
        font-size: 17rem;
        line-height: 31rem;
    }
}
