/* TL_HOME_ZONE_LAYOUTS_V1
   Home page rows: every content type (banners, links, benefits, categories, brands, products)
   can be shown as a grid, a scrolling row with arrows (carousel) or a one-at-a-time slider.
   Plus an optional appear effect per row. Works with home-zone-builder.js.
   Inside layer tl-storefront-iphone (the first declared layer) so the older layered
   home rules cannot override the chosen layout. */
@layer tl-storefront-iphone {

/* ---------- shared ---------- */
html:root body .tl-hz-home .tl-hz-zone:is(.tl-hz-layout-carousel, .tl-hz-layout-slider) > .tl-hz-shell {
    position: relative !important;
}
html:root body .tl-hz-home .tl-hz-row-arrow {
    position: absolute;
    z-index: 6;
    top: 50%;
    width: 38px;
    height: 38px;
    margin-top: -19px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    color: #1c1c1e;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    cursor: pointer;
}
html[data-theme="dark"] body .tl-hz-home .tl-hz-row-arrow {
    background: rgba(44,44,46,.94);
    color: #fff;
}
html:root body .tl-hz-home .tl-hz-row-arrow[hidden] { display: none; }
html:root body .tl-hz-home .tl-hz-row-arrow.is-next { left: 4px; }
html:root body .tl-hz-home .tl-hz-row-arrow.is-prev { right: 4px; }
html:root body .tl-hz-home .tl-hz-row-arrow svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
html:root body .tl-hz-home .tl-hz-row-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}
html:root body .tl-hz-home .tl-hz-row-dots button {
    flex: none !important;
    width: 7px !important;
    height: 7px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0;
    border-radius: 999px;
    background: rgba(120,120,128,.4);
    cursor: pointer;
    transition: width .25s ease, background .25s ease;
}
html:root body .tl-hz-home .tl-hz-row-dots button.is-active {
    width: 22px !important;
    background: #007aff;
}

/* ---------- carousel: one scrolling row ---------- */
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-carousel > .tl-hz-shell :is(.tl-hz-media-grid, .tl-hz-link-grid, .tl-hz-entity-grid, .tl-hz-products) {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    grid-auto-columns: calc((100% - (var(--hz-desktop-columns, 4) - 1) * var(--hz-desktop-gap, 16px)) / var(--hz-desktop-columns, 4)) !important;
    gap: var(--hz-desktop-gap, 16px) !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-carousel > .tl-hz-shell :is(.tl-hz-media-grid, .tl-hz-link-grid, .tl-hz-entity-grid, .tl-hz-products)::-webkit-scrollbar {
    display: none;
}
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-carousel > .tl-hz-shell :is(.tl-hz-media-grid, .tl-hz-link-grid, .tl-hz-entity-grid, .tl-hz-products) > * {
    display: flex;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    flex: none !important;
    scroll-snap-align: start;
}
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-carousel > .tl-hz-shell .tl-hz-media-grid > * {
    display: block !important;
}
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-carousel > .tl-hz-shell .tl-hz-products > * {
    display: grid !important;
}

/* ---------- slider: one item at a time ---------- */
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-slider > .tl-hz-shell :is(.tl-hz-media-grid, .tl-hz-link-grid, .tl-hz-entity-grid, .tl-hz-products) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto !important;
    grid-auto-flow: row !important;
    flex-wrap: nowrap !important;
    gap: 0 !important;
    overflow: hidden !important;
}
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-slider > .tl-hz-shell :is(.tl-hz-media-grid, .tl-hz-link-grid, .tl-hz-entity-grid, .tl-hz-products) > * {
    grid-area: 1 / 1 !important;
    width: 100% !important;
    max-width: none !important;
    flex: none !important;
    opacity: 0;
    visibility: hidden;
    transition-property: opacity, transform, visibility;
    transition-duration: var(--hz-slide-duration, 550ms);
    transition-timing-function: ease;
}
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-slider[data-effect="slide"] > .tl-hz-shell :is(.tl-hz-media-grid, .tl-hz-link-grid, .tl-hz-entity-grid, .tl-hz-products) > * {
    transform: translateX(-6%);
}
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-slider > .tl-hz-shell :is(.tl-hz-media-grid, .tl-hz-link-grid, .tl-hz-entity-grid, .tl-hz-products):not(.is-slider-ready) > :first-child,
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-slider > .tl-hz-shell :is(.tl-hz-media-grid, .tl-hz-link-grid, .tl-hz-entity-grid, .tl-hz-products) > .is-active {
    opacity: 1;
    visibility: visible;
    transform: none;
}

/* slider rows use their own arrows; hide the generic scroll-row arrows there */
html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-slider .tl-hz-category-arrow {
    display: none !important;
}

/* ---------- phones: same layouts with the phone column count ---------- */
@media (max-width: 840px) {
    html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-carousel > .tl-hz-shell :is(.tl-hz-media-grid, .tl-hz-link-grid, .tl-hz-entity-grid, .tl-hz-products) {
        grid-auto-columns: calc((100% - (var(--hz-mobile-columns, 2) - 1) * var(--hz-mobile-gap, 10px)) / var(--hz-mobile-columns, 2)) !important;
        gap: var(--hz-mobile-gap, 10px) !important;
    }
    html:root body .tl-hz-home .tl-hz-row-arrow {
        width: 32px;
        height: 32px;
        margin-top: -16px;
    }
}

/* ---------- appear effect (only once JS is ready, so nothing stays hidden without it) ---------- */
html:root body .tl-hz-home.tl-hz-appear-ready .tl-hz-zone:is(.tl-hz-appear-fade, .tl-hz-appear-rise) {
    transition: opacity .6s ease, transform .6s ease;
}
html:root body .tl-hz-home.tl-hz-appear-ready .tl-hz-zone.tl-hz-appear-fade:not(.is-appeared) {
    opacity: 0;
}
html:root body .tl-hz-home.tl-hz-appear-ready .tl-hz-zone.tl-hz-appear-rise:not(.is-appeared) {
    opacity: 0;
    transform: translateY(28px);
}

/* ---------- "see all" link in a row heading ---------- */
html:root body .tl-hz-home .tl-hz-heading > a.tl-hz-heading-cta {
    color: #007aff;
}
html[data-theme="dark"] body .tl-hz-home .tl-hz-heading > a.tl-hz-heading-cta {
    color: #0a84ff;
}

@media (prefers-reduced-motion: reduce) {
    html:root body .tl-hz-home .tl-hz-zone.tl-hz-layout-slider > .tl-hz-shell :is(.tl-hz-media-grid, .tl-hz-link-grid, .tl-hz-entity-grid, .tl-hz-products) > *,
    html:root body .tl-hz-home.tl-hz-appear-ready .tl-hz-zone {
        transition: none !important;
        transform: none !important;
    }
}
/* ---------- TL_HOME_ZONE_PRESETS_V1: product old price (all themes) ---------- */
html:root body .tl-hz-home .tl-hz-product > del.tl-hz-product-old-price {
    display: block;
    margin: 0 0 -4px;
    color: #8e8e93 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.4;
    text-decoration: line-through;
}

/* ---------- theme "card": white box with a thin border (Digikala-like brands strip) ---------- */
html:root body .tl-hz-home .tl-hz-zone.theme-card > .tl-hz-shell {
    padding: 16px 18px 14px !important;
    border: 1px solid rgba(60,60,67,.16) !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: none !important;
}
html[data-theme="dark"] body .tl-hz-home .tl-hz-zone.theme-card > .tl-hz-shell {
    border-color: rgba(84,84,88,.6) !important;
    background: #1c1c1e !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-card .tl-hz-heading {
    margin-bottom: 12px !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-card .tl-hz-heading h2 {
    font-size: 17px !important;
    font-weight: 800 !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-card .tl-hz-heading h2::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 7px;
    vertical-align: -3px;
    background: #f5a623;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.9 6.6 7.1.6-5.4 4.7 1.6 7-6.2-3.7-6.2 3.7 1.6-7L2 9.2l7.1-.6z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.9 6.6 7.1.6-5.4 4.7 1.6 7-6.2-3.7-6.2 3.7 1.6-7L2 9.2l7.1-.6z'/%3E%3C/svg%3E") center / contain no-repeat;
}
html:root body .tl-hz-home .tl-hz-zone.theme-card .tl-hz-entity-grid.is-brands .tl-hz-entity-card {
    min-height: 0 !important;
    gap: 10px !important;
    padding: 8px 6px !important;
    border: 1px solid rgba(60,60,67,.12) !important;
    border-radius: 12px !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: border-color .2s ease, box-shadow .2s ease;
}
html[data-theme="dark"] body .tl-hz-home .tl-hz-zone.theme-card .tl-hz-entity-grid.is-brands .tl-hz-entity-card {
    border-color: rgba(84,84,88,.6) !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-card .tl-hz-entity-grid.is-brands .tl-hz-entity-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.08) !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-card .tl-hz-entity-grid.is-brands .tl-hz-entity-media {
    border-radius: 10px !important;
    background: #fff !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-card .tl-hz-entity-grid.is-brands .tl-hz-entity-card strong {
    color: #3a3a3c !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
}
html[data-theme="dark"] body .tl-hz-home .tl-hz-zone.theme-card .tl-hz-entity-grid.is-brands .tl-hz-entity-card strong {
    color: #ebebf5 !important;
}

/* ---------- theme "amazing": red band for discounted products ---------- */
html:root body .tl-hz-home .tl-hz-zone.theme-amazing > .tl-hz-shell {
    padding: 16px !important;
    border-radius: 18px !important;
    background: linear-gradient(135deg, #ef394e 0%, #d4213c 100%) !important;
    color: #fff !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-amazing .tl-hz-heading,
html:root body .tl-hz-home .tl-hz-zone.theme-amazing .tl-hz-heading :is(h2, p, a) {
    color: #fff !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-amazing .tl-hz-heading h2 {
    font-weight: 900 !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-amazing .tl-hz-heading p {
    opacity: .9;
}
html:root body .tl-hz-home .tl-hz-zone.theme-amazing .tl-hz-heading > a.tl-hz-heading-cta {
    padding: 5px 14px;
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 999px;
    font-weight: 700;
}
html:root body .tl-hz-home .tl-hz-zone.theme-amazing .tl-hz-product {
    border: 0 !important;
    border-radius: 12px !important;
    background: #fff !important;
    color: #1c1c1e !important;
    box-shadow: none !important;
}
html[data-theme="dark"] body .tl-hz-home .tl-hz-zone.theme-amazing .tl-hz-product {
    background: #1c1c1e !important;
    color: #fff !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-amazing .tl-hz-product-media {
    background: #fff !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-amazing .tl-hz-product-media > b {
    background: #ef394e !important;
    color: #fff !important;
}
html:root body .tl-hz-home .tl-hz-zone.theme-amazing .tl-hz-product-price {
    color: inherit !important;
}
@media (min-width: 841px) {
    html:root body .tl-hz-home .tl-hz-zone.theme-amazing > .tl-hz-shell:has(> .tl-hz-heading) {
        display: grid !important;
        grid-template-columns: 150px minmax(0, 1fr);
        align-items: center;
        gap: 14px;
    }
    html:root body .tl-hz-home .tl-hz-zone.theme-amazing > .tl-hz-shell > .tl-hz-heading {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 14px !important;
        margin: 0 !important;
        text-align: center;
    }
    html:root body .tl-hz-home .tl-hz-zone.theme-amazing > .tl-hz-shell > .tl-hz-heading h2 {
        font-size: 26px !important;
        line-height: 1.4 !important;
    }
}

}
