/* ===== Hero فروشگاهی =====
   دسکتاپ: منوی دسته‌ها (فقط لیستش اسکرول می‌خورد) + زیرمنوی بازشو + بنر + دو پروموی دسته.
   موبایل/تبلت: نوار دسته‌های گرد (اسکرول افقی) + بنر + پروموها.
   رنگ‌ها از متغیرهای خود قالب (--primary, --white, --border, --text, --chalk). */

.hx {
    --p: var(--primary, #0cb94e);
    --w: var(--white, #fff);
    --b: var(--border, #e8e8e8);
    --t: var(--text, #555);
    --h: var(--heading, #1d2a22);
    --ch: var(--chalk, #f4f8f5);
    --tint: #eaf8ef;
    --side: 250px;
    --promo: 230px;
    --gap: 14px;
    --row: 360px;
    --circle: 70px;
    padding: 25px 0 10px;
}
@supports (background: color-mix(in srgb, red, blue)) {
    .hx { --tint: color-mix(in srgb, var(--p) 10%, #fff); }
}
.hx *, .hx *::before, .hx *::after { box-sizing: border-box; }
.hx h1, .hx h3, .hx h4, .hx p { margin: 0; }
.hx ul { margin: 0; padding: 0; list-style: none; }
.hx a { text-decoration: none; }

.hx-grid {
    position: relative;
    display: grid;
    grid-template-columns: var(--side) minmax(0, 1fr) var(--promo);
    grid-template-rows: var(--row);
    gap: var(--gap);
}

/* ── منوی دسته‌ها ── */
.hx-cats {
    position: relative;
    display: flex; flex-direction: column;
    min-height: 0;
    background: var(--w);
    border: 1px solid var(--b);
    border-radius: 8px;
}
.hx-cats__head {
    flex: none;
    padding: 13px 18px;
    color: var(--w); font-size: 14px; font-weight: 700;
    background: var(--p);
    border-radius: 7px 7px 0 0;
}
.hx-cats__head i { margin-inline-end: 8px; font-size: 13px; }

.hx-list {
    flex: 1; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: #cfd9d1 transparent;
}
.hx-list::-webkit-scrollbar { width: 5px; }
.hx-list::-webkit-scrollbar-thumb { background: #cfd9d1; border-radius: 5px; }
.hx-list::-webkit-scrollbar-track { background: transparent; }

.hx-cat__link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 18px;
    color: var(--h); font-size: 13.5px;
    border-bottom: 1px solid #f0f3f0;
    transition: background .15s, color .15s;
}
.hx-cat:last-child .hx-cat__link { border-bottom: 0; }
.hx-dot { flex: none; width: 7px; height: 7px; background: var(--p); border-radius: 50%; opacity: .45; }
.hx-cat__arrow { margin-inline-start: auto; color: var(--t); font-size: 10px; opacity: .6; }
.hx-cat__link:hover,
.hx-cat.is-open > .hx-cat__link { color: var(--p); background: var(--tint); }
.hx-cat.is-open .hx-dot { opacity: 1; }
.hx-cat__link:focus-visible { outline: 2px solid var(--p); outline-offset: -2px; }

/* محو شدن پایین لیست = نشانه‌ی اینکه ادامه دارد */
.hx-cats__fade {
    position: absolute; inset-inline: 1px; bottom: 1px; height: 34px;
    background: linear-gradient(to top, #fff, rgba(255, 255, 255, 0));
    border-radius: 0 0 7px 7px;
    pointer-events: none;
}

/* ── زیرمنو ── */
.hx-flywrap {
    display: none;
    position: absolute; z-index: 6;
    top: 0; bottom: 0;
    inset-inline-start: var(--side);
    inset-inline-end: 0;
    padding-inline-start: var(--gap);   /* پل نامرئی تا با رد شدن موس از فاصله بسته نشود */
}
.hx-flywrap.is-open { display: block; animation: hx-in .18s ease both; }
@keyframes hx-in { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }

.hx-fly {
    height: 100%;                       /* هم‌قد هیرو؛ داخل قاب می‌ماند و اگر محتوا زیاد بود اسکرول می‌خورد */
    overflow-y: auto; overscroll-behavior: contain;
    padding: 20px 30px 24px;
    background: var(--w);
    border: 1px solid var(--b);
    border-radius: 8px;
    box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .22);
    scrollbar-width: thin; scrollbar-color: #cfd9d1 transparent;
}
.hx-fly::-webkit-scrollbar { width: 5px; }
.hx-fly::-webkit-scrollbar-thumb { background: #cfd9d1; border-radius: 5px; }
.hx-fly::-webkit-scrollbar-track { background: transparent; }
.hx-fly__top {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px solid var(--b);
}
.hx-fly__top h4 { color: var(--h); font-size: 17px; font-weight: 700; }
.hx-fly__top a { color: var(--p); font-size: 13px; font-weight: 700; }
.hx-fly__top a i { margin-inline-start: 4px; font-size: 10px; }

.hx-fly__cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 30px; align-items: start; }
.hx-col__head {
    display: block; padding-bottom: 8px; margin-bottom: 2px;
    color: var(--h); font-size: 14px; font-weight: 700; line-height: 1.6;
    border-bottom: 1px solid #f0f3f0;
}
.hx-col__head:hover { color: var(--p); }
.hx-col li a { display: block; padding: 5px 0; color: var(--t); font-size: 13px; line-height: 1.7; transition: color .15s, padding .15s; }
.hx-col li a:hover { color: var(--p); padding-inline-start: 5px; }

/* ── بنر: فقط عکس + یک متن ── */
.hx-banner {
    position: relative; display: block; overflow: hidden;
    min-height: 0;
    background: var(--tint);
    border-radius: 8px;
}
.hx-banner__img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .6s;
}
.hx-banner::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .6) 0%, rgba(0, 0, 0, 0) 55%);
}
.hx-banner:hover .hx-banner__img { transform: scale(1.04); }
.hx-banner__text {
    position: absolute; z-index: 1;
    inset-inline: 36px; bottom: 32px;
    max-width: 13em;
    color: #fff; font-size: 34px; font-weight: 700; line-height: 1.55;
}

/* ── پروموها ── */
.hx-side { display: grid; grid-template-rows: 1fr 1fr; gap: var(--gap); min-height: 0; }
.hx-promo { position: relative; display: block; overflow: hidden; background: var(--ch); border-radius: 8px; }
.hx-promo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .45s; }
.hx-promo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0) 60%); }
.hx-promo:hover img { transform: scale(1.06); }
.hx-promo__name { position: absolute; z-index: 1; inset-inline: 18px; bottom: 14px; color: #fff; font-size: 17px; font-weight: 700; line-height: 1.6; }

/* ── دسته‌های گرد (فقط موبایل و تبلت؛ در دسکتاپ مخفی) ── */
.hx-circles { display: none; }

.hx-circles__track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 6px 4px 8px;                 /* جا برای حلقه‌ی دور دایره تا بریده نشود */
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.hx-circles__track::-webkit-scrollbar { display: none; }

.hx-circle {
    flex: none;
    width: calc(var(--circle) + 10px);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    scroll-snap-align: start;
    color: var(--h);
}
/* هر عکسی داخل دایره دقیقاً برش می‌خورد، مستقل از نسبت و اندازه‌ی عکس */
.hx-circle__img {
    position: relative;
    display: block; flex: none;
    width: var(--circle); height: var(--circle);
    border-radius: 50%;
    overflow: hidden;
    background: var(--ch);
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--b);
    transform: translateZ(0);             /* برش گرد در سافاری */
    transition: box-shadow .15s;
}
.hx-circle__img img {
    position: absolute; inset: 0;
    width: 100% !important; height: 100% !important;
    max-width: none !important; margin: 0 !important;
    object-fit: cover; object-position: center;
    border-radius: 50%;
    user-select: none; -webkit-user-drag: none;
}
.hx-circle:active .hx-circle__img { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--p); }
.hx-circle__name {
    max-width: 100%;
    color: var(--h); font-size: 12px; font-weight: 600; line-height: 1.5; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hx-circle:focus-visible { outline: 2px solid var(--p); outline-offset: 4px; border-radius: 10px; }

/* ── تبلت کوچک‌تر از دسکتاپ ── */
@media (max-width: 1199.98px) {
    .hx { --side: 225px; --promo: 200px; --row: 340px; }
    .hx-banner__text { inset-inline: 28px; bottom: 26px; font-size: 28px; }
    .hx-fly { padding: 18px 22px 22px; }
    .hx-fly__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── تبلت و موبایل: منوی کناری مخفی، دسته‌های گرد جایش ── */
@media (max-width: 991.98px) {
    .hx { --gap: 12px; --row: auto; }
    .hx-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .hx-cats, .hx-flywrap { display: none !important; }
    .hx-circles { display: block; grid-column: 1 / 3; min-width: 0; }
    .hx-banner { grid-column: 1 / 3; min-height: 260px; }
    .hx-side { grid-column: 1 / 3; grid-template-columns: 1fr 1fr; grid-template-rows: none; }
    .hx-promo { min-height: 150px; }
}

@media (max-width: 575.98px) {
    .hx { padding: 14px 0 6px; }
    .hx-banner { min-height: 210px; }
    .hx-banner__text { inset-inline: 18px; bottom: 18px; font-size: 22px; }
    .hx-promo { min-height: 130px; }
    .hx-promo__name { inset-inline: 12px; bottom: 10px; font-size: 14.5px; }
}

@media (prefers-reduced-motion: reduce) {
    .hx-flywrap.is-open { animation: none; }
    .hx-banner__img, .hx-promo img, .hx-cat__link, .hx-circle__img { transition: none; }
}