/*
 * Лаборатория Кошмарского — branches.css
 * Раздел «Наши филиалы»: карта с точками, вкладки городов, карточка филиала с фото.
 * Работает в паре с js/branches.js.
 */

/* ===== КАРТА ===== */
.branches__map {
    position: relative;
    border: 1px solid #9EA39E;
    background: #E9EBE6;
}

/* Карта — схема, а не фото: общий «архивный» фильтр картинок (style.css) ее только замутит */
.branches__map-img {
    display: block;
    width: 100%;
    height: auto;
    filter: none;
}

/* Точка филиала. Сама кнопка нулевого размера стоит ровно в координате,
   а кружок и подпись висят вокруг нее (position: absolute от этой нулевой точки) */
.branches__pin {
    position: absolute;
    width: 0;
    height: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    z-index: 1;
}

.branches__pin.is-active {
    z-index: 2;
}

.branches__dot {
    position: absolute;
    left: -8px;
    top: -8px;
    width: 16px;
    height: 16px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: #8E2A31;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .55);
    transition: transform .15s;
}

/* Расходящийся круг вокруг точки, как на картах «мы здесь» */
.branches__dot::after {
    content: "";
    position: absolute;
    left: -3px;
    top: -3px;
    width: 16px;
    height: 16px;
    border: 2px solid #8E2A31;
    border-radius: 50%;
    animation: branches-pulse 2.4s ease-out infinite;
}

@keyframes branches-pulse {
    0%   { transform: scale(1); opacity: .7; }
    100% { transform: scale(2.6); opacity: 0; }
}

.branches__pin:hover .branches__dot,
.branches__pin:focus-visible .branches__dot {
    transform: scale(1.25);
}

.branches__pin.is-active .branches__dot {
    background: #4E1215;
    transform: scale(1.35);
}

/* Главный управляющий центр: точка крупнее, со звездой, как столица на карте */
.branches__pin--hq .branches__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    left: -12px;
    top: -12px;
    width: 24px;
    height: 24px;
    color: #ffffff;
    font-size: 10px;
}

.branches__pin--hq .branches__dot::after {
    width: 24px;
    height: 24px;
}

/* Точка шире — отодвигаем подпись, чтобы не налезала */
.branches__pin--hq.branches__pin--left .branches__label {
    right: 20px;
}

.branches__pin--hq.branches__pin--right .branches__label {
    left: 20px;
}

.branches__label {
    position: absolute;
    top: -11px;
    padding: 2px 7px;
    background: rgba(255, 255, 255, .9);
    border: 1px solid #9EA39E;
    color: #2A2F2E;
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    white-space: nowrap;
}

.branches__pin--right .branches__label {
    left: 15px;
}

.branches__pin--left .branches__label {
    right: 15px;
}

.branches__pin:hover .branches__label {
    text-decoration: underline;
}

.branches__pin.is-active .branches__label {
    background: #6B1A1E;
    border-color: #4E1215;
    color: #ffffff;
}

/* ===== ВКЛАДКИ ГОРОДОВ ===== */
.branches__tabs {
    display: flex;
    flex-wrap: wrap;
    margin-top: 16px;
    border-bottom: 1px solid #9EA39E;
}

.branches__tab {
    margin: 0 4px -1px 0;
    padding: 8px 16px;
    background: #CDD0CC;
    border: 1px solid #9EA39E;
    color: #4F5654;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.branches__tab:hover {
    color: #6B1A1E;
}

/* Активная вкладка сливается с карточкой: тот же фон, нижняя граница цвета фона */
.branches__tab.is-active {
    background: #D5D8D4;
    border-bottom-color: #D5D8D4;
    color: #2A2F2E;
}

/* ===== КАРТОЧКА ФИЛИАЛА ===== */
.branch {
    display: flex;
    align-items: flex-start;
    padding: 20px;
    background: #D5D8D4;
    border: 1px solid #9EA39E;
    border-top: 0;
}

.branch__gallery {
    flex-shrink: 0;
    width: 46%;
    margin-right: 24px;
}

.branch__photo {
    position: relative;
    background: #101313;
    border: 1px solid #6E746F;
}

.branch__photo img {
    width: 100%;
    height: auto;
}

.branch__caption {
    margin-top: 8px;
    color: #2A2F2E;
    font-size: 13px;
    font-style: italic;
}

.branch__thumbs {
    display: flex;
    margin-top: 10px;
}

.branch__thumb {
    width: 84px;
    margin-right: 8px;
    padding: 0;
    background: #101313;
    border: 2px solid #9EA39E;
    cursor: pointer;
    opacity: .7;
}

.branch__thumb img {
    display: block;
    width: 100%;
    height: auto;
}

.branch__thumb:hover,
.branch__thumb.is-active {
    opacity: 1;
}

.branch__thumb.is-active {
    border-color: #8E2A31;
}

.branch__info {
    flex: 1;
    min-width: 0;
}

.branch__type {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 2px;
    background: #6B1A1E;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.branch__name {
    margin: 10px 0 2px;
    font-size: 21px;
}

.branch__city {
    margin-bottom: 14px;
    color: #4F5654;
    font-size: 13px;
}

/* Список «характеристик»: dt слева, dd справа, каждая пара — строка с линией */
.branch__facts {
    display: flex;
    flex-wrap: wrap;
    margin: 0 0 14px;
    border-top: 1px solid #9EA39E;
    font-size: 13px;
}

.branch__facts dt,
.branch__facts dd {
    margin: 0;
    padding: 6px 0;
    border-bottom: 1px solid #9EA39E;
}

.branch__facts dt {
    width: 34%;
    color: #4F5654;
}

.branch__facts dd {
    width: 66%;
    font-weight: 600;
}

.branch__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
}

/* ===== ТЕЛЕФОНЫ И УЗКИЕ ЭКРАНЫ ===== */
@media (max-width: 760px) {
    /* Сжатая до ширины телефона карта мелкая, точки слипаются.
       Поэтому карта держит ширину 700px, а обертка дает листать ее вбок */
    .branches__scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .branches__map {
        min-width: 700px;
    }

    .branch {
        flex-direction: column;
        padding: 14px;
    }

    .branch__gallery {
        width: 100%;
        margin: 0 0 18px;
    }

    .branches__tab {
        padding: 7px 10px;
    }
}

/* Кто попросил систему убрать анимацию — круг вокруг точки не пульсирует */
@media (prefers-reduced-motion: reduce) {
    .branches__dot::after {
        animation: none;
        opacity: 0;
    }
}

/* ===== ТЕМА 2010 ===== */
.theme-2010 .branches__map {
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}

.theme-2010 .branches__label {
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

.theme-2010 .branches__pin.is-active .branches__label {
    background: linear-gradient(#A3323A, #6B1A1E 55%, #4E1215);
}

.theme-2010 .branches__tab {
    border-radius: 5px 5px 0 0;
    background: linear-gradient(#F2F3F1, #C9CDC8);
    text-shadow: 0 1px 0 #ffffff;
}

.theme-2010 .branches__tab.is-active {
    background: #F2F3F1;
    border-bottom-color: #F2F3F1;
}

.theme-2010 .branch {
    background: linear-gradient(#F2F3F1, #E4E7E3);
    border-radius: 0 6px 6px 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

.theme-2010 .branch__photo {
    border: 3px solid #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

.theme-2010 .branch__thumb {
    border-radius: 3px;
}

.theme-2010 .branch__type {
    border-radius: 3px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
