/* Modern Dental V105: product gallery is one true square, not a wide blank rectangle.
   The square follows available window height; unused width belongs to the product information. */
.md91-product-shell{
  min-width:0;
}
.md91-presentation{
  display:grid;
  direction:ltr;
  grid-template-columns:max-content minmax(0,1fr);
  gap:clamp(20px,2.4vw,34px);
  align-items:start;
  min-width:0;
}
.md91-gallery{
  --md105-side:min(560px,calc(100dvh - 245px),calc(100vw - 555px));
  --md105-thumb:clamp(58px,5vw,72px);
  --md105-gap:12px;
  display:grid;
  direction:ltr;
  grid-template-columns:var(--md105-thumb) var(--md105-side);
  column-gap:var(--md105-gap);
  align-items:start;
  width:max-content;
  max-width:100%;
  min-width:0;
}
.md91-gallery .md91-stage{
  position:relative;
  display:block;
  box-sizing:border-box;
  width:var(--md105-side);
  height:var(--md105-side);
  min-width:0;
  min-height:0;
  max-width:100%;
  aspect-ratio:1/1;
  overflow:visible;
}
.md91-gallery .md75-main-photo{
  width:100% !important;
  height:100% !important;
  max-width:100%;
  max-height:100% !important;
  min-width:0;
  min-height:0;
  aspect-ratio:1/1 !important;
  padding:0 !important;
  margin:0;
  border:1px solid #bfdedd;
  border-radius:18px;
  overflow:hidden;
  background:#fff;
  box-shadow:0 6px 19px rgba(0,83,88,.04);
}
.md91-gallery .md75-main-photo img{
  display:block;
  width:100% !important;
  height:100% !important;
  max-width:100%;
  max-height:100%;
  object-fit:contain !important;
  object-position:center center;
  background:white;
  transform:none!important;
}
.md91-gallery .md75-thumbs{
  width:var(--md105-thumb);
  max-height:var(--md105-side);
  margin:0;
  overflow-x:hidden;
  overflow-y:auto;
  align-self:start;
}
.md91-gallery .md75-thumbs button{
  width:100%;
  aspect-ratio:1/1;
  height:auto;
}
.md91-purchase-column{
  min-width:0;
  width:100%;
  max-width:100%;
  overflow-wrap:anywhere;
}
.md91-purchase-column .md75-info h1{
  overflow-wrap:break-word;
  word-break:normal;
  line-height:1.7;
}
.md91-purchase-column .md75-meta,
.md91-purchase-column .md75-mini-benefits,
.md91-purchase-column .md75-actions{min-width:0}
/* Stacking at genuinely narrow widths keeps the product information comfortable. */
@media(max-width:940px){
  .md91-presentation{grid-template-columns:minmax(0,1fr);gap:22px}
  .md91-gallery{--md105-side:min(520px,calc(100dvh - 220px),calc(100vw - 150px))}
  .md91-purchase-column{width:100%}
}
@media(max-width:540px){
  .md91-presentation{gap:16px}
  .md91-gallery{
    --md105-side:min(calc(100vw - 52px),calc(100dvh - 205px));
    width:100%;
    max-width:100%;
    grid-template-columns:minmax(0,1fr);
    justify-items:center;
    gap:10px;
  }
  .md91-gallery .md91-stage{grid-column:1;grid-row:1;width:var(--md105-side);height:var(--md105-side)}
  .md91-gallery .md75-thumbs{
    grid-column:1;grid-row:2;
    display:flex;
    flex-direction:row;
    width:100%;
    max-width:100%;
    max-height:none;
    overflow-x:auto;
    overflow-y:hidden;
  }
  .md91-gallery .md75-thumbs button{width:61px;min-width:61px;flex:0 0 61px}
}
/* Product recommendations should never force the entire detail page wider on tablets. */
.md75-product-page .products{grid-template-columns:repeat(4,minmax(0,1fr))}
.md75-product-page .products > .product-card{min-width:0;max-width:100%}
@media(max-width:1100px){
  .md75-product-page .products{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:540px){
  .md75-product-page .products{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
}
