/* DARYA product refinement v1.0 — templates 7818 (simple), 7843 (variable).
 * Real Woodmart/Elementor desktop boundary: 1025 CSS px.
 * Existing Custom CSS contains !important gallery sizes and price typography;
 * overrides below are limited to those properties on these two templates.
 * Gallery JS adds darya-gallery-desktop and uses the existing horizontal Swiper.
 */
@media (min-width: 1025px) {
  body.single-product :is(.elementor-7818, .elementor-7843) {
    --darya-accent: #d93811;
    --darya-surface: #fffdfa;
    --darya-gutter: clamp(24px, 2vw, 32px);
  }

  /* Shared content gutters preserve the theme's actual maximum container. */
  body.single-product :is(.elementor-7818, .elementor-7843)
    > :is(.elementor-element-406c625, .elementor-element-6410868,
           .elementor-element-2450289a, .elementor-element-1371a82) {
    box-sizing: border-box;
    padding-inline: var(--darya-gutter);
  }

  /* The first grid item remains in the right column under inherited RTL. */
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-2450289a, .elementor-element-1371a82) > .e-con-inner {
    display: grid;
    grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.56fr);
    align-items: start;
    gap: clamp(18px, 1.8vw, 28px);
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-3a17ec73, .elementor-element-c136d7e,
         .elementor-element-5251ea09, .elementor-element-950ed21,
         .elementor-element-6af49592, .elementor-element-a4c024e) {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    flex: initial !important;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-6af49592, .elementor-element-a4c024e) {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    gap: clamp(12px, 1.2vw, 20px);
    padding: 18px;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-78c35f24, .elementor-element-18d899f,
         .elementor-element-2dacf94e, .elementor-element-7c33959) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-3d549acf, .elementor-element-d7061fe) {
    min-width: 0;
    padding: clamp(12px, 1.25vw, 20px);
  }

  /* G01: native gallery/variation image nodes are retained. */
  body.single-product :is(.elementor-7818, .elementor-7843)
    .woocommerce-product-gallery.darya-gallery-desktop {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    padding: 12px !important;
    margin: 0 !important;
    gap: 12px;
    border: 1px solid #eaded8 !important;
    border-radius: 22px !important;
    background: var(--darya-surface) !important;
    box-shadow: 0 8px 26px rgb(65 31 16 / 5%) !important;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop > :is(.wd-gallery-images, .wd-gallery-thumb) {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-gallery-images {
    order: 0;
    align-self: stretch;
    border: 0 !important;
    border-radius: 16px !important;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .woocommerce-product-gallery__image {
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .woocommerce-product-gallery__image > a {
    display: flex !important;
    width: 100% !important;
    align-items: center;
    justify-content: center;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .woocommerce-product-gallery__image img:not(.zoomImg) {
    display: block;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    margin-inline: auto !important;
    padding: 0 !important;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-gallery-thumb {
    order: 1;
    height: auto;
    overflow: hidden;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-gallery-thumb .wd-carousel-inner {
    position: relative;
    inset: auto;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-gallery-thumb .wd-carousel {
    --wd-gap: 10px;
    height: auto;
    touch-action: pan-y;
    overflow: hidden;
    padding: 3px;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-gallery-thumb .wd-carousel-wrap {
    flex-direction: row;
    align-items: center;
  }
  /* Match the JS slidesPerView:auto setting; no second carousel is created. */
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-gallery-thumb .wd-carousel-item {
    flex: 0 0 76px !important;
    width: 76px !important;
    height: auto;
    padding-inline: 5px !important;
    opacity: 1;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-gallery-thumb .wd-carousel-item img {
    display: block;
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    height: 66px !important;
    aspect-ratio: 1;
    margin: 0 !important;
    padding: 4px !important;
    object-fit: contain !important;
    border: 1px solid #e8dfd9 !important;
    border-radius: 12px !important;
    background: #fff;
    box-shadow: none !important;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-gallery-thumb :is(.wd-thumb-active, [aria-pressed="true"]) img {
    border-color: var(--darya-accent) !important;
    box-shadow: 0 0 0 1px var(--darya-accent) !important;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-gallery-thumb .wd-carousel-item:focus-visible {
    outline: 2px solid var(--darya-accent);
    outline-offset: -2px;
    border-radius: 12px;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-thumb-nav {
    --wd-arrow-width: 36px;
    --wd-arrow-height: 36px;
    --wd-arrow-offset-h: 0px;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop .wd-thumb-nav .wd-arrow-inner::after { rotate: 0deg; }
  body.single-product :is(.elementor-7818, .elementor-7843)
    .darya-gallery-desktop.darya-gallery-single :is(.wd-nav-arrows, .wd-nav-pagin-wrap, .wd-gallery-thumb) {
    display: none !important;
  }

  /* P01: simple product prices come from Jet fields, in separate rows. */
  body.single-product .elementor-7818 .elementor-element-3ccb44f2 > .e-con-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  body.single-product .elementor-7818
    :is(.elementor-element-43d1cd20, .elementor-element-1dd8e5f1) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex: 0 1 auto;
    align-items: flex-start;
    justify-content: flex-start;
  }
  body.single-product .elementor-7818 .elementor-element-1dd8e5f1 {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  body.single-product .elementor-7818
    :is(.elementor-element-44629f9e, .elementor-element-521d7369) {
    width: auto;
    min-width: 0;
    max-width: 100%;
  }
  body.single-product .elementor-7818
    :is(.elementor-element-44629f9e, .elementor-element-521d7369) .jet-listing-dynamic-field__content {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    direction: rtl;
    unicode-bidi: isolate;
    line-height: 1.65 !important;
  }
  body.single-product .elementor-7818 .elementor-element-44629f9e .jet-listing-dynamic-field__content {
    color: #b92f10 !important;
    font-size: clamp(17px, 1.35vw, 23px) !important;
    font-weight: 800 !important;
  }
  body.single-product .elementor-7818 .elementor-element-521d7369 .jet-listing-dynamic-field__content {
    font-size: 13px !important;
    color: #76706b !important;
    text-decoration: line-through !important;
  }
  body.single-product .elementor-7818 .elementor-element-3afccf82 .product-labels {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  body.single-product .elementor-7818
    :is(.elementor-element-3afccf82 .product-label, .elementor-element-523ad959 .stock,
         .elementor-element-523ad959 .stock > span) {
    width: auto;
    max-width: 100%;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
  }
  /* Only hide a repeated visual label when the canonical Woo stock output exists. */
  body.single-product .elementor-7818:has(.elementor-element-523ad959 .stock.out-of-stock)
    .elementor-element-3afccf82 .out-of-stock { display: none; }

  /* Variable products retain native WooCommerce ranges and variation updates. */
  body.single-product .elementor-7843
    :is(.elementor-element-ae4508c, .elementor-element-0062a92) .price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-start;
    gap: 6px 10px;
    line-height: 1.7;
    min-width: 0;
    text-align: start;
    font-size: clamp(17px, 1.35vw, 23px);
  }
  body.single-product .elementor-7843
    :is(.elementor-element-ae4508c, .elementor-element-0062a92) .price :is(del, ins) {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: baseline;
    gap: 6px;
    margin: 0;
    padding: 0;
    background: transparent;
  }
  body.single-product .elementor-7843
    :is(.elementor-element-ae4508c, .elementor-element-0062a92) .price del { font-size: .75em; }
  body.single-product .elementor-7843
    :is(.elementor-element-ae4508c, .elementor-element-0062a92) .price ins { text-decoration: none; }
  body.single-product .elementor-7843
    :is(.elementor-element-ae4508c, .elementor-element-0062a92) .price bdi {
    display: inline-block;
    white-space: nowrap;
    unicode-bidi: isolate;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-523ad959, .elementor-element-0062a92) .stock {
    width: fit-content;
    max-width: 100%;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
  }

  /* B01: same real content width/gutters, no breadcrumb DOM or link changes. */
  body.single-product :is(.elementor-7818, .elementor-7843)
    > :is(.elementor-element-406c625, .elementor-element-6410868) {
    margin-block: 18px 24px;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-5ea3a359, .elementor-element-8cfed46) > .elementor-widget-container {
    padding: 12px 20px;
    border: 1px solid #ebd6cb;
    border-radius: 14px;
    background: linear-gradient(110deg, #fffdfa, #fff0e8);
    box-shadow: 0 3px 14px rgb(104 43 20 / 3%);
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-5ea3a359, .elementor-element-8cfed46) .woocommerce-breadcrumb {
    display: block;
    margin: 0;
    padding: 0;
    color: #572c20;
    font-size: 13px;
    line-height: 1.9;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-5ea3a359, .elementor-element-8cfed46) .woocommerce-breadcrumb > a {
    color: #9b2e14;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-5ea3a359, .elementor-element-8cfed46) .woocommerce-breadcrumb a::after {
    content: none;
  }
  body.single-product :is(.elementor-7818, .elementor-7843)
    :is(.elementor-element-5ea3a359, .elementor-element-8cfed46) .woocommerce-breadcrumb a:focus-visible {
    outline: 2px solid var(--darya-accent);
    outline-offset: 3px;
    border-radius: 3px;
  }

  /* G02: the existing PhotoSwipe owns sizing, zoom, navigation and lifecycle. */
  body.single-product .pswp.darya-lightbox-desktop {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    --wd-otl-color-scheme: #8d2913;
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__bg {
    background: rgb(243 239 233 / 96%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  @supports ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
    body.single-product .pswp.darya-lightbox-desktop .pswp__bg { background: rgb(248 245 240 / 76%); }
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__img {
    border-radius: 18px;
    box-shadow: 0 14px 50px rgb(61 38 24 / 12%);
    background: #fff;
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__top-bar {
    top: max(16px, env(safe-area-inset-top));
    inset-inline: max(16px, env(safe-area-inset-left));
    width: auto;
    background: transparent;
    opacity: 1;
  }
  body.single-product.admin-bar .pswp.darya-lightbox-desktop .pswp__top-bar { top: 48px; }
  body.single-product .pswp.darya-lightbox-desktop .pswp__counter {
    color: #56382d;
    text-shadow: none;
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button {
    opacity: 1;
    width: 46px;
    height: 46px;
    margin-inline: 4px;
    border: 1px solid #dfcec4;
    border-radius: 13px;
    background: rgb(255 255 255 / 94%) !important;
    color: #612c1d;
    box-shadow: 0 3px 14px rgb(69 37 25 / 7%);
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button::before {
    position: static;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: currentColor;
    background: none;
    font: 28px/1 Arial, sans-serif;
    direction: ltr;
    unicode-bidi: isolate;
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button--close::before { content: "×"; }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button--zoom::before { content: "+"; }
  body.single-product .pswp.darya-lightbox-desktop.pswp--zoomed-in .pswp__button--zoom::before { content: "−"; }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button--fs::before { content: "⛶"; }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button--share::before {
    content: "";
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23612c1d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 18 18 6M6 6h12v12'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button--arrow--left {
    top: 50%;
    right: max(18px, env(safe-area-inset-right));
    margin-top: -23px;
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button--arrow--right {
    top: 50%;
    left: max(18px, env(safe-area-inset-left));
    margin-top: -23px;
  }
  body.single-product .pswp.darya-lightbox-desktop [class*="pswp__button--arrow--"] {
    visibility: visible;
    opacity: 1;
  }
  /* Match Woodmart's RTL mapping: its left-named arrow is physically right. */
  body.single-product .pswp.darya-lightbox-desktop .pswp__button--arrow--left::before { content: "›"; }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button--arrow--right::before { content: "‹"; }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button:hover {
    color: #ad2b0d;
    border-color: #b73b1b;
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__button:focus-visible {
    outline: 3px solid #b93716;
    outline-offset: 3px;
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__caption {
    background: transparent;
    color: #4a2d22;
  }
  body.single-product .pswp.darya-lightbox-desktop .pswp__caption__center { color: inherit; }
  body.single-product .pswp.darya-lightbox-desktop.darya-lightbox-single [class*="pswp__button--arrow--"] {
    display: none;
  }
}

@media (min-width: 1025px) and (prefers-reduced-motion: reduce) {
  body.single-product :is(.elementor-7818, .elementor-7843) .darya-gallery-desktop *,
  body.single-product .pswp.darya-lightbox-desktop,
  body.single-product .pswp.darya-lightbox-desktop * { transition: none !important; }
}
