/*
 * АлтайФлора — отдельный дизайн списка акций.
 * Файл относится только к шаблону:
 * /bitrix/templates/concept_phoenix_s1/components/bitrix/news.list/offers.news-list/
 */

/* =========================================================
   ДЕКОРАТИВНЫЕ ИЗОБРАЖЕНИЯ
   ========================================================= */

/*
 * ВАЖНО:
 * Здесь будут единственные места, куда нужно вставить URL готовых PNG/WebP.
 * Изображения должны быть с прозрачным фоном.
 *
 * Цикл:
 * leaf-01 → карточки 1, 5, 9...
 * leaf-02 → карточки 2, 6, 10...
 * leaf-03 → карточки 3, 7, 11...
 * leaf-04 → карточки 4, 8, 12...
 */

.af-offer-card__decor--leaf-01 {
    /* ДЕКОР: ЛИСТОЧЕК 1 — карточка №1 в концепте */
     background-image: url("/upload/offers/leaf-01.png");
}

.af-offer-card__decor--leaf-02 {
    /* ДЕКОР: ЛИСТОЧЕК 2 — карточка №2 в концепте */
     background-image: url("/upload/offers/leaf-02.png");
}

.af-offer-card__decor--leaf-03 {
    /* ДЕКОР: ЛИСТОЧЕК 3 — карточка №3 в концепте */
    background-image: url("/upload/offers/leaf-03.png");
}

.af-offer-card__decor--leaf-04 {
    /* ДЕКОР: ЛИСТОЧЕК 4 — карточка №4 в концепте */
    background-image: url("/upload/offers/leaf-04.png");
}


/* =========================================================
   ОБЩАЯ СЕТКА
   ========================================================= */

.af-offers {
    width: 100%;
    margin: 0 auto;
    padding: 12px 0 48px;
}

.af-offers *,
.af-offers *::before,
.af-offers *::after {
    box-sizing: border-box;
}

.af-offers__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
}

/* =========================================================
   КАРТОЧКА
   ========================================================= */

.af-offer-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(27, 27, 27, 0.06);
    border-radius: 22px;
    box-shadow: 0 12px 38px rgba(27, 27, 27, 0.08);
    transition: transform .28s ease, box-shadow .28s ease;
}

@media (hover: hover) and (pointer: fine) {
    .af-offer-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 18px 48px rgba(27, 27, 27, 0.12);
    }
}


/* =========================================================
   ИЗОБРАЖЕНИЕ ИЗ АДМИНКИ BITRIX
   ========================================================= */

.af-offer-card__media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1.9 / 1;
    overflow: hidden;
    background: #f4f5f1;
    text-decoration: none;
}

.af-offer-card__image,
.af-offer-card__image-placeholder {
    display: block;
    width: 100%;
    height: 100%;
}

.af-offer-card__image {
    object-fit: cover;
    transition: transform .45s ease;
}

@media (hover: hover) and (pointer: fine) {
    .af-offer-card:hover .af-offer-card__image {
        transform: scale(1.025);
    }
}


/* =========================================================
   СТАТУС АКЦИИ
   ========================================================= */

.af-offer-card__status {
    position: absolute;
    z-index: 3;
    top: 18px;
    left: 18px;
    max-width: calc(100% - 36px);
    padding: 9px 15px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: .035em;
    text-transform: uppercase;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

.af-offer-card__status--on {
    background: #79bd48;
}

.af-offer-card__status--off {
    background: #e76666;
}


/* =========================================================
   ТЕКСТОВАЯ ЧАСТЬ
   ========================================================= */

.af-offer-card__body {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 20px 24px 18px;
}

.af-offer-card__title-link {
    color: inherit;
    text-decoration: none;
}

.af-offer-card__title {
    margin: 0;
    color: #202020;
    font-size: clamp(21px, 1.65vw, 28px);
    line-height: 1.18;
    font-weight: 700;
}

.af-offer-card__description {
    margin-top: 8px;
    max-width: 92%;
    color: #6b6b6b;
    font-size: 15px;
    line-height: 1.55;
}

.af-offer-card__footer {
    margin-top: auto;
    padding-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}


/* =========================================================
   КНОПКА
   ========================================================= */

.af-offer-card__button {
    flex: 0 0 auto;
    min-height: 46px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    border: 1px solid #252525;
    border-radius: 999px;
    color: #202020;
    background: #fff;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
    font-weight: 600;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.af-offer-card__button-arrow {
    font-size: 20px;
    line-height: 1;
    transition: transform .2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .af-offer-card__button:hover {
        color: #fff;
        background: #79bd48;
        border-color: #79bd48;
    }

    .af-offer-card__button:hover .af-offer-card__button-arrow {
        transform: translateX(3px);
    }
}


/* =========================================================
   СРОК АКЦИИ
   ========================================================= */

.af-offer-card__period {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}

/* Иконка календаря */

.af-offer-card__period-icon {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #222;
}

.af-offer-card__period-icon svg {
    display: block;
    width: 28px;
    height: 28px;
}

.af-offer-card__period-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.af-offer-card__period-text strong {
    color: #242424;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 700;
}

.af-offer-card__period-text span {
    margin-top: 2px;
    color: #858585;
    font-size: 11px;
    line-height: 1.3;
}


/* =========================================================
   ДЕКОРАТИВНЫЕ ЛИСТЬЯ
   ========================================================= */

/*
 * Общий контейнер декоративного элемента.
 * Само изображение задаётся отдельными классами leaf-01...leaf-04.
 */
.af-offer-card__decor {
    position: absolute;
    z-index: 4;
    display: block;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}


/* ---------------------------------------------------------
   ЛИСТОК 01
   Карточки: 1 / 5 / 9 / ...
   --------------------------------------------------------- */

.af-offer-card__decor--leaf-01 {
    width: 150px;
    height: 125px;
    right: -35px;
    top: 46%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;

    transform: rotate(-8deg);

    /* СЮДА URL: decorative-leaf-01.png */
    /* background-image: url('/путь/decorative-leaf-01.png'); */
}


/* ---------------------------------------------------------
   ЛИСТОК 02
   Карточки: 2 / 6 / 10 / ...
   --------------------------------------------------------- */

.af-offer-card__decor--leaf-02 {
    width: 155px;
    height: 145px;
    right: -35px;
    top: 44%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transform: rotate(48deg);

    /* СЮДА URL: decorative-leaf-02.png */
    /* background-image: url('/путь/decorative-leaf-02.png'); */
}


/* ---------------------------------------------------------
   ЛИСТОК 03
   Карточки: 3 / 7 / 11 / ...
   --------------------------------------------------------- */

.af-offer-card__decor--leaf-03 {
    width: 165px;
    height: 145px;
    right: -45px;
    top: 41%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transform: rotate(-12deg);

    /* СЮДА URL: decorative-leaf-03.png */
    /* background-image: url('/путь/decorative-leaf-03.png'); */
}


/* ---------------------------------------------------------
   ЛИСТОК 04
   Карточки: 4 / 8 / 12 / ...
   --------------------------------------------------------- */

.af-offer-card__decor--leaf-04 {
    width: 175px;
    height: 155px;
    right: -50px;
    top: 43%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transform: rotate(7deg);

    /* СЮДА URL: decorative-leaf-04.png */
    /* background-image: url('/путь/decorative-leaf-04.png'); */
}


/* =========================================================
   ПАГИНАЦИЯ BITRIX
   ========================================================= */

.af-offers__pager {
    margin-top: 34px;
}


/* =========================================================
   АДАПТИВ
   ========================================================= */

/* Небольшие ноутбуки / планшеты landscape */
@media (max-width: 1199px) {
    .af-offers__grid {
        gap: 22px;
    }

    .af-offer-card__decor {
        display: none;
    }

    .af-offer-card__body {
        padding: 21px 20px 20px;
    }

    .af-offer-card__footer {
        gap: 14px;
    }

    .af-offer-card__description {
        max-width: 100%;
    }
}

/* Планшеты */
@media (max-width: 991px) {
    .af-offers {
        padding-bottom: 36px;
    }

    .af-offers__grid {
        gap: 18px;
    }

    .af-offer-card {
        border-radius: 18px;
    }

    .af-offer-card__media {
        aspect-ratio: 4 / 3;
    }

    .af-offer-card__footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .af-offer-card__button {
        order: 2;
    }

    .af-offer-card__period {
        order: 1;
    }

    .af-offer-card__decor {
        transform-origin: center;
    }

    .af-offer-card__decor--leaf-01 { width: 96px; height: 96px; }
    .af-offer-card__decor--leaf-02 { width: 82px; height: 82px; }
    .af-offer-card__decor--leaf-03 { width: 92px; height: 92px; }
    .af-offer-card__decor--leaf-04 { width: 108px; height: 108px; }
}

/* Основной мобильный breakpoint: одна карточка в ряд */
@media (max-width: 767px) {
    .af-offers {
        padding-top: 4px;
        padding-bottom: 28px;
    }

    .af-offers__grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .af-offer-card {
        border-radius: 17px;
        box-shadow: 0 8px 26px rgba(27, 27, 27, 0.08);
    }

    .af-offer-card__media {
        aspect-ratio: 1.8 / 1;
    }

    .af-offer-card__status {
        top: 13px;
        left: 13px;
        max-width: calc(100% - 26px);
        padding: 8px 12px;
        font-size: 10px;
    }

    .af-offer-card__body {
        padding: 16px 16px 15px;
    }

    .af-offer-card__title {
        font-size: 21px;
        line-height: 1.2;
    }

    .af-offer-card__description {
        margin-top: 7px;
        font-size: 14px;
        line-height: 1.5;
    }

    .af-offer-card__footer {
        padding-top: 14px;
        gap: 13px;
    }

    .af-offer-card__button {
        width: 100%;
        min-height: 48px;
    }

    .af-offer-card__period {
        width: 100%;
    }

    /* На мобильных сохраняем тот же цикл из четырёх вариантов,
       но уменьшаем декор, чтобы он не мешал чтению текста. */
    .af-offer-card__decor {
        opacity: .92;
    }

    .af-offer-card__decor--leaf-01 {
        width: 76px;
        height: 76px;
        right: -14px;
        top: 45%;
    }

    .af-offer-card__decor--leaf-02 {
        width: 66px;
        height: 66px;
        right: -12px;
        top: 55%;
    }

    .af-offer-card__decor--leaf-03 {
        width: 72px;
        height: 72px;
        right: -13px;
        top: 46%;
    }

    .af-offer-card__decor--leaf-04 {
        width: 82px;
        height: 82px;
        right: -14px;
        top: 47%;
    }
}

/* Узкие современные смартфоны */
@media (max-width: 420px) {
    .af-offers__grid {
        gap: 15px;
    }

    .af-offer-card__media {
        aspect-ratio: 4 / 3;
    }

    .af-offer-card__body {
        padding: 16px 15px 15px;
    }

    .af-offer-card__title {
        font-size: 19px;
    }

    .af-offer-card__description {
        font-size: 13px;
    }

    .af-offer-card__period-text strong {
        font-size: 12px;
    }

    .af-offer-card__period-text span {
        font-size: 10px;
    }
}

/* Очень узкие экраны */
@media (max-width: 359px) {
    .af-offer-card__status {
        position: static;
        display: inline-block;
        margin: 12px 12px 0;
        max-width: calc(100% - 24px);
    }

    .af-offer-card__media {
        display: flex;
        flex-direction: column;
        background: #fff;
    }

    .af-offer-card__image {
        aspect-ratio: 4 / 3;
        height: auto;
    }

    .af-offer-card__decor {
        display: none;
    }
}

/* Уважение системной настройки уменьшения анимации */
@media (prefers-reduced-motion: reduce) {
    .af-offer-card,
    .af-offer-card__image,
    .af-offer-card__button,
    .af-offer-card__button-arrow {
        transition: none !important;
    }
}
