/* ======================================================================
   SAFARI iOS ARABIC FIX — GLOBAL
   Cairo font has Arabic-only unicode-range. Safari iOS does not properly
   fall back to system sans-serif for Latin characters. This rule ensures
   Open Sans is available as an explicit Latin fallback site-wide.
   ====================================================================== */
html[dir="rtl"] body {
    font-family: 'Cairo', 'Open Sans', sans-serif !important;
}

/* ======================================================================
   WRAPPER STRUCTURE
   ====================================================================== */
.home-block-wrapper {
    position: relative;
    isolation: isolate;
    z-index: 1;
}

/* Ensure scroll container doesn't block arrows */
.home-block-wrapper .cms-row.home-block-grid {
    position: relative;
    z-index: 1;
}

/* Ensure arrows are always above scroll container */
.home-block-wrapper {
    position: relative !important;
    isolation: isolate !important;
    z-index: 1;
    overflow: visible !important;
}

.home-block-nav-arrows {
    pointer-events: none !important;
    z-index: 9999 !important;
    position: absolute !important;
    inset: 0;
}

.home-block-nav-arrow {
    pointer-events: auto !important;
    z-index: 10000 !important;
    position: absolute !important;
}

/* Grid remains scrollable - overflow controlled by media queries */
.cms-row.home-block-grid {
    position: relative;
}

/* ======================================================================
   BASE GRID LAYOUT (desktop only - ≥1551px)
   ====================================================================== */
.home-block-grid,
.home-blocks-grid {
    display: grid;
    gap: 6px;
    align-items: stretch;
}

/* Ensure all carousel containers have relative positioning for arrow placement */
.home-block-grid,
.home-blocks-grid,
.cms-row.home-block-grid,
#content-top-modules .cms-row.home-block-grid {
    position: relative;
}

@media (min-width: 1551px) {
    #content-top-modules .cms-row.home-block-grid {
        display: grid !important;
        gap: 6px;
        align-items: stretch;
    }
}

html.home-page .home-block-grid,
html.home-page .home-blocks-grid {
    margin: 5px auto 10px auto;
    max-width: 1880px;
    padding: 0 16px;
}

html.home-page .cms-row.home-block-grid > .journal2_cms_blocks > .box.cms-blocks {
    padding-left: 6px !important;
    padding-right: 6px !important;
}

html.home-page .cms-row.home-block-grid {
    padding: 12px 10px !important;
}

html.home-page .home-block-grid .box.cms-blocks,
html.home-page .home-block-grid .cms-block--journal-cms,
html.home-page .home-blocks-grid .box.cms-blocks,
html.home-page .home-blocks-grid .cms-block--journal-cms {
    float: none !important;
    display: block;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
}

/* ======================================================================
   CARD BASE STYLE
   ====================================================================== */
.home-block-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
    height: 480px;
    max-width: none;
}

.home-block-card .block-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.home-block-card .journal-cms-tiles-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 12px;
    row-gap: 12px;
}

.home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .journal-cms-tiles-grid {
    row-gap: 12px !important;
}

.home-block-card .tile-image {
    height: 135px;
}

.home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-discount-badge .tile-image,
.home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-product-price .tile-image {
    height: 100px;
}

.home-block-card .tile-image img,
.home-block-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .tile-image img {
    object-fit: cover;
    scale: 0.90;
}

.home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile .tile-image img {
    object-fit: cover;
    scale: 0.90;
}

.home-block-card .journal-cms-tile {
    border-radius: 8px;
    padding: 4px 4px 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.home-block-card .journal-cms-tile:not(.product-tile) {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.home-block-card .journal-cms-tile:not(.product-tile) .tile-image {
    flex: 1 1 auto;
    min-height: 0;
}

.home-block-card .tile-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    padding: 0 4px 4px;
    margin-top: auto;
}

.home-block-card .cms-block-more-link {
    margin-top: 12px;
}

.home-block-card .journal-cms-tile.product-tile .sale-badge {
    display: inline-block;
    background: var(--brand-discount-badge, #CC0C39);
    color: #fff;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Single hero image block (applies to both category and product tiles) */
.home-block-card.cms-block-single-tile .journal-cms-tiles-grid {
    grid-template-columns: 1fr;
    height: 100%;
}

.home-block-card.cms-block-single-tile .journal-cms-tile,
.home-block-card.cms-block-single-tile .tile-image {
    height: 100%;
}

.home-block-card.cms-block-single-tile .tile-image img {
    height: 100% !important;
    object-fit: contain !important;
    transform: none !important;
    transform-origin: center center;
}

.home-block-card.cms-block-single-tile .journal-cms-tile.product-tile .tile-image img {
    object-fit: contain !important;
    transform: none !important;
}

.home-block-card.cms-block-single-tile .tile-image {
    position: relative;
    overflow: visible;
}

.home-block-card.cms-block-single-tile .tile-image .sale-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 10;
    margin-top: 0;
}

/* Hero-only: single image, no title, no see-more — image fills entire card */
.home-block-card.cms-block-hero-only {
    padding: 0 !important;
    overflow: hidden;
    border-radius: 10px;
}

.home-block-card.cms-block-hero-only .journal-cms-tiles-grid {
    gap: 0 !important;
    height: 100%;
    width: 100%;
}

.home-block-card.cms-block-hero-only .journal-cms-tile {
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    height: 100%;
    width: 100%;
}

.home-block-card.cms-block-hero-only .tile-image {
    height: 100% !important;
    width: 100% !important;
    overflow: hidden;
}

.home-block-card.cms-block-hero-only .tile-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

.home-block-card.cms-block-hero-only .tile-label {
    display: none;
}

.home-block-card.cms-block-single-product-tile .journal-cms-tile {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
}

.home-block-card.cms-block-single-product-tile .tile-image {
    flex: 1 1 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
    max-height: calc(100% - 80px);
    height: auto;
}

.home-block-card.cms-block-single-product-tile .tile-image img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    transform: none !important;
    transform-origin: center center;
}

.home-block-card.cms-block-single-product-tile .journal-cms-tile.product-tile .tile-product-name,
.home-block-card.cms-block-single-product-tile .journal-cms-tile.product-tile .tile-product-price {
    flex-shrink: 0;
}

/* ======================================================================
   DESKTOP — GRID LAYOUT (≥1551px)
   ====================================================================== */
@media (min-width: 1551px) {
    .home-block-grid,
    .home-blocks-grid {
        display: grid !important;
        grid-template-columns: repeat(5, minmax(300px, 1fr)) !important;
        overflow-x: visible !important;
    }

    .home-block-nav-arrows {
        display: none;
    }

    .home-block-card {
        height: 525px;
    }

    .home-block-card .tile-image {
        height: 150px;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-hero-only) .tile-image img {
        object-fit: contain !important;
        transform: none !important;
    }
    
    /* Hero blocks with products */
    .home-block-card.cms-block-single-tile:not(.cms-block-hero-only) .journal-cms-tile.product-tile .tile-image img {
        object-fit: contain !important;
        transform: none !important;
    }
    
    .home-block-card.cms-block-single-product-tile .tile-image img {
        object-fit: contain !important;
        transform: none !important;
    }

    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .journal-cms-tiles-grid {
        row-gap: 12px !important;
    }
    
    /* Reduce image size when name + badge or name + price are shown */
    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-discount-badge .tile-image,
    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-product-price .tile-image {
        height: 115px;
    }
    
    /* Badge and prices side-by-side for min-width: 1551px */
    .home-block-card .journal-cms-tile.product-tile .tile-product-price {
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }
    
    /* Ensure price wrapper keeps prices side-by-side */
    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
    
    /* Resize images to fit without cropping */
    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .tile-image img {
        object-fit: cover;
        scale: 0.90;
    }
    
    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile .tile-image img {
        object-fit: cover;
        scale: 0.90;
    }


    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) {
        padding: 15px !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .journal-cms-tiles-grid {
        gap: 0 !important;
        height: 100%;
        width: 100%;
        margin-top: -4px;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .journal-cms-tile:not(.product-tile) {
        /* no inner padding/background so we don’t see white strips around the image */
        padding: 0 !important;
        border-radius: 8px !important;
        background: transparent !important;
        height: 100%;
        width: 100%;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .tile-image {
        height: 100% !important;
        width: 100% !important;
        overflow: hidden;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .tile-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block;
    }

}

/* ======================================================================
   MEDIUM DESKTOP — 3-COLUMN GRID (1200px to 1550px)
   ====================================================================== */
@media (min-width: 1200px) and (max-width: 1550px) {
    .home-block-grid,
    .home-blocks-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
        overflow-x: visible !important;
    }

    #content-top-modules .cms-row.home-block-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
        overflow-x: visible !important;
        padding: 12px 10px !important;
    }

    .home-block-nav-arrows {
        display: none;
    }

    .home-block-card {
        height: 500px;
    }

    .home-block-card .tile-image {
        height: 140px;
    }

    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-discount-badge .tile-image,
    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-product-price .tile-image {
        height: 110px;
    }

    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .tile-image img {
        object-fit: cover;
        scale: 0.90;
    }

    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile .tile-image img {
        object-fit: cover;
        scale: 0.90;
    }

    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .journal-cms-tiles-grid {
        row-gap: 12px !important;
    }

    .home-block-card .journal-cms-tile.product-tile .tile-product-price {
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }

    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-hero-only) .tile-image img {
        object-fit: contain !important;
        transform: none !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-hero-only) .journal-cms-tile.product-tile .tile-image img {
        object-fit: contain !important;
        transform: none !important;
    }

    .home-block-card.cms-block-single-product-tile .tile-image img {
        object-fit: contain !important;
        transform: none !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) {
        padding: 15px !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .journal-cms-tiles-grid {
        gap: 0 !important;
        height: 100%;
        width: 100%;
        margin-top: -4px;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .journal-cms-tile:not(.product-tile) {
        padding: 0 !important;
        border-radius: 8px !important;
        background: transparent !important;
        height: 100%;
        width: 100%;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .tile-image {
        height: 100% !important;
        width: 100% !important;
        overflow: hidden;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .tile-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block;
    }
}

/* ======================================================================
   TABLET — 2-COLUMN GRID (768px to 1199px)
   ====================================================================== */
@media (min-width: 768px) and (max-width: 1199px) {
    .home-block-grid,
    .home-blocks-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        overflow-x: visible !important;
    }

    #content-top-modules .cms-row.home-block-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        overflow-x: visible !important;
        padding: 12px 10px !important;
    }

    .home-block-nav-arrows {
        display: none;
    }

    .home-block-card {
        height: 480px;
    }

    .home-block-card .tile-image {
        height: 130px;
    }

    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-discount-badge .tile-image,
    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-product-price .tile-image {
        height: 100px;
    }

    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .tile-image img {
        object-fit: cover;
        scale: 0.90;
    }

    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile .tile-image img {
        object-fit: cover;
        scale: 0.90;
    }

    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .journal-cms-tiles-grid {
        row-gap: 12px !important;
    }

    .home-block-card .journal-cms-tile.product-tile .tile-product-price {
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }

    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-hero-only) .tile-image img {
        object-fit: contain !important;
        transform: none !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-hero-only) .journal-cms-tile.product-tile .tile-image img {
        object-fit: contain !important;
        transform: none !important;
    }

    .home-block-card.cms-block-single-product-tile .tile-image img {
        object-fit: contain !important;
        transform: none !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) {
        padding: 10px !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .journal-cms-tiles-grid {
        gap: 0 !important;
        height: 100%;
        width: 100%;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .journal-cms-tile:not(.product-tile) {
        padding: 0 !important;
        border-radius: 8px !important;
        background: transparent !important;
        height: 100%;
        width: 100%;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .tile-image {
        height: 100% !important;
        width: 100% !important;
        overflow: hidden;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .tile-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block;
    }
}

/* ======================================================================
   MOBILE — HORIZONTAL CAROUSEL (<768px)
   ====================================================================== */
@media (max-width: 768px) {
    .home-block-grid,
    .home-blocks-grid,
    .cms-row.home-block-grid,
    #content-top-modules .cms-row.home-block-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        gap: 6px;
        padding: 0 12px 8px 10px;
        max-width: 100%;
    }

    /* Show scrollbars - styled for all browsers */
    .home-block-grid,
    .home-blocks-grid {
        scrollbar-width: thin; /* Firefox */
        scrollbar-color: #cbd5e0 #f7fafc; /* Firefox: thumb and track */
    }

    /* WebKit scrollbar styling (Chrome, Safari, Edge) */
    .home-block-grid::-webkit-scrollbar,
    .home-blocks-grid::-webkit-scrollbar {
        height: 8px;
    }

    .home-block-grid::-webkit-scrollbar-track,
    .home-blocks-grid::-webkit-scrollbar-track {
        background: #f7fafc;
        border-radius: 4px;
    }

    .home-block-grid::-webkit-scrollbar-thumb,
    .home-blocks-grid::-webkit-scrollbar-thumb {
        background: #cbd5e0;
        border-radius: 4px;
    }

    .home-block-grid::-webkit-scrollbar-thumb:hover,
    .home-blocks-grid::-webkit-scrollbar-thumb:hover {
        background: #a0aec0;
    }

    .home-block-grid > .home-block-card,
    .home-blocks-grid > .home-block-card,
    .cms-row.home-block-grid > .home-block-card,
    #content-top-modules .cms-row.home-block-grid > .home-block-card,
    .home-block-grid > .box.cms-blocks,
    .home-blocks-grid > .box.cms-blocks,
    .cms-row.home-block-grid > .box.cms-blocks,
    #content-top-modules .cms-row.home-block-grid > .box.cms-blocks,
    #content-top-modules .cms-row.home-block-grid > .journal2_cms_blocks > .box.cms-blocks {
        flex: 0 0 300px !important;
        width: 300px !important;
        min-width: 300px !important;
        max-width: none !important;
        flex-shrink: 0 !important;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    .home-block-card,
    .journal-cms-block.home-block-card,
    .box.cms-blocks {
        height: 475px !important;
        max-width: none !important;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .home-block-card .journal-cms-tiles-grid {
        flex: 1 1 auto;
    }

    .home-block-card .cms-block-more-link {
        flex-shrink: 0;
        padding-bottom: 4px;
    }

    /* Reduce padding ONLY for non-hero blocks - more space for images */
    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) {
        padding: 12px !important;
    }

    html[dir="rtl"] .home-block-grid,
    html[dir="rtl"] .home-blocks-grid {
        direction: rtl !important;
        flex-direction: row !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        will-change: scroll-position;
    }

    /* Explicitly cover the row wrapper variant to block late overrides */
    html[dir="rtl"] .cms-row.home-block-grid {
        direction: rtl !important;
        flex-direction: row !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        will-change: scroll-position;
    }

    html[dir="rtl"] .home-block-grid > .home-block-card,
    html[dir="rtl"] .home-blocks-grid > .home-block-card {
        scroll-snap-align: end;
    }

    html[dir="rtl"] .home-block-card {
        direction: rtl !important;
        text-align: right !important;
    }

    html[dir="rtl"] .home-block-card .block-title {
        direction: rtl !important;
        text-align: right !important;
    }

    html[dir="rtl"] .home-block-card .tile-label {
        direction: rtl !important;
        text-align: right !important;
    }

    html[dir="rtl"] .home-block-card .cms-block-more-link {
        direction: rtl !important;
        text-align: right !important;
    }

    /* Safari iOS: ensure Latin text (prices, English names) renders in Arabic mode.
       Cairo font only covers Arabic unicode-range; Safari iOS fails to fall back
       to system sans-serif for Latin chars. Explicitly set Open Sans for Latin content. */
    html[dir="rtl"] .home-block-card .price-number,
    html[dir="rtl"] .home-block-card .price-special,
    html[dir="rtl"] .home-block-card .price-old,
    html[dir="rtl"] .home-block-card .price-regular,
    html[dir="rtl"] .box.cms-blocks .price-number,
    html[dir="rtl"] .box.cms-blocks .price-special,
    html[dir="rtl"] .box.cms-blocks .price-old,
    html[dir="rtl"] .box.cms-blocks .price-regular {
        font-family: 'Open Sans', 'Cairo', sans-serif !important;
        unicode-bidi: isolate;
        direction: ltr;
    }

    html[dir="rtl"] .home-block-card .tile-product-name,
    html[dir="rtl"] .box.cms-blocks .tile-product-name {
        font-family: 'Cairo', 'Open Sans', sans-serif !important;
    }

    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .journal-cms-tiles-grid {
        column-gap: 8px !important;
        row-gap: 4px !important;
    }

    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .tile-image {
        height: 120px !important;
    }

    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .tile-image img {
        object-fit: cover !important;
        scale: 0.90;
    }

    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile .tile-image img {
        object-fit: contain !important;
    }

    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-discount-badge .tile-image,
    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-product-price .tile-image {
        height: 95px !important;
    }

    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .journal-cms-tile {
        padding: 2px 2px 4px !important;
    }

    .home-block-card .journal-cms-tile.product-tile .tile-product-price {
        flex-direction: row !important;
        align-items: center !important;
        gap: 2px !important;
        flex-wrap: nowrap !important;
    }

    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        min-width: 0 !important;
        gap: 6px !important;
    }
    
    /* Allow prices to shrink slightly to fit JOD */
    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper .price-special,
    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper .price-old,
    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper .price-regular {
        flex-shrink: 1 !important;
        min-width: 0 !important;
        overflow: visible !important;
    }

    /* RTL Support for Mobile - Product Name, Price, and Badge */
    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-name {
        direction: rtl !important;
        text-align: right !important;
    }

    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price {
        flex-direction: row-reverse !important;
        direction: ltr !important;
        text-align: right !important;
    }

    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .sale-badge {
        text-align: right !important;
        margin-left: 0 !important;
    }

    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper {
        flex-direction: row-reverse !important;
    }

    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-special,
    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-regular,
    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-old {
        text-align: right !important;
        direction: ltr !important;
    }

    .home-block-nav-arrows {
        display: none;
    }

    /* Make image fill the journal-cms-tiles-grid container for hero non-product blocks,
   but keep the same card padding / inner white container as hero product blocks */
    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) {
        padding: 10px !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .journal-cms-tiles-grid {
        gap: 0 !important;
        height: 100%;
        width: 100%;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .journal-cms-tile:not(.product-tile) {
        /* no inner padding/background so we don’t see white strips around the image */
        padding: 0 !important;
        border-radius: 8px !important;
        background: transparent !important;
        height: 100%;
        width: 100%;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .tile-image {
        height: 100% !important;
        width: 100% !important;
        overflow: hidden;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .tile-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block;
    }

}

/* ======================================================================
   PRODUCT TILE - NAME AND PRICE STYLING
   ====================================================================== */

/* Product name styling */
.home-block-card .journal-cms-tile.product-tile .tile-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-top: 8px;
    line-height: 1.4;
    padding: 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 20px;
}

/* RTL Support - Product Name */
html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-name {
    direction: rtl;
    text-align: right;
}

/* Product price styling */
.home-block-card .journal-cms-tile.product-tile .tile-product-price {
    margin-top: 6px;
    padding: 0 2px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* RTL Support - Product Price Container */
html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price {
    flex-direction: row-reverse !important;
    direction: ltr !important;
    text-align: right !important;
}

/* Badge appears beside prices */
.home-block-card .journal-cms-tile.product-tile .tile-product-price .sale-badge {
    margin-bottom: 0;
    line-height: 1;
    flex-shrink: 0;
}

/* RTL Support - Sale Badge */
html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .sale-badge {
    text-align: right !important;
    margin-left: 0 !important;
}

/* Price wrapper keeps prices side-by-side */
.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    min-width: 0 !important;
    overflow: visible !important;
}

/* RTL Support - Price Wrapper */
html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper {
    flex-direction: row-reverse !important;
}

/* Prices inside wrapper - ensure they stay side-by-side*/
.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper > .price-special,
.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper > .price-old,
.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper > .price-regular {
    display: block !important;
    white-space: nowrap !important;
    min-width: 0 !important;
    overflow: visible !important;
}

.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-special {
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-discount-badge, #CC0C39);
    flex-shrink: 0;
    white-space: nowrap;
}

/* RTL Support - Price Elements */
html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-special,
html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-regular,
html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-old {
    text-align: right !important;
    direction: ltr !important;
}

/* Currency symbol */
.home-block-card .journal-cms-tile.product-tile .tile-product-price .currency-symbol {
    font-size: 9px !important;
    font-weight: 400 !important;
    opacity: 0.7;
    vertical-align: baseline;
    line-height: 1;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* RTL Support - Currency Symbol */
html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .currency-symbol {
    margin-right: 0 !important;
    padding-right: 0 !important;
}

/* Price number - isolate for BiDi stability */
.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-number {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .currency-symbol {
    direction: rtl;
    unicode-bidi: isolate;
    display: inline-block;
}

.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper .price-special,
.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper .price-old {
    flex-shrink: 1;
}

.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-old {
    font-size: 13px;
    color: #999;
    text-decoration: line-through !important;
    font-weight: 400;
    flex-shrink: 0;
    white-space: nowrap;
}

.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-old *,
.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-old span {
    text-decoration: inherit !important;
}

.home-block-card .journal-cms-tile.product-tile .tile-product-price .price-regular {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Single tile adjustments */
.home-block-card.cms-block-single-tile .journal-cms-tile.product-tile .tile-product-name {
    font-size: 16px;
    -webkit-line-clamp: 2;
    line-clamp: 1;
    min-height: 24px;
}

.home-block-card.cms-block-single-tile .journal-cms-tile.product-tile .tile-product-price .price-special {
    font-size: 18px;
}

.home-block-card.cms-block-single-tile .journal-cms-tile.product-tile .tile-product-price .price-regular {
    font-size: 18px;
}

@media (max-width: 500px) {
    .home-block-card {
        height: 510px !important;
    }

    /* Reduce padding ONLY for non-hero blocks on very small screens */
    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) {
        padding: 10px !important;
    }

    /* Make images larger ONLY for non-hero blocks */
    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .tile-image {
        height: 155px !important;
    }

    /* Resize images to fit without cropping on very small screens */
    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .tile-image img {
        object-fit: cover !important;
        scale: 0.90;
    }

    /* Ensure product tiles also resize without cropping on very small screens */
    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile .tile-image img {
        object-fit: contain !important;
    }

    /* Reduce gap even more on very small screens - ONLY for non-hero blocks */
    .home-block-card:not(.cms-block-single-tile):not(.cms-block-single-product-tile) .journal-cms-tiles-grid {
        column-gap: 12px !important;
        row-gap: 12px !important;
    }

    /* Price layout - badge and prices side-by-side on very small screens */
    .home-block-card .journal-cms-tile.product-tile .tile-product-price {
        flex-direction: row !important;
        align-items: center !important;
        gap: 3px !important;
        flex-wrap: nowrap !important;
    }
    
    /* Ensure price wrapper keeps prices side-by-side on very small screens */
    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

    /* Price typography */
    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-special {
        font-size: 14px;
    }

    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-old {
        font-size: 11px;
    }

    /* Ensure prices in wrapper stay side-by-side on mobile */
    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow: visible !important;
    }
    
    /* Ensure each price stays on one line but can shrink to fit JOD */
    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper .price-special,
    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper .price-old,
    .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper .price-regular {
        white-space: nowrap !important;
        min-width: 0 !important;
        overflow: visible !important;
    }

    /* Reduce image size when name + badge or name + price are shown */
    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-discount-badge .tile-image,
    .home-block-card:not(.cms-block-single-product-tile) .journal-cms-tile.product-tile.has-product-name.has-product-price .tile-image {
        height: 120px !important;
    }

    /* RTL Support for Very Small Mobile Screens */
    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-name {
        direction: rtl !important;
        text-align: right !important;
    }

    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price {
        flex-direction: row-reverse !important;
        direction: ltr !important;
        text-align: right !important;
    }

    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .sale-badge {
        text-align: right !important;
        margin-left: 0 !important;
    }

    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-wrapper {
        flex-direction: row-reverse !important;
    }

    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-special,
    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-regular,
    html[dir="rtl"] .home-block-card .journal-cms-tile.product-tile .tile-product-price .price-old {
        text-align: right !important;
        direction: ltr !important;
    }

    /* Make image fill the journal-cms-tiles-grid container for hero non-product blocks,
   but keep the same card padding / inner white container as hero product blocks */
    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) {
        padding: 10px !important;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .journal-cms-tiles-grid {
        gap: 0 !important;
        height: 100%;
        width: 100%;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .journal-cms-tile:not(.product-tile) {
        /* no inner padding/background so we don’t see white strips around the image */
        padding: 0 !important;
        border-radius: 8px !important;
        background: transparent !important;
        height: 100%;
        width: 100%;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .tile-image {
        height: 100% !important;
        width: 100% !important;
        overflow: hidden;
    }

    .home-block-card.cms-block-single-tile:not(.cms-block-single-product-tile):not(.cms-block-hero-only) .tile-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block;
    }

}