:root {
    --home-section-inset: clamp(24px, 3.5vw, 64px);
    --home-section-title-weight: 700;
}

.site-block {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 64px;
}

.news-section.section-space-default-less30 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 64px;
}

/*
 * Единый левый край заголовков блоков (в т.ч. B2B):
 * выходим из .container на ширину вьюпорта + inset.
 * Боковой скролл глушит overflow-x: clip на main.
 */
.home-section-heading,
.site-block > .container > .site-block__heading,
.news-section .section-heading-container {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: 0;
    padding-right: var(--home-section-inset);
    padding-left: var(--home-section-inset);
    box-sizing: border-box;
    margin-bottom: 22px;
    text-align: left;
}

.sanatorium-advantages__heading.home-section-heading,
.home-services__heading.home-section-heading {
    width: auto;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-right: 0;
    padding-left: 0;
    margin-bottom: 22px;
}

/* Заголовок слева, кнопка справа */
.home-section-heading.all-category,
.news-section .section-heading-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.home-section-heading.all-category .home-section-title,
.news-section .section-heading-container .section-heading {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
    text-align: left;
}

.news-section .see-all-button,
.home-section-heading.all-category > a,
.home-section-heading.all-category > .btn-fill,
.home-section-heading.all-category > .loadmore-four-item {
    flex: 0 0 auto;
    margin-left: auto;
    margin-top: 0;
}

.site-block__heading {
    margin-bottom: 0;
    text-align: left;
}

.site-block__heading .home-section-title,
.site-block__heading h1,
.site-block__heading h2,
.site-block__heading h3 {
    text-align: left !important;
}

/* Заголовки внутри HTML из B2B — тоже слева и в том же визуальном регистре */
.site-block__text h1,
.site-block__text h2,
.site-block__text h3,
.site-block__text h4 {
    margin: 0 0 0.6em;
    color: #111 !important;
    font-family: var(--s1-font-family, 'Suisse Intl', sans-serif);
    font-weight: var(--home-section-title-weight) !important;
    font-style: normal !important;
    line-height: 1.2;
    letter-spacing: 0;
    text-align: left !important;
    text-transform: none;
}

.site-block__text h1 {
    font-size: clamp(28px, 2.6vw, 40px);
}

.site-block__text h2 {
    font-size: clamp(26px, 2.4vw, 36px);
}

.site-block__text h3,
.site-block__text h4 {
    font-size: clamp(22px, 2vw, 28px);
}

/* Классы-заголовки Bootstrap (.h1–.h6) в HTML из B2B — это <span class="h4">:
   размер менеджер задаёт инлайном или обёрткой с font-size, а класс назначает
   свой (1.5rem) и перебивает наследование. */
.site-block__text .h1,
.site-block__text .h2,
.site-block__text .h3,
.site-block__text .h4,
.site-block__text .h5,
.site-block__text .h6 {
    font-size: inherit;
}

/* Контент из B2B (page/text).
   На desktop не трогаем заданные в кабинете ширины — иначе карточки
   «Проживание» / «Путёвки» раздуваются на весь контейнер.
   Жёсткий сброс width — только на мобиле ниже. */
.site-block__text {
    color: #444;
    font-size: 18px;
    line-height: 1.7;
    overflow-wrap: break-word;
    word-wrap: break-word;
    text-align: left;
}

.site-block__text > *:first-child {
    margin-top: 0;
}

.site-block__text > *:last-child {
    margin-bottom: 0;
}

.site-block__text p {
    margin: 0 0 1em;
    text-align: left;
}

.site-block__text img,
.site-block__text video,
.site-block__text embed,
.site-block__text object {
    max-width: 100%;
    height: auto;
}

.site-block__text iframe {
    display: block;
    max-width: 100%;
}

.site-block__text table {
    float: none !important;
    max-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
}

.site-block__text table,
.site-block__text table.table,
.site-block__text table tr,
.site-block__text table td,
.site-block__text table th {
    border: none !important;
    box-shadow: none !important;
}

.site-block__text td,
.site-block__text th {
    vertical-align: top;
    text-align: left;
}

/* Баннеры с фиксированной высотой (зелёный блок «Заболевания…») — контент по центру */
.site-block__text table[style*="height"] > tr > td,
.site-block__text table[style*="height"] > tr > th,
.site-block__text table[style*="height"] > tbody > tr > td,
.site-block__text table[style*="height"] > tbody > tr > th {
    vertical-align: middle;
}

/* B2B часто ставит text-align: center на подписи под фото («Наши номера») */
.site-block__text td[style*="text-align: center"],
.site-block__text td[style*="text-align:center"],
.site-block__text th[style*="text-align: center"],
.site-block__text th[style*="text-align:center"] {
    text-align: center !important;
}

.site-block__text a,
.site-block__text a:visited,
.site-block__text a:hover,
.site-block__text a:active {
    color: #111 !important;
    text-decoration: none !important;
}

@media (max-width: 767px) {
    .site-block__text {
        font-size: 17px;
        line-height: 1.6;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .site-block__text img,
    .site-block__text video,
    .site-block__text embed,
    .site-block__text object {
        max-width: 100% !important;
        height: auto;
    }

    .site-block__text iframe {
        width: 100% !important;
        max-width: 100% !important;
    }

    .site-block__text img[width],
    .site-block__text table[width],
    .site-block__text td[width],
    .site-block__text th[width] {
        width: auto !important;
        max-width: 100% !important;
    }

    .site-block__text table {
        width: 100%;
        max-width: 100%;
    }

    /* Карточки из таблиц B2B собирает site-block-cards.js в пары
       «картинка + текст». Таблицы с iframe/картой не трогаем. */
    .site-block__text table:has(iframe) {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .site-block__cards {
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        margin: 0 0 20px;
        text-align: left;
    }

    .site-block__cards:last-child {
        margin-bottom: 0;
    }

    .site-block__card {
        display: block;
        width: 100%;
        text-align: left;
    }

    .site-block__card td,
    .site-block__card th {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        padding: 0 !important;
        border: 0 !important;
        vertical-align: top !important;
        text-align: left !important;
    }

    .site-block__card td[style*="text-align: center"],
    .site-block__card td[style*="text-align:center"],
    .site-block__card th[style*="text-align: center"],
    .site-block__card th[style*="text-align:center"] {
        text-align: center !important;
    }

    .site-block__card a[style*="text-align: center"],
    .site-block__card a[style*="text-align:center"] {
        display: block;
        text-align: center !important;
    }

    .site-block__card img,
    .site-block__card video {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
        margin: 0 0 10px;
    }

    .site-block__card td > p:empty,
    .site-block__card td > p:has(> br:only-child),
    .site-block__card p:empty,
    .site-block__text p:empty {
        display: none !important;
        margin: 0 !important;
        height: 0 !important;
    }

    .site-block__card td > p,
    .site-block__card p {
        margin: 0 0 0.5em;
        text-align: left;
    }

    .site-block__card td > p:last-child,
    .site-block__card p:last-child {
        margin-bottom: 0;
    }

    .site-block__text [style*="float:"] {
        float: none !important;
    }

    .site-block__text [style*="height"],
    .site-block__text td[height],
    .site-block__text th[height],
    .site-block__text tr[height] {
        height: auto !important;
        min-height: 0 !important;
    }

    /* «Заболевания…»: один ряд [иконка|текст|иконка|текст] → пары в 2 колонки.
       Без картинок — простой столбик. Корпуса (много рядов) — JS. */
    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(> tr:only-child),
    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(> tbody > tr:only-child) {
        display: block;
        width: 100% !important;
        height: auto !important;
        box-sizing: border-box;
        padding: 16px !important;
    }

    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(> tbody > tr:only-child) > tbody {
        display: block;
        width: 100%;
    }

    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(img):has(> tr:only-child) > tr,
    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(img):has(> tbody > tr:only-child) > tbody > tr {
        display: grid;
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 12px 14px;
        align-items: center;
        width: 100%;
    }

    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):not(:has(img)):has(> tr:only-child) > tr,
    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):not(:has(img)):has(> tbody > tr:only-child) > tbody > tr {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(> tr:only-child) td,
    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(> tr:only-child) th,
    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(> tbody > tr:only-child) td,
    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(> tbody > tr:only-child) th {
        display: block;
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        float: none !important;
        padding: 0 !important;
        text-align: left !important;
    }

    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(img):has(> tbody > tr:only-child) td img,
    .site-block__text table:not(:has(iframe)):not([data-cards-reshaped]):has(img):has(> tr:only-child) td img {
        display: block;
        width: 56px !important;
        max-width: 56px !important;
        height: auto !important;
        margin: 0 auto;
    }
}

/* Блоки не наезжают друг на друга на мобиле */
.site-block--map,
.site-block--objects,
.site-block--page,
.site-block--text {
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.home-section-title,
.site-block__heading .home-section-title,
.sanatorium-advantages__heading .home-section-title,
.home-services__heading .home-section-title,
.section-heading.title-black.color-dark.all-category .home-section-title,
.section-heading.color-dark.all-category .home-section-title {
    margin: 0;
    color: #111 !important;
    font-family: var(--s1-font-family, 'Suisse Intl', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: clamp(32px, 3vw, 46px);
    font-weight: var(--home-section-title-weight) !important;
    font-style: normal !important;
    line-height: 1.15;
    letter-spacing: 0;
    text-align: left !important;
    text-transform: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 575px) {
    :root {
        --home-section-inset: 15px;
    }

    .site-block {
        margin-bottom: 48px;
    }

    .news-section.section-space-default-less30 {
        margin-bottom: 48px;
    }

    .home-section-heading,
    .site-block > .container > .site-block__heading,
    .news-section .section-heading-container,
    .sanatorium-advantages__heading.home-section-heading,
    .home-services__heading.home-section-heading {
        margin-bottom: 20px;
    }

    .home-section-heading.all-category,
    .news-section .section-heading-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .news-section .see-all-button,
    .home-section-heading.all-category > a,
    .home-section-heading.all-category > .btn-fill,
    .home-section-heading.all-category > .loadmore-four-item {
        margin-left: 0;
        margin-top: 12px;
    }

    .home-section-title,
    .site-block__heading .home-section-title,
    .sanatorium-advantages__heading .home-section-title,
    .home-services__heading .home-section-title,
    .section-heading.title-black.color-dark.all-category .home-section-title,
    .section-heading.color-dark.all-category .home-section-title {
        font-size: 30px;
    }

    .site-block__text h1 {
        font-size: 28px;
    }

    .site-block__text h2 {
        font-size: 26px;
    }

    .site-block__text h3,
    .site-block__text h4 {
        font-size: 22px;
    }
}
