/* =========================================================
   ФИЛИАЛ — компактная строка (категория 5)
   ========================================================= */

/* --- Сетка на главной --- */
.branches__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3);
    align-content: start;
}

/* --- Карточка: текст слева + стрелка справа --- */
.branch-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;   /* текст | стрелка */
    align-items: center;                            /* обе колонки по вертикали по центру */
    gap: var(--sp-3);
    min-height: calc(var(--app-em)*5.5);
    padding: calc(var(--app-em)*1) calc(var(--app-em)*1.25);
    border-radius: var(--r-lg);
    background-color: var(--metro-bg, var(--surface));
    box-shadow: var(--shadow-tiny);
    border: var(--hair) solid transparent;
    text-decoration: none;
    color: var(--text);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.branch-row:hover {
    border-color: var(--accent-soft);
    box-shadow: var(--shadow-soft);
    transform: translateY(calc(var(--app-em)*-0.0625));
}

/* --- Текстовый блок --- */
.branch-row__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;                            /* название и метро по центру своей колонки */
    justify-content: center;
    gap: var(--sp-2);
    text-align: center;
}

/* --- Название филиала --- */
.branch-row__name {
    margin: 0;
    max-width: 100%;
    font-size: var(--fs-ui);
    font-weight: 700;
    letter-spacing: -.012em;
    line-height: 1.25;
    color: inherit;
    overflow-wrap: anywhere;
}

/* --- Название станции метро --- */
.branch-row__metro {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    font-size: var(--fs-meta);
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Круглая кнопка-стрелка справа по центру --- */
.branch-row__cta {
    flex: none;
    display: grid;
    place-items: center;
    width: calc(var(--app-em)*2.5);
    height: calc(var(--app-em)*2.5);
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-strong);
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.branch-row__cta .icon {
    width: calc(var(--app-em)*1.125);
    height: calc(var(--app-em)*1.125);
}

.branch-row:hover .branch-row__cta {
    background: var(--accent-strong);
    color: var(--accent-ink);
    transform: translateX(calc(var(--app-em)*0.125));
}

/* --- Тёмная тема --- */
[data-theme="dark"] .branch-row:hover {
    border-color: var(--accent);
}

/* --- Адаптив --- */
@media (max-width: 68.75em) {
    .branches__list {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 30em) {
    .branch-row {
        min-height: calc(var(--app-em)*5);
        padding: calc(var(--app-em)*0.875) calc(var(--app-em)*1);
        gap: var(--sp-2);
    }
    .branch-row__cta {
        width: calc(var(--app-em)*2.25);
        height: calc(var(--app-em)*2.25);
    }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .branch-row,
    .branch-row__cta {
        transition: none;
    }
    .branch-row:hover,
    .branch-row:hover .branch-row__cta {
        transform: none;
    }
}

/* =========================================================
   ПОЛНАЯ СТРАНИЦА ФИЛИАЛА
   ========================================================= */
.branch-profile {
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-em)*2);
    padding: calc(var(--app-em)*1.75);
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

/* --- Шапка --- */
.branch-profile__head {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: calc(var(--app-em)*2);
    align-items: start;
    padding-bottom: calc(var(--app-em)*1.75);
    border-bottom: var(--hair) solid var(--line);
}

/* --- Медиа (скриншот карты) --- */
.branch-profile__media {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--surface-sunk);
    display: grid;
    place-items: center;
}
.branch-profile__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    filter: brightness(var(--image-brightness))
            contrast(var(--image-contrast))
            saturate(var(--image-saturate));
}
.branch-profile__placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--accent-strong);
    opacity: .5;
    background: linear-gradient(145deg, var(--accent-soft), var(--mist-soft));
}
.branch-profile__placeholder .icon {
    width: calc(var(--app-em)*4);
    height: calc(var(--app-em)*4);
}

/* --- Вводная часть --- */
.branch-profile__intro {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-em)*0.75);
}
.branch-profile__name {
    font-size: var(--fs-h2);
    line-height: 1.1;
    letter-spacing: -.03em;
    color: var(--text);
}

/* --- Факты --- */
.branch-profile__facts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: calc(var(--app-em)*0.375);
    margin: calc(var(--app-em)*0.5) 0 0;
    padding: 0;
    list-style: none;
}
.branch-profile__fact {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}
.branch-profile__fact .icon {
    width: calc(var(--app-em)*1.125);
    height: calc(var(--app-em)*1.125);
    flex: none;
    color: var(--accent);
}
.branch-profile__fact span {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: var(--fs-sm);
    color: var(--news-text);
}
.branch-profile__fact a {
    color: var(--accent-strong);
    text-decoration: none;
    border-bottom: var(--hair) dashed var(--accent);
    transition: color .18s ease, border-color .18s ease;
}
.branch-profile__fact a:hover {
    color: var(--accent);
    border-bottom-style: solid;
}




/* --- Полное описание (full-story от DLE) --- */
.branch-profile > .fullstory,
.branch-profile > .story-text {
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--news-text);
    font-size: var(--fs-body);
    line-height: 1.7;
}
.branch-profile > .fullstory img,
.branch-profile > .story-text img {
    max-width: 100%;
    height: auto;
    border-radius: var(--r-md);
    filter: brightness(var(--image-brightness))
            contrast(var(--image-contrast))
            saturate(var(--image-saturate));
}
.branch-profile > .fullstory :last-child,
.branch-profile > .story-text :last-child {
    margin-bottom: 0;
}

/* --- Служебная информация --- */
.branch-profile__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-5);
    padding-top: calc(var(--app-em)*1.25);
    border-top: var(--hair) solid var(--line);
}
.branch-profile__meta .meta-item {
    font-size: var(--fs-meta);
    color: var(--muted);
}
.branch-profile__meta .icon {
    width: calc(var(--app-em)*0.875);
    height: calc(var(--app-em)*0.875);
}

/* --- Адаптив --- */
@media (max-width: 48.75em) {
    .branch-profile {
        padding: calc(var(--app-em)*1.25);
        gap: calc(var(--app-em)*1.5);
    }
    .branch-profile__head {
        grid-template-columns: 1fr;
        gap: var(--sp-5);
    }
    .branch-profile__media {
        aspect-ratio: 16 / 10;
    }
    .branch-profile__name {
        font-size: calc(var(--app-em)*1.5);
    }

}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .branch-profile__fact a {
        transition: none;
    }
     .messenger-btn {
        transition: none;
    }
    .messenger-btn:hover {
        transform: none;
    }
}

/* =========================================================
   ФИЛИАЛЫ — цвет названия в тёмной теме (branch-row)
   ========================================================= */

/* Филиалы с metro-color: фон цветной, название — белым в светлой теме */
.branch-row[style*="--tile-accent"] .branch-row_name,
.branch-row[style*="--tile-accent"] .branch-row__name {
    color: #fff;
}

/* Тёмная тема: название — чёрным, чтобы читалось на пастельных цветах */
[data-theme="dark"] .branch-row[style*="--tile-accent"] .branch-row_name,
[data-theme="dark"] .branch-row[style*="--tile-accent"] .branch-row__name {
    color: #000;
}

/* То же — на всякий случай для .branch-tile (если где-то используется) */
[data-theme="dark"] .branch-tile[style*="--tile-accent"] .branch-tile__name {
    color: #000;
}
