/* ===========================================
   Секции главной — «Популярные категории» и «Популярные товары»
   =========================================== */

/* Общая шапка секции: заголовок + «Смотреть все →» */
.rv-home-section__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin: 0 0 var(--wp--preset--spacing--40);
}

.rv-home-section__title {
    margin: 0;
    font-size: var(--wp--preset--font-size--x-large);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.rv-home-section__all {
    flex: 0 0 auto;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 700;
    color: var(--wp--preset--color--accent-1);
    text-decoration: none;
    white-space: nowrap;
}

.rv-home-section__all:hover,
.rv-home-section__all:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ===========================================
   Категории — вся плитка является ссылкой
   =========================================== */

.rv-home-categories__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--wp--preset--spacing--40);
}

.rv-category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    background: var(--wp--preset--color--base);
    border: 1px solid var(--wp--preset--color--accent-6);
    border-radius: 16px;
    padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--30);
    text-decoration: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Gradient overlay при наведении */
.rv-category-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(30, 84, 200, 0.03) 0%, rgba(30, 84, 200, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.35s ease;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

.rv-category-card:hover::before {
    opacity: 1;
}

.rv-category-card:hover {
    border-color: var(--wp--preset--color--accent-1);
    box-shadow: 0 16px 40px rgba(30, 84, 200, 0.15);
    transform: translateY(-6px);
}

.rv-category-card:focus-visible {
    outline: 2px solid var(--wp--preset--color--accent-1);
    outline-offset: 2px;
}

/* Линейная SVG-иконка в цвете бренда — плавное увеличение при hover */
.rv-category-card__icon {
    display: inline-flex;
    line-height: 1;
    margin-bottom: 8px;
    color: var(--rv-brand, #164E7E);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.rv-category-card__icon svg {
    width: 56px;
    height: 56px;
}

.rv-category-card:hover .rv-category-card__icon {
    transform: scale(1.15);
}

.rv-category-card__title {
    margin: 0 0 6px;
    font-size: var(--wp--preset--font-size--large);
    font-weight: 700;
    color: var(--wp--preset--color--contrast);
}

.rv-category-card__desc {
    margin: 0 0 16px;
    font-size: var(--wp--preset--font-size--small);
    color: var(--wp--preset--color--accent-4);
}

/* Псевдокнопка «Перейти» — прижата к низу, вся плитка кликабельна */
.rv-category-card__cta {
    margin-top: auto;
    width: 100%;
    box-sizing: border-box;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    font-weight: 700;
    font-size: 14px;
    color: var(--wp--preset--color--contrast);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.rv-category-card:hover .rv-category-card__cta {
    background: linear-gradient(135deg, #1e54c8 0%, #0f3460 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(30, 84, 200, 0.3);
}

@media (max-width: 1023px) {
    .rv-home-categories__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 679px) {
    .rv-home-categories__grid {
        gap: 12px;
    }

    .rv-category-card {
        padding: 20px 12px;
    }

    .rv-category-card__icon svg {
        width: 40px;
        height: 40px;
    }

    .rv-category-card__title {
        font-size: 16px;
    }

    .rv-category-card__desc {
        margin-bottom: 0;
        font-size: 12px;
    }

    /* На узком экране кнопка-намёк избыточна: кликабельна вся плитка */
    .rv-category-card__cta {
        display: none;
    }
}

/* ===========================================
   Популярные товары — сетка карточек каталога
   (сами карточки стилизует redesign-catalog.css через .rv-catalog)
   =========================================== */

.rv-catalog.rv-home-products__loop ul.products {
    grid-template-columns: repeat(4, 1fr);
    padding-top: 0;
}

@media (max-width: 1023px) {
    .rv-catalog.rv-home-products__loop ul.products {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 679px) {
    .rv-catalog.rv-home-products__loop ul.products {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   Кнопки CTA — градиенты + glow
   =========================================== */

.wp-block-button__link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-weight: 600;
}

/* Основная CTA кнопка — градиент */
.wp-block-button:not(.is-style-outline) .wp-block-button__link.has-accent-1-background-color {
    background: linear-gradient(135deg, #1e54c8 0%, #2a6af0 50%, #1e54c8 100%) !important;
    background-size: 200% auto !important;
    box-shadow: 0 4px 15px rgba(30, 84, 200, 0.35);
}

.wp-block-button:not(.is-style-outline) .wp-block-button__link.has-accent-1-background-color:hover {
    background-position: right center !important;
    box-shadow: 0 6px 25px rgba(30, 84, 200, 0.5);
    transform: translateY(-2px);
}

/* Outline кнопка — подсветка */
.wp-block-button.is-style-outline .wp-block-button__link:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

/* ===========================================
   Scroll Reveal — анимация появления
   =========================================== */

.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal--visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger-задержки для дочерних элементов */
.scroll-reveal--stagger>.wp-block-column:nth-child(1) {
    transition-delay: 0s;
}

.scroll-reveal--stagger>.wp-block-column:nth-child(2) {
    transition-delay: 0.1s;
}

.scroll-reveal--stagger>.wp-block-column:nth-child(3) {
    transition-delay: 0.2s;
}

.scroll-reveal--stagger>.wp-block-column:nth-child(4) {
    transition-delay: 0.3s;
}

/* Дочерние элементы stagger тоже скрываем */
.scroll-reveal--stagger>.wp-block-column {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal--stagger.scroll-reveal--visible>.wp-block-column {
    opacity: 1;
    transform: translateY(0);
}
