/* ==========================================================================
   ИНТЕРАКТИВНЫЙ БЛОК «КАК МЫ РАБОТАЕМ»
   При скролле сначала показывается одна карточка, а затем горизонтально едет к концу списка
   ========================================================================== */

.how-we-work {
    position: relative;
    overflow: visible;
    border: 0;
    background:
        radial-gradient(circle at 10% 12%, rgba(116, 177, 88, .12), transparent 28%),
        radial-gradient(circle at 90% 82%, rgba(207, 225, 198, .24), transparent 30%),
        linear-gradient(180deg, #f8faf6 0%, #f1f5ee 100%);
    box-sizing: border-box;
}

.how-we-work *,
.how-we-work *::before,
.how-we-work *::after {
    box-sizing: border-box;
}

.how-we-work .work-steps-track {
    transition: none !important;
}

/* ==========================================================================
   ДЕСКТОП: Липкий экран 100vh на высоте прокрутки 320vh
   Одиночный фокус на карточке: в кадре видна одна карточка, плавно сменяющаяся при скролле
   ========================================================================== */
@media (min-width: 992px) {
    /* Sticky не работает внутри overflow:hidden и content-visibility:auto.
       Родитель оставляем без горизонтального скроллбара через clip: он не
       создаёт отдельный scroll-container и не ломает липкое позиционирование. */
    .home-wide-layout .pattern-bg-wrapper {
        overflow: clip !important;
    }

    .how-we-work {
        height: 340vh;
        min-height: 2200px;
        padding: 0 !important;
        margin: 0 !important;
        content-visibility: visible !important;
        contain: none !important;
    }

    .work-process-sticky-frame {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: var(--wp-desktop-top, 88px);
        height: calc(100svh - var(--wp-desktop-top, 88px));
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: clamp(12px, 2vh, 24px) 0;
        box-sizing: border-box;
        z-index: 3;
    }

    .work-process-track-viewport {
        position: relative;
        width: 100%;
        overflow: hidden;
        flex: 1;
        display: flex;
        align-items: center;
        padding: 12px 0;
    }

    .work-steps-track {
        display: flex;
        gap: var(--wp-card-gap, 42px);
        width: max-content;
        will-change: transform;
        padding-left: var(--wp-side-pad, max(24px, calc((100vw - 1540px) / 2)));
        padding-right: var(--wp-side-pad, max(24px, calc((100vw - 1540px) / 2)));
    }

    /* Полноширинная карточка в границах основного контейнера */
    .how-we-work .step-card {
        display: grid;
        grid-template-columns: minmax(0, 1.52fr) minmax(390px, .88fr);
        width: min(var(--site-container-width, 1540px), calc(100vw - 48px));
        height: min(540px, 52vh, calc(100svh - var(--wp-desktop-top, 88px) - 240px));
        flex: 0 0 auto;
        border: 1px solid rgba(47, 107, 29, .14);
        border-radius: 32px;
        background: rgba(255, 255, 252, .94);
        box-shadow: 0 18px 55px rgba(31, 55, 25, .09);
        overflow: hidden;
        cursor: pointer;
        outline: none;
        opacity: 0.72;
        transition:
            opacity 0.35s ease,
            border-color 0.35s ease;
    }

    .how-we-work .step-card.is-active {
        opacity: 1;
        border-color: rgba(55, 163, 3, .42);
    }

    .how-we-work .step-media {
        position: relative;
        width: 100%;
        height: 100% !important;
        overflow: hidden;
        border-radius: 31px 0 0 31px;
        background: #172018;
    }

    .how-we-work .step-body {
        position: relative;
        z-index: 2;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: clamp(34px, 3.4vw, 58px) clamp(32px, 3.8vw, 64px) clamp(30px, 3vw, 48px);
        background:
            radial-gradient(circle at 100% 0, rgba(109, 183, 73, .09), transparent 38%),
            rgba(255, 255, 252, .9);
    }

    .how-we-work .step-title {
        max-width: 520px;
        margin: 0 0 18px;
        font-size: clamp(26px, 2vw, 36px);
        font-weight: 850;
        line-height: 1.12;
        letter-spacing: -.025em;
    }

    .how-we-work .step-text {
        max-width: 520px;
        font-size: clamp(15px, 1.1vw, 17px);
        line-height: 1.65;
    }
}

/* ==========================================================================
   ШАПКА БЛОКА
   ========================================================================== */
.how-we-work .work-process-heading {
    max-width: 820px;
    margin-bottom: 18px;
}

.how-we-work .work-process-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    margin-bottom: 10px;
    padding: 0 14px;
    border: 1px solid rgba(70, 137, 44, .2);
    border-radius: 999px;
    background: rgba(255, 255, 255, .75);
    color: #37a303;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .12em;
    text-transform: uppercase;
    box-shadow: 0 6px 18px rgba(42, 88, 27, .06);
    backdrop-filter: blur(14px) saturate(130%);
    -webkit-backdrop-filter: blur(14px) saturate(130%);
}

.how-we-work .section-title {
    margin: 0 0 8px;
    color: #172018;
    font-size: clamp(30px, 3vw, 44px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -.035em;
    text-align: left !important;
}

.how-we-work .section-subtitle {
    max-width: 720px;
    margin: 0;
    color: #5d6b5b;
    font-size: 15px;
    line-height: 1.55;
    text-align: left !important;
}

/* ==========================================================================
   ИНТЕРАКТИВНЫЙ СТЕППЕР / ТАБЫ ЭТАПОВ
   ========================================================================== */
.work-process-nav {
    position: relative;
    margin-bottom: 12px;
}

.work-process-nav__bar {
    position: relative;
    width: 100%;
    height: 4px;
    margin-bottom: 12px;
    border-radius: 999px;
    background: rgba(43, 90, 26, 0.12);
    overflow: hidden;
}

.work-process-nav__progress {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #37a303, #46b809);
    box-shadow: 0 0 12px rgba(55, 163, 3, 0.45);
    transition: width 0.25s linear;
}

.work-process-nav__items {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.work-process-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-family: inherit;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 14px rgba(35, 60, 28, 0.04);
    cursor: pointer;
    text-align: left;
    transition: all 0.25s ease;
    outline: none;
}

.work-process-nav__item:hover {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(55, 163, 3, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(55, 163, 3, 0.12);
}

.work-process-nav__item.is-active {
    background: #ffffff;
    border-color: rgba(55, 163, 3, 0.55);
    box-shadow: 0 8px 24px rgba(55, 163, 3, 0.16);
    transform: translateY(-2px);
}

.work-process-nav__item .nav-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 8px;
    background: rgba(55, 163, 3, 0.1);
    color: #2b7d06;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.05em;
    transition: all 0.25s ease;
}

.work-process-nav__item.is-active .nav-step-badge,
.work-process-nav__item:hover .nav-step-badge {
    background: #37a303;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(55, 163, 3, 0.35);
}

.work-process-nav__item .nav-step-label {
    font-size: 13px;
    font-weight: 750;
    color: #435540;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.25s ease;
}

.work-process-nav__item.is-active .nav-step-label {
    color: #172018;
    font-weight: 800;
}

/* ==========================================================================
   МЕДИА И ИНФОРМАЦИЯ ШАГОВ
   ========================================================================== */
.how-we-work .step-card::after,
.how-we-work .step-card::before {
    display: none !important;
}

.how-we-work .step-img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
    display: block;
    filter: saturate(1.02) contrast(1.015);
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.how-we-work .step-card:hover .step-img,
.how-we-work .step-card.is-active .step-img {
    transform: scale(1.025);
}

.how-we-work .step-media-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(16, 28, 14, .28) 0%, rgba(16, 28, 14, .02) 52%, rgba(16, 28, 14, .3) 100%);
    pointer-events: none;
}

.how-we-work .step-header {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.how-we-work .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 999px;
    background: rgba(18, 32, 16, .65);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 850;
    letter-spacing: .1em;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
    transition: background 0.25s ease, color 0.25s ease;
}

.how-we-work .step-card.is-active .step-num,
.how-we-work .step-card:hover .step-num {
    background: #37a303;
    border-color: #37a303;
    box-shadow: 0 4px 14px rgba(55, 163, 3, 0.5);
}

.how-we-work .step-icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 50%;
    background: rgba(255, 255, 255, .82);
    color: #37a303;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .14);
    transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.how-we-work .step-card:hover .step-icon-circle,
.how-we-work .step-card.is-active .step-icon-circle {
    transform: rotate(6deg) scale(1.05);
    background: #37a303;
    color: #ffffff;
    border-color: #37a303;
}

.how-we-work .step-icon-circle svg {
    width: 18px;
    height: 18px;
}

.how-we-work .step-badge {
    position: absolute;
    bottom: 12px;
    left: 14px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 999px;
    background: rgba(14, 25, 12, .6);
    color: rgba(255, 255, 255, .9);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.how-we-work .step-divider-line {
    width: 46px;
    height: 4px;
    margin-bottom: 18px;
    border-radius: 999px;
    background: #37a303;
    transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.how-we-work .step-card:hover .step-divider-line,
.how-we-work .step-card.is-active .step-divider-line {
    width: 60px;
}

.how-we-work .step-footer {
    margin-top: auto;
    padding-top: 6px;
}

.how-we-work .step-action-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100%, 340px);
    min-height: 48px;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 750;
    line-height: normal;
    border: 1px solid rgba(55, 163, 3, .25);
    border-radius: 999px;
    background: rgba(55, 163, 3, .08);
    color: #2b7d06;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
    box-sizing: border-box;
    outline: none;
}

.how-we-work .step-action-btn svg {
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.how-we-work .step-action-btn:hover,
.how-we-work .step-card.is-active .step-action-btn {
    background: #37a303;
    color: #ffffff;
    border-color: #37a303;
    box-shadow: 0 6px 16px rgba(55, 163, 3, 0.28);
    text-decoration: none;
}

.how-we-work .step-action-btn:hover svg,
.how-we-work .step-card.is-active .step-action-btn svg {
    transform: translateX(3px);
}

/* ==========================================================================
   НИЖНЯЯ СВОДКА И ИНТЕРАКТИВНЫЕ ФАКТ-ПИЛЮЛИ
   ========================================================================== */
.how-we-work .work-process-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, .85);
    border-radius: 18px;
    background: rgba(255, 255, 255, .68);
    box-shadow: 0 12px 30px rgba(34, 66, 25, .05);
    backdrop-filter: blur(18px) saturate(125%);
    -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.how-we-work .work-process-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.how-we-work .work-fact-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 750;
    line-height: normal;
    border: 1px solid rgba(55, 163, 3, .18);
    border-radius: 999px;
    background: rgba(255, 255, 255, .75);
    color: #37572f;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
}

.how-we-work .work-fact-pill:hover,
.how-we-work .work-fact-pill.is-active {
    background: rgba(55, 163, 3, .12);
    border-color: #37a303;
    color: #246a05;
    transform: translateY(-1px);
}

.how-we-work .work-fact-pill svg {
    color: #37a303;
}

.how-we-work .work-process-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #37a303, #46b809);
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none !important;
    box-shadow: 0 6px 16px rgba(55, 163, 3, 0.28);
    transition: all 0.25s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.how-we-work .work-process-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(55, 163, 3, 0.38);
    background: linear-gradient(135deg, #3db503, #4cc50a);
}

.how-we-work .action-arrow {
    font-size: 15px;
    line-height: 1;
    transition: transform 0.25s ease;
}

.how-we-work .work-process-action:hover .action-arrow {
    transform: translateX(3px);
}

/* ==========================================================================
   АДАПТИВНОСТЬ ДЛЯ ПЛАНШЕТОВ И МОБИЛЬНЫХ
   ========================================================================== */
@media (max-width: 991px) {
    .home-wide-layout .pattern-bg-wrapper {
        overflow: clip !important;
    }

    .how-we-work {
        height: var(--wp-mobile-height, auto) !important;
        padding: 0 !important;
        content-visibility: visible !important;
        contain: none !important;
    }

    .work-process-sticky-frame {
        position: sticky !important;
        top: var(--wp-mobile-top, 72px);
        height: var(--wp-mobile-frame-height, calc(100svh - var(--wp-mobile-top, 72px))) !important;
        min-height: 430px;
        padding: 10px 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column;
    }

    .work-process-header-wrap {
        flex: 0 0 auto;
        margin-bottom: 8px;
    }

    .work-process-track-viewport {
        display: flex;
        min-height: 0;
        flex: 1 1 auto;
        align-items: center;
        overflow: hidden;
        padding: 2px 0;
        margin: 0;
    }

    .work-steps-track {
        display: flex;
        gap: var(--wp-card-gap, 16px);
        width: max-content;
        height: 100%;
        padding: 0 var(--wp-side-pad, 16px);
        will-change: transform;
    }

    .how-we-work .step-card {
        display: flex;
        flex-direction: column;
        width: calc(100vw - 32px);
        height: 100%;
        min-height: 0;
        flex: 0 0 auto;
        opacity: .72;
        border-radius: 22px;
        overflow: hidden;
        transition: opacity .35s ease;
    }

    .how-we-work .step-card.is-active {
        opacity: 1;
    }

    .how-we-work .step-media {
        height: 40%;
        min-height: 120px;
        flex: 0 0 40%;
        border-radius: 21px 21px 0 0;
    }

    .how-we-work .step-body {
        display: flex;
        min-height: 0;
        flex: 1 1 auto;
        flex-direction: column;
        padding: 14px 18px;
        overflow-y: auto;
    }

    .how-we-work .step-title {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .how-we-work .step-text {
        font-size: 13.5px;
        margin-bottom: 16px;
    }

    .how-we-work .work-process-summary {
        margin-top: 6px;
        padding: 7px 10px;
    }

    .how-we-work .work-process-facts {
        justify-content: flex-start;
    }

    .how-we-work .work-process-action {
        justify-content: center;
    }

    .work-process-nav__items {
        gap: 8px;
    }

    .work-process-nav__item {
        padding: 6px 10px;
        gap: 6px;
    }

    .work-process-nav__item .nav-step-label {
        font-size: 11px;
    }
}

@media (max-width: 600px) {
    .how-we-work .work-process-heading { margin-bottom: 9px; }
    .how-we-work .section-title { font-size: 28px; }
    .how-we-work .section-subtitle { font-size: 11px; line-height: 1.3; }
    .how-we-work .work-process-nav { margin-bottom: 0; }
    .work-process-nav__bar { margin-bottom: 6px; }
    .work-process-nav__items {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
    }
    .work-process-nav__item { justify-content: center; min-height: 32px; padding: 3px; }
    .work-process-nav__item .nav-step-label { display: none; }
    .how-we-work .work-process-facts { display: none; }
    .how-we-work .work-process-action { width: 100%; min-height: 36px; }
}

@media (max-width: 600px) and (max-height: 700px) {
    .how-we-work .work-process-kicker,
    .how-we-work .section-subtitle,
    .how-we-work .work-process-footer-wrap { display: none; }
    .how-we-work .work-process-heading { margin-bottom: 5px; }
    .how-we-work .section-title { margin-bottom: 3px; font-size: 25px; }
    .work-process-nav__bar { margin-bottom: 4px; }
    .work-process-nav__item { min-height: 28px; }
    .how-we-work .step-media { min-height: 105px; flex-basis: 36%; }
}

@media (max-width: 991px) and (prefers-reduced-motion: reduce) {
    .how-we-work { height: auto !important; padding: 56px 0 64px !important; }
    .work-process-sticky-frame { position: static !important; height: auto !important; display: block !important; overflow: visible !important; }
    .work-process-track-viewport { overflow-x: auto; height: auto; padding: 10px 16px 20px; }
    .work-steps-track { height: auto; transform: none !important; }
    .how-we-work .step-card { height: auto; min-height: 420px; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .work-steps-track {
        transform: none !important;
    }
    .how-we-work .step-card {
        transform: none !important;
        transition: none !important;
    }
    .how-we-work .step-img {
        transition: none !important;
    }
}
