/* Keep Android text autosizing from inflating wide carousel/card text. Browser zoom and the accessibility text controls still work. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;}
/* Image gestures leave vertical page scrolling available. */
.homie-card-gallery > a:first-child,
.homie-card-gallery > div:first-child > a { touch-action: pan-y pinch-zoom; }
.homie-card-gallery .homie-card-prev,
.homie-card-gallery .homie-card-next {
    width: 32px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transform: translateY(-50%);
    transition: opacity .15s ease;
}
.homie-card-gallery .homie-card-prev { left: 4px !important; right: auto !important; }
.homie-card-gallery .homie-card-next { right: 4px !important; left: auto !important; }
@media (hover: hover) and (pointer: fine) {
    .homie-card-gallery .homie-card-prev,
    .homie-card-gallery .homie-card-next { opacity: 0; }
    .homie-card-gallery:hover .homie-card-prev,
    .homie-card-gallery:hover .homie-card-next,
    .homie-card-gallery:focus-within .homie-card-prev,
    .homie-card-gallery:focus-within .homie-card-next { opacity: 1; }
}
.homie-card-gallery .homie-card-prev:focus-visible,
.homie-card-gallery .homie-card-next:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* The legacy widget slider omits a mobile slide width. Keep its card inside the track. */
@media (max-width: 767px) {
    body.cms-index-index .hyva-category .js_slides { min-width: 0; max-width: 100%; scroll-snap-type: x mandatory; }
    body.cms-index-index .hyva-category .js_slides > .js_slide {
        flex: 0 0 100%; width: 100%; min-width: 0; max-width: 100%;
        margin-left: 0; margin-right: 0; scroll-snap-align: start;
    }
    body.cms-index-index .hyva-category .js_slide > .card {
        box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%;
        margin-left: 0; margin-right: 0;
    }
    body.cms-index-index .hyva-category .homie-card-gallery { width: 100%; min-width: 0; max-width: 100%; }
    body.cms-index-index .hyva-category .homie-card-gallery img { width: 100%; max-width: 100%; height: auto; }
}

/* The curated Discover More strip uses rectangular product tiles, not circular crops. */
body.cms-index-index .popular-categories-wrapper,
body.cms-index-index .popular-categories-wrapper .home-widgets,
body.cms-index-index .popular-categories-wrapper .block-content { display: block !important; }
body.cms-index-index .popular-categories-wrapper .home-widgets .block-content > .grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: start;
}
body.cms-index-index .popular-categories-wrapper .home-widgets .product-item { min-width: 0; }
body.cms-index-index .popular-categories-wrapper .home-widgets .homie-card-gallery {
    display: block !important; width: 100% !important; min-width: 0; max-width: 100%;
}
body.cms-index-index .popular-categories-wrapper .home-widgets .homie-card-gallery > a {
    display: block !important; width: 100%;
}
body.cms-index-index .popular-categories-wrapper .home-widgets .homie-card-gallery > a > div {
    width: 100% !important; height: auto !important; border-radius: 0 !important; background: #f7f6f3;
}
body.cms-index-index .popular-categories-wrapper .home-widgets .homie-card-gallery img.product-image-photo {
    display: block; width: 100% !important; height: auto !important;
    aspect-ratio: 4 / 3; border-radius: 0 !important; object-fit: contain !important;
}
@media (max-width: 1024px) {
    body.cms-index-index .popular-categories-wrapper .home-widgets .block-content > .grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}
@media (max-width: 640px) {
    body.cms-index-index .popular-categories-wrapper .home-widgets .block-content > .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 16px;
    }
}

/* One rhythm between homepage content sections; card/CTA spacing stays independent. */
body.cms-index-index {
    --homie-home-section-gap: var(--homie-section-gap,60px);
    --homie-home-heading-gap: var(--homie-heading-gap,22px);
    --homie-home-card-gap: var(--homie-card-gap,24px);
}
@media (min-width: 768px) and (max-width: 1023px) {
    body.cms-index-index { --homie-home-section-gap: var(--homie-section-gap,60px); --homie-home-heading-gap: var(--homie-heading-gap,22px); }
}
body.cms-index-index .column.main > :is(
    .hyva-banner-slider, .home-panel,
    .overflow-hidden:has(> .hyva_multi_field), .overflow-hidden:has(> .hyva-category),
    .homie-blog-carousel, .popular-categories-wrapper, .homie-popular-carousel, .homie-inspiration,
    [class*="elfsight-app-"]
) {
    margin-block: 0 !important;
    display: flow-root;
}
body.cms-index-index .column.main > :is(
    .hyva-banner-slider, .home-panel,
    .overflow-hidden:has(> .hyva_multi_field), .overflow-hidden:has(> .hyva-category),
    .homie-blog-carousel, .popular-categories-wrapper, .homie-popular-carousel, .homie-inspiration,
    [class*="elfsight-app-"]
) ~ :is(
    .hyva-banner-slider, .home-panel,
    .overflow-hidden:has(> .hyva_multi_field), .overflow-hidden:has(> .hyva-category),
    .homie-blog-carousel, .popular-categories-wrapper, .homie-popular-carousel, .homie-inspiration,
    [class*="elfsight-app-"]
) { margin-block-start: var(--homie-home-section-gap) !important; }
/* Neutralize the widgets' vertical overflow gutters and authored outer margins. */
body.cms-index-index .column.main > .overflow-hidden:has(> :is(.hyva_multi_field, .hyva-category)) {
    padding-block: 0 !important;
}
body.cms-index-index .column.main > .overflow-hidden > :is(.hyva_multi_field, .hyva-category) {
    margin-block: 0 !important;
}
body.cms-index-index .column.main > .home-panel { padding-block: 0; }
body.cms-index-index .column.main > .home-panel > .container > .grid:last-child { margin-bottom: 0; }
body.cms-index-index .column.main > [class*="elfsight-app-"] .es-embed-root { margin-block: 0 !important; }
@media (max-width: 767px) {
    body.cms-index-index {
        --homie-home-section-gap: var(--homie-section-gap,36px);
        --homie-home-heading-gap: var(--homie-heading-gap,18px);
        --homie-home-card-gap: var(--homie-card-gap,16px);
    }
    /* Every authored manual category panel remains available on mobile. */
    body.cms-index-index .column.main > .home-panel { display: block; }
    body.cms-index-index .home-panel > .container { padding-inline: 12px; }
    body.cms-index-index .home-panel .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
    body.cms-index-index .home-panel a.group { min-width: 0; aspect-ratio: 4 / 3; height: auto; }
    body.cms-index-index .home-panel a.group > img { width: 100%; height: 100%; object-fit: cover; }
    body.cms-index-index .home-panel a.group > span {
        max-width: calc(100% - 12px); white-space: normal; font-size: 16px; line-height: 1.3;
        padding: 8px 10px; bottom: 8px; text-align: center;
    }
}

/* Nov 3: natural RTL copy and compact product details, without rewriting catalog content. */
body.catalog-product-view :is(.product-description, .homie-pdp-description) :is(h1,h2,h3,h4,h5,h6,p,li,span) {
    text-align: start !important; text-align-last: auto !important;
    word-spacing: normal !important; letter-spacing: normal !important;
    white-space: normal !important; word-break: normal; overflow-wrap: break-word;
}
body.catalog-product-view :is(.product-description, .homie-pdp-description) :is(h1,h2,h3,h4,h5,h6) {
    display: block !important; line-height: 1.4; margin-block: 16px 8px;
}
body.catalog-product-view .homie-pdp-info .product-options-swatches-wrapper:not(:has(*)) { display: none; }
body.catalog-product-view .homie-pdp-info .product-options-swatches-wrapper { margin-block: 16px 24px; }
body.catalog-product-view .homie-pdp-info #product_addtocart_form { margin-bottom: 12px; }
body.catalog-product-view .homie-pdp-info #product_addtocart_form > .relative { margin-bottom: 12px; }
body.catalog-product-view .homie-pdp-info .homie-pdp-purchase { margin-block: 24px 16px; gap: 16px; }
body.catalog-product-view .homie-pdp-purchase > .flex { margin-top: 0; gap: 16px; }
body.catalog-product-view #product-attributes :is(th,td) { padding-block: 6px; line-height: 1.5; }
/* Allow native page panning around the image and at thumbnail-rail boundaries. */
body.catalog-product-view #gallery .pdp_center_img:not(.fixed) { touch-action: pan-y; }
body.catalog-product-view #gallery #gallery-thumbs,
body.catalog-product-view #gallery #gallery-thumbs nav {
    overscroll-behavior: auto !important; touch-action: auto !important;
}
@media (max-width: 767px) {
    body.catalog-product-view h1.page-title {
        font-size: 24px; line-height: 1.4; text-align: start; margin-block: 12px 16px;
        white-space: normal; word-break: normal; overflow-wrap: break-word; text-wrap: balance;
    }
    body.catalog-product-view .breadcrumbs .items {
        flex-wrap: wrap; margin-inline: 0; padding-block: 10px; gap: 4px 0; overflow: visible;
    }
    body.catalog-product-view .breadcrumbs .items > li[aria-hidden] { display: none; }
    body.catalog-product-view .breadcrumbs .item {
        white-space: normal; min-width: 0; max-width: 100%; line-height: 1.5;
    }
    body.catalog-product-view .breadcrumbs .item a { overflow-wrap: break-word; }
    body.catalog-product-view #gallery { flex-direction: column !important; padding-inline: 0 !important; gap: 8px; }
    body.catalog-product-view #gallery .pdp_center_img:not(.fixed) { width: 100% !important; }
    body.catalog-product-view #gallery #gallery-thumbs {
        position: relative !important; inset: auto !important; width: 100% !important;
        height: auto !important; min-height: 0 !important; max-height: none !important;
        padding-block: 4px !important; overflow: visible !important;
    }
    body.catalog-product-view #gallery #gallery-thumbs nav {
        display: flex; flex-direction: row !important; height: auto !important;
        min-height: 0 !important; max-height: none !important; width: 100%;
        overflow-x: auto !important; overflow-y: hidden !important;
    }
    body.catalog-product-view #gallery #gallery-thumbs nav > button {
        flex: 0 0 72px; width: 72px; height: 72px;
    }
    body.catalog-product-view #gallery #gallery-thumbs nav > button img {
        width: 100%; height: 100%; object-fit: contain;
    }
    body.catalog-product-view .homie-pdp-info .swatch-attribute > .flex { padding-block: 8px; }
    body.catalog-product-view .homie-pdp-info .product-custom-tabs-wrapper { margin-top: 16px; }
    body.cms-index-index :is(.hyva-category .title-font, .hyva_multi_field .title-font,
        .popular-categories-wrapper h2.text-3xl, .homie-blog-carousel h2) { font-weight: 700; }
}

/* Mobile manual categories: Modern Rugs leads, followed by two balanced pairs. */
@media (max-width: 767px) {
    body.cms-index-index .home-panel:not(.home-panel-middle) > .container {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
    }
    body.cms-index-index .home-panel:not(.home-panel-middle) > .container > .grid {
        display: contents;
    }
    body.cms-index-index .home-panel:not(.home-panel-middle) > .container > .grid:first-child > div:first-child {
        grid-column: 1 / -1;
    }
    body.cms-index-index .home-panel:not(.home-panel-middle) > .container > .grid:first-child > div:first-child > a.group {
        aspect-ratio: 16 / 9;
    }
}

/* Keep hover feedback inside carousel bounds and preserve each card's border. */
body.cms-index-index :is(.hyva-category .card-interactive, .homie-blog-card, .homie-inspiration article) {
    transition: border-color .2s ease, box-shadow .2s ease;
}
body.cms-index-index :is(.hyva-category .card-interactive, .homie-blog-card, .homie-inspiration article):is(:hover, :focus-within) {
    --card-stroke: #83b9d8;
    border-color: #83b9d8;
    box-shadow: inset 0 0 0 1px #83b9d8;
}
@media (prefers-reduced-motion: reduce) {
    body.cms-index-index :is(.hyva-category .card-interactive, .homie-blog-card, .homie-inspiration article) {
        transition: none;
    }
}

/* New products: keep navigation at the image midpoint and away from per-card arrows. */
body.cms-index-index .homie-latest-slider { position: relative; margin-inline: 44px; }
body.cms-index-index .homie-latest-slider :is(.homie-latest-prev,.homie-latest-next) {
    position: absolute; top: var(--homie-latest-arrow-top, 30%);
    z-index: 22; transform: translateY(-50%);
    display: grid; place-items: center; width: 44px; height: 44px;
    direction: ltr; unicode-bidi: isolate;
    border: 1px solid #d4d4d4; border-radius: 50%; background: white; color: #171717;
    box-shadow: 0 2px 6px rgb(0 0 0 / .16);
}
body.cms-index-index .homie-latest-slider .homie-latest-prev { right: -44px; }
body.cms-index-index .homie-latest-slider .homie-latest-next { left: -44px; }
body.cms-index-index .homie-latest-slider button:disabled { opacity: .4; cursor: default; }
body.cms-index-index .homie-latest-slider button[\@click="scrollPrevious"],
body.cms-index-index .homie-latest-slider button[\@click="scrollNext"] { display: none; }
body.cms-index-index .hyva-category .homie-card-gallery :is(.homie-card-prev,.homie-card-next) { opacity: 1; }
body.cms-index-index .homie-blog-carousel .homie-blog-card .post-title { min-block-size: 2.8em; }
@media (max-width: 767px) {
    body.cms-index-index .homie-blog-carousel .homie-blog-card .post-title { min-block-size: 0; }
}

/* Keep size options in consistent cells and align the purchase controls with them. */
body.catalog-product-view .homie-pdp-info .swatch-attribute.size .product-option-values {
    margin-inline: 0;
}
body.catalog-product-view .homie-pdp-info .swatch-attribute.size .swatch-attribute-options {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 82px), 1fr)) !important;
    gap: 8px;
    margin-inline: 0;
}
body.catalog-product-view .homie-pdp-info .swatch-attribute.size .swatch-attribute-options > div {
    min-width: 0;
    margin: 0;
}
body.catalog-product-view .homie-pdp-info .swatch-attribute.size .swatch-option {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 44px;
    height: 100%;
    padding: 5px;
    text-align: center;
    white-space: normal;
}
body.catalog-product-view .product-info-main {
    margin-bottom: 0 !important;
}
@media (max-width: 767px) {
    body.catalog-product-view :is(h1.page-title, .homie-pdp-info h2) {
        text-wrap: pretty;
        word-break: normal;
        overflow-wrap: normal;
        hyphens: none;
    }
    body.catalog-product-view .homie-pdp-purchase > .flex:first-child {
        width: 100%;
        margin-inline: 0;
    }
}

/* Match homepage headings to the content that follows them. */
body.cms-index-index :is(.hyva_multi_field, .hyva-category) .title-font,
body.cms-index-index :is(.popular-categories-wrapper, .homie-inspiration) > h2,
body.cms-index-index .homie-blog-carousel > .title {
    margin-block-end: var(--homie-home-heading-gap) !important;
}
body.cms-index-index :is(.hyva_multi_field, .hyva-category) .title-font + *,
body.cms-index-index :is(.popular-categories-wrapper, .homie-inspiration) > h2 + *,
body.cms-index-index .homie-blog-carousel > .title + * {
    margin-block-start: 0 !important;
}
body.cms-index-index .hyva-category .js_slide {
    padding-inline: calc(var(--homie-home-card-gap) / 2) !important;
}
body.cms-index-index .popular-categories-wrapper .block-products-list .grid.gap-4 {
    gap: var(--homie-home-card-gap) !important;
}
/* RTL places the legacy previous control on the right. Keep the icon facing out. */
body.cms-index-index button[\@click="scrollPrevious"]:dir(rtl) svg,
body.cms-index-index button[\@click="scrollNext"]:dir(rtl) svg {
    transform: scaleX(-1);
}

/* PDP size labels need room for Hebrew round sizes as well as dimensions. */
@media (max-width: 767px) {
    body.catalog-product-view .homie-pdp-info .swatch-attribute.size .swatch-attribute-options {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr)) !important;
    }
    body.catalog-product-view .homie-pdp-info .swatch-attribute.size .swatch-option {
        min-width: 0;
        min-height: 44px;
        padding: 8px 10px;
    }
    body.catalog-product-view .homie-pdp-info .swatch-attribute.size .swatch-option > div {
        min-width: 0;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.35;
    }
}

/* Do not hide tall homepage sections behind a 50%-intersection animation. */
body.cms-index-index #maincontent .hyva-category{opacity:1!important;transform:none!important;transition:none!important;}
@media(max-width:767px){
 body.cms-index-index #maincontent .hyva-banner-slider .banner-media-container img{height:auto!important;aspect-ratio:2/1;object-fit:cover;object-position:right center;}
 body.cms-index-index .hyva_multi_field-content-data > div:first-child .text-center > p,
 body.cms-index-index .hyva-category-content > p{font-size:15px;line-height:1.5;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;margin-block:12px 0;}
}

/* Nov12: photo links gained a wrapper; keep native New/Featured track swipes available over photos. */
@media(max-width:767px){
 body.cms-index-index #maincontent :is(.homie-latest-slider,.homie-featured-track) .homie-card-gallery > div:first-child > a,
 body.cms-index-index #maincontent :is(.homie-latest-slider,.homie-featured-track) .homie-card-gallery > a:first-child {
  touch-action:pan-x pan-y pinch-zoom!important;
 }
}

/* Product media reserves its frame before images/Alpine. Editorial tiles keep their own ratios.
   Opt-in grid classes deliberately outrank legacy square-image and one-line-title rules. */
body #maincontent .product-item.card.homie-product-card .homie-card-media,
body #maincontent .homie-card-gallery.homie-widget-product-card .homie-card-media {
    display:block; position:relative; width:100%; aspect-ratio:3 / 4; overflow:hidden;
}
body #maincontent .product-item.card.homie-product-card .homie-card-media > div {
    position:absolute; inset:0; width:100%; height:100%;
}
body #maincontent .product-item.card.homie-product-card .homie-card-gallery .homie-card-media img,
body #maincontent .homie-card-gallery.homie-widget-product-card .homie-card-media img {
    display:block; width:100%!important; height:100%!important; max-height:none!important;
    aspect-ratio:auto!important; object-fit:contain!important; object-position:center;
}
body #maincontent .product-item.card.homie-product-card .homie-product-name,
body #maincontent .homie-card-gallery.homie-widget-product-card .homie-card-name {
    min-height:2.8em!important; height:auto!important; line-height:1.4!important;
}
body #maincontent .product-item.card.homie-product-card .homie-product-name .product-item-link,
body #maincontent .homie-card-gallery.homie-widget-product-card .homie-card-name {
    display:-webkit-box!important; -webkit-box-orient:vertical; -webkit-line-clamp:2!important;
    white-space:normal!important; overflow:hidden!important; text-overflow:ellipsis;
}
body #maincontent .product-item.card.homie-product-card .homie-card-bottom,
body #maincontent .homie-card-gallery.homie-widget-product-card .homie-card-bottom {
    margin-block-start:auto; display:flex; flex-direction:column;
}
body #maincontent .homie-card-gallery.homie-widget-product-card { width:100%; min-width:0; }
body #maincontent .homie-card-reviews { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:.375em; }
body #maincontent .homie-card-review-count { font-size:.875em; line-height:1.4; }
.homie-card-nav-reserve { display:none; }
@media(max-width:767px) {
    body:not(.cms-index-index) #maincontent .homie-product-card .homie-card-nav-reserve,
    body:not(.cms-index-index) #maincontent .homie-widget-product-card .homie-card-nav-reserve { display:block; min-height:44px; }
    body.cms-index-index #maincontent .homie-product-card .homie-card-nav-reserve,
    body.cms-index-index #maincontent .homie-widget-product-card .homie-card-nav-reserve { display:block; min-height:32px; }
    body.cms-index-index #maincontent .homie-product-card .homie-card-dots,
    body.cms-index-index #maincontent .homie-widget-product-card > .homie-card-dots { min-height:32px; }
}
/* Existing accessibility text mode keeps complete names available and natural heights. */
html[data-homie-large-text] body #maincontent .product-item.card.homie-product-card .homie-product-name .product-item-link,
html[data-homie-large-text] body #maincontent .homie-card-gallery.homie-widget-product-card .homie-card-name {
    -webkit-line-clamp:unset!important; overflow:visible!important;
}
