/* ============================================================
   Блок «Меню услуг» — перелинковка по разделам
   Стили для фронтенда + превью в редакторе Gutenberg
   ============================================================ */

/* ── Обёртка блока ────────────────────────────────────── */
.services-menu-block {
    background: #eef2f7;
    border-radius: 16px;
    padding: 0;
    margin: 32px auto;
    overflow: hidden;
    max-width: 1200px;
    width: 100%;
}

/* ── Кнопка-заголовок «Все услуги ▾» ─────────────────── */
.services-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 20px 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--font-main, 'Montserrat Alternates', sans-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: #222;
    letter-spacing: 0.01em;
    transition: background 0.2s;
}
.services-menu-toggle:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* Шеврон */
.services-menu-chevron {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}
.services-menu-block.is-collapsed .services-menu-chevron {
    transform: rotate(-180deg);
}

/* ── Сетка разделов ───────────────────────────────────── */
.services-menu-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 88px;
    padding: 32px 32px 32px 32px;
    transition: max-height 0.35s ease;
    overflow: hidden;
    justify-content: center;
}

/* Каждый раздел — 1/4 ширины минус gap, но если не влезает — переносится */
.services-menu-section {
    flex: 0 0 calc(25% - 18px);
    min-width: 185px;
    margin-bottom: 20px;
}

/* ── Раздел (колонка) ─────────────────────────────────── */

/* ── Заголовок раздела (Имплантация, Протезирование…) ── */
.services-menu-heading {
    font-family: var(--font-main, 'Montserrat Alternates', sans-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: #222;
    margin: 0 0 12px;
    padding: 0 0 8px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.06);
    /* Перенос только по целым словам, никаких слогов и дефисов */
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: none;
}
.services-menu-heading a {
    color: inherit;
    text-decoration: none;
}
.services-menu-heading a:hover {
    color: #e31f26;
}

/* ── Список пунктов ───────────────────────────────────── */
.services-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── Пункт меню ───────────────────────────────────────── */
.services-menu-item {
    position: relative;
    margin: 0;
    padding: 0;
}

/* ── Ссылка ────────────────────────────────────────────── */
.services-menu-link {
    display: block;
    padding: 5px 0 5px 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #444;
    text-decoration: none;
    transition: color 0.15s;
}
a.services-menu-link:hover {
    color: #e31f26;
}
a.services-menu-link.is-current {
    color: #44c4c0;
    font-weight: 600;
}

/* ── Кнопка раскрытия ─────────────────────────────────── */
.services-menu-expand {
    position: absolute;
    left: -20px;
    top: 6px;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #888;
    transition: transform 0.25s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.services-menu-expand:hover {
    color: #e31f26;
}
.services-menu-item.is-active > .services-menu-expand {
    transform: rotate(0deg);
    color: #44c4c0;
}
.services-menu-item:not(.is-active) > .services-menu-expand {
    transform: rotate(-90deg);
}

/* Сдвиг ссылок с дочерними, чтобы стрелка помещалась */
.services-menu-item.has-children > a.services-menu-link {
    padding-left: 0;
}

/* ── Вложенный подсписок ──────────────────────────────── */
.services-menu-sublist {
    list-style: none;
    margin: 0;
    padding: 0 0 0 12px;
    transition: max-height 0.3s ease;
    overflow: hidden;
}

.services-menu-subitem {
    margin: 0;
}
.services-menu-subitem .services-menu-link {
    font-size: 0.82rem;
    color: #666;
    padding: 3px 0;
}
.services-menu-subitem .services-menu-link:hover {
    color: #e31f26;
}

/* ── 3-й уровень (под-подразделы) ──────────────────────── */
.services-menu-subsublist {
    list-style: none;
    margin: 0;
    padding: 0 0 0 14px;
    transition: max-height 0.3s ease;
    overflow: hidden;
}
.services-menu-subsubitem {
    margin: 0;
}
.services-menu-subsubitem .services-menu-link {
    font-size: 0.78rem;
    color: #777;
    padding: 2px 0;
}
.services-menu-subsubitem .services-menu-link:hover {
    color: #e31f26;
}

/* Стрелка 3-го уровня */
.services-menu-expand--l3 {
    left: -16px;
    top: 4px;
    width: 14px;
    height: 14px;
}

/* Подэлемент с дочерними (3-й ур.) */
.services-menu-subitem.has-children {
    position: relative;
}
.services-menu-subitem.has-children > .services-menu-expand--l3 {
    position: absolute;
}
.services-menu-subitem.is-active > .services-menu-expand--l3 {
    transform: rotate(0deg);
    color: #44c4c0;
}
.services-menu-subitem:not(.is-active) > .services-menu-expand--l3 {
    transform: rotate(-90deg);
}

/* Превью: 3-й уровень в редакторе */
.services-menu-editor .services-menu-subsublist {
    padding-left: 14px;
}
.services-menu-editor .services-menu-expand-icon--l3 {
    display: inline-flex;
    align-items: center;
    margin-right: 3px;
    color: #aaa;
}

/* ── Пустое состояние ─────────────────────────────────── */
.services-menu-empty {
    text-align: center;
    color: #999;
    padding: 24px;
    font-style: italic;
}

/* ── Адаптив: 3 колонки ──────────────────────────────── */
@media (max-width: 1100px) {
    .services-menu-grid {
        gap: 0 24px;
        padding: 0 24px 24px;
    }
    .services-menu-section {
        flex: 0 0 calc(33.333% - 10px);
        min-width: 165px;
    }
}

/* ── Адаптив: 2 колонки ──────────────────────────────── */
@media (max-width: 768px) {
    .services-menu-block {
        border-radius: 14px;
        margin: 24px auto;
    }
    .services-menu-grid {
        gap: 0 20px;
        padding: 8px 20px 24px;
    }
    .services-menu-section {
        flex: 0 0 calc(50% - 10px);
        min-width: 100px;
        margin-bottom: 24px;
    }
    .services-menu-toggle {
        font-size: 1.25rem;
        padding: 18px 20px;
    }
    .services-menu-heading {
        font-size: 1.05rem;
        margin-bottom: 14px;
        padding-bottom: 10px;
    }
    .services-menu-link {
        font-size: 0.95rem;
        padding: 7px 0;
    }
}

/* ── Адаптив: мобильные — увеличенные стрелки раскрытия ─ */
@media (max-width: 768px) {
    .services-menu-expand {
        left: -28px;
        top: 6px;
        width: 24px;
        height: 24px;
    }
    .services-menu-expand svg {
        width: 20px;
        height: 20px;
    }
    .services-menu-expand--l3 {
        left: -24px;
        top: 4px;
        width: 22px;
        height: 22px;
    }
    .services-menu-expand--l3 svg {
        width: 18px;
        height: 18px;
    }
    .services-menu-item.has-children > a.services-menu-link {
        padding-left: 4px;
    }
    .services-menu-list {
        padding-left: 28px;
    }
    .services-menu-sublist {
        padding-left: 24px;
    }
}

/* ── Адаптив: 1 колонка (мобильные) ──────────────────── */
@media (max-width: 480px) {
    .services-menu-block {
        border-radius: 12px;
        margin: 20px 0;
    }
    .services-menu-grid {
        gap: 0;
        padding: 4px 20px 20px;
    }
    .services-menu-section {
        flex: 0 0 100%;
        min-width: 0;
        margin-bottom: 20px;
    }
    .services-menu-toggle {
        font-size: 1.25rem;
        padding: 18px 20px;
    }
    .services-menu-heading {
        font-size: 1.15rem;
        margin-bottom: 12px;
        padding-bottom: 10px;
    }
    .services-menu-link {
        font-size: 1.05rem;
        padding: 8px 0;
        line-height: 1.5;
    }
    .services-menu-subitem .services-menu-link {
        font-size: 1rem;
        padding: 6px 0;
    }
}

/* ============================================================
   Стили для превью в редакторе Gutenberg
   ============================================================ */
.services-menu-editor {
    border: 2px dashed #ccc;
    border-radius: 16px;
}
.services-menu-editor .services-menu-toggle-preview {
    text-align: center;
    padding: 16px 24px 8px;
    font-size: 1.3rem;
}
.services-menu-editor .services-menu-grid {
    padding-top: 8px;
}
.services-menu-editor .services-menu-link {
    cursor: default;
}
.services-menu-editor .services-menu-expand-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
    color: #888;
}
