/* Home page (front/index2). Classes start with "hm-" so the site theme can not override them. */
.hm {
    --hm-ink: #111111;
    --hm-muted: #8a8f98;
    --hm-line: #ececec;
    --hm-accent: #fe7e00;
    --hm-accent-soft: #fff4e8;
    --hm-radius: 18px;
    background: #fff;
    color: var(--hm-ink);
    padding: 12px 0 8px;
}
.hm *, .hm *::before, .hm *::after { box-sizing: border-box; }
.hm a { text-decoration: none !important; color: inherit; }
.hm img { max-width: 100%; display: block; }
.hm-container { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 12px; }
@media (min-width: 992px) { .hm-container { padding: 0 20px; } }

/* ---------- arrows (rails + hero) ---------- */
.hm-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
    width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
    background: #fff; color: var(--hm-ink); box-shadow: 0 4px 14px rgba(17, 17, 17, .14);
    display: none; align-items: center; justify-content: center; transition: background .2s, color .2s;
}
.hm-arrow:hover { background: var(--hm-accent); color: #fff; }
.hm-arrow svg { width: 20px; height: 20px; }
.hm-arrow[hidden] { display: none !important; }
.hm-arrow--prev { inset-inline-start: -6px; }
.hm-arrow--next { inset-inline-end: -6px; }
[dir="ltr"] .hm-arrow svg, [dir="ltr"] .hm-head__all svg { transform: scaleX(-1); }

/* ---------- hero + promo (one slide per view) ---------- */
.hm-hero, .hm-promo { position: relative; margin-bottom: 16px; }
.hm-hero__track {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
    border-radius: var(--hm-radius); scrollbar-width: none; background: #f6f6f7;
}
.hm-hero__track::-webkit-scrollbar { display: none; }
.hm-hero__slide { flex: 0 0 100%; scroll-snap-align: center; }
.hm-hero__slide img { width: 100%; height: auto; }
.hm-hero .hm-arrow--prev { inset-inline-start: 16px; }
.hm-hero .hm-arrow--next { inset-inline-end: 16px; }
.hm-dots { position: absolute; bottom: 12px; inset-inline: 0; display: flex; justify-content: center; gap: 6px; z-index: 2; }
.hm-dots button { width: 8px; height: 8px; border-radius: 4px; border: 0; padding: 0; cursor: pointer; background: rgba(255, 255, 255, .7); box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); transition: width .2s, background .2s; }
.hm-dots button.is-active { width: 22px; background: var(--hm-accent); }

/* ---------- section head ---------- */
.hm-section { margin-top: 28px; }
.hm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.hm-head h2 { position: relative; margin: 0; padding-bottom: 8px; font-size: 20px; font-weight: 800; color: var(--hm-ink) !important; }
.hm-head h2::after { content: ""; position: absolute; bottom: 0; inset-inline-start: 0; width: 56px; height: 3px; border-radius: 2px; background: var(--hm-accent); }
.hm-head__all { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; color: var(--hm-accent) !important; white-space: nowrap; }
.hm-head__all svg { width: 16px; height: 16px; }
.hm-head__all:hover { text-decoration: underline !important; }

/* ---------- horizontal rails ---------- */
.hm-rail { position: relative; }
.hm-rail__track {
    --per: 2.2; --gap: 12px;
    display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
    padding: 4px 2px 14px; scrollbar-width: none;
}
.hm-rail__track::-webkit-scrollbar { display: none; }
.hm-rail__track > * { flex: 0 0 calc((100% - (var(--per) - 1) * var(--gap)) / var(--per)); scroll-snap-align: start; min-width: 0; }

/* products */
.hm-rail--products .hm-rail__track { --per: 2.15; }
.hm-rail__item { display: flex; }
.hm-rail__item > .pc { width: 100%; }

/* circles (categories / malls) */
.hm-rail--circles .hm-rail__track { --per: 3.6; --gap: 10px; }
.hm-circle { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.hm-circle__img {
    width: 100%; max-width: 116px; aspect-ratio: 1 / 1; border-radius: 50%; overflow: hidden;
    background: radial-gradient(circle at 50% 40%, #fff 0%, var(--hm-accent-soft) 100%);
    border: 2px solid #fff; box-shadow: 0 0 0 1px #f3e2d0, 0 6px 16px rgba(254, 126, 0, .10);
    display: flex; align-items: center; justify-content: center; transition: transform .25s, box-shadow .25s;
}
.hm-circle__img img { width: 100%; height: 100%; object-fit: cover; }
.hm-circle:hover .hm-circle__img { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--hm-accent), 0 10px 22px rgba(254, 126, 0, .18); }
.hm-circle__name { font-size: 13px; font-weight: 700; line-height: 1.4; color: var(--hm-ink); }
.hm-circle:hover .hm-circle__name { color: var(--hm-accent); }

/* brands */
.hm-rail--brands .hm-rail__track { --per: 3.3; --gap: 10px; }
.hm-brand {
    height: 76px; border: 1px solid var(--hm-line); border-radius: 14px; background: #fff;
    display: flex; align-items: center; justify-content: center; padding: 10px 14px; transition: border-color .2s, box-shadow .2s;
}
.hm-brand img { max-height: 54px; width: auto; object-fit: contain; filter: grayscale(.15); }
.hm-brand:hover { border-color: var(--hm-accent); box-shadow: 0 6px 16px rgba(17, 17, 17, .08); }

/* ---------- discover tiles ---------- */
.hm-explore { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 28px; }
.hm-explore__tile { position: relative; display: block; border-radius: 16px; overflow: hidden; background: #f6f6f7; aspect-ratio: 1 / 1; }
.hm-explore__tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.hm-explore__tile:hover img { transform: scale(1.05); }
.hm-explore__cta {
    position: absolute; bottom: 12px; inset-inline-start: 12px; padding: 5px 14px; border-radius: 16px;
    background: var(--hm-accent); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}
.hm-explore--5 .hm-explore__tile--5, .hm-explore--3 .hm-explore__tile--3 { grid-column: 1 / -1; aspect-ratio: 2 / 1; }

/* ---------- welcome popup ---------- */
.hm-welcome { position: fixed; inset: 0; z-index: 9998; background: rgba(0, 0, 0, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.hm-welcome[hidden] { display: none; }
.hm-welcome__box {
    position: relative; width: 100%; max-width: 440px; padding: 48px 28px 36px; border-radius: 24px; text-align: center;
    background: linear-gradient(160deg, #ff9a2e 0%, var(--hm-accent) 60%, #f06d00 100%); color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35); animation: hm-pop .45s cubic-bezier(.2, 1.3, .4, 1);
}
.hm-welcome__box h2 { color: #fff !important; font-size: 34px; font-weight: 900; margin: 0 0 12px; }
.hm-welcome__box p { color: #fff !important; font-size: 17px; line-height: 1.8; margin: 0 0 26px; }
.hm-welcome__close { position: absolute; top: 12px; inset-inline-end: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.hm-welcome__btn { border: 2px solid #fff; background: transparent; color: #fff; font-size: 17px; font-weight: 800; padding: 12px 40px; border-radius: 30px; cursor: pointer; transition: background .2s, color .2s; font-family: inherit; }
.hm-welcome__btn:hover { background: #fff; color: var(--hm-accent); }
@keyframes hm-pop { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }

/* ---------- tablet ---------- */
@media (min-width: 640px) {
    .hm-rail--products .hm-rail__track { --per: 3; --gap: 16px; }
    .hm-rail--circles .hm-rail__track { --per: 5; --gap: 16px; }
    .hm-rail--brands .hm-rail__track { --per: 5; --gap: 14px; }
    .hm-head h2 { font-size: 22px; }
    .hm-circle__name { font-size: 14px; }
}

/* ---------- desktop ---------- */
@media (min-width: 992px) {
    .hm { padding-top: 20px; }
    .hm-section { margin-top: 36px; }
    .hm-arrow { display: inline-flex; }
    .hm-rail--products .hm-rail__track { --per: 5; --gap: 16px; }
    .hm-rail--circles .hm-rail__track { --per: 7; --gap: 18px; }
    .hm-rail--brands .hm-rail__track { --per: 7; --gap: 16px; }
    .hm-circle__img { max-width: 132px; }
    .hm-brand { height: 86px; }
    .hm-head h2 { font-size: 24px; }

    /* first two tiles stacked, the others tall (like the design) */
    .hm-explore { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 170px; gap: 14px; margin-top: 36px; }
    .hm-explore__tile { aspect-ratio: auto; }
    .hm-explore--5 .hm-explore__tile--1 { grid-column: 1; grid-row: 1; }
    .hm-explore--5 .hm-explore__tile--2 { grid-column: 1; grid-row: 2; }
    .hm-explore--5 .hm-explore__tile--3 { grid-column: 2; grid-row: 1 / span 2; }
    .hm-explore--5 .hm-explore__tile--4 { grid-column: 3; grid-row: 1 / span 2; }
    .hm-explore--5 .hm-explore__tile--5 { grid-column: 4; grid-row: 1 / span 2; aspect-ratio: auto; }
    .hm-explore:not(.hm-explore--5) { grid-auto-rows: 340px; }
    .hm-explore--3 .hm-explore__tile--3 { grid-column: auto; aspect-ratio: auto; }
}

/* featured ads: wide banner, the picture is cropped to the banner size */
.hm-promo--featured { margin-top: 28px; }
.hm-promo--featured .hm-hero__slide img { aspect-ratio: 2 / 1; object-fit: cover; }
@media (min-width: 992px) {
    .hm-promo--featured { margin-top: 36px; }
    .hm-promo--featured .hm-hero__slide img { aspect-ratio: 3.2 / 1; }
}

/* brand logos fill their tile */
.hm-brand img { width: 100%; height: 100%; max-height: none; }

/* brand logos: bigger and sharper (no gray filter, less padding) */
.hm-brand { height: 92px; padding: 6px; border-radius: 16px; }
.hm-brand img { width: 100%; height: 100%; object-fit: contain; filter: none; image-rendering: -webkit-optimize-contrast; }
.hm-rail--brands .hm-rail__track { --per: 3; }
@media (min-width: 640px) { .hm-rail--brands .hm-rail__track { --per: 4.5; } }
@media (min-width: 992px) {
    .hm-rail--brands .hm-rail__track { --per: 6; }
    .hm-brand { height: 120px; padding: 8px; }
}

/* =====================================================================
   App layout (same order / look as the home screen of the mobile app)
   ===================================================================== */
.hm--app .hm-head { align-items: center; margin-bottom: 14px; }
.hm--app .hm-head h2 { padding-bottom: 0; font-size: 19px; font-weight: 800; }
.hm--app .hm-head h2::after { display: none; }
.hm--app .hm-head__all { font-size: 16px; font-weight: 600; }
.hm--app .hm-head__all:hover { text-decoration: none !important; opacity: .8; }

/* malls: tall picture cards, name on the picture */
.hm-rail--malls .hm-rail__track { --per: 2.8; --gap: 12px; }
.hm-mall {
    position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; background: #f1f1f2;
}
.hm-mall img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.hm-mall:hover img { transform: scale(1.05); }
.hm-mall::after { content: ""; position: absolute; inset: 45% 0 0 0; background: linear-gradient(to top, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0)); }
.hm-mall span {
    position: absolute; z-index: 1; inset-inline: 12px; bottom: 12px;
    color: #fff; font-size: 16px; font-weight: 700; line-height: 1.4; text-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}

/* product grids (one dinar, new arrivals) */
.hm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* top brands: centered orange title + big white logo cards */
.hm-title-center { text-align: center; color: var(--hm-accent) !important; font-size: 21px; font-weight: 800; margin: 0 0 16px; }
.hm-brands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.hm--app .hm-brand {
    height: 130px; padding: 18px; border: 0; border-radius: 22px; background: #fff;
    box-shadow: 0 1px 2px rgba(17, 17, 17, .04), 0 8px 24px rgba(17, 17, 17, .06);
}
.hm--app .hm-brand:hover { box-shadow: 0 12px 30px rgba(17, 17, 17, .10); }

/* discover: tall pictures with a black button under each */
.hm-discover { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
.hm-discover__item { display: flex; flex-direction: column; gap: 12px; }
.hm-discover__img { display: block; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; background: #f1f1f2; }
.hm-discover__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.hm-discover__item:hover .hm-discover__img img { transform: scale(1.05); }
.hm-discover__btn {
    display: flex; align-items: center; justify-content: center; height: 48px; border-radius: 24px;
    background: #111; color: #fff; font-size: 16px; font-weight: 700; transition: background .2s;
}
.hm-discover__item:hover .hm-discover__btn { background: var(--hm-accent); }

@media (min-width: 640px) {
    .hm-rail--malls .hm-rail__track { --per: 4; --gap: 16px; }
    .hm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
    .hm-brands { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .hm-discover { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
    .hm--app .hm-head h2 { font-size: 24px; }
    .hm-rail--malls .hm-rail__track { --per: 6; --gap: 18px; }
    .hm-mall span { font-size: 18px; inset-inline: 16px; bottom: 16px; }
    .hm-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
    .hm-title-center { font-size: 26px; }
    .hm-brands { gap: 18px; }
    .hm--app .hm-brand { height: 150px; }
    .hm-discover { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; margin-top: 36px; }
}

/* =====================================================================
   Mobile (like the app): 4 products per grid (the rest in "all"),
   brands 2 x 2 and discover 2 visible, the others scroll sideways
   ===================================================================== */
@media (max-width: 639.98px) {
    .hm-grid > :nth-child(n+5) { display: none; }

    .hm-brands, .hm-discover {
        overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none;
        padding-bottom: 6px;
    }
    .hm-brands::-webkit-scrollbar, .hm-discover::-webkit-scrollbar { display: none; }

    /* two rows, filled column by column: 4 logos visible */
    .hm-brands { grid-template-columns: none; grid-template-rows: repeat(2, auto); grid-auto-flow: column; grid-auto-columns: calc((100% - 14px) / 2); }
    .hm-brands > * { scroll-snap-align: start; }

    .hm-discover { display: flex; }
    .hm-discover__item { flex: 0 0 calc((100% - 14px) / 2); scroll-snap-align: start; }
}

/* long mall names wrap on two lines (like the app) */
.hm-mall span { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* the welcome popup is outside .hm, so it needs its own colors (orange background like before) */
.hm-welcome { --hm-accent: #fe7e00; --hm-accent-soft: #fff4e8; --hm-ink: #111111; }
.hm-welcome__box { background: linear-gradient(160deg, #ff9a2e 0%, #fe7e00 60%, #f06d00 100%); }
