/**
 * Features Block Styles
 * Блок переваг (Що ми гарантуємо?)
 * Базується на Tilda дизайні
 * 
 * @package MyFood
 * @since 1.0
 */

/* ==========================================================================
   BASE BLOCK STYLES
   ========================================================================== */

.block-features {
    position: relative;
    width: 100%;
    min-height: 590px;
    background-color: #ffffff;
    padding: 80px 0 60px;
    overflow: hidden;
}

/* Container */
.block-features .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   TITLE
   ========================================================================== */

.features__title {
    color: #3a3d4e;
    font-size: 48px;
    font-family: 'Gilroy', Arial, sans-serif;
    line-height: 1.55;
    font-weight: 600;
    text-align: center;
    margin: 0 0 80px;
}

/* ==========================================================================
   GRID LAYOUT
   ========================================================================== */

.features__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    align-items: start;
    position: relative;
    overflow: visible; /* ВАЖЛИВО: щоб стрілки були видимі */
}

/* ==========================================================================
   FEATURE ITEM
   ========================================================================== */

.features__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: visible; /* ВАЖЛИВО: щоб стрілки були видимі за межами */
}

/* Icon wrapper (кружечок) */
.features__icon-wrapper {
    width: 180px;
    height: 180px;
    margin-bottom: 60px;
    position: relative;
}

.features__icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* Декоративна стрілка МІЖ елементами (як на скріні) */
.features__arrow {
    position: absolute;
    top: 90px; /* Центр іконки (180px / 2) */
    right: -25px; /* Позиціонування між колонками */
    transform: translateY(-50%);
    width: 11px;
    height: 18px;
    z-index: 5;
}

.features__arrow svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Текст переваги */
.features__text {
    color: #000000;
    font-size: 18px;
    font-family: 'Gilroy', Arial, sans-serif;
    line-height: 1.35;
    font-weight: 400;
    letter-spacing: 0.5px;
    max-width: 260px;
}

.features__text p {
    margin: 0 0 10px;
}

.features__text p:last-child {
    margin-bottom: 0;
}

.features__text br {
    line-height: 0;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (як в Tilda)
   ========================================================================== */

/* Tablet Large: <= 1199px */
@media screen and (max-width: 1199px) {
    .block-features {
        min-height: 520px;
        padding: 70px 0 50px;
    }
    
    .features__title {
        margin-bottom: 60px;
    }
    
    .features__icon-wrapper {
        width: 160px;
        height: 160px;
        margin-bottom: 50px;
    }
    
    .features__arrow {
        top: 80px; /* Центр іконки (160px / 2) */
        right: -23px;
    }
}

/* Tablet: <= 959px (2 колонки) */
@media screen and (max-width: 959px) {
    .block-features {
        min-height: 730px;
        padding: 50px 0 40px;
    }
    
    .features__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 50px 40px;
    }
    
    .features__title {
        margin-bottom: 50px;
    }
    
    /* Стрілки тільки для непарних елементів (1-й та 3-й в ряду) */
    .features__item:nth-child(even) .features__arrow {
        display: none;
    }
    
    .features__arrow {
        top: 77px; /* Центр іконки */
        right: -23px;
    }
}

/* Mobile Large: <= 639px (все ще 2 колонки) */
@media screen and (max-width: 639px) {
    .features__title {
        font-size: 44px;
        margin-bottom: 40px;
    }
    
    .features__text {
        font-size: 16px;
        max-width: 220px;
    }
    
    .features__icon-wrapper {
        width: 154px;
        height: 154px;
    }
    
    .features__arrow {
        top: 77px; /* Центр меншої іконки */
        right: -20px;
    }
}

/* Mobile: <= 479px (1 колонка) */
@media screen and (max-width: 479px) {
    .block-features {
        min-height: 1260px;
        padding: 40px 0 40px;
    }
    
    .features__grid {
        grid-template-columns: 1fr;
        gap: 60px;
    }
    
    .features__title {
        font-size: 30px;
        margin-bottom: 50px;
    }
    
    .features__text {
        max-width: 220px;
    }
    
    /* Приховуємо всі стрілки на mobile */
    .features__arrow {
        display: none;
    }
}

/* ==========================================================================
   PERFORMANCE OPTIMIZATIONS (Google PageSpeed)
   ========================================================================== */

/* CSS Containment для ізоляції (покращує rendering performance) */
.block-features {
    contain: style; /* Видалено layout - конфліктує зі стрілками поза межами */
    content-visibility: auto; /* Lazy rendering для off-screen блоків */
    contain-intrinsic-size: auto 590px; /* Резервний розмір для content-visibility */
}

.features__item {
    contain: style; /* Видалено layout/paint - стрілки мають бути видимі */
}

/* Prevent layout shift (CLS optimization) */
.features__icon-wrapper {
    aspect-ratio: 1 / 1; /* Резервує простір до завантаження зображення */
    contain-intrinsic-size: 180px 180px; /* Explicit size для content-visibility */
}

/* GPU acceleration для стрілок (плавніша анімація) */
.features__arrow {
    will-change: opacity; /* Підказка браузеру для оптимізації */
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Оптимізація для transform (GPU layer) */
.features__arrow svg {
    transform: translateZ(0); /* Створює окремий GPU layer */
}

