/* ---------- RESET ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---------- ПЕРЕМЕННЫЕ ---------- */
:root {
    --primary-dark: #2c3e4e;
    --accent: #5a7f6e;
    --accent-light: #7fa392;
    --bg-light: #ffffff;
    --bg-offwhite: #f8f9fb;
    --text-dark: #1f2a36;
    --text-medium: #4a5a6e;
    --border-light: #eef2f5;
    --shadow-sm: 0 8px 20px rgba(0,0,0,0.02), 0 2px 6px rgba(0,0,0,0.03);
    --shadow-md: 0 20px 30px -12px rgba(0,0,0,0.08);
    --shadow-lg: 0 30px 40px -15px rgba(0,0,0,0.12);
    --transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #eef2f5;
    color: var(--text-dark);
    line-height: 1.5;
    font-size: 17px;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(45deg, rgba(90,127,110,0.02) 0px, rgba(90,127,110,0.02) 2px, transparent 2px, transparent 8px), radial-gradient(circle at 20% 30%, rgba(90,127,110,0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

/* ---------- HEADER ---------- */
header {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.7rem;
    font-weight: 500;
    letter-spacing: -0.3px;
    color: var(--primary-dark);
    transition: var(--transition);
    cursor: pointer;
}

.logo:hover {
    color: var(--accent);
    transform: scale(1.02);
}

.nav-links {
    display: flex;
    gap: 2.2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 480;
    font-size: 1rem;
    transition: var(--transition);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: 0.2s;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

/* ---------- HERO ---------- */
.hero {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    text-align: center;
    padding: 5rem 2rem;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(90,127,110,0.1) 0%, rgba(90,127,110,0) 70%);
    animation: slowDrift 18s infinite alternate ease-in-out;
    pointer-events: none;
}

@keyframes slowDrift {
    0% { transform: translate(0%, 0%) scale(1); }
    100% { transform: translate(5%, 5%) scale(1.2); }
}

.hero h1 {
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    font-weight: 500;
    color: var(--primary-dark);
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-medium);
    max-width: 680px;
    margin: 1.2rem auto 0;
    position: relative;
    z-index: 2;
}

/* ---------- ОБЩИЕ КОНТЕЙНЕРЫ ---------- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 2.2rem;
    color: var(--primary-dark);
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
}

/* ---------- ПРЕИМУЩЕСТВА ---------- */
.advantages-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: space-between;
    margin: 2.5rem 0;
}

.adv-card {
    background: var(--bg-light);
    border-radius: 28px;
    padding: 2rem 1.5rem;
    text-align: center;
    flex: 1 1 200px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.adv-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), transparent);
    transform: scaleX(0);
    transition: transform 0.4s;
}

.adv-card:hover::before {
    transform: scaleX(1);
}

.adv-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

.adv-card i {
    font-size: 2.3rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.adv-card h3 {
    font-weight: 500;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

/* ---------- ПРОЕКТЫ (СЕТКА) ---------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--bg-light);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-light);
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.project-img {
    height: 260px;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.project-card:hover .project-img {
    transform: scale(1.03);
}

.project-info {
    padding: 1.5rem;
}

.project-status {
    display: inline-block;
    padding: 0.25rem 0.9rem;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.8rem;
}

.status-completed { background: #e9f3ef; color: #2c6e4f; }
.status-building { background: #fff2e0; color: #b7681a; }
.status-plan { background: #edf2f7; color: #3a5a78; }

.project-price {
    font-size: 1.4rem;
    font-weight: 500;
    margin: 0.6rem 0;
    color: var(--primary-dark);
}

/* ---------- ФИЛЬТРЫ ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filter-btn {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    padding: 0.6rem 1.4rem;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

/* ---------- УСЛУГИ ---------- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.service-card {
    background: var(--bg-light);
    border-radius: 28px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.service-card i {
    font-size: 2.4rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.service-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
}

.service-card p {
    color: var(--text-medium);
}

.service-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-light);
}

/* ---------- ФОРМЫ ---------- */
.form-card {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.form-card input,
.form-card select,
.form-card textarea {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-light);
    border-radius: 32px;
    background: var(--bg-light);
    font-family: inherit;
    font-size: 0.95rem;
}

.form-card button {
    background: var(--primary-dark);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 50px;
    font-weight: 500;
    width: 100%;
    cursor: pointer;
    transition: var(--transition);
}

.form-card button:hover {
    background: var(--accent);
    transform: translateY(-2px);
}

/* ---------- КОНТАКТЫ (ГЛАВНЫЙ КОНТЕЙНЕР) ---------- */
.contacts-grid {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.contacts-info {
    flex: 1;
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 32px;
    line-height: 2;
}

.contacts-info p i {
    width: 1.8rem;
    display: inline-block;
    text-align: center;
}

.map-container {
    flex: 2;
    height: 380px;
    border-radius: 32px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    touch-action: pan-x pan-y;
}

/* ---------- КАЛЬКУЛЯТОР ---------- */
.calc-result {
    margin-top: 1.2rem;
    background: var(--bg-offwhite);
    padding: 1rem;
    border-radius: 28px;
    line-height: 1.6;
}

/* ---------- МОДАЛЬНЫЕ ОКНА ---------- */
.modal {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 36px;
    max-width: 520px;
    width: 90%;
    text-align: center;
    animation: fadeInUp 0.3s ease;
}

.modal-content i {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.close-modal {
    float: right;
    font-size: 1.6rem;
    cursor: pointer;
}

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

/* ---------- FOOTER ---------- */
footer {
    background: var(--primary-dark);
    color: #ccd6df;
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

/* ---------- ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ ---------- */
.btn-primary {
    background: var(--primary-dark);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--accent);
    transform: translateY(-2px);
}

.geo-btn {
    margin-top: 1.2rem;
    background: var(--primary-dark);
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    color: white;
    cursor: pointer;
}

.text-center { text-align: center; }
.mt-4 { margin-top: 2rem; }

/* ---------- АНИМАЦИЯ СТРАНИЦ ---------- */
.page {
    display: none;
    animation: fadeIn 0.4s ease;
}
.page.active-page { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- МОБИЛЬНАЯ АДАПТАЦИЯ (основной блок) ---------- */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        background: rgba(255,255,255,0.98);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        padding: 1.2rem;
        gap: 1rem;
        border-radius: 28px;
        margin-top: 1rem;
    }
    .nav-links.active { display: flex; }
    .menu-toggle { display: block; }
    .nav-container { padding: 1rem; }

    .container { padding: 1.5rem; }
    .section-title { font-size: 1.5rem; }

    .projects-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .advantages-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    .adv-card { padding: 1rem; }

    /* КОНТАКТЫ: вертикальное расположение, карта под информацией */
    
    .contacts-grid {
        display: block !important;
    }
    .map-container {
        height: 250px !important;
        width: 100% !important;
    }
    .contacts-info {
    margin-bottom: 1.5rem;  /* или 20px — нужный отступ */
}


    .form-card { padding: 1.2rem; }
    .form-card input, .form-card button { padding: 0.8rem; }
    .modal-content { width: 95%; padding: 1.2rem; }
}

/* ---------- ДОПОЛНИТЕЛЬНАЯ АДАПТАЦИЯ ДЛЯ УЗКИХ ЭКРАНОВ (≤540px) ---------- */
@media (max-width: 540px) {
    /* Ипотека: два блока (калькулятор и форма) переключаем в колонку */
    .mortgage-wrapper {
        flex-direction: column;
    }
    /* Если .mortgage-wrapper отсутствует, но используются два .form-card подряд в #mortgage-page, можно задать контейнеру */
    .mortgage-page .form-card:first-child {
        margin-bottom: 1rem;
    }
    /* Для оборачивающего контейнера, если он есть */
    .mortgage-page > .container > div:first-of-type {
        flex-direction: column !important;
    }
}