/* Модуль contact-map — карта филиалов + карточка выбранного города.
   Самодостаточный: подключается на любой странице. Отступы секции под конкретную
   страницу задаёт родительская обёртка (.home-page-map, .contacts-map и т.п.).
   Состояние активного города — атрибут [data-active], JS цепляется за data-* хуки. */

.contact-map__title {
    text-align: center;
    color: var(--primary-color-1000);
    font-weight: bold;
    font-size: 26px;
    line-height: 110%;
}

.contact-map__desc {
    text-align: center;
    color: var(--primary-text-1000);
    font-size: 20px;
    line-height: 135%;
    margin-top: 20px;
    margin-bottom: 60px;
}

.contact-map__container {
    display: grid;
    grid-template-columns: 1fr 905px;
}

.contact-map__card {
    height: fit-content;
    position: relative;
    background: white;
    padding: 40px 32px 48px;
    border-radius: 14px;
    box-shadow: var(--primary-box-shadow);
    overflow: clip;
}

.contact-map__card::before {
    content: "";
    position: absolute;
    display: block;
    width: 100%;
    height: 4px;
    background: var(--primary-color-1000);
    top: 0;
    left: 0;
}

.contact-map__card > h4 {
    font-size: 24px;
    line-height: 110%;
    font-weight: bold;
    color: var(--primary-text-1000);
}

.contact-map__card > p {
    margin-top: 20px;
    font-size: 16px;
    line-height: 135%;
    color: var(--primary-text-1000);
}

.contact-map__card span {
    color: var(--primary-text-900);
    line-height: 135%;
    font-size: 16px;
}

.contact-map__links {
    margin: 40px 0;
    display: flex;
    gap: 40px;
}

.contact-map__links img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin: 0 auto;
}

.contact-map__qr {
    display: flex;
    flex-flow: column;
    gap: 10px;
}

.contact-map__qr[hidden] {
    display: none;
}

.contact-map__contacts {
    display: flex;
    flex-flow: column;
    row-gap: 12px;
}

.contact-map__contacts span[hidden] {
    display: none;
}

.contact-map__map {
    position: relative;
    width: 905px;
    height: 581px;
}

.contact-map__city {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color-1000);
    cursor: pointer;
    position: absolute;
}

.contact-map__city[data-active] {
    animation: city-pulse 3s linear infinite;
}

.contact-map__city[data-active]::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    animation: city-pulse 3s linear infinite;
    animation-delay: 1.5s;
}

@keyframes city-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5);
    }
    100% {
        box-shadow: 0 0 0 16px rgba(255, 255, 255, 0);
    }
}

/* координаты маркеров на карте (десктоп) */
.contact-map__city--yiwu {
    top: 60%;
    right: 35%;
}

.contact-map__city--shenzhen {
    top: 68.5%;
    right: 38.5%;
}

.contact-map__city--guangzhou {
    top: 67.5%;
    right: 41%;
}

.contact-map__city--ivanovo {
    top: 36.5%;
    left: 26%;
}

.contact-map__city--moscow {
    top: 39%;
    left: 23%;
}

.contact-map__city--hongkong {
    top: 71%;
    right: 37%;
}

.contact-map__city--changchun {
    top: 49%;
    right: 32%;
}

.contact-map__city--xinjiang {
    top: 50%;
    left: 46%;
}

.contact-map__city--astana {
    top: 45%;
    left: 38.5%;
}

.contact-map__city--novosibirsk {
    top: 38.2%;
    left: 44%;
}

@media screen and (min-width: 1024px) {
    .contact-map__desc {
        margin-left: auto;
        margin-right: auto;
        max-width: 832px;
    }
}

/* карта → ряд чипов */
@media screen and (max-width: 1439px) {
    .contact-map__container {
        display: flex;
        flex-direction: column-reverse;
        gap: 28px;
    }

    .contact-map__card {
        width: 100%;
    }

    .contact-map__map {
        width: 100%;
        height: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
    }

    .contact-map__map-img {
        display: none;
    }

    /* маркер → чип; название города из data-city, без пульса */
    .contact-map__city {
        position: static;
        width: auto;
        height: 50px;
        padding: 0 20px;
        display: inline-flex;
        align-items: center;
        border-radius: 14px;
        border: 1px solid var(--primary-border-900);
        background: white;
        animation: none;
    }

    .contact-map__city::before,
    .contact-map__city[data-active]::before {
        content: attr(data-city);
        position: static;
        inset: auto;
        border-radius: 0;
        box-shadow: none;
        animation: none;
        font-size: 16px;
        color: var(--primary-text-1000);
    }

    .contact-map__city[data-active] {
        border-color: var(--primary-color-1000);
    }

    .contact-map__city[data-active]::before {
        font-weight: bold;
    }
}

@media screen and (max-width: 1439px) and (min-width: 1024px) {
    .contact-map__title {
        font-size: 26px;
    }
}

@media screen and (max-width: 1023px) and (min-width: 768px) {
    .contact-map__title {
        font-size: 20px;
    }

    .contact-map__desc {
        margin-top: 16px;
        font-size: 14px;
        margin-bottom: 40px;
    }

    .contact-map__card > h4 {
        font-size: 20px;
    }

    .contact-map__city::before,
    .contact-map__city[data-active]::before {
        font-size: 14px;
    }
}

/* ряд чипов → горизонтальный скролл с drag */
@media screen and (max-width: 767px) {
    .contact-map__title {
        font-size: 18px;
    }

    .contact-map__desc {
        margin-top: 16px;
        font-size: 14px;
        margin-bottom: 40px;
    }

    .contact-map__card > h4 {
        font-size: 18px;
    }

    .contact-map__map {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        cursor: grab;
    }

    .contact-map__map::-webkit-scrollbar {
        display: none;
    }

    .contact-map__map.is-dragging {
        cursor: grabbing;
    }

    .contact-map__city {
        flex: 0 0 auto;
        height: 44px;
        padding: 0 16px;
        user-select: none;
    }

    .contact-map__city::before,
    .contact-map__city[data-active]::before {
        font-size: 14px;
    }
}

@media screen and (max-width: 360px) {
    .contact-map__card > h4 {
        font-size: 18px;
    }

    .contact-map__card > p {
        font-size: 14px;
    }

    .contact-map__card span {
        font-size: 14px;
    }

    .contact-map__links {
        display: flex;
        flex-flow: column;
        justify-content: start;
        margin: 20px 0;
    }

    .contact-map__qr span {
        display: none;
    }

    .contact-map__links img {
        width: 109px;
        height: 109px;
        margin: 0;
    }

    .contact-map__contacts {
        gap: 12px;
    }
}
