@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;
}

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

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

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

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

.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: 20px;
    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;
    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__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;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    padding: 30px 20px 0;
    flex-wrap: wrap;
}

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

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

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

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

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

.footer__social img {
    width: 40px;
    transition: transform 0.3s ease;
}

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

.footer__bottom {
    text-align: center;
    padding: 25px 0 30px;
    color: #666;
    font-size: 13px;
}

.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__label {
    font-size: 14px;
    margin-bottom: 6px;
    color: #555;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.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 {
    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 {
    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 .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);
    color: #f0f0f0;
}

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

body.dark .footer__contact a {
    color: #f0f0f0;
    transition: color 0.3s ease;
}

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

body.dark .footer__social img {
    filter: brightness(0) invert(1);
    transition: transform 0.3s ease;
}

body.dark .footer__social a:hover img {
    transform: scale(1.1);
}

body.dark .footer__bottom {
    color: #aaa;
}

.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;
    }
}