/* Основные стили для сайта ММ Лига */

:root {
    --primary-color: #173261;
    --secondary-color: #A9862C;
    --accent-color: #D9BA6A;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --bs-dark-rgb: 45, 52, 54;
    --bs-body-color: #333;
    --bs-body-bg: #fff;
}

/* Шрифты подключаются в base.html: fonts-local.css (локальные woff2) */

body {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    /* Общий фон сайта — «морская пена» с бликами, как на /history/ и в проектах.
       Белые «листы» и карточки лежат поверх неё. */
    background:
        radial-gradient(900px 220px at 0% 5%, rgba(23, 50, 97, 0.06), transparent),
        radial-gradient(700px 180px at 100% 80%, rgba(217, 186, 106, 0.10), transparent),
        #eef4fa;
}

/* Ничто не должно расширять страницу вбок: обрезаем горизонтальные вылезания.
   clip (а не hidden) — не создаёт scroll-контейнер и не ломает sticky-шапку. */
html {
    overflow-x: clip;
}

/* Старинная карта-ватермарк по углам вьюпорта. Лежит в собственном
   fixed-контейнере с overflow:hidden: повёрнутые картинки с отрицательными
   отступами не могут расширить страницу (на iOS fixed-элементы за краем
   вьюпорта дают горизонтальное «плавание»). Разметка — в base.html. */
.sea-underlay {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}
.sea-underlay__map {
    position: absolute;
    width: 480px;
    height: 480px;
    background: url("../images/history/map-watermark.93fa46cfd8c6.webp") center / contain no-repeat;
    opacity: 0.10;
    filter: sepia(0.3);
}
.sea-underlay__map--tl {
    top: -80px;
    left: -120px;
    transform: rotate(-8deg);
}
.sea-underlay__map--br {
    bottom: -60px;
    right: -140px;
    width: 520px;
    height: 520px;
    transform: rotate(12deg);
}
@media (max-width: 700px) {
    /* На телефоне карта в полэкрана давила на контент — делаем её скромнее */
    .sea-underlay__map { width: 300px; height: 300px; opacity: 0.08; }
    .sea-underlay__map--br { width: 330px; height: 330px; }
}

/* Единый стиль заголовков как на главной */
h1, .h1 {font-family:'Cormorant Garamond', serif;font-weight:700;color:#173261;text-shadow:0 0 20px rgba(23,50,97,0.2)}
h2, .h2 {font-family:'Cormorant Garamond', serif;font-weight:700;color:#173261}
h3, .h3 {font-family:'Cormorant Garamond', serif;font-weight:700;color:#173261}

/* Кастомизация Bootstrap */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

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

.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* Навигация */
.navbar {
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand img {
    transition: transform 0.3s ease;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 600;
}

/* Hero секция */
.hero-section {
    position: relative;
    padding: 180px 100px;
    background: linear-gradient(180deg, rgba(233, 241, 248, 0) 0%, #3A648C 100%);
    color: #173261;
    overflow: hidden;
    min-height: 798px;
    display: flex;
    align-items: center;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 781px;
}

.hero-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 24px;
    line-height: 1.25;
    text-transform: uppercase;
    color: #A9862C;
    margin-bottom: 40px;
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 75px;
    line-height: 1;
    color: #173261;
    text-shadow: 0px 0px 20px rgba(23, 50, 97, 0.2);
    margin-bottom: 40px;
}

.hero-description {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    line-height: 1.625;
    max-width: 781px;
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    align-items: center;
    gap: 25px;
}

.hero-buttons .btn {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 20px;
    line-height: 1.2;
    padding: 13px 30px;
    border-radius: 50px;
    transition: all 0.3s ease;
    text-decoration: none;
    border: 2px solid transparent;
}

.hero-buttons .btn-primary {
    background-color: #D9BA6A;
    border-color: #D9BA6A;
    color: #173261;
}

.hero-buttons .btn-primary:hover {
    background-color: #c7a85a;
    border-color: #c7a85a;
}

.hero-buttons .btn-outline {
    border-color: #173261;
    color: #173261;
}

.hero-buttons .btn-outline:hover {
    background: rgba(23, 50, 97, 0.1);
    color: #173261;
}

.hero-image {
    position: absolute;
    top: 0;
    right: 0;
    width: 737px;
    height: 798px;
    z-index: 0;
    background-image: url("../images/hero-image-new.397747b03632.png");
    background-size: cover;
    background-position: center;
    -webkit-mask-image: url("../images/hero-background.1659a3fcadeb.svg");
    mask-image: url("../images/hero-background.1659a3fcadeb.svg");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.hero-ship {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Карточки */
.card {
    border: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.card-img-top {
    transition: transform 0.3s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

/* Бейджи */
.badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* Кнопки */
.btn {
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

/* Footer */
footer {
    margin-top: auto;
}

/* Футер в фирменном нейви (раньше — бутстраповский серый .bg-dark) */
.site-footer {
    background-color: var(--primary-color);
}

footer a {
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--accent-color) !important;
}

/* Breadcrumbs */
.breadcrumb {
    background-color: transparent;
    padding: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-weight: bold;
}

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section {
        min-height: 400px;
        text-align: center;
    }
    
    .hero-section .display-4 {
        font-size: 2rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
    
    .d-flex.gap-3 {
        flex-direction: column;
        gap: 1rem !important;
    }
    
    .btn-lg {
        width: 100%;
    }
}

/* Utilities */
.text-decoration-none:hover {
    text-decoration: underline !important;
}

.object-fit-cover {
    object-fit: cover;
}

/* Форма поиска */
.navbar .form-control {
    border-radius: 20px;
    min-width: 200px;
}

.navbar .btn-outline-primary {
    border-radius: 50%;
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Социальные ссылки */
.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.social-links a:hover {
    transform: translateY(-3px);
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
}

/* Секция партнеров */
.partners-section img {
    filter: grayscale(100%);
    opacity: 0.7;
    transition: all 0.3s ease;
}

.partners-section img:hover {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.1);
}

/* Загрузка */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Header */
.header .logo-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 24px;
    line-height: 0.8;
    color: #173261;
}

.header .logo-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    color: #A9862C;
    margin-top: 5px;
}

.header .navbar-nav .nav-link {
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 16px;
    color: #173261;
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
}

/* Адаптивность меню */
@media (max-width: 1400px) {
    .header .navbar-nav .nav-link {
        font-size: 15px;
        padding: 0.5rem 0.6rem;
    }
    
    .header .logo-title {
        font-size: 22px;
    }
}

@media (max-width: 1200px) {
    .header .navbar-nav .nav-link {
        font-size: 14px;
        padding: 0.5rem 0.5rem;
    }
    
    .header .logo-title {
        font-size: 20px;
    }
    
    .header .logo-subtitle {
        font-size: 11px;
    }
    
    .header .navbar-brand img {
        width: 50px;
        height: 48px;
    }
}

@media (max-width: 1100px) {
    .header .navbar-nav .nav-link {
        font-size: 13px;
        padding: 0.5rem 0.4rem;
    }
}

.header .navbar-nav .nav-link.active,
.header .navbar-nav .nav-link:hover {
    color: #D9BA6A;
}

.header .btn-primary {
    font-family: 'Montserrat', sans-serif;
    background-color: #D9BA6A;
    border-color: #D9BA6A;
    color: #fff;
    font-weight: 700;
    font-size: 21px;
    padding: 13px 30px;
    border-radius: 50px;
}

.header .btn-primary:hover {
    background-color: #c7a85a;
    border-color: #c7a85a;
}

.header .btn-brand {
    font-family: 'Montserrat', sans-serif;
    background-color: #D9BA6A;
    border-color: #D9BA6A;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    padding: 10px 25px;
    border-radius: 50px;
}

.header .btn-brand:hover {
    background-color: #c7a85a;
    border-color: #c7a85a;
    color: #fff;
}

.header .dropdown-menu {
    border-radius: 0;
    border: 1px solid #eee;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
}

.header .dropdown-item {
    font-family: 'Montserrat', sans-serif;
}

/* About Section */
.about-section {
    padding: 80px 0;
}

/* Стили для статей проектов */
.project-articles {
    background: #f8f9fa;
    padding: 40px;
    border-radius: 10px;
    margin-top: 40px;
}

.project-articles h3 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 30px;
}

.articles-timeline {
    position: relative;
}

.article-item {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border-left: 4px solid var(--accent-color);
}

.article-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border-left-color: var(--primary-color);
}

.article-image img {
    border-radius: 8px;
    object-fit: cover;
    height: 120px;
    width: 100%;
}

.article-date {
    font-size: 14px;
    font-weight: 500;
    color: #A9862C;
}

.article-title a {
    color: var(--primary-color);
    font-weight: 600;
    transition: color 0.3s ease;
}

.article-title a:hover {
    color: #A9862C;
}

.article-excerpt {
    font-size: 14px;
    line-height: 1.5;
}

.articles-list-wrapper .article-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border-left: 4px solid var(--accent-color);
}

.articles-list-wrapper .article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border-left-color: var(--primary-color);
}

.articles-list-wrapper .article-image img {
    border-radius: 8px;
    object-fit: cover;
    height: 150px;
    width: 100%;
}

.article-detail-wrapper .article-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 15px;
}

.article-detail-wrapper .article-meta {
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.article-detail-wrapper .article-content {
    font-size: 16px;
    line-height: 1.8;
}

.article-detail-wrapper .article-content h2,
.article-detail-wrapper .article-content h3,
.article-detail-wrapper .article-content h4 {
    color: var(--primary-color);
    margin-top: 30px;
    margin-bottom: 15px;
}

.article-detail-wrapper .article-content p {
    margin-bottom: 20px;
}

.article-detail-wrapper .article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

.article-footer {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
}

.sidebar .card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.sidebar .card-title {
    color: var(--primary-color);
    font-weight: 600;
}

.related-articles .list-group-item {
    transition: background-color 0.3s ease;
}

.related-articles .list-group-item:hover {
    background-color: var(--light-bg);
}

.no-articles {
    background: white;
    border-radius: 10px;
    padding: 60px 40px;
}

.no-articles .fa-newspaper {
    color: var(--border-color);
}

/* Адаптивность для статей */
@media (max-width: 768px) {
    .project-articles {
        padding: 20px;
        margin-top: 30px;
    }
    
    .article-item {
        padding: 20px;
    }
    
    .articles-list-wrapper .article-card {
        padding: 20px;
    }
    
    .article-detail-wrapper .article-title {
        font-size: 1.8rem;
    }
}

/* Стили для выпадающего меню проектов */
.dropdown-menu {
    min-width: 280px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: none;
    border-radius: 8px;
    padding: 10px 0;
}

.dropdown-item {
    padding: 8px 20px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
    padding-left: 25px;
}

.dropdown-item.fw-bold {
    color: var(--primary-color);
    border-top: 1px solid var(--border-color);
    margin-top: 5px;
    padding-top: 15px;
}

/* Дочерние пункты в меню «Проекты» — слегка приглушены и с отступом, как ветка */
.dropdown-item-child {
    padding-left: 36px;
    font-size: 0.92em;
    color: #4a5b78;
}
.dropdown-item-child__bullet {
    display: inline-block;
    width: 14px;
    margin-left: -18px;
    margin-right: 6px;
    color: #A9862C;
    opacity: 0.8;
    font-family: 'Courier New', monospace;
}
.dropdown-item-child:hover .dropdown-item-child__bullet {
    opacity: 1;
}

.dropdown-divider {
    margin: 10px 0;
    border-color: var(--border-color);
}

/* Анимация для выпадающего меню */
.dropdown-menu {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    display: block;
    visibility: hidden;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 991px) {
    .header .navbar-collapse {
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        background: #fff;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 12px 24px rgba(23,50,97,0.10);
        margin: 8px -12px 0;
        padding: 8px 12px 14px;
    }

    .header .navbar-nav {
        margin-top: 0.4rem;
        gap: 2px;
    }

    .header .navbar-nav .nav-link {
        padding: 0.75rem 0.85rem;
        font-size: 15px;
        border-radius: 8px;
    }
    .header .navbar-nav .nav-link:hover,
    .header .navbar-nav .nav-link:focus {
        background: rgba(217,186,106,0.10);
    }

    .header .logo-title {
        font-size: 20px;
    }

    .header .logo-subtitle {
        font-size: 11px;
    }

    /* Дропдауны на мобиле — закрыты по умолчанию, открываются по тапу
       (Bootstrap добавляет класс .show на нажатие) */
    .dropdown-menu {
        position: static !important;
        float: none;
        transform: none !important;
        box-shadow: none;
        border: 1px solid var(--border-color);
        margin: 4px 0 6px 12px;
        padding: 4px 0;
        width: auto;
        background: #fafbfd;
        border-radius: 8px;
        /* Перекрываем «всегда видимые» стили из общего правила выше */
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
    .dropdown-menu.show {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Индикатор-стрелка у тогглера */
    .header .navbar-nav .dropdown-toggle::after {
        margin-left: 8px;
        transition: transform 0.2s ease;
    }
    .header .navbar-nav .dropdown.show .dropdown-toggle::after {
        transform: rotate(180deg);
    }

    .dropdown-item {
        padding: 9px 14px;
        white-space: normal;
        line-height: 1.35;
    }
    .dropdown-item:hover {
        padding-left: 18px;
    }

    .header .navbar-brand {
        flex-wrap: wrap;
    }

    .header .navbar-brand img {
        width: 50px;
        height: 48px;
    }
}

@media (max-width: 576px) {
    .header .logo-title {
        font-size: 18px;
        line-height: 1;
    }
    
    .header .logo-subtitle {
        font-size: 10px;
    }
    
    .header .navbar-brand img {
        width: 45px;
        height: 43px;
    }
    
    .header .navbar-nav .nav-link {
        font-size: 14px;
        padding: 0.6rem 1rem;
    }
}

/* --- Стили для страницы проекта (detail.html) --- */
.project-container {
    max-width: 1200px;
    margin: 40px auto 40px auto;
    padding: 32px 24px;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 6px 36px rgba(23,50,97,0.10);
}

/* Обёртка страницы проекта. Фон и ватермарк теперь глобальные (body),
   здесь остаются только боковые поля. */
.project-page-sea {
    padding: 4px 16px;
}
/* На морской подложке широкая белая карточка не нужна: заголовок и превью
   лежат прямо на «пене», а описание оформлено отдельным «листом» ниже. */
.project-page-sea .project-container {
    background: transparent;
    box-shadow: none;
}

.project-hero-row {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-bottom: 48px;
}

.project-hero-image {
    flex: 0 0 380px;
    max-width: 380px;
}

.project-hero-image img {
    width: 100%;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(23,50,97,0.10);
}

.project-hero-text {
    flex: 1 1 0;
    min-width: 0;
}

.project-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #173261;
    margin-bottom: 18px;
    margin-top: 0;
    line-height: 1.1;
}

.project-short-desc {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.18rem;
    color: #6c757d;
    margin-bottom: 18px;
}

.project-description {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.08rem;
    color: #222;
}

.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #173261;
    text-align: center;
    margin-bottom: 36px;
    margin-top: 48px;
}

.project-articles-section {
    margin: 56px 0 48px 0;
}

.project-articles-list {
    display: flex;
    gap: 38px;
    justify-content: center;
    flex-wrap: wrap;
}

.project-article-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 18px rgba(23,50,97,0.08);
    border: 1.5px solid #f0f2f7;
    padding: 22px 18px 18px 18px;
    width: 320px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: box-shadow 0.2s, transform 0.2s;
}
.project-article-card:hover {
    box-shadow: 0 10px 36px rgba(23,50,97,0.13);
    transform: translateY(-4px) scale(1.02);
}
.project-article-img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 14px;
    margin-bottom: 14px;
}
.project-article-date {
    font-size: 1.01rem;
    color: #a0a0a0;
    margin-bottom: 6px;
}
.project-article-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.22rem;
    font-weight: 600;
    color: #173261;
    margin-bottom: 8px;
}
.project-article-excerpt {
    font-size: 1.01rem;
    color: #444;
    margin-bottom: 12px;
}
.project-article-link {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.01rem;
    color: #A9862C;
    text-decoration: underline;
    font-weight: 700;
    margin-top: auto;
    transition: color 0.2s;
    letter-spacing: 0.01em;
}
.project-article-link:hover {
    color: #173261;
    text-decoration: underline;
}
.project-articles-more {
    text-align: center;
    margin-top: 28px;
}

.project-gallery-section {
    margin-top: 56px;
}

/* Подзаголовки в тексте */
.project-description h2, .project-description h3 {
    color: #173261;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    margin-top: 36px;
    margin-bottom: 18px;
    line-height: 1.15;
}
.project-description h2 {
    font-size: 1.45rem;
}
.project-description h3 {
    font-size: 1.18rem;
}

@media (max-width: 900px) {
    .project-articles-list {
        gap: 18px;
    }
    .project-article-card {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 600px) {
    .project-container {
        /* боковой паддинг поднят с 2px до 14px — так текст не липнет к краю экрана */
        padding: 14px 14px;
        margin: 16px auto;
        border-radius: 16px;
    }
    .section-title {
        font-size: 1.3rem;
        margin-top: 24px;
    }
}

/* --- Обтекание фото в проекте --- */
.project-hero-floated {
    position: relative;
    min-height: 180px;
    margin-bottom: 56px;
    display: flex;
    align-items: flex-start;
}
.project-hero-float-img {
    float: left;
    width: 300px;
    max-width: 40%;
    height: 220px;
    margin: 0 44px 18px 0;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(23,50,97,0.12);
    object-fit: cover;
}
@media (max-width: 900px) {
    .project-hero-floated {
        display: block;
    }
    .project-hero-float-img {
        float: none;
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
        margin: 0 0 18px 0;
    }
}

/* --- Центрированный заголовок --- */
.project-title-center {
    text-align: center;
    margin-bottom: 32px;
    font-size: 2.7rem;
}

/* --- Flex-блок под заголовком: фото слева, описание справа --- */
.project-hero-flex {
    display: flex;
    align-items: flex-start;
    gap: 36px;
    margin-bottom: 36px;
    justify-content: center;
}
.project-hero-flex-img {
    flex: 0 0 320px;
    max-width: 320px;
}
.project-hero-flex-img img {
    width: 100%;
    height: auto;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(23,50,97,0.12);
    object-fit: cover;
}
.project-hero-flex-desc {
    flex: 1 1 0;
    font-size: 1.18rem;
    color: #6c757d;
    font-family: 'Montserrat', sans-serif;
    align-self: center;
    min-width: 0;
}
@media (max-width: 900px) {
    .project-hero-flex {
        flex-direction: column;
        gap: 18px;
        align-items: stretch;
    }
    .project-hero-flex-img {
        max-width: 100%;
        width: 100%;
        margin-bottom: 0;
    }
    .project-hero-flex-desc {
        font-size: 1.08rem;
    }
}

/* --- Figma-стили для project detail hero --- */
.project-title-figma {
    font-family: 'Cormorant Garamond', serif;
    /* 60px на любом экране давил; масштабируется с шириной окна */
    font-size: clamp(36px, 4.5vw, 52px);
    font-weight: 700;
    color: #173261;
    text-align: center;
    margin-top: 40px;
    margin-bottom: 36px;
    text-shadow: 0px 0px 20px rgba(23, 50, 97, 0.2);
    line-height: 1.1;
}

.project-hero-figma {
    display: flex;
    flex-direction: row;
    /* Центрируем по вертикали: короткий анонс не «висит» у верхней кромки
       фотографии с пустотой под ним */
    /* stretch: фото-панель тянется на всю высоту карточки — «навылет»
       к левому, верхнему и нижнему краям, без полей и рамок */
    align-items: stretch;
    justify-content: center;
    gap: 0;
    /* Единая карточка превью: фото и анонс в одном белом блоке,
       «лист» описания выпущен из-под неё (перекрытие слоёв ниже) */
    max-width: 1040px;
    margin: 0 auto;
    background: #fff;
    border-radius: 18px;
    padding: 0;
    overflow: hidden; /* скругление карточки кадрирует фото-панель */
    box-shadow: 0 16px 44px rgba(23, 50, 97, 0.16);
    position: relative;
    z-index: 2;
}
.project-hero-figma-imgwrap {
    width: 100%;
    /* Пропорция вместо фиксированной высоты: портретное фото всегда кадрируется
       в 3:2 (object-fit: cover), а не разворачивается башней во всю натуральную
       высоту, когда нет короткого текста рядом. */
    aspect-ratio: 3 / 2;
    /* Навылет: без рамок, скруглений и теней — края обрезает сама карточка */
    overflow: hidden;
    background: #eef4fa;
    /* Рядом с анонсом фото занимает умеренную ширину (~высота 350px) */
    flex: 0 1 520px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Без анонса фото — единственный элемент превью: даём ему больше ширины */
.project-hero-figma-imgwrap:only-child {
    flex-basis: 820px;
    max-height: 547px;
}
.project-hero-figma-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.project-hero-figma-desc {
    font-family: 'Montserrat', sans-serif;
    /* 25px/1.22 читались тяжело и крупно — спокойный лид */
    font-size: 1.2rem;
    color: #173261;
    line-height: 1.55;
    text-align: left;
    flex: 1 1 320px;
    max-width: 52ch;
    margin-top: 0;
    /* фото навылет — поля анонса живут на самом анонсе */
    padding: 28px 36px;
    align-self: center;
}

.project-description-figma {
    font-family: 'Montserrat', sans-serif;
    /* Читаемая типографика вместо «рыхлой»: 22px/1.8 на всю ширину давали
       разреженный текст с чрезмерно длинной строкой */
    font-size: 1.06rem;       /* ~17px */
    color: #22314a;
    line-height: 1.7;
    /* «Лист», выпущенный из-под карточки превью: уже её по ширине,
       заходит верхом под карточку (отрицательный отступ + нижний слой) */
    max-width: 880px;
    margin: -30px auto 48px;
    padding: 78px 56px 48px; /* верхнее поле учитывает скрытые 30px под карточкой */
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(23, 50, 97, 0.12);
    position: relative;
    z-index: 1;
    /* Редактор вставляет картинки с float: left. Без flow-root они вываливаются
       за пределы блока и сжимают следующую за ним галерею. */
    display: flow-root;
}
.project-description-figma p {
    margin-bottom: 1.05em;
}
.project-description-figma p:last-child {
    margin-bottom: 0;
}
/* Картинки, вставленные редактором в текст: у них инлайновые width/float.
   max-width побеждает инлайновый width — фото не вылезает за «лист». */
.project-description-figma img,
.article-content img {
    max-width: 100%;
    height: auto;
}
@media (max-width: 700px) {
    /* На телефоне обтекание текстом не работает — картинка во всю ширину листа */
    .project-description-figma img,
    .article-content img {
        float: none !important;
        display: block;
        width: 100%;
        margin: 14px auto;
    }
}

/* Тексты статей приходят из того же редактора — там те же плавающие картинки. */
.article-content {
    display: flow-root;
}

@media (max-width: 1200px) {
    .project-hero-figma {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }
    /* В колонке flex-basis работает по ВЫСОТЕ: базовые 520px/820px превращали
       карточку в пустую белую башню с маленьким фото посередине. Сбрасываем
       basis и держим пропорцию 3:2 по ширине. */
    .project-hero-figma-imgwrap,
    .project-hero-figma-imgwrap:only-child {
        flex-basis: auto;
        width: 100%;
        /* навылет во всю ширину карточки */
        max-width: none;
        aspect-ratio: 3 / 2;
        max-height: none;
    }
    .project-hero-figma-desc {
        font-size: 1.15rem;
        max-width: none;
        /* как и у фото: в колонке flex-basis 320px становится высотой
           и оставляет пустую полосу под текстом анонса */
        flex-basis: auto;
        padding: 20px 20px 24px;
    }
}
@media (max-width: 700px) {
    .project-title-figma {
        font-size: 32px;
        margin-top: 30px;
        margin-bottom: 24px;
    }
    .project-description-figma {
        font-size: 16px;
        /* «лист» на телефоне: перекрытие с карточкой меньше (16px), а верхнее
           поле учитывает его (16 скрыто + 28 видимых) — текст не липнет к карточке */
        margin-top: -16px;
        padding: 44px 18px 24px;
        border-radius: 10px;
    }
    .project-hero-figma-desc {
        max-width: none;
    }
}

/* Галерея проекта / статьи: Masonry — как раньше, без обрезки (естественная высота снимков).
   Ограничиваем ширину, чтобы галерея не растягивалась на всю карточку проекта,
   но не делаем слишком узкой — на широких экранах должно быть видно 3 колонки. */
.article-gallery .masonry-grid,
.project-gallery-section .masonry-grid {
    display: block;
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
}

/* Лоадер галереи — компас под маринистскую палитру; крутится пока Masonry не разложит сетку */
.gallery-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 40px 20px 48px;
    max-width: 1040px;
    margin: 0 auto;
    color: #173261;
    transition: opacity 0.35s ease;
}
.gallery-loader--hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}
/* CSS-only fallback: если JS старый (кэш) и не вызвал hideLoader,
   но успел поставить .masonry-ready — прячем лоадер по соседству */
.gallery-loader:has(+ .masonry-grid.masonry-ready) {
    display: none !important;
}
.gallery-loader__compass {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(217,186,106,0.55);
    background: radial-gradient(circle at 30% 30%, #fff7e0 0%, #f3deb1 60%, #d9ba6a 100%);
    box-shadow:
        0 0 0 6px rgba(217,186,106,0.14),
        0 6px 14px rgba(15,35,71,0.16);
    display: flex; align-items: center; justify-content: center;
    color: #173261;
    font-size: 1.4rem;
    animation: galleryLoaderSpin 2.4s linear infinite;
}
.gallery-loader__text {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.92rem;
    color: #5a6b85;
    letter-spacing: 0.02em;
}
@keyframes galleryLoaderSpin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .gallery-loader__compass { animation: none; }
}

/* --- Masonry gallery (медиа-страницы и др., где нужен Masonry в JS) --- */
/* --- Галерея на CSS-колонках ---
   Колонки раскладывает браузер, без JS: нужное их число есть уже в первом кадре.
   Место под каждое фото зарезервировано атрибутами width/height у <img>, поэтому
   при подгрузке снимков ничего не «прыгает». */
.photo-columns {
    column-count: 3;
    column-gap: 16px;
    /* Контейнер колонок обязан обтекать плавающие элементы: без clear галерея
       сжимается до остатка строки рядом с картинкой из текста. */
    clear: both;
}
.photo-columns__item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    margin: 0 0 16px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(23,50,97,0.10);
    background: #fff;
}
.photo-columns__item a {
    display: block;
}
.photo-columns__item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}
/* Запасной вариант для фото, у которых размеры в БД не проставились
   (файл не найден при заполнении): держим место под обычную горизонтальную рамку. */
.photo-columns__item img:not([width]) {
    aspect-ratio: 3 / 2;
    object-fit: cover;
}
/* Медиа-галерея живёт в широком контейнере — там помещается больше колонок. */
.photo-columns--wide {
    column-count: 4;
    column-gap: 20px;
}
@media (max-width: 1100px) {
    .photo-columns--wide { column-count: 3; }
}
@media (max-width: 800px) {
    .photo-columns { column-count: 2; }
    .photo-columns--wide { column-count: 2; }
}
@media (max-width: 600px) {
    .photo-columns { column-count: 1; column-gap: 0; }
    .photo-columns--wide { column-count: 1; column-gap: 0; }
    .photo-columns__item { margin-bottom: 14px; }
}

.masonry-grid {
    display: block;
    margin-left: -8px;
    margin-right: -8px;
}

/* Скрыта до загрузки картинок и первого layout Masonry (дублирует hidden в разметке). */
.article-gallery .masonry-grid.masonry-pending,
.project-gallery-section .masonry-grid.masonry-pending,
.media-gallery .masonry-grid.masonry-pending,
.media-video-gallery .masonry-grid.masonry-pending,
.masonry-grid.masonry-pending {
    display: none !important;
}

/* Медиа-контейнеры фиксированной ширины (как на главной) */
.media-wrapper{max-width:1200px;margin:0 auto;padding:0 24px}
.media-card{background:#fff;border-radius:16px;box-shadow:0 6px 36px rgba(23,50,97,0.10);padding:24px}
.media-title{font-family:'Cormorant Garamond',serif;font-weight:700;color:#173261;font-size:2.2rem;text-align:center;margin-bottom:14px}
.media-sub{font-family:'Montserrat',sans-serif;color:#173261;text-align:center;max-width:870px;margin:0 auto 28px}
.masonry-grid-item {
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(23,50,97,0.10);
    background: #fff;
    padding: 0;
}
.masonry-grid-item img {
    width: 100%;
    display: block;
    border-radius: 12px;
}

/* --- Masonry gallery columns: общие (медиа-галереи и т.п.) --- */
.masonry-grid-sizer,
.masonry-grid-item {
    width: 20%; /* 5 колонок на десктопе */
}
@media (max-width: 1100px) {
    .masonry-grid-sizer,
    .masonry-grid-item {
        width: 25%; /* 4 колонки */
    }
}
@media (max-width: 800px) {
    .masonry-grid-sizer,
    .masonry-grid-item {
        width: 33.33%; /* 3 колонки */
    }
}
@media (max-width: 500px) {
    .masonry-grid-sizer,
    .masonry-grid-item {
        width: 50%; /* 2 колонки */
    }
}

/* --- Галерея проекта / статьи: уже основная сетка (max-width 1040) → меньше колонок;
       на телефоне 1 фото в строку во всю доступную ширину.
       Ширина < 1/N специально оставляет запас на masonry gutter (16px),
       иначе третья/вторая колонка не помещается в контейнер. --- */
.article-gallery .masonry-grid-sizer,
.article-gallery .masonry-grid-item,
.project-gallery-section .masonry-grid-sizer,
.project-gallery-section .masonry-grid-item {
    width: 32%; /* 3 колонки на десктопе с запасом 4% на 2 gutter-а */
}
@media (max-width: 800px) {
    .article-gallery .masonry-grid-sizer,
    .article-gallery .masonry-grid-item,
    .project-gallery-section .masonry-grid-sizer,
    .project-gallery-section .masonry-grid-item {
        width: 48%; /* 2 колонки на планшете с запасом */
    }
}
@media (max-width: 600px) {
    /* На мобильном полностью отключаем абсолютное позиционирование Masonry
       и кладём фото обычным потоком — одно в строку на полную ширину контейнера.
       !important нужен потому, что Masonry выставляет position/width/left/top inline-стилем */
    .article-gallery .masonry-grid,
    .project-gallery-section .masonry-grid {
        display: block !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        height: auto !important;
    }
    .article-gallery .masonry-grid-sizer,
    .project-gallery-section .masonry-grid-sizer {
        display: none !important;
    }
    .article-gallery .masonry-grid-item,
    .project-gallery-section .masonry-grid-item {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        top: auto !important;
        right: auto !important;
        margin-bottom: 14px !important;
    }
}
.masonry-grid-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

/* Карточки новостей */
.news-card-img-wrap { position: relative; overflow: hidden; }
.news-card-badges { position: absolute; top: 12px; left: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.news-card-badge { background-color: var(--accent-color) !important; color: var(--primary-color) !important; border: none; font-weight: 600; padding: 6px 12px; }
.news-card-badge-featured { background-color: var(--secondary-color) !important; color: #fff !important; }
.news-featured-badges { position: absolute; top: 16px; left: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.news-featured-badge { background-color: var(--accent-color) !important; color: var(--primary-color) !important; border: none; font-weight: 600; padding: 8px 14px; font-size: 0.9rem; }
.news-featured-badge-featured { background-color: var(--secondary-color) !important; color: #fff !important; }
.news-card-custom .news-card-title { font-family: 'Cormorant Garamond', serif; font-weight: 700; }
.news-card-custom .news-card-title a { color: #173261; transition: color .2s; }
.news-card-custom:hover .news-card-title a { color: #5a7db8 !important; }
.news-card-custom .news-card-excerpt { color: #6c757d; transition: color .2s; }
.news-card-custom:hover .news-card-excerpt { color: #9ca3af !important; }
.news-card-custom .news-card-title a:hover { text-decoration: none !important; }
.news-card-files { display: flex; gap: 14px; flex-wrap: wrap; margin: 1rem 0 0.75rem 0; }
.news-card-file-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #6c757d; text-decoration: none; transition: color .2s; }
.news-card-file-item:hover { color: var(--primary-color); }
.news-card-file-icon { font-size: 2.5rem; line-height: 1; display: flex; align-items: center; justify-content: center; }
.news-card-file-icon-img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.news-card-file-label { font-size: 0.75rem; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.news-card-file-expand { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(-8px) scale(0.9); opacity: 0; visibility: hidden; transition: opacity .25s, transform .25s, visibility .25s; z-index: 10; min-width: 160px; max-width: 240px; padding: 10px 12px; background: #fff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.15); border: 1px solid rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 4px; text-align: left; }
.news-card-file-item:hover .news-card-file-expand { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(-8px) scale(1); }
.news-card-file-expand-title { font-size: 0.8rem; font-weight: 600; color: var(--primary-color); line-height: 1.3; white-space: normal; word-break: break-word; }
.news-card-file-expand-desc { font-size: 0.72rem; color: #6c757d; line-height: 1.35; white-space: normal; }
@media (hover: none), (max-width: 768px) {
  .news-card-file-label { display: none; }
  .news-card-file-expand { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: none; background: transparent; padding: 2px 0; min-width: 0; max-width: 120px; }
  .news-card-file-expand-desc { display: block; }
}
.news-card-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.news-card-meta { display: flex; gap: 12px; }
.news-featured-card-custom .news-featured-title { color: #173261; }
.news-featured-card-custom .news-featured-excerpt { color: #6c757d; }
.news-featured-card-custom:hover { text-decoration: none !important; }
.news-featured-files { display: flex; gap: 24px; flex-wrap: wrap; margin: 1.5rem 0 1.25rem 0; align-items: flex-start; }
.news-featured-file-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; color: #6c757d; text-decoration: none; transition: color .2s; }
.news-featured-file-item:hover { color: var(--primary-color); }
.news-featured-file-icon { font-size: 5rem; line-height: 1; display: flex; align-items: center; justify-content: center; }
.news-featured-file-icon-img { width: 80px; height: 80px; object-fit: cover; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.news-featured-file-label { font-size: 0.85rem; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.news-featured-file-expand { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(-10px) scale(0.9); opacity: 0; visibility: hidden; transition: opacity .25s, transform .25s, visibility .25s; z-index: 10; min-width: 200px; max-width: 280px; padding: 12px 14px; background: #fff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.15); border: 1px solid rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 6px; text-align: left; }
.news-featured-file-item:hover .news-featured-file-expand { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(-10px) scale(1); }
.news-featured-file-expand-title { font-size: 0.95rem; font-weight: 600; color: var(--primary-color); line-height: 1.3; white-space: normal; word-break: break-word; }
.news-featured-file-expand-desc { font-size: 0.82rem; color: #6c757d; line-height: 1.35; white-space: normal; }
@media (hover: none), (max-width: 768px) {
  .news-featured-file-label { display: none; }
  .news-featured-file-expand { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: none; background: transparent; padding: 4px 0; min-width: 0; max-width: 140px; }
  .news-featured-file-expand-desc { display: block; }
}
.news-featured-meta { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(0,0,0,.1); }

/* ============================================================
   Морской тюнинг (2026-08): волны, якорный разделитель, шапка
   ============================================================ */

/* Волновые разделители секций (templates/includes/wave_sep.html).
   Цвет волны задаётся color на .wave-sep, заливка — от верхней кромки. */
.wave-sep {
    display: block;
    line-height: 0;
    margin-top: -1px; /* прижать к секции выше, без щели в 1px при зуме */
}
.wave-sep svg {
    display: block;
    width: 100%;
    height: 48px;
}
.wave-sep--flip svg {
    transform: scaleY(-1);
}
@media (max-width: 768px) {
    .wave-sep svg { height: 28px; }
}

/* Разделитель заголовков «якорь в линии» — единый для всех секций.
   Разметка прежняя: <div class="divider"></div>; локальные копии стиля
   из инлайн-<style> секций удалены. */
.divider {
    display: flex;
    align-items: center;
    gap: 36px; /* просвет под якорь (20px) + воздух */
    width: 200px;
    /* высота нужна явная: иначе контейнер схлопывается до 2px линий
       и фоновому якорю негде отрисоваться */
    height: 24px;
    background: none;
    margin: 0 auto 4rem auto;
}
.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background-color: #A9862C;
}
.divider {
    /* якорь по центру: инлайн-SVG в золоте, между ::before и ::after */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A9862C' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='5' r='2.4'/><line x1='12' y1='7.4' x2='12' y2='20'/><line x1='7.5' y1='10.5' x2='16.5' y2='10.5'/><path d='M5 14c0 4 3.2 6 7 6s7-2 7-6l-2.6 1.4M5 14l2.6 1.4'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
}

/* Шапка: тонкая золотая «ватерлиния» и отделение от контента при скролле */
.header {
    border-bottom: 2px solid var(--accent-color);
    transition: background-color .25s ease, box-shadow .25s ease;
}
.header.is-scrolled {
    background-color: rgba(255, 255, 255, .92) !important;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 14px rgba(23, 50, 97, .10) !important;
}

/* Плейсхолдер «нет фото»: нейви-градиент с силуэтом корабля вместо серой коробки */
.sea-placeholder {
    background: linear-gradient(160deg, #173261 0%, #274F76 100%) !important;
    color: rgba(255, 255, 255, .45);
}
.sea-placeholder i {
    color: rgba(255, 255, 255, .45) !important;
    font-size: 2.2rem;
}

/* Мелкая полировка */
::selection {
    background-color: var(--primary-color);
    color: #fff;
}
html {
    scrollbar-color: #4a628c #eef1f5; /* Firefox */
    scrollbar-width: thin;
}
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #eef1f5; }
::-webkit-scrollbar-thumb {
    background: #4a628c;
    border-radius: 5px;
    border: 2px solid #eef1f5;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }

/* Уважение к prefers-reduced-motion: без появлений и подлётов */
@media (prefers-reduced-motion: reduce) {
    .fade-in-up { animation: none; }
    .card, .card:hover, .card-img-top, .card:hover .card-img-top {
        transform: none;
        transition: none;
    }
    html { scroll-behavior: auto; }
}
