/* Cover and vertical thumbnails share 44.625% of the initial viewport. */
.product-detail .product-gallery{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,3fr);grid-template-rows:minmax(0,1fr);gap:10px;height:44.625vh;height:44.625svh;min-height:0;align-self:start}
.product-detail .product-gallery:not(:has(.product-gallery-thumbs-wrap)){grid-template-columns:minmax(0,1fr)}
.product-detail .product-gallery .product-gallery-main{height:100%;min-height:0;aspect-ratio:auto;margin:0}
.product-detail .product-gallery #mainImage{height:100%;width:100%;max-height:100%;object-fit:cover;object-position:center;cursor:zoom-in}
.product-detail .product-gallery .product-gallery-thumbs-wrap{height:100%;min-height:0;display:block;overflow:hidden}
.product-detail .product-gallery .product-gallery-thumbs{display:flex;flex-direction:column;gap:8px;height:100%;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;padding:0 3px;overscroll-behavior:contain}
.product-detail .product-gallery .product-gallery-thumbs::-webkit-scrollbar{display:block;width:4px}
.product-detail .product-gallery .product-gallery-thumbs img{box-sizing:border-box;width:100%;height:auto;aspect-ratio:3/4;flex:0 0 auto;object-fit:contain;background:#fff;transform:none;cursor:zoom-in}
.product-detail .product-gallery .product-gallery-thumb-nav{display:none}
.product-image-lightbox{box-sizing:border-box;max-width:none;max-height:none;width:100vw;height:100dvh;margin:0;padding:48px 44px;border:0;background:#101b17f5;color:#fff;overflow:hidden}
.product-image-lightbox::backdrop{background:#101b17ed}
.product-image-lightbox img{display:block;width:100%;height:100%;object-fit:contain}
.product-image-lightbox button{position:absolute;display:grid;place-items:center;min-width:40px;min-height:40px;border:1px solid #ffffff80;border-radius:50%;background:#163e32;color:#fff;font-size:24px;cursor:pointer}
.product-image-lightbox [data-close]{right:12px;top:8px}
.product-image-lightbox [data-prev]{left:4px;top:calc(50% - 20px)}
.product-image-lightbox [data-next]{right:4px;top:calc(50% - 20px)}
.product-image-lightbox [hidden]{display:none}
.product-image-lightbox-count{position:absolute;bottom:12px;left:0;width:100%;text-align:center;font-size:14px}

/* Compact product title below the gallery on mobile. */
.product-detail .product-info h1#productDetailTitle{font-size:13px;line-height:1.45}

/* Compact seller and price summary. */
.product-detail .product-detail-grid{row-gap:10px}
.product-detail .product-info h1#productDetailTitle{margin:0 0 6px}
.product-detail .product-info .seller-name{display:flex;align-items:center;gap:6px;font-size:13px;line-height:1.35;margin:0 0 6px}
.product-detail .product-info .product-seller-logo{display:block;width:24px;height:24px;flex:0 0 24px;object-fit:contain;border-radius:4px}
.product-detail .product-info .product-meta{gap:4px 12px;margin:0 0 8px}
.product-detail .product-info .product-price-section{padding:12px;margin:0 0 12px}

/* Keep the gallery close to the category breadcrumb. */
section.product-detail{padding-top:4px}
.container:has(+ section.product-detail) .breadcrumb{padding-bottom:4px;margin-bottom:0}

/* Price and immediate purchase controls below the seller. */
.product-detail .product-price-section .current-price,
.product-detail .product-price-section #productCurrentPrice{font-size:24px;line-height:1.2}
.product-detail .product-price-section .current-price small{font-size:13px}
.product-detail .product-quick-purchase{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:10px 0}
.product-detail .product-quick-quantity{display:flex;align-items:center;flex:0 0 114px;height:42px;border:1px solid #cddbd2;border-radius:8px;background:#fff;overflow:hidden}
.product-detail .product-quick-quantity button{flex:0 0 32px;height:100%;border:0;background:transparent;color:#0b5141;font-size:20px;cursor:pointer}
.product-detail .product-quick-quantity input{box-sizing:border-box;width:48px;min-width:0;height:100%;padding:0;border:0;background:transparent;text-align:center;font-size:16px;appearance:textfield;-moz-appearance:textfield}
.product-detail .product-quick-quantity input::-webkit-inner-spin-button{appearance:none}
.product-detail .product-quick-action{flex:1;min-height:42px;padding:8px 12px;font-size:14px;white-space:nowrap;justify-content:center}
/* The calculator is available only inside the purchase modal. */
.product-purchase-dialog{box-sizing:border-box;position:fixed;inset:0;margin:auto;width:calc(100% - 24px);max-width:520px;max-height:88vh;max-height:88dvh;padding:16px;border:1px solid #d2dfd6;border-radius:16px;background:#fff;color:#21382d;overflow-y:auto;overscroll-behavior:contain;box-shadow:0 16px 60px #12392c33}
.product-purchase-dialog::backdrop{background:#102b22a6}
.product-purchase-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.product-purchase-heading h2{font-size:18px;margin:0}
.product-purchase-heading button{width:36px;height:36px;border:0;border-radius:50%;background:#edf4ef;color:#0b5141;font-size:24px;cursor:pointer}
.product-purchase-dialog .calculator-heading-row,.product-purchase-dialog .product-measure-modes{display:none!important}
.product-purchase-dialog .calculator-section{padding:0;margin:0;border:0;box-shadow:none;background:transparent}
.product-purchase-dialog #addToCartBtn{min-height:44px;font-size:15px}
.product-purchase-dialog input,.product-purchase-dialog select{font-size:16px}
.product-purchase-dialog .purchase-size-search{box-sizing:border-box;width:100%;min-height:42px;padding:10px;border:1px solid #cddbd2;border-radius:8px;margin-bottom:8px}
.product-purchase-dialog .purchase-size-list{max-height:220px;overflow-y:auto;display:grid;gap:6px;margin-bottom:12px}
.product-purchase-dialog .purchase-size-list button{padding:10px;border:1px solid #d8e3db;border-radius:8px;background:#fff;color:#234135;text-align:left;font-size:14px;cursor:pointer}
.product-purchase-dialog .purchase-size-list button[aria-pressed=true]{border-color:#0b5141;background:#eaf4ed}
.product-purchase-dialog .purchase-size-list button:disabled{opacity:.45;cursor:default}

/* Compact price-calculation modal matching the original layout. */
.product-purchase-dialog{top:8px;bottom:auto;margin:0 auto;padding:0;width:min(520px,calc(100% - 16px));max-height:calc(100dvh - 16px);border-radius:8px;overflow:hidden}
.product-purchase-dialog[open]{display:flex;flex-direction:column}
.product-purchase-dialog .product-purchase-heading{flex:0 0 auto;gap:8px;margin:0;padding:8px 12px;border-bottom:1px solid #e4e9e5}
.product-purchase-dialog .product-purchase-heading h2{flex:1;font-size:16px;line-height:22px;white-space:nowrap}
.product-purchase-dialog .product-purchase-heading .measure-guide-btn{min-height:24px;padding:0;border:0;background:none;box-shadow:none;font-size:11px;white-space:nowrap;gap:4px}
.product-purchase-dialog .product-purchase-heading button{flex:0 0 40px;width:40px;height:40px;border-radius:6px}
.product-purchase-dialog .product-purchase-body{flex:1 1 auto;min-height:0;overflow-y:auto;padding:10px 12px;overscroll-behavior:contain}
.product-purchase-dialog .calc-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0 0 8px}
.product-purchase-dialog .calc-group{min-width:0;gap:4px}
.product-purchase-dialog .calc-group label{font-size:13px;line-height:20px}
.product-purchase-dialog .calc-group input,.product-purchase-dialog .calc-group select{box-sizing:border-box;width:100%;min-width:0;height:44px;padding:0 8px;border-radius:6px;font-size:16px}
.product-purchase-dialog .qty-selector{display:flex;width:100%;height:44px}
.product-purchase-dialog .qty-selector button{flex:0 0 32px;width:32px;padding:0}
.product-purchase-dialog .qty-selector input{flex:1;width:0}
.product-purchase-dialog .form-helper{font-size:10px;line-height:1.4}
.product-purchase-dialog .product-purchase-options{display:flex;flex-wrap:wrap;gap:0 12px;align-items:flex-start}
.product-purchase-dialog .product-purchase-options details{flex:1;min-width:120px;margin:4px 0;font-size:11px}
.product-purchase-dialog .product-purchase-options summary{cursor:pointer;font-size:11px;line-height:20px}
.product-purchase-dialog .product-purchase-options .perdekit-offer{margin:8px 0;padding:8px}
.product-purchase-dialog .product-purchase-footer{flex:0 0 auto;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:center;gap:10px;padding:8px 12px max(8px,env(safe-area-inset-bottom));border-top:1px solid #e4e9e5;background:#fff}
.product-purchase-dialog .product-purchase-footer .calc-total{margin:0;padding:0;background:none;border:0;text-align:left}
.product-purchase-dialog .product-purchase-footer .calc-total .amount{font-size:18px;line-height:1.3}
.product-purchase-dialog .product-purchase-footer .calc-total .label{font-size:11px}
.product-purchase-dialog .product-purchase-footer #addToCartBtn{margin:0;min-height:44px;font-size:15px;padding:8px}
.product-purchase-dialog .calculator-price-breakdown{display:none}

/* Search stays inside the collapsed size dropdown. */
.product-purchase-dialog .purchase-size-select{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:44px;padding:10px 12px;border:1px solid #cddbd2;border-radius:8px;background:#fff;color:#234135;text-align:left;font-size:16px;cursor:pointer}
.product-purchase-dialog .purchase-size-menu{margin-top:4px;padding:8px;border:1px solid #a9c4b3;border-radius:8px;background:#fff;box-shadow:0 4px 12px #12392c18}
.product-purchase-dialog .purchase-size-menu[hidden]{display:none}
.product-purchase-dialog .purchase-size-menu .purchase-size-list{max-height:180px;margin:0;gap:0}
.product-purchase-dialog .purchase-size-menu .purchase-size-list button{border:0;border-bottom:1px solid #edf1ee;border-radius:0}
.product-purchase-dialog .purchase-size-menu .purchase-size-list button[aria-selected=true]{background:#eaf4ed;color:#0b5141}
.product-purchase-dialog .purchase-size-dropdown{margin-bottom:12px}

/* Native top-layer host keeps material choice above every existing modal. */
dialog.product-material-top-layer{position:fixed;inset:0;box-sizing:border-box;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;background:transparent;overflow:hidden}
dialog.product-material-top-layer::backdrop{background:transparent}
dialog.product-material-top-layer:not([open]){display:none}
dialog.product-material-top-layer #materialChoiceModal{box-sizing:border-box;width:100%;height:100%;margin:0}
/* Three compact materials per row; only the list body scrolls. */
#materialChoiceModal{padding:12px}
#materialChoiceModal .product-material-modal{box-sizing:border-box;display:flex;flex-direction:column;max-width:640px;max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);overflow:hidden}
#materialChoiceModal .modal-header{flex:0 0 auto;padding:12px 14px}
#materialChoiceModal .modal-header h3{margin:0;font-size:18px}
#materialChoiceModal .product-material-modal-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:12px 14px}
#materialChoiceModal .product-material-modal-body>p{font-size:12px;line-height:1.5;margin:0 0 12px}
#materialChoiceModal .product-material-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
#materialChoiceModal .product-material-card{box-sizing:border-box;min-width:0;padding:5px;border-radius:8px}
#materialChoiceModal .product-material-card img,#materialChoiceModal .product-material-card-placeholder{display:block;width:100%;height:auto;aspect-ratio:1;object-fit:contain;margin:0 0 5px;border-radius:5px}
#materialChoiceModal .product-material-card-placeholder{display:grid}
#materialChoiceModal .product-material-card strong{font-size:12px;line-height:1.35;overflow-wrap:anywhere}

/* Thumbnail rail on the left; keep single-image products full width. */
.product-detail .product-gallery:has(.product-gallery-thumbs-wrap) .product-gallery-thumbs-wrap{grid-column:1;grid-row:1}
.product-detail .product-gallery:has(.product-gallery-thumbs-wrap) .product-gallery-main{grid-column:2;grid-row:1}

/* Compact cover labels; thumbnails replace cover navigation arrows. */
.product-detail .product-gallery .product-gallery-color-badge,
.product-detail .product-gallery .product-gallery-counter{font-size:12px;line-height:1.3;padding:6px 9px;gap:5px}
.product-detail .product-gallery .product-gallery-color-badge i,
.product-detail .product-gallery .product-gallery-counter i{font-size:12px}
.product-detail .product-gallery .product-gallery-nav{display:none}

/* Remove promotional labels from detail photos; compact the video control. */
.product-detail .product-gallery .product-detail-image-badges{display:none}
.product-detail .product-gallery .product-video-open,
.product-detail .product-gallery .product-video-open:hover,
.product-detail .product-gallery .product-video-open:active{transform:scale(.66);transform-origin:top right}

/* Compact comparison price stays beside the main price. */
.product-detail .product-price-section .product-price-main{display:flex;align-items:center;flex-wrap:nowrap;gap:8px}
.product-detail .product-price-section .current-price{flex:0 0 auto;flex-wrap:nowrap;gap:4px;white-space:nowrap}
.product-detail .product-price-section .product-price-meta{display:flex;align-items:center;flex-wrap:nowrap;gap:6px;min-width:0;white-space:nowrap}
.product-detail .product-price-section .old-price{font-size:12px;line-height:1.3}
.product-detail .product-price-section .discount-badge{font-size:10px;line-height:1.3;padding:4px 6px;border-radius:4px;white-space:nowrap}
