/*
 * Стили блоков, добавленных вместе с Wagtail. Все правила — для классов cms-*,
 * поэтому существующие страницы выглядят как раньше.
 */

/* Цвет фона страниц из «Настройки → Дизайн» (пусто — белый, как в site.css) */
body { background: var(--page-bg, var(--white-color)); }

/* ---------- подменю в шапке ---------- */
.nav-item.has-submenu { position: relative; }
.nav-submenu {
    position: absolute; top: 100%; left: 50%; z-index: 30;
    min-width: 220px; margin: 0; padding: 10px; list-style: none;
    border: 1px solid var(--border-color); border-radius: 10px; background: var(--white-color);
    box-shadow: var(--shadow-soft);
    opacity: 0; visibility: hidden; transform: translate(-50%, 6px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.nav-item.has-submenu:hover > .nav-submenu,
.nav-item.has-submenu:focus-within > .nav-submenu { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.nav-submenu a {
    display: block; padding: 9px 12px; border-radius: 8px;
    color: var(--heading-color, var(--primary-color));
    font-size: calc(14px * var(--fs-text, 1)); font-weight: 700; line-height: 1.3;
}
.nav-submenu a:hover, .nav-submenu a:focus-visible { background: #f8f5ee; color: var(--accent-color); }
@media (max-width: 991px) {
    .nav-submenu { position: static; min-width: 0; padding: 4px 0 0; border: 0; box-shadow: none;
        opacity: 1; visibility: visible; transform: none; background: transparent; }
    .nav-submenu a { text-align: center; }
}

/* ---------- общие блоки ---------- */
.cms-block { padding: clamp(28px, 4vw, 56px) 0; }
.cms-page > .cms-block:first-child { padding-top: clamp(120px, 12vw, 160px); }
.cms-full { width: 100%; }
.cms-block .section-title { margin-bottom: 18px; }
.cms-block .section-title-center { text-align: center; }
.cms-h3 { margin: 0 0 12px; color: var(--heading-color, var(--primary-color));
    font-size: calc(clamp(22px, 2.4vw, 30px) * var(--fs-head, 1)); font-weight: 900; line-height: 1.15; }
.cms-h4 { margin: 0 0 10px; color: var(--heading-color, var(--primary-color));
    font-size: calc(20px * var(--fs-head, 1)); font-weight: 800; line-height: 1.2; }

.cms-rich { color: var(--text-color); font-size: calc(17px * var(--fs-text, 1)); line-height: 1.7; }
.cms-rich h2, .cms-rich h3, .cms-rich h4 { margin: 1.4em 0 .5em; color: var(--heading-color, var(--primary-color)); font-weight: 900; line-height: 1.15; }
.cms-rich h2 { font-size: calc(clamp(26px, 3vw, 36px) * var(--fs-head, 1)); }
.cms-rich h3 { font-size: calc(clamp(21px, 2.3vw, 27px) * var(--fs-head, 1)); }
.cms-rich h4 { font-size: calc(19px * var(--fs-head, 1)); }
.cms-rich > :first-child { margin-top: 0; }
.cms-rich ul, .cms-rich ol { margin: 0 0 1rem; padding-left: 1.3em; }
.cms-rich li { margin-bottom: .35em; }
.cms-rich a { color: var(--accent-color); text-decoration: underline; text-underline-offset: 3px; }
.cms-rich blockquote { margin: 1.2em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--accent-color); }
.cms-rich hr { margin: 2em 0; border: 0; border-top: 1px solid var(--border-color); }
.cms-rich img { max-width: 100%; height: auto; border-radius: 12px; }
.cms-width-narrow { max-width: 760px; }
.cms-width-normal { max-width: 960px; }

/* цитата */
.cms-quote { margin: 0 auto; max-width: 900px; padding: clamp(24px, 4vw, 44px); border-radius: 18px;
    background: var(--secondary-color); border-left: 6px solid var(--accent-color); }
.cms-quote blockquote { margin: 0; color: var(--heading-color, var(--primary-color));
    font-size: calc(clamp(19px, 2vw, 25px) * var(--fs-text, 1)); font-weight: 700; line-height: 1.5; }
.cms-quote figcaption { margin-top: 16px; color: var(--text-color); }
.cms-quote figcaption b { display: block; color: var(--heading-color, var(--primary-color)); }

/* картинки */
.cms-figure { margin: 0; }
.cms-figure img { width: 100%; height: auto; border-radius: 16px; }
.cms-image--narrow .cms-figure { max-width: 720px; margin: 0 auto; }
.cms-image--full .cms-figure img { border-radius: 0; }
.cms-figure figcaption, .cms-gallery figcaption, .cms-video figcaption { margin-top: 10px; color: var(--text-color);
    font-size: calc(14px * var(--fs-text, 1)); text-align: center; }

/* сетки */
.cms-gallery, .cms-cards, .cms-columns { display: grid; gap: clamp(14px, 2vw, 26px); }
.cms-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cms-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cms-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 991px) { .cms-cols-3, .cms-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .cms-cols-2, .cms-cols-3, .cms-cols-4 { grid-template-columns: 1fr; } }
.cms-gallery__item { margin: 0; }
.cms-gallery__item img { width: 100%; aspect-ratio: 4 / 3; height: auto; object-fit: cover; border-radius: 14px;
    transition: transform .25s ease; }
.cms-gallery__item a:hover img { transform: scale(1.02); }

/* карточки */
.cms-card { padding: clamp(20px, 2.4vw, 30px); border: 1px solid var(--border-color); border-radius: 18px;
    background: var(--white-color); box-shadow: 0 12px 34px rgba(23, 32, 51, .07); }
.cms-card__media { margin: -6px -6px 18px; }
.cms-card__media img { width: 100%; height: auto; max-height: 220px; object-fit: cover; border-radius: 12px; }
.cms-card h3 { margin: 0 0 10px; color: var(--heading-color, var(--primary-color));
    font-size: calc(20px * var(--fs-head, 1)); font-weight: 900; line-height: 1.2; }
.cms-card h3 a:hover { color: var(--accent-color); }
.cms-card p { margin: 0; color: var(--text-color); font-size: calc(15px * var(--fs-text, 1)); }

/* кнопки */
.cms-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.cms-buttons--center { justify-content: center; }
.cms-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 26px;
    border: 2px solid transparent; border-radius: 12px; font-size: calc(15px * var(--fs-text, 1)); font-weight: 800;
    line-height: 1.2; cursor: pointer; transition: background .2s ease, color .2s ease, border-color .2s ease; }
.cms-btn--primary { background: var(--accent-color); color: #fff; }
.cms-btn--primary:hover { background: var(--accent-strong); }
.cms-btn--ghost { border-color: var(--accent-color); color: var(--accent-color); background: transparent; }
.cms-btn--ghost:hover { background: var(--accent-color); color: #fff; }
.cms-btn--dark { background: var(--heading-color, var(--primary-color)); color: #fff; }
.cms-btn--dark:hover { opacity: .9; }

/* картинка + текст */
.cms-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 5vw, 64px); align-items: center; }
.cms-split--reverse .cms-split__media { order: 2; }
.cms-split__media img { width: 100%; height: auto; border-radius: 18px; }
@media (max-width: 860px) { .cms-split { grid-template-columns: 1fr; } .cms-split--reverse .cms-split__media { order: 0; } }

/* FAQ */
.cms-faq { max-width: 900px; margin: 0 auto; display: grid; gap: 12px; }
.cms-faq__item { border: 1px solid var(--border-color); border-radius: 14px; background: var(--white-color); }
.cms-faq__item summary { position: relative; padding: 18px 52px 18px 22px; color: var(--heading-color, var(--primary-color));
    font-size: calc(17px * var(--fs-text, 1)); font-weight: 800; cursor: pointer; list-style: none; }
.cms-faq__item summary::-webkit-details-marker { display: none; }
.cms-faq__item summary::after { content: "+"; position: absolute; top: 50%; right: 22px; transform: translateY(-50%);
    color: var(--accent-color); font-size: 26px; font-weight: 400; }
.cms-faq__item[open] summary::after { content: "−"; }
.cms-faq__item .cms-rich { padding: 0 22px 18px; }

/* баннер */
.cms-banner { position: relative; overflow: hidden; display: flex; align-items: center;
    padding: clamp(80px, 10vw, 140px) 0; background: var(--primary-color); color: #fff; }
.cms-page > .cms-banner:first-child { padding-top: clamp(150px, 14vw, 200px); }
.cms-banner--h60 { min-height: 60vh; }
.cms-banner--h100 { min-height: 100vh; }
.cms-banner__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cms-banner__overlay { position: absolute; inset: 0; background: #0b1020; }
.cms-banner__inner { position: relative; z-index: 1; }
.cms-banner__kicker { display: inline-block; margin-bottom: 14px; color: var(--accent-color);
    font-size: calc(14px * var(--fs-text, 1)); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cms-banner__title { margin: 0 0 16px; max-width: 900px; color: inherit;
    font-size: calc(clamp(34px, 5vw, 64px) * var(--fs-head, 1)); font-weight: 900; line-height: 1.05; }
.cms-banner__sub { max-width: 720px; color: rgba(255, 255, 255, .86); font-size: calc(18px * var(--fs-text, 1)); }
.cms-banner[style*="text-align: center"] .cms-banner__title,
.cms-banner[style*="text-align: center"] .cms-banner__sub { margin-left: auto; margin-right: auto; }
.cms-banner[style*="text-align: center"] .cms-buttons { justify-content: center; }

/* слайдер */
.cms-slider { position: relative; overflow: hidden; border-radius: 18px; background: #0b1020; }
.cms-slide { display: none; position: relative; height: var(--slider-h, 520px); }
.cms-slide.is-active { display: block; animation: cms-fade .45s ease; }
.cms-slide img { width: 100%; height: 100%; object-fit: cover; }
.cms-slide__body { position: absolute; left: 0; right: 0; bottom: 0; padding: clamp(20px, 4vw, 44px);
    background: linear-gradient(transparent, rgba(11, 16, 32, .82)); color: #fff; }
.cms-slide__body h3 { margin: 0 0 8px; color: #fff; font-size: calc(clamp(22px, 3vw, 36px) * var(--fs-head, 1)); font-weight: 900; }
.cms-slide__body p { max-width: 720px; color: rgba(255, 255, 255, .88); }
.cms-slider__nav { position: absolute; top: 50%; z-index: 2; width: 46px; height: 46px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .9); color: var(--primary-color); font-size: 28px; line-height: 1; cursor: pointer;
    transform: translateY(-50%); }
.cms-slider__prev { left: 14px; }
.cms-slider__next { right: 14px; }
.cms-slider__dots { position: absolute; left: 0; right: 0; bottom: 12px; z-index: 2; display: flex; justify-content: center; gap: 8px; }
.cms-slider__dots button { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .5); cursor: pointer; }
.cms-slider__dots button.is-active { background: #fff; }
@keyframes cms-fade { from { opacity: .3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cms-slide.is-active { animation: none; } }

/* видео и карта */
.cms-video { margin: 0 auto; max-width: 1000px; }
.cms-video__frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 16px; background: #000; }
.cms-video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cms-map iframe { width: 100%; border: 0; border-radius: 18px; }
.cms-contacts { margin-top: 18px; }

/* отступ */
.cms-spacer { display: flex; align-items: center; }
.cms-spacer .container { width: min(1200px, calc(100% - 32px)); }
.cms-divider { margin: 0; border: 0; border-top: 1px solid var(--border-color); }

/* формы */
.cms-form-box { max-width: 760px; margin: 0 auto; padding: clamp(22px, 4vw, 44px); border-radius: 20px;
    background: var(--secondary-color); }
.cms-form { display: grid; gap: 16px; }
.cms-form__field { display: grid; gap: 6px; }
.cms-form__field label { color: var(--heading-color, var(--primary-color)); font-weight: 800; font-size: calc(15px * var(--fs-text, 1)); }
.cms-form__field input, .cms-form__field textarea, .cms-form__field select {
    width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--border-color); border-radius: 10px;
    background: #fff; color: var(--primary-color); font: inherit; }
.cms-form__field textarea { min-height: 130px; resize: vertical; }
.cms-form__field.is-checkbox { grid-template-columns: auto 1fr; align-items: center; }
.cms-form__field.is-checkbox input { width: auto; min-height: 0; order: -1; }
.cms-form__field input:focus, .cms-form__field textarea:focus, .cms-form__field select:focus {
    outline: 2px solid var(--accent-color); outline-offset: 1px; }
.cms-form__field.has-error input, .cms-form__field.has-error textarea { border-color: #c0392b; }
.cms-form__error, .cms-form__errors { color: #c0392b; font-size: 14px; }
.cms-form__field small { color: var(--text-color); }
.cms-form .cms-btn { justify-self: start; }
.cms-hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* поиск */
.cms-search-form { display: flex; gap: 10px; max-width: 640px; margin: 0 0 28px; }
.cms-search-form input { flex: 1; min-height: 50px; padding: 0 16px; border: 1px solid var(--border-color); border-radius: 12px; font: inherit; }
.cms-search-results { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.cms-search-results li { padding: 18px 20px; border: 1px solid var(--border-color); border-radius: 14px; background: #fff; }
.cms-search-results a { color: var(--heading-color, var(--primary-color)); font-weight: 900; font-size: calc(19px * var(--fs-head, 1)); }
.cms-search-results a:hover { color: var(--accent-color); }
.cms-search-results p { margin: 6px 0 0; color: var(--text-color); }
.cms-search-results small { color: var(--accent-color); font-weight: 800; }
