/* ==================================================
   Главная страница
================================================== */

.homepage {
    padding: 10px 20px 80px;
}

.homepage-container {
    max-width: 1400px;
    margin: 0 auto;
}

.homepage-title {
    margin: 0 0 18px;
    text-align: center;
    font-size: clamp(28px, 3vw, 46px);
    line-height: 1.15;
    font-weight: 700;
}

/* ==================================================
   Hero
================================================== */

.hero {
    margin-bottom: 60px;
}

.hero-text {
    text-align: center;
    font-size: 22px;
}

/* ==================================================
   Компактные преимущества
================================================== */

.homepage-advantages {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0 42px;
}

.homepage-advantage {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 11px;
    padding: 12px 14px;
    border: 1px solid #e8edf2;
    border-radius: 12px;
    background: #fff;
}

.homepage-advantage-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(0, 248, 221, .16), rgba(1, 169, 190, .16));
    color: #019aac;
}

.homepage-advantage-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.homepage-advantage-content {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    line-height: 1.25;
}

.homepage-advantage-content strong {
    color: #20262d;
    font-size: 15px;
    font-weight: 700;
}

.homepage-advantage-content > span {
    color: #66707a;
    font-size: 12.5px;
}

/* ==================================================
   Категории
================================================== */

.homepage-categories {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 80px;
}

.homepage-category {
    display: block;
    overflow: hidden;
    border-radius: 12px;
}

.homepage-category img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    transition: transform .25s ease;
}

.homepage-category:hover img {
    transform: scale(1.03);
}

/* ==================================================
   Кнопка "Смотреть все категории"
================================================== */

.homepage-all-categories {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 12px;
}

.homepage-all-categories a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 13px 30px;
    border-radius: 11px;
    background: #0a7cff;
    color: #fff !important;
    box-shadow: 0 5px 16px rgba(10, 124, 255, .18);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.homepage-all-categories a:hover,
.homepage-all-categories a:focus {
    background: #086bdc;
    color: #fff !important;
    box-shadow: 0 7px 20px rgba(10, 124, 255, .24);
    transform: translateY(-1px);
}

/* ==================================================
   Заголовки блоков товаров
================================================== */

.homepage-products {
    margin-bottom: 80px;
}

.homepage-section-header {
    margin-bottom: 30px;
}

.homepage-section-header h2 {
    margin: 0;
    text-align: center;
    font-size: clamp(26px, 3vw, 40px);
    line-height: 1.2;
}

/* ==================================================
   Сетка товаров
================================================== */

.homepage-products-wrapper {
    width: 100%;
}

.homepage-products .products {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
    align-items: stretch;
}

.homepage-products .products li.product {
    display: flex !important;
    width: auto !important;
    height: 100%;
    float: none !important;
    flex-direction: column;
    margin: 0 !important;
    padding: 16px;
    border: 1px solid #ececec;
    border-radius: 12px;
    background: #fff;
    transition: transform .2s ease, box-shadow .2s ease;
}

.homepage-products .products li.product:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    transform: translateY(-2px);
}

/* Фото */
.homepage-products .astra-shop-thumbnail-wrap,
.homepage-products .woocommerce-loop-product__link {
    flex: 0 0 auto;
}

.homepage-products img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    object-fit: cover;
}

/*
 * Astra помещает название, цену и кнопку внутрь этого блока.
 * Делаем его flex-контейнером, чтобы кнопка всегда уходила вниз.
 */
.homepage-products .astra-shop-summary-wrap {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
}

/* Категория товара, если Astra её показывает */
.homepage-products .ast-woo-product-category {
    margin-top: 10px;
}

/* Название */
.homepage-products .woocommerce-loop-product__title {
    display: -webkit-box;
    min-height: 48px;
    margin: 9px 0 0;
    overflow: hidden;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* Цена */
.homepage-products .price {
    margin: 13px 0 14px !important;
    font-size: 22px;
    font-weight: 700;
}

/* Кнопка всегда прижата к нижнему краю карточки */
.homepage-products .astra-shop-summary-wrap > .button,
.homepage-products .product > .button {
    width: 100%;
    margin-top: auto !important;
    border-radius: 8px;
    text-align: center;
}

/* ==================================================
   Планшет
================================================== */

@media (max-width: 1024px) {
    .homepage-advantages {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-bottom: 34px;
    }

    .homepage-categories {
        grid-template-columns: repeat(3, 1fr);
    }

    .homepage-products .products {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ==================================================
   Телефон
================================================== */

@media (max-width: 768px) {
    .homepage {
        padding-right: 14px;
        padding-left: 14px;
    }

    .homepage-advantages {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin: 14px 0 28px;
    }

    .homepage-advantage {
        align-items: flex-start;
        gap: 8px;
        padding: 10px;
    }

    .homepage-advantage-icon {
        flex-basis: 32px;
        width: 32px;
        height: 32px;
        border-radius: 9px;
    }

    .homepage-advantage-icon svg {
        width: 19px;
        height: 19px;
    }

    .homepage-advantage-content strong {
        font-size: 13px;
    }

    .homepage-advantage-content > span {
        font-size: 11px;
        line-height: 1.25;
    }

    .homepage-categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .homepage-products .products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .homepage-products .products li.product {
        padding: 12px;
    }

    .homepage-products .woocommerce-loop-product__title {
        min-height: 58px;
        -webkit-line-clamp: 3;
    }

    .homepage-products .price {
        font-size: 19px;
    }

    .homepage-all-categories a {
        width: 100%;
        max-width: 330px;
    }
}

/* Только главная страница */
@media (min-width: 1200px) {
    .home.ast-plain-container.ast-no-sidebar #primary {
        margin-top: 0 !important;
    }
}
