/* ELORÉNE V29. All overrides are restricted to the main product section. */
#MainContent[data-template^="product"] .elorene-pdp {
  display: block;
  --pdp-border: #dededb;
  --pdp-panel-gap: clamp(40px, 4vw, 64px);
  --pdp-image-limit: min(var(--pdp-media-height, 640px), max(360px, calc(100svh - var(--header-group-height, 0px) - 48px)));

  .product-information {
    display: block;
    max-width: var(--pdp-max-width, 1440px);
    margin-inline: auto;
    padding: 32px clamp(24px, 3vw, 48px) 48px;
  }
  .product-information__grid,
  .product-information__grid:not(.product-information--media-none) {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) !important;
    column-gap: var(--pdp-panel-gap) !important;
    align-items: start;
    width: 100%;
  }
  .product-information__media,
  .product-details {
    grid-column: auto !important;
    padding: 0 !important;
    width: 100%;
    min-width: 0;
  }
  .product-details {
    position: static;
    max-width: none;
    align-self: start;
  }
  &[data-sticky="true"] .product-details {
    position: sticky;
    top: var(--pdp-sticky-top, calc(var(--sticky-header-offset, 0px) + 16px));
  }
  .product-information__grid.product-information--media-none {
    grid-template-columns: minmax(0, 620px) !important;
    justify-content: center;
  }
  .product-information--media-none .product-details { margin: 0; width: 100%; }
  .product-details > .group-block {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }
  .product-details .group-block-content { gap: 16px; }
  .product-details .group-block:has(> .group-block-content > product-price) > .group-block-content { gap: 12px; }
  .product-details h1 {
    font-size: clamp(21px, 1.6vw, 26px) !important;
    line-height: 1.24 !important;
    letter-spacing: -.015em;
    margin: 0;
  }
  .product-details product-price { font-size: 17px !important; line-height: 1.4; }
  .product-details product-price .price { font-weight: 600; }
  .product-details product-price .compare-at-price { color: #6a6a6a; font-size: 14px; text-decoration: line-through; }

  /* Re-enable Horizon controls hidden by the prior PDP customization. */
  media-gallery.media-gallery--carousel {
    position: static;
    background: transparent;
    overflow: visible;
    min-width: 0;
  }
  media-gallery.media-gallery--carousel slideshow-component { gap: 14px; min-width: 0; }
  media-gallery.media-gallery--carousel slideshow-container { min-width: 0; overflow: hidden; }
  media-gallery.media-gallery--carousel slideshow-controls { display: flex !important; }
  media-gallery.media-gallery--carousel .media-gallery__mobile-controls { display: block !important; }
  media-gallery.media-gallery--carousel .media-gallery__mobile-controls.desktop\:hidden { display: none !important; }
  media-gallery.media-gallery--carousel .product-media-container {
    max-height: var(--pdp-image-limit);
    --constrained-height: var(--pdp-image-limit);
    min-height: 0;
    background: #f6f6f4 !important;
  }
  media-gallery.media-gallery--carousel .product-media-constraint-wrapper {
    width: 100% !important;
    max-width: 100%;
    height: 100%;
  }
  media-gallery.media-gallery--carousel .product-media {
    width: 100% !important;
    height: 100%;
    max-height: var(--pdp-image-limit);
  }
  media-gallery.media-gallery--carousel .product-media__image {
    width: 100% !important;
    height: 100% !important;
    max-height: var(--pdp-image-limit);
    object-fit: contain !important;
    object-position: center;
    background: #f6f6f4;
  }
  media-gallery.media-gallery--carousel :is(video, iframe, model-viewer, .deferred-media__poster-image) { object-fit: contain !important; }
  /* Zoom keeps its own full-screen canvas and natural image size. */
  media-gallery .dialog-zoomed-gallery .product-media-container,
  media-gallery .dialog-zoomed-gallery .product-media,
  media-gallery .dialog-zoomed-gallery .product-media__image { max-height: none !important; }
  media-gallery .dialog-zoomed-gallery .product-media__image { height: auto !important; }
  .slideshow-controls__thumbnails-container { scrollbar-width: thin; scrollbar-color: #c7c7c3 transparent; }
  .slideshow-controls__thumbnails { gap: 12px; padding: 2px; }
  .slideshow-controls__thumbnail {
    flex-shrink: 0;
    padding: 0;
    border: 1px solid transparent;
    background: #f6f6f4;
    aspect-ratio: 3 / 4 !important;
    border-radius: 0;
  }
  .slideshow-controls__thumbnail img { object-fit: contain; }
  .slideshow-controls__thumbnail[aria-selected="true"] { outline: 1px solid #111; outline-offset: 0; }
  media-gallery.media-gallery--carousel slideshow-arrows { mix-blend-mode: normal !important; }
  media-gallery.media-gallery--carousel slideshow-arrows .slideshow-control {
    color: #111 !important;
    background: rgb(255 255 255 / .78) !important;
    height: 44px !important;
    min-height: 44px !important;
    opacity: .8 !important;
  }
  media-gallery.media-gallery--carousel slideshow-arrows .slideshow-control[disabled] { opacity: 0 !important; }

  .elorene-pdp-inventory { display: block; width: 100%; }
  .elorene-pdp-inventory:not(:has(p)) { display: none; }
  .elorene-pdp-inventory__content { display: grid; gap: 10px; }
  .elorene-pdp-inventory p { margin: 0; font-size: 12px; line-height: 1.5; }
  .elorene-pdp-urgency { font-weight: 600; letter-spacing: .045em; }
  .elorene-pdp-stock { display: flex; align-items: center; gap: 8px; }
  .elorene-pdp-stock__dot { width: 7px; height: 7px; border-radius: 50%; background: #9c9c9c; flex: 0 0 7px; }
  .elorene-pdp-stock[data-available="true"] .elorene-pdp-stock__dot { background: #38884d; box-shadow: 0 0 0 3px #38884d12; }
  .elorene-pdp-benefits:not(:has(p)) { display: none; }
  .elorene-pdp-benefits { display: grid; gap: 8px; width: 100%; }
  .elorene-pdp-benefits p { display: flex; gap: 9px; align-items: flex-start; margin: 0; font-size: 12px; line-height: 1.5; }
  .elorene-pdp-benefits svg { width: 18px; height: 18px; flex: 0 0 18px; }
  .elorene-pdp-benefits a { color: inherit; text-decoration: none; }
  .elorene-pdp-benefits a:hover { text-decoration: underline; }

  variant-picker .variant-picker__form { display: grid; gap: 18px; }
  variant-picker .variant-option { margin: 0; min-width: 0; }
  variant-picker .variant-option legend { font-size: 11px !important; letter-spacing: .09em; margin-bottom: 8px; }
  variant-picker .variant-option--buttons:not(.variant-option--swatches):not(.elorene-color-option),
  variant-picker .elorene-color-option {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px !important;
    width: 100%;
  }
  variant-picker .variant-option--buttons legend { width: 100%; }
  variant-picker .variant-option--buttons .variant-option__button-label,
  variant-picker .elorene-color-option .variant-option__button-label {
    width: auto !important;
    min-width: 44px !important;
    height: auto !important;
    min-height: 44px !important;
    max-width: 100%;
    flex: 0 1 auto !important;
    padding: 10px 13px !important;
    border: 1px solid var(--pdp-border) !important;
    border-radius: 0 !important;
    background: #fff !important;
    color: #171717;
    font-size: 12px;
    line-height: 1.3;
    overflow-wrap: anywhere;
    box-shadow: none;
  }
  variant-picker .elorene-color-option .variant-option__button-label__text { display: inline !important; }
  variant-picker .variant-option__button-label__pill { display: none !important; }
  variant-picker .variant-option__button-label:has(input:checked) { border-color: #111 !important; box-shadow: inset 0 0 0 .5px #111; }
  variant-picker .elorene-color-option .variant-option__button-label:has(input:checked)::after { display: none; }
  variant-picker .variant-option__button-label:has(input:disabled) { opacity: .4; text-decoration: line-through; cursor: not-allowed; }
  variant-picker .variant-option__button-label:has(input:focus-visible) { outline: 2px solid #111; outline-offset: 3px; }
  variant-picker .variant-option--swatches .variant-option__button-label { padding: 7px !important; }

  variant-picker .variant-option[data-testid="variant-option-single"] { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
  .product-form-buttons { gap: 12px; }
  .product-form-buttons > add-to-cart-component { flex-basis: 100%; min-width: 0; }
  &[data-show-quantity="false"] .product-form-buttons:not(:has(.quantity-rules)) > .quantity-selector-wrapper { display: none; }
  .buy-buttons-block .add-to-cart-button {
    width: 100% !important;
    min-height: 50px;
    padding: 14px 16px;
    background: #111;
    color: #fff;
    border: 1px solid #111;
    border-radius: 0 !important;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 12px;
    transition: background-color .18s ease;
  }
  .buy-buttons-block .add-to-cart-button:hover:not(:disabled) { background: #303030; }
  .buy-buttons-block .add-to-cart-button:disabled { background: #777; border-color: #777; cursor: not-allowed; }
  .buy-buttons-block .add-to-cart-icon { display: none; }
  &[data-show-quantity="true"] .product-details quantity-selector,
  .product-details .product-form-buttons:has(.quantity-rules) quantity-selector { display: flex !important; width: fit-content !important; }
  .elorene-pdp-size-chart { display: block; width: 100%; }
  .elorene-pdp-size-chart__trigger { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
  .elorene-pdp-size-chart__trigger svg { width: 18px; height: 18px; }
  .elorene-pdp-size-chart__dialog { margin: auto; width: min(680px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: 85svh; padding: 24px; border: 0; background: #fff; color: #171717; overflow: auto; }
  .elorene-pdp-size-chart__dialog::backdrop { background: rgb(0 0 0 / .55); }
  .elorene-pdp-size-chart__header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
  .elorene-pdp-size-chart__header h2 { font-size: 22px; margin: 0; }
  .elorene-pdp-size-chart__close { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; background: transparent; border: 0; color: inherit; cursor: pointer; }
  .elorene-pdp-size-chart__close svg { width: 18px; height: 18px; }
  .elorene-pdp-payments { width: 100%; }
  .elorene-pdp-payments p { margin: 0 0 9px; font-size: 11px; line-height: 1.5; color: #565656; }
  .elorene-pdp-payments ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
  .elorene-pdp-payments li { display: flex; }
  .elorene-pdp-payments svg { width: 36px; height: 23px; }
  .elorene-pdp-accordions { width: 100%; margin-top: 0; border-top: 0; }
  .elorene-pdp-accordion { border: 1px solid var(--pdp-border); background: #fff; }
  .elorene-pdp-accordion + .elorene-pdp-accordion { border-top: 0; }
  .elorene-pdp-accordion summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 48px; padding: 12px 16px; font-size: 11px; letter-spacing: .12em; line-height: 1.5; text-transform: uppercase; list-style: none; cursor: pointer; }
  .elorene-pdp-accordion summary::-webkit-details-marker { display: none; }
  .elorene-pdp-accordion summary::after { display: none; }
  .elorene-pdp-accordion summary svg { width: 16px; height: 16px; flex-shrink: 0; transition: transform .2s ease; }
  .elorene-pdp-accordion[open] summary svg { transform: rotate(180deg); }
  .elorene-pdp-accordion__content { padding: 0 16px 18px; }
  .elorene-pdp-richtext { font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; min-width: 0; overflow-x: auto; }
  .elorene-pdp-richtext :is(h1,h2,h3,h4) { font-size: 17px !important; line-height: 1.4 !important; margin: 16px 0 8px; }
  .elorene-pdp-richtext :is(p,ul,ol) { margin: 0 0 12px; }
  .elorene-pdp-richtext :is(ul,ol) { padding-left: 20px; }
  .elorene-pdp-richtext :is(img,video,iframe,table) { max-width: 100%; }
  .elorene-pdp-richtext img { height: auto; }
  .elorene-pdp-richtext table { display: block; overflow-x: auto; width: 100%; }
}
@supports (interpolate-size: allow-keywords) {
  #MainContent[data-template^="product"] .elorene-pdp .elorene-pdp-accordion::details-content {
    interpolate-size: allow-keywords;
    height: 0;
    overflow: clip;
    transition: height .2s ease, content-visibility .2s allow-discrete;
  }
  #MainContent[data-template^="product"] .elorene-pdp .elorene-pdp-accordion[open]::details-content { height: auto; }
}
@media (min-width: 750px) {
  #MainContent[data-template^="product"] .elorene-pdp {
    slideshow-controls[thumbnails]:is([pagination-position="left"],[pagination-position="right"]) { max-height: var(--pdp-image-limit); }
    slideshow-component:has(slideshow-controls[thumbnails][pagination-position="left"]) { grid-template-columns: auto minmax(0, 1fr); }
    slideshow-component:has(slideshow-controls[thumbnails][pagination-position="right"]) { grid-template-columns: minmax(0, 1fr) auto; }
  }
}
@media (min-width: 750px) and (max-width: 989px) {
  #MainContent[data-template^="product"] .elorene-pdp {
    --pdp-panel-gap: 28px;
    .product-information { padding-inline: 20px; }
    .product-information__grid:not(.product-information--media-none) { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) !important; }
    .product-details h1 { font-size: 21px !important; }
    .slideshow-controls__thumbnail { width: 44px; }
  }
}
@media (max-width: 749px) {
  #MainContent[data-template^="product"] .elorene-pdp {
    --pdp-image-limit: min(620px, 125vw);
    .product-information { padding: 16px 16px 36px; }
    .product-information__grid,
    .product-information__grid:not(.product-information--media-none) { grid-template-columns: minmax(0, 1fr) !important; row-gap: 24px !important; }
    .product-details,
    &[data-sticky="true"] .product-details { position: static; padding: 0 !important; }
    .product-details h1 { font-size: 23px !important; }
    .product-details product-price { order: 1; }
    .elorene-pdp-inventory { order: 2; }
    media-gallery.media-gallery--carousel slideshow-component { display: flex; flex-direction: column; gap: 10px; }
    media-gallery.media-gallery--carousel slideshow-controls { width: 100%; height: auto; min-height: 0; max-height: none; order: 1; }
    media-gallery.media-gallery--carousel slideshow-controls.mobile\:hidden { display: none !important; }
    media-gallery.media-gallery--carousel .media-gallery__mobile-controls.desktop\:hidden { display: block !important; }
    .slideshow-controls__thumbnails-container { overflow: auto hidden; position: static; }
    .slideshow-controls__thumbnails { flex-direction: row !important; margin: 0; }
    .slideshow-controls__thumbnail { width: 48px; min-width: 48px; }
    variant-picker .variant-option--buttons .variant-option__button-label { min-height: 44px !important; }
    .elorene-pdp-size-chart__trigger { min-height: 44px; }
    .elorene-pdp-size-chart__dialog { padding: 16px; }
    .elorene-pdp-benefits p { font-size: 13px; }
    .elorene-pdp-payments p { font-size: 12px; }
    .elorene-pdp-accordion summary { font-size: 12px; }
    .elorene-pdp-richtext { font-size: 14px; }
  }
}
@media (prefers-reduced-motion: reduce) {
  #MainContent[data-template^="product"] .elorene-pdp .elorene-pdp-accordion::details-content,
  #MainContent[data-template^="product"] .elorene-pdp .elorene-pdp-accordion summary svg,
  #MainContent[data-template^="product"] .elorene-pdp .add-to-cart-button { transition: none; }
}
