/* Страница Контакты — карта на весь блок, карточка поверх */

.contacts-page {
    padding-bottom: 4rem;
}

.contacts-page .container {
    max-width: 1400px;
    padding: 0 30px;
}

@media (max-width: 1100px) {
    .contacts-page .container {
        padding: 0 20px;
    }
}

@media (max-width: 768px) {
    .contacts-page .container {
        padding: 0 15px;
    }
}

/* Шапка: заголовок по центру и описание */
.contacts-head {
    padding: 5rem 0 3.25rem;
    background: #fff;
}

.contacts-head-inner {
    text-align: center;
}

.contacts-title {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 1rem 0;
    letter-spacing: -0.02em;
}

.contacts-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #64748b;
    margin: 0;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* Блок карты на всю ширину страницы (без белых полей по краям) */
.contacts-map-section {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-bottom: 3rem;
    padding-bottom: 75px;
}

.contacts-map-wrap {
    position: relative;
    width: 100%;
    min-height: 595px;
    background: #eef1f5;
    overflow: visible;
}

.contacts-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.contacts-map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9375rem;
    color: #6b7280;
    background: #f3f4f6;
}

.contacts-map-loading.hidden {
    display: none;
}

/* Парящая анимация для блока контактов */
@keyframes contacts-card-float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

/* Блок контактов: 75px на карте, 75px под картой */
.contacts-primary-card {
    position: absolute;
    left: 50%;
    bottom: -75px;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1400px;
    height: 150px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08), 0 10px 30px rgba(0, 0, 0, 0.15);
    animation: contacts-card-float 4s ease-in-out infinite;
}

.contacts-primary-info {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

/* Планшеты: карточка офиса компактнее и в одну колонку */
@media (min-width: 769px) and (max-width: 1024px) {
    .contacts-primary-card {
        height: auto;
        padding: 1.25rem 1.75rem;
    }

    .contacts-primary-info {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 1.25rem 2.5rem;
    }

    .contacts-info-row {
        min-width: 0;
        flex: 1 1 28%;
    }

    /* Адрес — на всю ширину, остальные (телефон, время, почта) становятся в ряд */
    .contacts-info-row:first-child {
        flex-basis: 100%;
    }
}

.contacts-info-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 200px;
}

.contacts-info-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 10px;
    color: #6b7280;
}

.contacts-info-icon svg {
    width: 20px;
    height: 20px;
}

.contacts-info-content {
    flex: 1;
    min-width: 0;
}

.contacts-info-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0.25rem;
}

.contacts-info-value {
    font-size: 0.9375rem;
    color: #1f2937;
    margin: 0;
    line-height: 1.5;
}

.contacts-link {
    color: #17255F;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.contacts-link:hover {
    color: #FD7100;
}

/* Секция «Офисы в других городах» — дизайн блоков */
.contacts-main {
    margin-top: 0;
}

.contacts-other-title {
    font-size: clamp(1.5rem, 3vw, 1.875rem);
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 2rem 0;
    letter-spacing: -0.03em;
}

.contacts-offices-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Блок офиса: изображение слева, контент справа в одну колонку */
.contacts-office-card {
    display: grid;
    grid-template-columns: 340px 1fr;
    align-items: stretch;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.contacts-office-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.12), 0 8px 24px rgba(15, 23, 42, 0.08);
}

.contacts-office-image-wrap {
    position: relative;
    min-height: 200px;
    background: linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 100%);
    overflow: hidden;
}

.contacts-office-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.contacts-office-card:hover .contacts-office-image {
    transform: scale(1.04);
}

.contacts-office-content {
    padding: 1.75rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.contacts-office-city {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.02em;
}

.contacts-office-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 6rem;
}

/* Кнопка «Показать на карте» остаётся в потоке сразу после блоков */
.contacts-office-map-link {
    align-self: start;
}

/* На планшетах и десктопе: часы и контакты в один ряд,
   при этом адрес и ссылка "Показать на карте" идут в естественном порядке */
@media (min-width: 769px) {
    .contacts-office-details .contacts-office-row:nth-of-type(2) {
        grid-column: 1;      /* Часы работы слева */
    }
    .contacts-office-details .contacts-office-row:nth-of-type(3) {
        grid-column: 2;      /* Контакты справа */
    }
}

.contacts-office-row {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
}

.contacts-office-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #17255F;
    background: rgba(23, 37, 95, 0.06);
    border-radius: 10px;
}

.contacts-office-icon svg {
    width: 16px;
    height: 16px;
}

.contacts-office-row div {
    flex: 1;
    min-width: 0;
}

.contacts-office-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.contacts-office-row p {
    font-size: 0.875rem;
    color: #334155;
    line-height: 1.5;
    margin: 0;
}

/* На широких экранах адрес СПБ и Москвы держим в одну строку,
   если позволяет ширина карточки (без влияния на мобильные) */
@media (min-width: 1200px) {
    .contacts-office-details .contacts-office-row:first-of-type p {
        white-space: nowrap;
    }
}

.contacts-office-row a {
    color: #17255F;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.contacts-office-row a:hover {
    color: #FD7100;
    text-decoration: underline;
}

.contacts-office-map-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #17255F;
    text-decoration: none;
    width: fit-content;
    transition: color 0.2s ease, gap 0.2s ease;
}

.contacts-office-map-link::after {
    content: '';
    width: 20px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg fill='none' stroke='%2317255F' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z'%3E%3C/path%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 11a3 3 0 11-6 0 3 3 0 016 0z'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.contacts-office-map-link:hover {
    color: #0f1941;
    gap: 0.75rem;
}

/* Адаптив */
@media (max-width: 1024px) {
    .contacts-primary-info {
        gap: 1.5rem;
    }
}

@media (max-width: 900px) {
    .contacts-office-card {
        grid-template-columns: 1fr;
    }

    .contacts-office-image-wrap {
        min-height: 180px;
        aspect-ratio: 21 / 9;
    }

    .contacts-office-details {
        grid-template-columns: 1fr;
    }

    .contacts-office-map-link {
        grid-column: 1;
        grid-row: auto;
    }
}

@media (max-width: 768px) {
    .contacts-offices-list {
        grid-template-columns: 1fr;
    }

    .contacts-office-content {
        padding: 1.25rem 1.25rem;
    }
}

@media (max-width: 768px) {
    .contacts-head {
        padding: 1.25rem 0 1rem;
    }

    /* На мобильных: карта сверху, блок контактов — под ней (не поверх) */
    .contacts-map-section {
        padding-bottom: 0;
    }

    .contacts-map-wrap {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .contacts-map {
        position: relative;
        height: 420px;
        flex-shrink: 0;
    }

    .contacts-primary-card {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        width: auto;
        max-width: none;
        margin: 1rem;
        height: auto;
        min-height: 150px;
        padding: 1.25rem 1rem;
        border-radius: 28px;
        align-items: flex-start;
        animation: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 10px 30px rgba(0, 0, 0, 0.1);
    }

    .contacts-primary-info {
        flex-direction: column;
        gap: 1.25rem;
        align-items: flex-start;
    }

    .contacts-info-row {
        min-width: 0;
    }

    .contacts-info-icon {
        width: 36px;
        height: 36px;
    }

    .contacts-info-icon svg {
        width: 18px;
        height: 18px;
    }

    .contacts-office-content {
        padding: 1.25rem 1.25rem;
    }
}
