/* ==========================================================================
   fn-responsive.css — адаптивная и мобильная версия темы fn27
   Подключается последним (functions.php, приоритет 100).
   Блоки главной содержат собственные <style> внутри страницы, поэтому
   селекторы здесь начинаются с body — так они гарантированно перекрывают их.

   Контрольные точки (как в Bootstrap 5):
     ≤1199 — ноутбук/планшет горизонтально, меню-«бургер»
     ≤991  — планшет
     ≤767  — большой телефон
     ≤575  — телефон
   ========================================================================== */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* overflow-x: hidden у body ломает position: sticky — clip обрезает так же, но не создаёт прокрутку */
body {
    overflow-x: clip;
}

/* --------------------------------------------------------------------------
   Шапка и мобильное меню
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
    body .fn-header {
        position: sticky;
        top: 0;
        z-index: 1030;
    }
}

body .fn-header__logo img {
    height: 56px;
    width: auto;
    display: block;
}

body .fn-header__nav {
    list-style: none;
}

body .fn-burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 48px;
    height: 48px;
    padding: 0 10px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
}

body .fn-burger span {
    display: block;
    height: 3px;
    border-radius: 3px;
    background: #0071b0;
    transition: background .2s ease;
}

body .fn-burger:hover span,
body .fn-burger:focus-visible span {
    background: #099250;
}

@media (min-width: 1200px) {
    body .fn-burger {
        display: none;
    }
}

body .fn-mobile-menu {
    --bs-offcanvas-width: min(360px, 88vw);
    background: #e9e9e9;
    z-index: 1060;
}

body .fn-mobile-menu .offcanvas-header {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(33, 91, 150, .15);
}

body .fn-mobile-menu .offcanvas-body {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 24px 20px 32px;
}

body .fn-mobile-menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

body .fn-mobile-menu__list a {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid rgba(33, 91, 150, .12);
    color: #215b96;
    font-size: 20px;
    font-weight: 600;
    text-decoration: none;
    transition: color .2s ease, padding-left .2s ease;
}

body .fn-mobile-menu__list a:hover,
body .fn-mobile-menu__list a:focus-visible {
    color: #099250;
    padding-left: 6px;
}

body .fn-mobile-menu__contacts {
    display: grid;
    gap: 6px;
}

body .fn-mobile-menu__contacts a {
    color: #0071b0;
    font-size: 16px;
    text-decoration: none;
}

body .fn-mobile-menu__social {
    display: flex;
    gap: 20px;
    list-style: none;
    margin: auto 0 0;
    padding: 0;
}

@media (max-width: 575px) {
    body .fn-header__logo img {
        height: 44px;
    }
}

/* --------------------------------------------------------------------------
   Типографика
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
    body p {
        font-size: 18px;
    }

    body .fn-header-2 {
        font-size: 22px;
    }
}

@media (max-width: 575px) {
    body p {
        font-size: 16px;
    }

    body .fn-header-2 {
        font-size: 20px;
    }
}

/* --------------------------------------------------------------------------
   Первый экран (fn-hero)
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
    body .fn-hero {
        padding-top: 32px !important;
        padding-bottom: 16px !important;
        overflow: hidden;
    }

    body .fn-hero .row > .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }

    body .fn-hero .fn-header-1 {
        font-size: clamp(52px, 11vw, 96px);
        line-height: 1.05;
        margin-bottom: 28px !important;
        padding-bottom: 0 !important;
    }

    /* Слайдер на десктопе скрыт классом d-none d-xl-block — показываем его ниже текста */
    body .fn-hero .row > .col-6.d-none {
        display: block !important;
        margin-top: 36px;
    }

    body .fn-hero .hero-slider-position {
        position: relative !important;
        top: auto;
        right: auto;
        max-width: 480px;
        margin: 0 auto;
    }

    body .fn-hero .slider-container,
    body .fn-hero .swiper.hero-slider,
    body .fn-hero .hero-slider .swiper-slide {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        border-radius: 50%;
    }

    body .fn-hero .hero-round {
        width: 90%;
        height: auto;
        aspect-ratio: 1 / 1;
        right: 2%;
        bottom: -12px;
    }

    body .fn-hero .my-pagination {
        bottom: 9% !important;
        left: 9% !important;
    }

    body .fn-hero .hero-img-box {
        left: auto;
        right: -60px;
        top: 34%;
        width: 300px;
        height: auto;
        transform: translateY(-50%);
        opacity: .6;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    body .fn-hero .row {
        align-items: center;
    }

    body .fn-hero .row > .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    body .fn-hero .fn-header-1 {
        font-size: 80px;
    }

    body .fn-hero .row > .col-6.d-none {
        margin-top: 0;
    }

    body .fn-hero .hero-slider-position {
        max-width: 440px;
        margin-right: 0;
    }
}

@media (max-width: 575px) {
    body .fn-hero .row > .col-6.d-none {
        margin-top: 28px;
    }

    body .fn-hero .hero-slider-position {
        max-width: 340px;
    }

    body .fn-hero .my-pagination {
        gap: 10px;
    }

    body .fn-hero .hero-img-box {
        width: 220px;
        right: -70px;
    }

    body .fn-hero .btn-gradient {
        font-size: 15px;
        padding: .7rem 1.6rem;
    }
}

/* --------------------------------------------------------------------------
   Карточки над новостями (fn-news: news-card)
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 991px) {
    body .fn-news .row > .col-md-6.col-lg-4 {
        flex: 0 0 33.3333%;
        max-width: 33.3333%;
    }

    body .news-title {
        font-size: 20px;
    }
}

/* Сетка новостей в 2 колонки: одиночные карточки занимают свободное место рядом */
@media (min-width: 576px) and (max-width: 991px) {
    body .fn-news-block__grid {
        grid-auto-flow: row dense;
    }
}

@media (max-width: 575px) {
    body .news-card {
        min-height: 150px;
    }

    body .news-title {
        font-size: 20px;
    }
}

/* --------------------------------------------------------------------------
   Проекты и грантовые конкурсы (fn-projects)
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
    body .fn-projects .h-122 {
        height: auto;
        min-height: 122px;
    }

    body .fn-projects .project-item {
        height: 100%;
    }

    body .fn-projects .row > [class*="col-"] > a {
        display: block;
        height: 100%;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    body .fn-projects .row > .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    body .fn-projects .row > .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        order: 3;
    }
}

@media (max-width: 767px) {
    body .fn-projects .g-30 {
        --bs-gutter-y: 16px;
    }

    body .fn-projects .row.mt-2 {
        margin-top: 0 !important;
    }

    body .fn-projects .project-item {
        min-height: 96px;
        padding: 16px 20px;
    }

    body .fn-projects .project-title {
        font-size: 17px;
    }

    body .fn-projects .project-title-big {
        font-size: 20px;
        padding-right: 16px;
    }

    body .fn-projects .item-img-inner {
        flex-shrink: 0;
        max-width: 40%;
    }
}

/* --------------------------------------------------------------------------
   Цитаты (fn-quote)
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
    /* Слайды разной высоты: колонка вместо переноса строк, синий блок растягивается до низа */
    body .fn-quote .row.align-stretch {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    body .fn-quote .row.align-stretch > .col-12 {
        width: 100%;
    }

    body .fn-quote .row.align-stretch > .col-lg-7 {
        flex: 1 1 auto;
    }

    body .fn-quote .custom-image-wrap {
        flex: 0 0 auto;
        height: 360px;
    }

    body .fn-quote .custom-image {
        object-position: center 20%;
    }

    body .fn-quote .custom-image-wrap::after {
        content: '';
        position: absolute;
        inset: auto 0 0 0;
        height: 45%;
        background: linear-gradient(180deg, rgba(0, 113, 176, 0) 0%, #0071b0 100%);
        pointer-events: none;
    }

    body .fn-quote .custom-right-col {
        padding: 32px 32px 88px 64px;
        box-shadow: none;
    }

    body .fn-quote .custom-nav-btn {
        top: auto;
        bottom: 76px;
        margin-top: 0;
    }
}

@media (max-width: 575px) {
    body .fn-quote.mt-5 {
        margin-top: 24px !important;
    }

    body .fn-quote .custom-image-wrap {
        height: 280px;
    }

    body .fn-quote .custom-right-col {
        padding: 24px 20px 84px 52px;
    }

    body .fn-quote .custom-nav-btn {
        bottom: 72px;
    }

    body .fn-quote .custom-right-col p {
        font-size: 15px;
    }

    body .fn-quote .custom-right-col .custom-right-inner:before {
        left: -34px;
    }
}

/* --------------------------------------------------------------------------
   Партнёры (бегущая строка)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    body .marquee-track {
        gap: 32px;
        animation-duration: 22s;
    }

    body .marquee-img {
        width: 88px;
        height: 88px;
    }

    body .marquee-wrapper {
        padding: 12px 0;
    }
}

/* --------------------------------------------------------------------------
   Результаты за год (fn-result)
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
    body .fn-result-number {
        font-size: 170px;
        height: auto;
        line-height: 1;
        margin-top: 0;
        letter-spacing: -10px;
    }

    body .fn-result-text {
        font-size: 30px;
    }

    body .fn-result-round {
        width: 460px;
        height: 460px;
        left: -10rem;
    }

    body .fn-result-left {
        padding-top: 4rem;
    }
}

@media (max-width: 767px) {
    body .fn-result.my-5 {
        margin-top: 24px !important;
        margin-bottom: 24px !important;
        padding-bottom: 24px !important;
        overflow: hidden;
    }

    body .fn-result-left {
        padding-top: 1rem;
        padding-bottom: 2rem !important;
    }

    body .fn-result-number {
        font-size: 140px;
        letter-spacing: -8px;
        margin-left: -12px;
    }

    body .fn-result-text {
        font-size: 26px;
    }

    body .fn-result-round {
        width: 280px;
        height: 280px;
        left: -7rem;
        top: -1rem;
    }

    body .fn-result-list {
        position: relative;
        z-index: 5;
    }

    body .fn-result .row > .col-md-8 {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    body .fn-result-list {
        padding-top: 0 !important;
        gap: 18px;
    }

    body .result-item {
        font-size: 17px;
        padding-left: 44px !important;
    }

    /* На тач-экранах нет наведения — стрелка видна сразу */
    body .result-item:before {
        opacity: 1;
        width: 30px;
        height: 30px;
    }
}

/* --------------------------------------------------------------------------
   «О фонде» и «Журнал»: директор и форма обратной связи
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
    body .fn-leader__photo img {
        max-height: 460px;
        width: 100%;
        object-fit: cover;
        object-position: center 15%;
    }
}

@media (max-width: 575px) {
    body .fn-leader__photo img {
        max-height: 340px;
    }
}

body section[id="Обратная связь"] .wpcf7 input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
body section[id="Обратная связь"] .wpcf7 textarea {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 991px) {
    body section[id="Обратная связь"] {
        margin-top: 24px !important;
        margin-bottom: 24px !important;
        padding-top: 24px !important;
        padding-bottom: 24px !important;
    }

    body section[id="Обратная связь"] .row > .col-md-5 {
        margin-left: 0;
        flex: 0 0 50%;
        max-width: 50%;
    }

    body section[id="Обратная связь"] .fs-3 {
        font-size: 22px !important;
    }
}

@media (max-width: 767px) {
    body section[id="Обратная связь"] .row > .col-md-5 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    body section[id="Обратная связь"] .lead {
        font-size: 17px;
    }
}

/* --------------------------------------------------------------------------
   Подвал
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
    body #footer {
        padding-top: 40px !important;
        padding-bottom: 32px !important;
    }

    body #footer .fn-header-2 {
        font-size: 20px;
        padding-bottom: 8px !important;
    }
}

@media (max-width: 575px) {
    body #footer .row.g-4 {
        --bs-gutter-y: 28px;
    }

    body #footer .fn-header-2 {
        margin-top: 0;
    }

    body #footer .fn-header-2[style*="margin-top"] {
        margin-top: 24px !important;
    }

    body #footer .row.g-4 {
        --bs-gutter-x: 16px;
    }

    body .fn-footer-item {
        font-size: 14px;
        line-height: 1.45;
        margin-bottom: 4px;
        overflow-wrap: anywhere;
    }

    body .fn-footer-social {
        display: flex;
        gap: 4px;
    }

    body .fn-footer-social a:first-child {
        padding-left: 0 !important;
    }

    body #footer .copyright {
        font-size: 13px;
        color: #dee2e6;
    }
}

/* --------------------------------------------------------------------------
   Обычные страницы и записи (page.php, single.php, index.php)
   -------------------------------------------------------------------------- */
body .fn-entry {
    max-width: 960px;
    padding-top: 40px;
    padding-bottom: 56px;
}

body .fn-entry > h1 {
    font-weight: 700;
    color: #0071b0;
    font-size: clamp(26px, 4vw, 40px);
    line-height: 1.2;
}

body .fn-entry img,
body .fn-entry video,
body .fn-entry iframe {
    max-width: 100%;
    height: auto;
}

body .fn-entry iframe {
    aspect-ratio: 16 / 9;
}

body .fn-entry figure {
    margin: 24px 0;
}

body .fn-entry table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

body .fn-entry p,
body .fn-entry li {
    font-size: 18px;
    line-height: 1.6;
}

@media (max-width: 575px) {
    body .fn-entry {
        padding-top: 24px;
        padding-bottom: 40px;
    }

    body .fn-entry > h1 {
        text-align: left !important;
    }

    body .fn-entry p,
    body .fn-entry li {
        font-size: 16px;
    }
}

/* --------------------------------------------------------------------------
   Страница 404
   -------------------------------------------------------------------------- */
body .fn-404 {
    padding-top: 72px;
    padding-bottom: 96px;
}

body .fn-404__code {
    margin: 0;
    line-height: 1;
    font-size: clamp(96px, 20vw, 180px);
}

body .fn-404__title {
    font-size: clamp(24px, 4vw, 36px);
    margin: 8px 0 24px;
}

body .fn-404__link {
    display: inline-block;
    padding: 10px 24px;
    border: 2px solid #0071b0;
    border-radius: 6px;
    color: #0071b0;
    font-weight: 600;
    text-decoration: none;
}

body .fn-404__link:hover {
    color: #099250;
    border-color: #099250;
}
