/* ==========================================
   ИНВЕСТИЦИИ В БУДУЩЕЕ — СТИЛИ
========================================== */

:root {
    --primary: #0B2345;
    --secondary: #C8A24D;
    --white: #ffffff;
    --light: #f6f7fb;
    --text: #2b2b2b;
    --shadow: 0 15px 40px rgba(0,0,0,.12);
    --radius: 18px;
    --transition: .35s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Страховка от растягивания картинок.
   Если у <img> заданы атрибуты width/height, а в CSS указана только width,
   браузер берёт высоту из атрибута и изображение деформируется.
   height:auto заставляет высоту считаться из пропорций файла. */
img {
    height: auto;
    max-width: 100%;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Montserrat', Arial, Helvetica, sans-serif;
    color: var(--text);
    background: #f4f4f4;
    overflow-x: hidden;
    /* Исходное разрешение 4216x5968 сохранено полностью: на HiDPI-экранах
       фон не растягивается. WebP q85 при этом весит 257 КБ вместо 13.4 МБ
       у исходного PNG (PSNR 47.4 дБ — отличие не различимо глазом).
       background-position НЕ задаём: по умолчанию это "0 0", и при cover
       видна верхняя часть картинки с волнами. Со "center" окно съезжает
       на нижнюю часть с сеткой крестиков — внешний вид меняется. */
    background-image: url("../images/background.webp");
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.container {
    width: 92%;
    max-width: 1280px;
    margin: auto;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ==========================================
   HEADER
========================================== */
header {
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 999;
    backdrop-filter: blur(18px);
    background: rgba(11,35,69,.85);
    border-bottom: 1px solid rgba(255,255,255,.08);
    transition: all 0.3s ease;
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    transition: all 0.3s ease;
}

header.shrink .container {
    padding: 8px 0;
}

header.shrink .logo img {
    height: 46px;
    width: auto;
}

header.shrink nav ul {
    gap: 20px;
}

header.shrink nav a {
    font-size: 13px;
}

header.shrink .header-button {
    padding: 8px 16px;
    font-size: 12px;
}

/* Логотип почти квадратный (512x491), поэтому размер задаём по высоте:
   при width:180px он давал высоту ~175px и шапка вырастала до ~210px. */
.logo img {
    height: 64px;
    width: auto;
    transition: all 0.3s ease;
    display: block;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 35px;
    transition: all 0.3s ease;
}

nav a {
    color: white;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    font-size: 15px;
    letter-spacing: 0.3px;
}

nav a::after {
    content: "";
    position: absolute;
    width: 0;
    height: 2px;
    background: var(--secondary);
    left: 0;
    bottom: -8px;
    transition: var(--transition);
}

nav a:hover {
    color: var(--secondary);
}

nav a:hover::after {
    width: 100%;
}

.header-button {
    padding: 12px 24px;
    background: var(--secondary);
    color: white;
    border-radius: 40px;
    font-weight: 700;
    transition: var(--transition);
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(200,162,77,.45);
}

/* ==========================================
   HERO
========================================== */
#hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(11,35,69,.70), rgba(11,35,69,.78));
}

.hero-content {
    position: relative;
    z-index: 10;
}

.hero-logo {
    width: 240px;
    height: auto;
    margin-bottom: 40px;
}

#hero h1 {
    color: white;
    font-size: 64px;
    letter-spacing: 4px;
    margin-bottom: 25px;
    text-transform: uppercase;
    font-weight: 900;
}

#hero h1 span {
    color: var(--secondary);
}

#hero p {
    color: white;
    font-size: 24px;
    max-width: 700px;
    margin: auto;
    margin-bottom: 50px;
    line-height: 1.8;
    font-weight: 400;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
}

.hero-buttons .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 18px 36px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 800;
    transition: var(--transition);
    box-shadow: var(--shadow);
    background: white;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-buttons .btn:hover {
    transform: translateY(-6px) scale(1.02);
}

.hero-buttons .gold {
    background: var(--secondary);
    color: white;
}

.hero-buttons .gold:hover {
    box-shadow: 0 15px 40px rgba(200,162,77,.5);
}

.hero-buttons .outline {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.hero-buttons .outline:hover {
    background: white;
    color: var(--primary);
}

/* ==========================================
   ОБЩИЕ СЕКЦИИ
========================================== */
section {
    padding: 110px 0;
}

section h2 {
    text-align: center;
    color: var(--primary);
    font-size: 42px;
    margin-bottom: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

section .section-subtitle {
    text-align: center;
    font-size: 18px;
    color: rgba(11,35,69,0.6);
    max-width: 600px;
    margin: 0 auto 50px;
    line-height: 1.7;
}

/* ==========================================
   О ПРОЕКТЕ
========================================== */
#about {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    text-align: center;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
    text-align: left;
    margin-top: 30px;
}

.about-text-content p {
    font-size: 18px;
    line-height: 1.9;
    color: var(--text);
    margin-bottom: 20px;
    text-align: justify;
    text-justify: inter-word;
    text-indent: 30px;
}

.about-text-content p:last-child {
    margin-bottom: 0;
}

/* Блок с видео в «О проекте». Локальный файл отдаётся нативно,
   поэтому пропорции рамки должны совпадать с пропорциями самого видео:
   при несовпадении плеер покажет чёрные полосы (не растянет картинку). */
.about-image {
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    aspect-ratio: 16 / 9;
}

.about-image video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ==========================================
   НАПРАВЛЕНИЯ
========================================== */
#directions {
    background: rgba(11,35,69,0.03);
    padding-top: 70px;
    padding-bottom: 90px;
}

.direction-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-top: 10px;
}

.direction-card {
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 35px 25px;
    transition: var(--transition);
    text-align: center;
    border: 1px solid rgba(200,162,77,0.15);
}

.direction-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.12);
    border-color: var(--secondary);
}

.direction-card .icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.direction-card h4 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.direction-card p {
    font-size: 14px;
    color: rgba(11,35,69,0.6);
    line-height: 1.6;
}

/* ==========================================
   ОСНОВАТЕЛИ
========================================== */
.founders-title {
    text-align: center;
    color: var(--primary);
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 70px 0 0;
}

/* Специфичность: у `section .section-subtitle` — (0,1,1), поэтому селектор
   тоже должен опираться на section, иначе margin из общего правила побеждает. */
section .founders-subtitle {
    margin: 15px auto 45px;
}

.founders-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 30px;
}

.founders-grid .founder-block {
    flex: 1 1 300px;
    max-width: 370px;
    margin: 0;
    padding: 45px 30px 35px;
}

/* Размеры карточки задаёт .founders-grid .founder-block выше:
   все .founder-block на странице находятся внутри .founders-grid,
   поэтому дублировать здесь padding/margin/max-width не нужно. */
.founder-block {
    background: linear-gradient(135deg, #fef9f0 0%, #fff 40%, #fef9f0 100%);
    border: 3px solid var(--secondary);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(200,162,77,0.15);
    position: relative;
    transition: var(--transition);
    text-align: center;
}

.founder-block:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 80px rgba(200,162,77,0.2);
}

.founder-block .founder-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary);
    color: white;
    font-size: 13px;
    font-weight: 800;
    padding: 6px 28px;
    border-radius: 30px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(200,162,77,0.4);
    white-space: nowrap;
}

/* Единая рамка для фото/логотипа: любое изображение — портрет, квадрат
   или широкая «плашка» — занимает абсолютно одинаковую область и
   масштабируется пропорционально, без растяжения и обрезки.
   Формат 3:4 — книжная (портретная) ориентация. */
.founder-photo {
    width: 100%;
    aspect-ratio: 3 / 4;
    margin: 10px auto 20px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid rgba(11,35,69,0.10);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.founder-photo .founder-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    filter: none;
    margin: 0;
}

/* Вариант без белой подложки — для фотографии человека.
   Селектор из двух классов, чтобы перебить .founder-photo из медиазапросов
   (у них одинаковая специфичность, но они идут ниже по файлу). */
.founder-photo.founder-photo--plain {
    background: transparent;
    border: none;
    padding: 0;
}

/* Снимок заполняет рамку целиком: белых полей вокруг не остаётся.
   object-position подобран так, чтобы в кадр попадало лицо целиком. */
.founder-photo.founder-photo--plain .founder-logo {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center 35%;
}

.founder-block .founder-company {
    color: rgba(11,35,69,0.55);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    margin: -8px 0 16px;
}

.founder-block .founder-sub {
    color: var(--secondary);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.founder-block .founder-desc {
    color: var(--text);
    font-size: 17px;
    line-height: 1.8;
    opacity: 0.85;
    max-width: 650px;
    margin: 0 auto;
}

.founders-grid .founder-block .founder-desc {
    font-size: 16px;
    line-height: 1.7;
}

/* ==========================================
   СТАТИСТИКА
========================================== */
#stats {
    background: var(--primary);
    color: white;
    padding: 80px 0;
}

#stats h2 {
    color: white;
    margin-bottom: 10px;
}

#stats .section-subtitle {
    color: rgba(255,255,255,0.5);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    text-align: center;
    margin-top: 20px;
}

.stat-card h3 {
    font-size: 52px;
    color: var(--secondary);
    margin-bottom: 8px;
    font-weight: 900;
}

.stat-card span {
    font-size: 18px;
    letter-spacing: 1px;
    opacity: 0.8;
    font-weight: 400;
}

/* ==========================================
   МЕРОПРИЯТИЯ + КАРТА
========================================== */
#events {
    background: rgba(11,35,69,0.04);
}

.event-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    align-items: stretch;
}

.event-card {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 24px 20px;
    transition: var(--transition);
    border-left: 5px solid var(--secondary);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.event-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.event-card .date {
    color: var(--secondary);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    margin-bottom: 6px;
}

.event-card h3 {
    font-size: 20px;
    color: var(--primary);
    margin: 0 0 6px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1.3;
    min-height: 52px;
}

.event-card .place {
    color: #666;
    font-size: 15px;
    margin-bottom: 6px;
    font-weight: 400;
    flex-shrink: 0;
}

.event-card .event-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    min-height: 38px;
}

.event-card .btn-small {
    display: inline-block;
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 700;
    transition: var(--transition);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: auto;
    align-self: flex-start;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
}

.event-card .btn-small:hover {
    background: var(--secondary);
    transform: scale(1.05);
}

/* Сообщение внутри сетки мероприятий: пустой список или ошибка загрузки.
   grid-column: 1 / -1 растягивает блок на всю сетку при любом числе колонок
   (раньше было 1/4, из-за чего на мобильной одноколоночной сетке создавались
   три лишних трека и появлялся горизонтальный скролл). */
.event-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 24px;
    color: #64748b;
    background: rgba(255,255,255,0.6);
    border-radius: var(--radius);
    line-height: 1.7;
}

/* Заглушка карты, если API Яндекс.Карт не загрузился */
.map-fallback {
    height: 100%;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    text-align: center;
    background: rgba(255,255,255,0.75);
    color: #64748b;
}

.map-fallback-icon {
    font-size: 46px;
    line-height: 1;
}

.map-fallback p {
    color: var(--primary);
    font-weight: 600;
    font-size: 17px;
    margin: 0;
}

.map-fallback small {
    font-size: 13px;
    opacity: 0.8;
}

/* ==========================================
   КАРТА
========================================== */
.map-wrapper {
    position: relative;
    margin-top: 0;
}

#yandex-map {
    width: 100%;
    height: 450px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 2px solid rgba(200,162,77,0.2);
}

.map-title {
    text-align: center;
    margin-top: 50px;
    margin-bottom: 15px;
    font-size: 32px;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ==========================================
   FOOTER
========================================== */
footer {
    background: #06152b;
    color: rgba(255,255,255,0.7);
    padding: 50px 0 30px;
    border-top: 2px solid rgba(200,162,77,0.15);
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

footer .socials {
    display: flex;
    gap: 20px;
    align-items: center;
}

footer .socials a.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
    transition: var(--transition);
    text-decoration: none;
    overflow: hidden;
    position: relative;
}

footer .socials a .social-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: none !important;
    transition: var(--transition);
    display: inline-block;
}

footer .socials a .social-fallback {
    display: none;
    color: white;
    font-size: 14px;
    font-weight: 700;
    transition: var(--transition);
    line-height: 1;
}

footer .socials a .social-icon[style*="display: none"] + .social-fallback {
    display: inline-block !important;
}

footer .socials a.social-link:hover {
    background: var(--secondary);
    transform: translateY(-4px);
}

footer .socials a.social-link:hover .social-icon {
    transform: scale(1.1);
}

footer .socials a.social-link:hover .social-fallback {
    color: white;
}

footer .copy {
    text-align: center;
    font-size: 14px;
    opacity: 0.5;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* ==========================================
   АНИМАЦИИ
========================================== */
.fade-in {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   КНОПКА "НАВЕРХ"
========================================== */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--secondary);
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(200,162,77,0.4);
    transition: var(--transition);
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    font-weight: 700;
}

#back-to-top.show {
    opacity: 1;
    pointer-events: auto;
}

#back-to-top:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(200,162,77,0.6);
}

/* ==========================================
   АДАПТИВНОСТЬ
========================================== */
@media (max-width: 992px) {
    header .container {
        flex-direction: column;
        gap: 20px;
    }
    nav ul {
        gap: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }
    #hero h1 {
        font-size: 44px;
    }
    #hero p {
        font-size: 20px;
    }
    .hero-logo {
        width: 180px;
        height: auto;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .direction-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .event-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    #yandex-map {
        height: 380px;
    }
    .founders-title {
        font-size: 26px;
        margin-top: 55px;
    }
    .founders-grid {
        gap: 25px;
    }
    /* padding задаётся здесь, а не в .founder-block: селектор .founder-block
       имеет меньшую специфичность и был бы перебит этим правилом. */
    .founders-grid .founder-block {
        flex: 1 1 260px;
        padding: 40px 22px 30px;
    }
    .about-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .logo img {
        height: 52px;
        width: auto;
    }
    #hero h1 {
        font-size: 32px;
        letter-spacing: 2px;
    }
    #hero p {
        font-size: 18px;
    }
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    .hero-buttons .btn {
        width: 100%;
        max-width: 320px;
        margin: auto;
        font-size: 16px;
        padding: 16px 28px;
    }
    section {
        padding: 70px 0;
    }
    section h2 {
        font-size: 30px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .stat-card h3 {
        font-size: 40px;
    }
    .direction-cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .event-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    #yandex-map {
        height: 300px;
    }
    .map-title {
        font-size: 24px;
    }
    #back-to-top {
        width: 45px;
        height: 45px;
        font-size: 22px;
        bottom: 20px;
        right: 20px;
    }
    .founders-title {
        font-size: 22px;
        margin-top: 45px;
    }
    .founders-subtitle {
        margin-bottom: 35px;
    }
    .founders-grid {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }
    .founders-grid .founder-block {
        flex: 0 1 auto;
        width: 100%;
        max-width: 420px;
        padding: 25px 20px;
    }
    .founder-block .founder-badge {
        font-size: 10px;
        padding: 4px 16px;
        top: -12px;
    }
    .founder-block .founder-sub {
        font-size: 15px;
    }
    .founder-block .founder-desc {
        font-size: 15px;
    }
    header.shrink .logo img {
        height: 38px;
        width: auto;
    }
    header.shrink nav ul {
        gap: 10px;
    }
    header.shrink nav a {
        font-size: 10px;
    }
    header.shrink .header-button {
        padding: 6px 12px;
        font-size: 10px;
    }
    header.shrink .container {
        padding: 5px 0;
    }
}

@media (max-width: 480px) {
    .founder-photo {
        padding: 10px;
    }
}

/* ==========================================
   ПРОИЗВОДИТЕЛЬНОСТЬ НА МОБИЛЬНЫХ
========================================== */
/* Здесь раньше отключался background-attachment: fixed на узких экранах и
   тач-устройствах. Отключение убрано: при scroll фон прокручивается вместе
   со страницей, и на разных секциях видна разная его часть — вид отличается
   от исходного. Вернуть при необходимости — одна строка:
   @media (max-width:768px),(hover:none){ body { background-attachment: scroll } } */