/**
 * Frontend CSS for iHerb Week Block shortcode
 */
.ihb {
    width: 100%;
    height: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
    row-gap: 20px;
    margin: 40px 0;
}

.ihb_item {
    width: 100%;
    height: auto;
    display: block;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.ihb_image {
    width: 100%;
    position: relative;
    margin-bottom: 20px;
    display: block;
    height: 180px; /* фиксированная высота карточки */
    overflow: hidden; /* обрезаем излишки, чтобы все были одной высоты */
    /* ИСПРАВЛЕНО: will-change только при hover, не постоянно */
}

.ihb_image:after {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    content: '';
    background: #0aa88c;
    opacity: 0;
    z-index: 2;
    transition: opacity 0.2s ease;
    /* ДОБАВЛЕНО: pointer-events: none чтобы не блокировать клики */
    pointer-events: none;
    /* УБРАНО: избыточные display, width, height, transform, will-change */
}

.ihb_image:hover:after {
    opacity: 0.4;
}

.ihb_image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
    display: block;
}

.ihb_image img[alt]:not([src]),.ihb_image img[alt][src=""] {
    background: #f0f0f0;
    color: #666;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
}

/* Плашки на изображениях (позиционирование absolute) */
.ihb_image > .ihb-label {
    position: absolute;
    right: 0;
    top: 5px;
    background: #1e7e34 !important; /* Улучшен контраст: было #28a745 (3.3:1), стало #1e7e34 (4.8:1) */
    font-size: 14px;
    line-height: 20px;
    padding: 0 10px;
    color: #fff !important;
    font-weight: 600;
    display: inline-block;
    border-radius: 3px;
}

/* Все остальные плашки — только цвет фона для контраста, без позиционирования */
.ihb-label,
.ihb-label.ihb-sale-badge {
    background: #1e7e34 !important; /* Улучшен контраст: было #28a745 (3.3:1), стало #1e7e34 (4.8:1) */
    color: #fff !important;
}

.ihb_image > .ihb-label:nth-child(3) {
    top: 30px;
}

.ihb_text1 {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 0 10px;
    font-weight: 600;
    font-size: 22px;
}

.ihb_text1 a {
    color: #0aa88c;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ihb_text1 a:hover {
    text-decoration: underline;
}

/* Stable width for animated numbers */
.ihb-discount {
    font-variant-numeric: tabular-nums;
    display: inline-block;
}

.ihb_text2 {
    width: 100%;
    height: auto;
    display: block;
    color: #555555; /* Улучшен контраст: было #6d6d6e (4.1:1), стало #555555 (5.7:1) */
    font-size: 16px;
    margin: 0 0 15px;
}

.ihb_text3 {
    display: inline-block;
    padding: 10px;
    color: rgb(51, 51, 51);
    background-color: #f7f7f7;
    border-radius: 5px;
    font-size: 12px;
    width: auto;
    max-width: 100%;
}

.ihb_text4 a {
    color: #0aa88c;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ihb_text4 a:hover {
    text-decoration: underline;
}

/* Responsive styles for mobile devices */
@media screen and (max-width: 767px) {
    .ihb {
        grid-template-columns: 1fr;
    }
    /* на мобиле также оставляем фиксированную высоту 180px */
}

/* Specific styles for small mobile devices */
@media screen and (max-width: 479px) {
    .ihb_text1 {
        font-size: 18px;
    }
    
    .ihb_text2 {
        font-size: 14px;
    }
}

/* Дополнительные стили для совместимости семантической разметки */
figure.ihb_item {
    margin: 0;
    padding: 0;
    width: 100%;
    height: auto;
    display: block;
}

figure.ihb_item figcaption {
    display: block;
    margin: 0;
    padding: 0;
}

figure.ihb_item .ihb_text1,
figure.ihb_item .ihb_text2,
figure.ihb_item .ihb_text4 {
    display: block;
}

figure.ihb_item .ihb_text3 {
    display: inline-block;
}

figure.ihb_item time {
    font-style: normal;
    font-weight: normal;
}

figure.ihb_item strong {
    font-weight: 600;
}

/* Наведение: картинка чуть приближается ВНУТРИ рамки, рамка стоит на месте.
   Раньше увеличивалась сама рамка (scale 1.02 у .ihb_image): она вылезала на 6 px в
   стороны и на 2 px вверх, а will-change, включаемый только при наведении, в тот же
   миг переносил её на свой слой — картинка дёргалась на долю пикселя (06.11.2026).
   Лишнее срезает overflow:hidden рамки. */
@media (prefers-reduced-motion: no-preference) {
    .ihb_image img {
        transition: transform 0.35s ease;
    }
    .ihb_image:hover img {
        transform: scale(1.04);
    }
}

/* Отключаем анимации для пользователей с ограничениями */
@media (prefers-reduced-motion: reduce) {
    .ihb_image,
    .ihb_image:after,
    .ihb_image img,
    .ihb_text1 a,
    .ihb_text4 a {
        transition: none;
    }

    .ihb_image:hover img {
        transform: none;
    }
}

/* Мобильная версия */
@media (max-width: 767px) {
    .ihb_image > .ihb-label {
        top: 3px;
        font-size: 12px;
        line-height: 18px;
        padding: 0 8px;
    }
    
    .ihb_image > .ihb-label:nth-child(3) {
        top: 25px;
    }
}
/* Заголовок секции из атрибута title шорткода — в стиле заголовков страницы
   (центр, светлая плашка). Выводится плагином, чтобы исчезать вместе с
   карточками, когда категория пуста. */
.ihb-section-title {
    text-align: center;
    background: #f7f7f7;
    padding: 10px 16px;
    margin: 0 0 20px;
    font-size: 20px;
    line-height: 1.35;
    border-radius: 4px;
}

/* ── Бренды-исключения по странам (05.11.2026) ───────────────────────── */


/* Плашка страны на статье — те же правила, что .hpc-geo главной (coupons.css плагина
   купонов на статье не грузится). Менять вид — синхронно с главной. */
.ihb-geo { display: flex; justify-content: center; margin: 20px 0 8px; }
.ihb-geo-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.ihb-geo-box { position: relative; max-width: 680px; }
.ihb-geo-state { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 18px; font-size: 14px; color: #3a3a3a; }
.ihb-geo [hidden] { display: none !important; }
.ihb-geo-offer { background: #fbf8ef; border: 1px solid #ece3c8; box-shadow: 0 1px 3px rgba(60, 50, 20, .06); }
.ihb-geo-applied { background: #f0f6f0; border: 1px solid #d5e6d5; box-shadow: 0 1px 3px rgba(30, 60, 30, .06); padding-right: 18px; }
.ihb-geo-dismissed { justify-content: center; padding: 0; }
.ihb-geo-flag { width: 22px; height: 15px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); flex-shrink: 0; }
.ihb-geo-text b { font-weight: 600; }
.ihb-geo-btn { background: #fff; border: 1px solid #b9d2b9; border-radius: 0; color: #2e7d32; padding: 7px 18px; font-size: 13px; line-height: 1.3; cursor: pointer; transition: border-color .15s, background .15s; white-space: nowrap; }
.ihb-geo-btn:hover { border-color: #2e7d32; background: #f4f8f4; color: #2e7d32; }
.ihb-geo-link { background: none; border: none; border-bottom: 1px dotted #2e7d32; border-radius: 0; color: #2e7d32; font-size: 13px; cursor: pointer; padding: 0; line-height: 1.3; white-space: nowrap; }
.ihb-geo-link:hover { color: #1b5e20; background: none; }
.ihb-geo-link-muted { color: #8a8a8a; border-bottom-color: #aaa; }
.ihb-geo-link-muted:hover { color: #555; }
.ihb-geo-x { background: none; border: none; color: #b5ac93; font-size: 15px; cursor: pointer; padding: 0 4px; line-height: 1; flex-shrink: 0; }
.ihb-geo-x:hover { color: #777; background: none; }
.ihb-geo-sep { color: #c9c0a8; user-select: none; }
.ihb-geo-applied .ihb-geo-sep { color: #b8d2b8; }
.ihb-geo-dd { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: 320px; max-width: 94vw; background: #fff; border: 1px solid #ddd; box-shadow: 0 12px 34px rgba(0, 0, 0, .14); z-index: 30; overflow: hidden; }
.ihb-geo-dd-search { padding: 10px 10px 6px; }
.ihb-geo-dd-search input { width: 100%; box-sizing: border-box; border: 1px solid #ddd; border-radius: 0; padding: 8px 12px; font-size: 14px; outline: none; background: #fff; color: #222; }
.ihb-geo-dd-search input:focus { border-color: #2e7d32; box-shadow: none; }
.ihb-geo-dd-list { max-height: 260px; overflow-y: auto; padding: 4px 0 6px; overscroll-behavior: contain; }
.ihb-geo-dd-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 14px; cursor: pointer; }
.ihb-geo-dd-item:hover, .ihb-geo-dd-item.active { background: #f4f8f4; }
.ihb-geo-dd-flag { width: 20px; height: 14px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); flex-shrink: 0; }
.ihb-geo-dd-name { flex: 1; color: #222; }
.ihb-geo-dd-count { color: #aaa; font-size: 12px; }
.ihb-geo-dd-empty { padding: 12px 16px 14px; font-size: 13px; color: #888; text-align: center; }
@media (max-width: 600px) {
    .ihb-geo-box { width: 100%; }
    .ihb-geo-state { flex-wrap: wrap; justify-content: center; padding: 12px 14px; gap: 10px; row-gap: 12px; }
    .ihb-geo-offer { position: relative; padding-right: 32px; }
    .ihb-geo-offer .ihb-geo-x { position: absolute; top: 8px; right: 10px; }
    .ihb-geo-sep { display: none; }
    .ihb-geo-dd { width: auto; left: 0; right: 0; transform: none; max-width: none; }
}

/* Бренд, исключённый лишь в части стран: скрыт, пока не выбрана его страна.
   Нужен явный display:none — .ihb_item задаёт display:block и перебивает [hidden]. */
figure.ihb_item[hidden] {
    display: none !important;
}

/* Журнал изменений */
.ihb-exc-changes {
    margin: 12px 0 24px;
    padding-left: 20px;
}
.ihb-exc-changes time {
    color: #6b7473;
}
