@font-face {
    font-family: Montserrat;
    src: url(../assets/fonts/Montserrat-Regular.woff2) format("woff2");
    font-display: swap;
}

@font-face {
    font-family: Montserrat-SemiBold;
    src: url(../assets/fonts/Montserrat-SemiBold.woff2) format("woff2");
    font-display: swap;
}

@font-face {
    font-family: Montserrat-Medium;
    src: url(../assets/fonts/Montserrat-Medium.woff2) format("woff2");
    font-display: swap;
}

:root {
    --color-primary: #2e5095;
    --color-secondary: #304266;
    --color-accent: #a80308;
    --color-light: #f9f9f9;
    --color-border: #e6e6e6;
}

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

body {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    background: #fff;
    color: var(--color-secondary);
}

body.modal-open {
    overflow: hidden;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Исправление для старых браузеров */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

img {
    height: auto;
    display: block;
}

.section-title {
    font-family: 'Montserrat-SemiBold', sans-serif;
    font-size: 32px;
    text-align: center;
    margin-bottom: 40px;
    color: var(--color-secondary);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 5px;
    font-family: 'Montserrat-SemiBold', sans-serif;
    font-size: 16px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s ease;
    border: none;
}

.btn--primary {
    background: var(--color-primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--color-secondary);
}

.btn:focus-visible,
.header__menu-link:focus-visible,
.header__phone:focus-visible,
.header__submenu-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

section[id] {
    scroll-margin-top: 88px;
}

.btn--secondary {
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
}

.btn--secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
}

[data-include="header.html"] {
    display: contents;
}

.header {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header__container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px;
    position: relative;
}

.logo img {
    width: 120px;
    height: auto;
}

.header__nav {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header__menu {
    display: flex;
    gap: 30px;
    list-style: none;
}

.header__menu-link {
    position: relative;
    color: var(--color-secondary);
    font-size: 16px;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.header__menu-link::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -4px;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
    transform: translateX(-50%);
}

.header__menu-link:hover {
    color: var(--color-primary);
}

.header__menu-link:hover::after {
    width: 100%;
}

.header__dropdown {
    position: relative;
}

.header__dropdown-toggle.header__menu-link {
    font: inherit;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.header__submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, 6px);
    min-width: 280px;
    margin: 0;
    padding: 10px 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    z-index: 1002;
}

.header__submenu-link {
    display: block;
    padding: 10px 18px;
    color: var(--color-secondary);
    font-size: 15px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.header__submenu-link:hover {
    background: var(--color-light);
    color: var(--color-primary);
}

@media (min-width: 901px) {
    .header__dropdown:hover .header__submenu,
    .header__dropdown:focus-within .header__submenu {
        display: block;
    }
}

@media (max-width: 900px) {
    .header__submenu {
        position: static;
        transform: none;
        min-width: unset;
        width: 100%;
        max-width: 280px;
        margin-top: 8px;
        padding: 8px 0;
        box-shadow: none;
        border-radius: 6px;
        text-align: center;
    }

    .header__dropdown:hover .header__submenu {
        display: none;
    }

    .header__dropdown.is-open .header__submenu {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
}

.header__contacts {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header__contacts--mobile {
    display: none;
}

.header__phone {
    color: var(--color-primary);
    font-weight: 600;
    transition: all 0.3s ease;
}

.header__phone:hover {
    color: var(--color-secondary);
    transform: scale(1.05);
}

/* --- бургер --- */
.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 28px;
    height: 22px;
    border: none;
    background: none;
    cursor: pointer;
    z-index: 1101;

}

.burger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--color-secondary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.burger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.burger.active span:nth-child(2) {
    opacity: 0;
}
.burger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.footer {
    background: #fff;
    border-top: 1px solid var(--color-border);
    color: var(--color-secondary);
    font-size: 14px;
}

.footer__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    padding: 20px;
}

.footer__logo {
    flex-shrink: 0;
}

.footer__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 28px 0;
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
}

.footer__nav-col {
    min-width: 132px;
    padding: 0 36px;
}

.footer__nav-col:first-child {
    padding-left: 0;
}

.footer__nav-col + .footer__nav-col {
    border-left: 1px solid var(--color-border);
}

.footer__nav-heading {
    font-family: 'Montserrat-SemiBold', sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #7a8499;
    margin: 0 0 10px;
}

.footer__nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.footer__nav-list a {
    font-size: 13px;
    color: var(--color-secondary);
    line-height: 1.35;
}

.footer__nav-list a:hover {
    color: var(--color-primary);
}

.footer__tail {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
    flex-shrink: 0;
    margin-left: auto;
}

.footer__contact {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.footer__contact a {
    color: var(--color-secondary);
    transition: color 0.3s ease;
}

.footer__contact a[href^="tel"] {
    font-family: 'Montserrat-SemiBold', sans-serif;
    font-size: 15px;
}

.footer__contact a[href^="mailto"] {
    font-size: 13px;
    color: #6b7285;
}

.footer__contact a:hover {
    color: var(--color-primary);
}

.footer__social {
    display: flex;
    gap: 10px;
}

.footer__social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(48, 66, 102, 0.12);
    box-shadow: 0 2px 8px rgba(48, 66, 102, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.footer__social a:hover {
    transform: translateY(-2px);
    border-color: rgba(46, 80, 149, 0.35);
    box-shadow: 0 6px 14px rgba(46, 80, 149, 0.14);
}

.footer__social img {
    width: 22px;
    height: 22px;
    transition: transform 0.2s ease;
}

.footer__social a:hover img {
    transform: scale(1.06);
}

.footer__bottom {
    text-align: center;
    padding: 25px 20px 30px;
    color: #666;
    font-size: 13px;
    border-top: 1px solid var(--color-border);
    background: transparent;
}

.footer__bottom p + p {
    margin-top: 6px;
}

.footer__bottom a {
    color: var(--color-primary);
}

.footer__bottom a:hover {
    text-decoration: underline;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.35s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}

.modal__content {
    position: relative;
    z-index: 10;
    background: #ffffff;
    border-radius: 12px;
    padding: 40px 45px;
    max-width: 820px;
    width: 95%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    min-width: 220px;
    max-width: 280px;
    padding: 12px 16px;
    border-radius: 10px;
    color: #fff;
    background: rgba(46, 80, 149, 0.95);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}

.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--hide {
    opacity: 0;
    transform: translateY(-10px);
}

.toast--success {
    background: rgba(46, 80, 149, 0.95);
}

.toast--error {
    background: rgba(168, 3, 8, 0.95);
}

.toast--info {
    background: rgba(48, 66, 102, 0.95);
}

.modal__close {
    position: absolute;
    top: 16px;
    right: 18px;
    font-size: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #555;
    transition: color 0.2s;
}

.modal__close:hover {
    color: var(--color-primary, #0056ff);
}

.modal__title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-primary, #002d6e);
    margin-bottom: 28px;
}

.modal__form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.modal__row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.modal__row--full {
    flex-direction: column;
}

.modal__group {
    flex: 1;
    min-width: calc(33.333% - 14px);
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    animation: fadeIn 0.6s ease;
}

.modal.modal__block {
    display: flex;
    gap: 8px;
}

.modal__checkbox-block {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.modal__checkbox-block label {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #5a6478;
    cursor: pointer;
}

.modal__checkbox-block label a {
    color: var(--color-primary, #0056ff);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.modal__checkbox-block small {
    flex-basis: 100%;
}

.modal__label {
    font-size: 14px;
    margin-bottom: 6px;
    color: #555;
    font-weight: 500;
}

.modal__input,
.modal__textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ccd3e0;
    border-radius: 6px;
    font-size: 15px;
    background: #f9fbfd;
    transition: all 0.25s ease;
}

.modal__input:focus,
.modal__textarea:focus {
    border-color: var(--color-primary, #0056ff);
    box-shadow: 0 0 0 3px rgba(0, 86, 255, 0.15);
    background: #fff;
    outline: none;
}

.modal__textarea {
    resize: none;
    overflow-y: auto;
    min-height: 70px;
    max-height: 140px;
}

.modal__agreement {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

.modal__agreement label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal__agreement small {
    display: none;
    color: var(--color-accent);
    font-size: 12px;
}

.modal__checkbox.input-error ~ small {
    display: block;
}

.form-alert {
    background: var(--color-accent);
    color: #d00000;
    font-size: 14px;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 12px;
    display: none;
}

.modal__agreement a {
    color: var(--color-primary, #0056ff);
    text-decoration: underline;
}

.modal__submit {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 6px;
    background: var(--color-primary, #0056ff);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal__submit:hover {
    background: var(--color-secondary, #003ec9);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 86, 255, 0.3);
}

/* ===== Error messages ===== */
.modal__group small,
.modal__agreement small {
    display: none;
    opacity: 0;
    height: 0;
    color: var(--color-accent);
    font-size: 12px;
    margin-top: 4px;
    transition: opacity 0.3s ease, height 0.3s ease;
}

.modal__checkbox-block small {
    color: var(--color-accent);
}

/* Show when JS sets message */
.input-error + small,
.modal__agreement .input-error + small {
    display: block;
    opacity: 1;
    height: auto;
}

/* Error border */
.input-error {
    border-color: rgba(236, 13, 13, 0.7) !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.dark .modal__content {
    background: #1b243b;
    color: #e0e6f0;
}

body.dark .modal__label {
    color: #c7d3e1;
}

body.dark .modal__title {
    color: var(--color-accent);
}

body.dark .modal__input,
body.dark .modal__textarea {
    background: #121a2f;
    border-color: #2c3b58;
    color: #e0e6f0;
}

body.dark .modal__input:focus,
body.dark .modal__textarea:focus {
    border-color: var(--color-primary, #3a82ff);
    box-shadow: 0 0 0 3px rgba(0, 86, 255, 0.25);
}

body.dark .modal__agreement,
body.dark .modal__checkbox-block label {
    color: #c8d3e1;
}

body.dark .modal__submit {
    background: var(--color-primary, #3a82ff);
}

body.dark .modal__submit:hover {
    background: #1d62d8;
}

body.dark {
    background: #0d1a33;
    color: #fff;
}

body.dark .section-title {
    color: var(--color-accent);
}

body.dark .open-modal {
    background-color: var(--color-secondary);
    color: var(--color-light);
}

body.dark .open-modal:hover {
    color: #cf0208;
}

body.dark .header {
    background: var(--color-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark .header__logo img,
body.dark .footer__logo img {
    content: url("../assets/images/dark-logo.png");
}

body.dark .header__menu-link,
body.dark .header__phone {
    color: #fff;
}

body.dark .header__menu-link::after {
    background-color: white;
}

body.dark .header__menu-link:hover {
    color: var(--color-light);
}

body.dark .header__phone:hover {
    color: var(--color-light);
    transform: scale(1.05);
    transition: all 0.3s ease;
}

body.dark .header__btn {
    background: var(--color-secondary);
    color: var(--color-accent);
}

body.dark .header__btn:hover {
    color: #ea0409;
}

body.dark .header__cta {
    background: var(--color-light);
    color: #1a2640;
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark .header__cta:hover {
    background: var(--color-primary);
    color: #fff;
}

body.dark .burger {
    filter: brightness(0) invert(1);
}

body.dark .header__nav {
    background: var(--color-secondary);
    color: var(--color-light);
}

body.dark .header__submenu {
    background: var(--color-secondary);
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark .header__submenu-link {
    color: #fff;
}

body.dark .header__submenu-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-light);
}

body.dark .form {
    background: #121c35;
}

body.dark .form__label {
    color: #e0e6f0;
}

body.dark .form__input,
body.dark .form__textarea {
    background: #1a243d;
    border-color: #2b385d;
    color: #fff;
}

body.dark .form__input:focus,
body.dark .form__textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 255, 0.25);
}

body.dark .footer {
    background: var(--color-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #f0f0f0;
}

body.dark .footer__nav-heading {
    color: #9aa5bd;
}

body.dark .footer__nav-col + .footer__nav-col {
    border-left-color: rgba(255, 255, 255, 0.12);
}

body.dark .footer__nav-list a {
    color: var(--color-light);
}

body.dark .footer__nav-list a:hover {
    color: var(--color-accent);
}

body.dark .footer__contact a[href^="mailto"] {
    color: #c5cad8;
}

body.dark .footer__contact a[href^="tel"] {
    color: var(--color-light);
}

body.dark .footer__contact a:hover {
    color: var(--color-accent);
}

body.dark .footer__social a {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: none;
}

body.dark .footer__social img {
    filter: brightness(0) invert(1);
}

body.dark .footer__social a:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
}

body.dark .footer__bottom {
    border-top-color: rgba(255, 255, 255, 0.1);
    background: transparent;
    color: #aaa;
}

body.dark .footer__bottom a {
    color: #d6e2ff;
}

.theme-toggle,
.scroll-top {
    position: fixed;
    bottom: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 999;
}

.theme-toggle {
    right: 30px;
    background: var(--color-primary);
    color: #fff;
}

.theme-toggle:hover {
    background: var(--color-secondary);
    transform: scale(1.1);
}

.scroll-top {
    left: 30px;
    background: var(--color-primary);
    opacity: 0;
    pointer-events: none;
}

.scroll-top.show {
    opacity: 1;
    pointer-events: auto;
}

.scroll-top:hover {
    background: var(--color-secondary);
    transform: translateY(-3px);
}

.scroll-top.show img {
    filter: brightness(0) invert(1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}