/* ==========================================================================
   worldrobots.cn - goods detail photo display cap
   Version: 20261113a
   Applies to: every ShopXO goods detail page (PC + H5), every product,
               every product photo - no product id / class / src selectors.

   Problem: a 427x850 portrait product photo was rendered at the full width of
   the description column (928px on a 1440px viewport) because the product
   description ships its own embedded <style> with width:100% and no pixel cap,
   producing a 928x1845 image (~2 screens tall). The PC magnifier gallery was
   already bounded, but had no explicit guard against future theme changes.

   Fix: cap the leading product photo at ~400px wide / 800px tall on all
   viewports. Portrait images keep their aspect ratio (object-fit: contain)
   and never stretch the page. The magnifier (jqzoom) and the thumbnail
   carousel are untouched.

   !important is required for the description image because the embedded
   product-description stylesheet (stored as product content, not editable
   from here) has higher selector specificity than any head stylesheet.
   ========================================================================== */

/* 1) PC magnifier gallery: hard ceiling for the photo display box.
      Current theme already yields 400x398, so this is a guard, not a
      restyle - no computed value changes on the live page. */
@media only screen and (min-width: 641px) {
    .system-goods-detail .tb-booth {
        max-width: 400px;
        max-height: 400px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* 2) Description lead photo (the oversized one).
      Structural selector: any image placed directly in the description
      rich-text container, on any product. */
.system-goods-detail .am-tabs-bd .detail-content .content-web > img {
    display: block;
    float: none;
    width: 100% !important;
    max-width: 400px !important;
    height: auto !important;
    max-height: 800px !important;
    object-fit: contain;
    margin: 0 auto 22px !important;
}

/* 3) H5 / tablet gallery slider: same cap. On a 390px phone the image stays
      full width (~390px, within the 400px target); on a 600px tablet it stops
      expanding instead of growing to 600x1194. */
@media only screen and (max-width: 640px) {
    .system-goods-detail .scoll .slider-content .am-slides > li > img {
        display: block;
        width: 100% !important;
        max-width: 400px !important;
        height: auto !important;
        max-height: 800px !important;
        object-fit: contain;
        margin: 0 auto !important;
    }
}
