/* ==========================================================================
   Наші філії (спільний блок, template-parts/branches.php)
   Фон секції: SVG із сірими еліпсами й сіткою (frame-629618.svg), як у «Відгуках»,
   на всю секцію; сітку видно по боках картки.
   Посередині темна скруглена картка-«острів» (як у «Автопарку» й «Інструкторів»).
   Усередині: м'ятно-бірюзове сяйво (два розмиті кола, обрізані карткою), заголовок по центру
   і скляні картки міст (за замовчуванням 2 у ряд, проміжок 24px) з м'ятною обводкою.
   Картка філії поточної сторінки (.is-current) має мітку «Ви тут» і без кнопки переходу;
   у карток інших філій є акцентна кнопка «Перейти до філії», «На карті» — кнопка-контур.
   На мобільному (≤767px) картки йдуть одна під одною.
   У кінці файлу: підпис над адресою в шапці/футері («Головний офіс», «Філія»)
   і рядки інших філій у футері.
   ========================================================================== */
.branches {
    position: relative;
    isolation: isolate;
    padding-block: 80px;
    overflow: clip;
    background: var(--color-bg-soft);
    color: var(--color-light);
}

.branches__bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.branches__card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 60px;
    border-radius: 20px;
    background: #181D1F;
}

/* Внутрішнє світло по краю картки */
.branches__card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    box-shadow: 0 2px 8px rgba(255, 255, 255, .08) inset;
    pointer-events: none;
}

/* Сяйво: бірюзове зверху ліворуч, м'ятне знизу праворуч; картка обрізає зайве */
.branches__glow {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.branches__glow > span {
    position: absolute;
    border-radius: 50%;
}

.branches__glow-cyan {
    top: -240px;
    left: -140px;
    width: 560px;
    height: 560px;
    background: #7CDAE7;
    filter: blur(120px);
    opacity: .38;
}

.branches__glow-mint {
    right: -160px;
    bottom: -260px;
    width: 620px;
    height: 620px;
    background: #7FEEC4;
    filter: blur(130px);
    opacity: .32;
}

.branches__title {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: clamp(30px, 4vw, 48px);
    font-weight: 600;
    line-height: 1;
    letter-spacing: var(--tracking-heading);
    text-align: center;
}

.branches__list {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: 24px;
    margin: 48px 0 0;
    padding: 0;
    list-style: none;
}

.branches__item {
    display: flex;
}

/* Картка міста (скло) */
.branch-card {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;
    padding: 40px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .10) 0%, rgba(255, 255, 255, .04) 100%);
    box-shadow:
        0 0 0 1px rgba(158, 255, 224, .45) inset,
        0 2px 8px rgba(255, 255, 255, .12) inset,
        0 -2px 8px rgba(0, 0, 0, .12) inset;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    transition: box-shadow .3s ease, transform .3s ease;
}

/* Тонка м'ятна смужка вгорі картки */
.branch-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 32px;
    right: 32px;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--gradient-accent);
    opacity: .85;
}

.branch-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 0 0 1px rgba(158, 255, 224, .8) inset,
        0 2px 8px rgba(255, 255, 255, .16) inset,
        0 0 40px rgba(127, 238, 196, .18);
}

/* Філія поточної сторінки: м'ятна обводка яскравіша, без підйому на ховері */
.branch-card.is-current {
    box-shadow:
        0 0 0 1px rgba(158, 255, 224, .85) inset,
        0 2px 8px rgba(255, 255, 255, .16) inset,
        0 0 36px rgba(127, 238, 196, .16);
}

.branch-card.is-current:hover {
    transform: none;
}

/* Мітки над містом: «Головний офіс»/«Філія» і «Ви тут» */
.branch-card__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 26px;
    margin-bottom: 16px;
}

.branch-card__tag {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 9999px;
    background: var(--gradient-accent);
    color: var(--color-dark);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.branch-card__here {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 9999px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .45) inset;
    color: rgba(255, 255, 255, .9);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
}

.branch-card__here::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-accent);
    box-shadow: 0 0 8px rgba(127, 242, 184, .8);
}

.branch-card__city {
    margin: 0;
    font-size: clamp(26px, 2.6vw, 32px);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: var(--tracking-heading);
}

.branch-card__row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 16px 0 0;
    color: rgba(255, 255, 255, .9);
    font-size: 16px;
    line-height: 1.4;
}

.branch-card__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: var(--color-cyan);
}

.branch-card__icon .icon {
    width: 22px;
    height: 22px;
}

.branch-card__phone {
    color: var(--color-light);
    font-weight: 600;
    text-decoration: none;
}

.branch-card__phone:hover,
.branch-card__phone:focus-visible {
    text-decoration: underline;
}

/* Кнопки притиснуті до низу, щоб у сусідніх картках стояли на одному рівні */
.branch-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-top: auto;
    padding-top: 32px;
}

/* «На карті»: другорядна кнопка-контур (як кнопки карток послуг) */
.branch-card__map {
    color: var(--color-light);
    background: transparent;
    outline: 1px solid rgba(255, 255, 255, .7);
    outline-offset: -1px;
    box-shadow:
        0 2px 8px rgba(255, 255, 255, .24) inset,
        0 -2px 8px rgba(0, 0, 0, .24) inset;
    transition: background-color .25s ease, outline-color .25s ease, transform .2s ease;
}

.branch-card__map:hover,
.branch-card__map:focus-visible {
    background: rgba(255, 255, 255, .12);
    outline-color: var(--color-light);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Підпис над адресою в шапці та футері: дрібний рядок «Головний офіс» / «Філія»
   над самою адресою. Висота рядка шапки не росте: плитка з пином 40px вміщає обидва рядки.
   -------------------------------------------------------------------------- */
.header__address-text,
.footer__address-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.header__address-label,
.footer__address-label {
    color: rgba(255, 255, 255, .6);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
}

/* Інші філії у футері: один рядок на філію, по центру */
.footer__branches {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    color: rgba(255, 255, 255, .7);
    font-size: 14px;
    line-height: 1.4;
    list-style: none;
    text-align: center;
}

.footer__branches a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer__branches a:hover,
.footer__branches a:focus-visible {
    color: var(--color-light);
}

@media (max-width: 991px) {
    .branches {
        padding-block: 56px;
    }

    .branches__card {
        padding: 44px 32px;
    }

    .branches__list {
        margin-top: 36px;
    }

    .branch-card {
        padding: 32px 28px;
    }
}

@media (max-width: 767px) {
    .branches {
        padding-block: 40px;
    }

    .branches__card {
        padding: 32px 16px;
        border-radius: 16px;
    }

    .branches__glow-cyan {
        top: -200px;
        left: -200px;
    }

    .branches__glow-mint {
        right: -240px;
        bottom: -240px;
    }

    .branches__list {
        gap: 16px;
        margin-top: 28px;
    }

    .branch-card {
        padding: 28px 20px 24px;
        border-radius: 12px;
    }

    .branch-card::before {
        left: 20px;
        right: 20px;
    }

    .branch-card__actions {
        padding-top: 24px;
    }
}
