/* =====================================
   SOHOLMS — ЗДОРОВЫЙ РЕБЁНОК ONLINE
   ПОЛНЫЙ CSS (версия 20)
===================================== */


/* БАЗОВЫЕ НАСТРОЙКИ */

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
    background: #ffffff;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img {
    max-width: 100%;
}


/* ПОЛЯ СТРАНИЦЫ */

@media (min-width: 768px) {
    main.main {
        width: 100% !important;
        max-width: 1320px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: clamp(20px, 4vw, 56px) !important;
        padding-right: clamp(20px, 4vw, 56px) !important;
    }
    main.main section,
    main.main ._cnt {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

@media (max-width: 767px) {
    main.main {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    main.main ._cnt {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    p, h1, h2, h3 {
        max-width: 100%;
        overflow-wrap: break-word;
    }
}


/* ЗАГОЛОВКИ РАЗДЕЛОВ — ПО ЦЕНТРУ, С ВОЗДУХОМ */

main.main section.promo h2,
main.main section.about h2 {
    text-align: center !important;
    margin: 56px auto 28px !important;
}

main.main h2:empty {
    display: none !important;
}


/* ЛОГОТИП */

img[src*="logo_zr"] {
    height: auto !important;
}


/* ПЕРВЫЙ ЭКРАН — МОБИЛЬНАЯ:
   «Здоровый ребёнок онлайн», под ним логотип */

@media (max-width: 767px) {
    section.promo div[style*="grid-template-columns"]:has(h1) {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 16px !important;
        overflow: visible !important;
    }
    section.promo div[style*="grid-template-columns"]:has(h1) > * {
        width: 100% !important;
        max-width: 100% !important;
        text-align: center !important;
    }
    section.promo div[style*="grid-template-columns"]:has(h1) img {
        display: block !important;
        width: 200px !important;
        max-width: 70% !important;
        margin: 0 auto !important;
    }
}


/* ПУСТЫЕ СЕТКИ (без содержимого) НЕ ЗАНИМАЮТ МЕСТО */

main.main div[style*="grid-template-columns"]:not(:has(img, h1, h2, h3, p, lms, a, button, iframe, span)) {
    display: none !important;
}


/* КУРСЫ НА ПК — КАРТОЧКИ ПО ЦЕНТРУ */

@media (min-width: 768px) {
    main.main div[style*="grid-template-columns"]:not(#experts *):not(:has(h1)):not(:has(soho-form)):not(:has(img)) {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: stretch !important;
        gap: 32px !important;
        width: 100% !important;
        margin: 0 auto 24px !important;
    }
    main.main div[style*="grid-template-columns"]:not(#experts *):not(:has(h1)):not(:has(soho-form)):not(:has(img)) > *:not(:empty) {
        flex: 0 1 320px !important;
        width: 320px !important;
        max-width: 340px !important;
        min-width: 0 !important;
    }
    main.main div[style*="grid-template-columns"]:not(#experts *):not(:has(h1)):not(:has(soho-form)):not(:has(img)) > *:empty {
        display: none !important;
    }
}


/* КУРСЫ НА ТЕЛЕФОНЕ — ЛИСТАЮТСЯ ПАЛЬЦЕМ */

@media (max-width: 767px) {
    main.main div[style*="grid-template-columns"]:not(#experts *):not(:has(h1)):not(:has(soho-form)):not(:has(img)) {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 16px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding-bottom: 12px !important;
        scroll-snap-type: x mandatory !important;
        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch;
    }
    main.main div[style*="grid-template-columns"]:not(#experts *):not(:has(h1)):not(:has(soho-form)):not(:has(img))::-webkit-scrollbar {
        display: none !important;
    }
    main.main div[style*="grid-template-columns"]:not(#experts *):not(:has(h1)):not(:has(soho-form)):not(:has(img)) > *:not(:empty) {
        flex: 0 0 85% !important;
        width: 85% !important;
        max-width: 85% !important;
        min-width: 0 !important;
        scroll-snap-align: start !important;
    }
    main.main div[style*="grid-template-columns"]:not(#experts *):not(:has(h1)):not(:has(soho-form)):not(:has(img)) > *:empty {
        display: none !important;
    }
}


/* БЕЛЫЙ ФОН КАРТОЧЕК КУРСОВ */

main [style*="241, 245, 249"],
main [style*="F1F5F9" i] {
    background: #ffffff !important;
    background-color: #ffffff !important;
}


/* ФОРМА «ЗАПИШИТЕСЬ НА КОНСУЛЬТАЦИЮ» */

#courses .courses__items > section {
    background: #ffffff !important;
    border: 1px solid #e3e8ee !important;
}

@media (max-width: 767px) {
    #courses .courses__items > section {
        margin: 16px 0 !important;
        padding: 36px 18px !important;
        border-radius: 20px !important;
    }
    #courses .courses__items > section h2 {
        font-size: 26px !important;
    }
    #courses .courses__items > section p {
        font-size: 16px !important;
        margin-bottom: 24px !important;
    }
}


/* =====================================
   СПЕЦИАЛИСТЫ
   Все карточки — одна ровная сетка по центру:
   на ПК по 3 в ряд, на телефоне по одному.
   Фото квадратные с мягко скруглёнными углами.
===================================== */

/* пустые шаблонные блоки платформы */
#experts .experts__items {
    display: none !important;
}

#experts .experts__title {
    text-align: center !important;
    margin: 0 auto 8px !important;
}

/* раздел — общая сетка для всех карточек */
section#experts {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: flex-start !important;
    gap: 44px 32px !important;
    padding-top: 24px !important;
    padding-bottom: 56px !important;
    background: #ffffff !important;
}

section#experts > .experts__container {
    flex: 0 0 100% !important;
}

/* ряды платформы «растворяем», чтобы все
   карточки встали в одну сетку */
section#experts > div[style*="grid-template-columns"] {
    display: contents !important;
}

/* карточка */
section#experts > div[style*="grid-template-columns"] > div {
    flex: 0 1 300px !important;
    width: 300px !important;
    max-width: 300px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
}

/* пустые ячейки и заготовки без фото не показываем */
section#experts > div[style*="grid-template-columns"] > div:empty,
section#experts > div[style*="grid-template-columns"] > div:has(> img[src^="ССЫЛКА"]) {
    display: none !important;
}

/* фото */
section#experts img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    object-position: center top !important;
    border-radius: 16px !important;
    margin: 0 0 16px !important;
    background: #eef2f6 !important;
}

/* текст */
section#experts [role="text-block-widget"] {
    width: 100% !important;
    margin: 0 !important;
    text-align: left !important;
}

section#experts [role="text-block-widget"]:not(:has(span)) ,
section#experts p:empty {
    display: none !important;
}

section#experts [role="text-block-widget"] p,
section#experts [role="text-block-widget"] div,
section#experts [role="text-block-widget"] span {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    line-height: 1.5 !important;
    color: #4b5563 !important;
    background: transparent !important;
    white-space: normal !important;
    text-align: left !important;
    font-family: inherit !important;
}

/* первая строка — имя и специальность */
section#experts img + [role="text-block-widget"] > p:first-child {
    margin-bottom: 8px !important;
}

section#experts img + [role="text-block-widget"] > p:first-child,
section#experts img + [role="text-block-widget"] > p:first-child span {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #1f2933 !important;
    line-height: 1.4 !important;
}


/* СПЕЦИАЛИСТЫ — ТЕЛЕФОН: по одному */

@media (max-width: 767px) {
    section#experts {
        gap: 36px !important;
        padding-top: 16px !important;
        padding-bottom: 40px !important;
    }
    section#experts > div[style*="grid-template-columns"] > div {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 420px !important;
    }
    section#experts img {
        border-radius: 16px !important;
        margin-bottom: 14px !important;
    }
}


/* =====================================
   ПОРЯДОК БЛОКОВ
   1. «Здоровый ребёнок онлайн» + логотип
   2. Форма «Запишитесь на консультацию»
   3. Невролог (БАК), логопед
   4. Нейропсихолог, детский психолог, взрослые
   5. Специалисты
===================================== */

main.main {
    display: flex !important;
    flex-direction: column !important;
}

/* «раскрываем» вложенные обёртки первого экрана,
   чтобы логотип и курсы можно было разнести */
main.main > section.promo,
main.main > section.promo *:has(section.promo),
main.main > section.promo section.promo,
main.main > section.promo section.promo > .promo__container {
    display: contents !important;
}

/* всё содержимое первого экрана по умолчанию — после формы */
main.main > section.promo * {
    order: 3;
}

/* 1. название и логотип */
main.main > section.promo div[style*="grid-template-columns"]:has(h1) {
    order: 1 !important;
}

/* 2. форма */
main.main > section#courses {
    order: 2 !important;
}

/* 3. курсы логопеда — после блока невролога */
main.main > section.promo section.promo > div[style*="grid-template-columns"] {
    order: 4 !important;
}

/* 4. нейропсихолог, детский психолог, взрослые */
main.main > section.about {
    order: 5 !important;
}

/* 5. специалисты */
main.main > section#experts {
    order: 6 !important;
}
