/* The established mobile product layout remains unchanged. */
.single-product .rt-recently-viewed { display: none; }
.single-product .rt-recently-viewed[hidden] { display: none !important; }
.single-product .rt-product-collection__all { display: none; }
.rt-product-gallery-boundary,
.rt-product-collection-boundary { display: contents; }
.rt-collection-photo-frame { display: contents; }

@media (min-width: 1024px) {
  .single-product div.product {
    --rt-product-column-gap: clamp(24px,2.3vw,40px);
    --rt-product-gallery-limit: max(360px,min(64svh,660px));
    --rt-product-usable-width: calc(100% - var(--rt-product-column-gap));
    /* Cap the track itself; all unused gallery space belongs to the summary. */
    grid-template-columns: minmax(0,min(calc(var(--rt-product-usable-width) * 7 / 12),var(--rt-product-gallery-limit))) minmax(0,1fr);
    column-gap: var(--rt-product-column-gap);
    align-items: start;
  }
  .single-product div.product:has(> .rt-product-collection-boundary) {
    --rt-product-usable-width: calc(100% - var(--rt-product-column-gap) - var(--rt-product-column-gap));
    --rt-product-related-width: max(224px,calc(var(--rt-product-usable-width) * 5 / 21));
    grid-template-columns: minmax(0,min(calc((var(--rt-product-usable-width) - var(--rt-product-related-width)) * 7 / 12),var(--rt-product-gallery-limit))) minmax(0,1fr) var(--rt-product-related-width);
  }
  .single-product .rt-product-gallery-boundary,
  .single-product .rt-product-collection-boundary { display: block; grid-row: 1; align-self: stretch; min-width: 0; }
  .single-product .rt-product-gallery-boundary { grid-column: 1; }
  .single-product .rt-product-collection-boundary { grid-column: 3; }
  .single-product .rt-product-gallery {
    position: sticky; width: 100%; margin-inline: 0;
    top: min(calc(var(--rt-header) + 16px),calc(100dvh - var(--rt-sticky-height,0px) - 16px));
  }
  .single-product .rt-product-gallery__stage { width: 100%; height: auto; min-height: 0; aspect-ratio: 1; }
  .single-product div.product > div.summary { grid-column: 2; grid-row: 1; align-self: stretch; min-width: 0; }
  .single-product .rt-product-collection-boundary > .related {
    min-width: 0; width: 100%;
    padding: 24px 0 0; margin: 0; position: sticky;
    top: min(calc(var(--rt-header) + 16px),calc(100dvh - var(--rt-sticky-height,0px) - 16px));
  }
  .single-product .rt-product-collection-boundary > .related > h2 {
    margin: 0 0 22px; font-size: clamp(21px,1.8vw,28px); line-height: 1.25;
  }
  .single-product .related:not(.rt-recently-viewed) ul.products[class*="columns-"] {
    display: grid; grid-template-columns: minmax(0,1fr); grid-auto-flow: row; grid-auto-columns: auto; gap: 20px;
    padding: 0; margin: 0; overflow: visible; scroll-snap-type: none;
  }
  .single-product .related:not(.rt-recently-viewed) ul.products::before,
  .single-product .related:not(.rt-recently-viewed) ul.products::after { display: none; }
  .single-product .related:not(.rt-recently-viewed) ul.products li.product {
    width: 100%; min-width: 0; margin: 0; padding: 0 0 20px;
    border-bottom: 1px solid var(--rt-line); position: relative;
  }
  .single-product .related:not(.rt-recently-viewed) ul.products li.product:nth-child(n+5) { display: none; }
  .single-product .related:not(.rt-recently-viewed) li.product > a.woocommerce-loop-product__link {
    display: block; position: static; min-height: 144px; padding: 0 0 10px calc(50% + 14px);
  }
  .single-product .related:not(.rt-recently-viewed) .rt-catalog-photo {
    position: absolute; top: 0; bottom: 20px; left: 0; width: 50%; height: auto; aspect-ratio: auto; margin: 0;
  }
  .single-product .related:not(.rt-recently-viewed) .rt-product-card__brand { font-size: 11px; line-height: 1.4; }
  .single-product .rt-commerce-shell .related:not(.rt-recently-viewed) .woocommerce-loop-product__title { font-size: 15px; line-height: 1.4; margin: 4px 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .single-product .related:not(.rt-recently-viewed) .rt-product-card__reference { font-size: 11px; line-height: 1.5; margin: 4px 0 0; overflow-wrap: anywhere; }
  .single-product .related:not(.rt-recently-viewed) .rt-product-card__spec,
  .single-product .related:not(.rt-recently-viewed) .rt-wishlist-toggle,
  .single-product .related:not(.rt-recently-viewed) .rt-product-card__footer > .button,
  .single-product .related:not(.rt-recently-viewed) .rt-product-card__footer > .rt-text-link { display: none !important; }
  .single-product .related:not(.rt-recently-viewed) .rt-product-card__footer { display: block; margin: 0 0 0 calc(50% + 14px); padding: 0; position: relative; }
  .single-product .related:not(.rt-recently-viewed) .rt-product-card__offer { padding: 0; }
  .single-product .related:not(.rt-recently-viewed) .rt-product-card__price { font-size: 14px; line-height: 1.5; }
  .single-product .related:not(.rt-recently-viewed) .rt-price-labels { position: static; max-width: 100%; margin-bottom: 6px; }
  .single-product .related:not(.rt-recently-viewed) .rt-price-labels > * { font-size: 9px; padding: 3px 5px; }
  .single-product .related:not(.rt-recently-viewed) .rt-scroll-strip { min-width: 0; }
  .single-product .rt-product-collection__all { display: inline-flex; margin-top: 20px; font-size: 13px; }
  .single-product .rt-recently-viewed:not([hidden]) { display: block; grid-column: 1 / -1; width: 100%; }
  @supports (width: 1cqw) {
    .single-product .related:not(.rt-recently-viewed) .rt-catalog-photo.is-framed { container-type: size; display: flex; align-items: center; justify-content: center; }
    .single-product .related:not(.rt-recently-viewed) .rt-collection-photo-frame { display: block; position: relative; flex: none; width: min(100cqw,80cqh); height: min(125cqw,100cqh); }
  }
}
