/* Product details */
.pd-wrap { padding-top: 18px; }
.pd-wrap > .breadcrumb { margin-bottom: 18px; }
.breadcrumb .current { color: var(--ink); }
.pd { display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: start; }

.gallery { display: grid; grid-template-columns: 86px 1fr; gap: 16px; position: sticky; top: calc(var(--header-h) + 16px); }
.thumbs { display: flex; flex-direction: column; gap: 12px; max-height: 560px; overflow-y: auto; scrollbar-width: none; }
.thumbs::-webkit-scrollbar { display: none; }
.thumb { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; padding: 0; background: var(--cream); aspect-ratio: 9 / 11; flex: none; transition: border-color .2s; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.on, .thumb:hover { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.stage { position: relative; border-radius: 14px; overflow: hidden; background: var(--cream); aspect-ratio: 5 / 5.6; }
.stage img { width: 100%; height: 100%; object-fit: cover; transition: opacity .25s; }
.stage .rail-btn { top: 50%; transform: translateY(-50%); }
.st-prev { inset-inline-start: 14px; }
.st-next { inset-inline-end: 14px; }
.st-zoom { position: absolute; bottom: 14px; inset-inline-end: 14px; width: 40px; height: 40px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.st-zoom .icon { width: 18px; height: 18px; }

.info h1 { font-size: clamp(26px, 3vw, 34px); margin: 10px 0 8px; }
.stock { display: inline-block; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; background: var(--primary-soft); color: var(--wine); padding: 3px 10px; border-radius: 4px; }
.stars { display: inline-flex; align-items: center; gap: 2px; font-size: 16px; color: #ddd0cb; }
.stars i { font-style: normal; }
.stars i.on { color: var(--gold); }
.stars b { margin-inline-start: 8px; font-size: 13px; color: var(--muted); font-weight: 400; }
.pd-price { font-size: 28px; font-weight: 600; margin: 14px 0 10px; }
.pd-price del { font-size: 16px; color: var(--muted); font-weight: 400; margin-inline-start: 10px; }
.lead { color: var(--muted); padding-bottom: 18px; border-bottom: 1px solid var(--border); }

.opts { display: flex; flex-direction: column; gap: 18px; padding: 18px 0; }
.opt { display: flex; flex-direction: column; gap: 8px; }
.opt-label { font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.opt .input { height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 8px; background: #fff; max-width: 320px; }
.opt .note { max-width: none; height: auto; padding: 10px 14px; min-height: 80px; resize: vertical; }
.swatches.lg .swatch { width: 28px; height: 28px; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--border); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; transition: .2s; }
.chips input:checked + label { background: var(--primary); border-color: var(--primary); color: #fff; }
.chips input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }

.size-guide { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); text-decoration: underline; font-size: 14px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; width: max-content; background: #fff; }
.qty button { width: 42px; height: 42px; font-size: 18px; color: var(--primary); }
.qty button:hover { background: var(--cream); }
.qty input { width: 52px; height: 42px; text-align: center; border: 0; border-inline: 1px solid var(--border); outline: none; }

.buy { display: flex; gap: 12px; align-items: stretch; }
.buy-main { flex: 1; }
.btn-lg { height: 54px; font-size: 16px; }
.buy-fav a { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.buy-fav a:has(img:not([style*="display:none"])) { }
.buy-fav img { width: 24px; height: 24px; }
.buy-fav a:empty { display: none; }
.share { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-size: 13px; color: var(--muted); }
.share a, .share button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--cream); color: var(--wine); }
.share .icon { width: 16px; height: 16px; }

.pd-perks { margin: 40px 0 28px; }

.tabs { padding: 0 28px 28px; }
.tab-list { display: flex; gap: 32px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; padding: 18px 0 14px; font-size: 14.5px; color: var(--muted); white-space: nowrap; }
.tab.on { color: var(--wine); font-weight: 500; }
.tab.on::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; background: var(--wine); }
.tab-panel { display: none; padding-top: 24px; }
.tab-panel.on { display: block; animation: fadeIn .25s; }
.tab-panel h2 { font-size: 26px; margin-bottom: 12px; }
.rich { color: var(--muted); max-width: 80ch; }
.rich img { border-radius: 10px; margin: 10px 0; }
@keyframes fadeIn { from { opacity: 0; } }

.reviews { display: grid; grid-template-columns: 1fr 1.5fr; gap: 32px; }
.review-form { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.review-form h3 { font-size: 20px; }
.review-form .note { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; min-height: 100px; }
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.star-input input { position: absolute; opacity: 0; }
.star-input label { font-size: 28px; color: #ddd0cb; cursor: pointer; line-height: 1; transition: color .15s; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--gold); }
.review-list { display: flex; flex-direction: column; gap: 18px; }
.review { display: flex; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.review .avatar { width: 44px; height: 44px; }
.review p { color: var(--muted); margin: 4px 0; }
.review small { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }

.measure { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

@media (max-width: 992px) {
    .pd { grid-template-columns: 1fr; gap: 24px; }
    .gallery { position: static; grid-template-columns: 1fr; }
    .thumbs { order: 2; flex-direction: row; max-height: none; overflow-x: auto; }
    .thumb { width: 72px; }
    .reviews { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .tabs { padding: 0 16px 20px; }
    .tab-list { gap: 20px; }
    .measure { grid-template-columns: 1fr; }
    .buy { position: sticky; bottom: 64px; background: var(--bg); padding: 10px 0; z-index: 5; }
}

/* ---- v2: zoom on the product image ---- */
.stage.can-zoom { cursor: zoom-in; }
.stage.can-zoom img[data-stage] { transition: transform .15s ease-out, opacity .25s; will-change: transform; }
.stage.zooming .rail-btn, .stage.zooming .st-zoom { opacity: 0; pointer-events: none; }
.st-zoom { z-index: 2; cursor: pointer; }
.zoom-hint { position: absolute; top: 14px; inset-inline-start: 14px; z-index: 3; padding: 4px 10px; border-radius: 999px; background: rgba(42, 35, 36, .75); color: #fff; font-size: 12px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.zoom-hint.show { opacity: 1; }
.rating-row { display: flex; align-items: center; gap: 4px; margin: 6px 0 2px; }
.rating-row .stars-bg { font-size: 17px; }
.opt .opt-label { display: block; margin-bottom: 8px; }

/* =================== v3 product page =================== */
.pd { grid-template-columns: 1.2fr 1fr; gap: 48px; }
.stage { aspect-ratio: 4 / 5; border-radius: 18px; }
.stage img[data-stage] { object-fit: cover; object-position: center top; }
.pd-badge { position: absolute; top: 14px; inset-inline-start: 14px; background: var(--danger); color: #fff; font-weight: 600; font-size: 13px; padding: 4px 10px; border-radius: 999px; z-index: 2; }
.st-tip { position: absolute; bottom: 14px; inset-inline-start: 14px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .92); font-size: 12px; color: var(--ink); box-shadow: var(--shadow-sm); transition: opacity .2s; }
.st-tip .icon { width: 15px; height: 15px; color: var(--primary); }
.stage.zooming .st-tip { opacity: 0; }
@media (hover: none) { .st-tip { display: none; } }

/* square zoom lens */
.zoom-lens { position: absolute; z-index: 4; width: 210px; height: 210px; border: 2px solid #fff; border-radius: 10px; background-repeat: no-repeat; background-color: #fff;
    box-shadow: 0 0 0 1px rgba(110, 31, 44, .25), 0 18px 40px rgba(42, 35, 36, .3); pointer-events: none; opacity: 0; transform: scale(.85); transition: opacity .15s, transform .15s; }
.stage.zooming .zoom-lens { opacity: 1; transform: none; }
.stage.can-zoom { cursor: crosshair; }
.stage.can-zoom img[data-stage] { transform: none !important; }

/* zoom box thumbnails */
.zb-thumbs { display: flex; justify-content: center; gap: 8px; padding: 6px 0 0; }
.zb-thumbs button { width: 54px; height: 66px; border-radius: 8px; overflow: hidden; opacity: .5; border: 2px solid transparent; transition: .2s; }
.zb-thumbs button.on, .zb-thumbs button:hover { opacity: 1; border-color: #fff; }
.zb-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.zoombox.single .zb-thumbs { display: none; }
.zb-reset { border-radius: 999px !important; }

/* info column */
.info h1 { margin: 4px 0 8px; }
.info .lead { color: var(--muted); font-size: 15px; margin-bottom: 4px; }
.rating-row { margin: 0; }
.rating-row .stars-bg { font-size: 18px; }
.rating-txt { color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.pd-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pd-price .save { background: #fdecea; color: var(--danger); font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.stock.out { background: #fbe5e2; color: var(--danger); }
.opts { display: flex; flex-direction: column; gap: 18px; margin: 20px 0; }
.opt .opt-label { font-size: 14px; font-weight: 500; }
.opt .opt-label b { font-weight: 400; color: var(--muted); }
.opt.invalid .opt-chips, .opt.invalid .swatches-pick, .opt.invalid input { outline: 2px solid var(--danger); outline-offset: 4px; border-radius: 8px; }
.opt .field-error { color: var(--danger); font-size: 12.5px; }
.opt .field-error:empty { display: none; }
.opt .input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.opt textarea.input { height: auto; padding: 10px 12px; }

/* colour swatches */
.swatches-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; font-size: 11.5px; color: var(--muted); }
.swatch-btn span { width: 48px; height: 48px; border-radius: 10px; border: 1px solid rgba(0, 0, 0, .1); box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--border); transition: .15s; }
.swatch-btn em { font-style: normal; text-align: center; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; max-width: 64px; white-space: nowrap; }
.swatch-btn:hover span { box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--primary); }
.swatch-btn.on span { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--wine); }
.swatch-btn.on em { color: var(--wine); font-weight: 500; }
.swatch-btn.no-code span { background: repeating-linear-gradient(45deg, #f3e4df, #f3e4df 6px, #fff 6px, #fff 12px) !important; }

.qty input { width: 52px; height: 46px; text-align: center; border: 0; border-inline: 1px solid var(--border); font: inherit; }
.qty button { width: 44px; height: 46px; font-size: 18px; color: var(--primary); }
.buy { margin-top: 6px; }
.buy #pdAdd { flex: 1; height: 56px; font-size: 16px; }
.buy-fav { width: 56px; height: 56px; border: 1px solid var(--border); border-radius: 10px; background: #fff; display: grid; place-items: center; position: static !important; }
.buy-fav .icon { width: 24px; height: 24px; }
.buy-fav.on { color: var(--danger); border-color: var(--danger); }
.buy-fav.on .icon { fill: currentColor; }
.size-guide { display: inline-flex; align-items: center; gap: 8px; color: var(--wine); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* measurements dialog */
.measure-dlg { max-width: 560px; }
.measure-dlg .measure { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; text-align: start; }
.measure-dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.measure-dlg input { height: 42px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; }
.measure-dlg input.bad { border-color: var(--danger); }

/* reviews */
.rv { display: grid; grid-template-columns: 320px 1fr; gap: 28px 40px; }
.rv-summary { display: flex; flex-direction: column; gap: 16px; }
.rv-avg { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.rv-avg strong { font-family: var(--font-head); font-size: 52px; line-height: 1; color: var(--wine); }
.rv-avg .stars-bg { font-size: 20px; }
.rv-avg small { color: var(--muted); }
.rv-bars { display: flex; flex-direction: column; gap: 8px; }
.rv-bar { display: grid; grid-template-columns: 38px 1fr 42px; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.rv-track { height: 8px; border-radius: 8px; background: var(--cream); overflow: hidden; }
.rv-track i { display: block; height: 100%; background: var(--gold); border-radius: 8px; transition: width .6s ease; }
.rv-bar b { font-weight: 500; text-align: end; }
.rv-form { grid-column: 2; display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: #fdfaf8; }
.rv-form h3 { font-size: 19px; }
.rv-form .btn { align-self: flex-start; }
.star-pick { display: flex; gap: 4px; direction: ltr; }
[dir="rtl"] .star-pick { justify-content: flex-end; }
.star-pick button { font-size: 30px; line-height: 1; color: #e6d6cf; transition: transform .1s, color .1s; }
.star-pick button.on, .star-pick button.hover { color: var(--gold); }
.star-pick button:hover { transform: scale(1.15); }
.rv-list { grid-column: 1 / -1; display: flex; flex-direction: column; }
.review { display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 18px 0; border-top: 1px solid var(--border); }
.rv-av { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); color: var(--wine); display: grid; place-items: center; font-weight: 600; font-size: 18px; }
.rv-top { display: flex; justify-content: space-between; gap: 10px; }
.rv-top small { color: var(--muted); }
.review p { margin-top: 6px; color: var(--ink); }

@media (max-width: 992px) {
    .pd { grid-template-columns: 1fr; gap: 24px; }
    .rv { grid-template-columns: 1fr; }
    .rv-form { grid-column: auto; }
    .buy { position: sticky; bottom: 64px; z-index: 5; background: var(--bg); padding: 10px 0; }
}
@media (max-width: 640px) {
    .measure-dlg .measure { grid-template-columns: 1fr; }
    .swatch-btn { width: 56px; }
    .swatch-btn span { width: 42px; height: 42px; }
}

/* live total + measurement shortcuts */
.unit-price { display: block; color: var(--muted); font-size: 13px; margin: -6px 0 10px; }
.add-total { font-weight: 500; opacity: .9; }
.m-hint { font-size: 13px; margin: 4px 0 12px; }
.m-presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 4px; }
.m-presets button { min-width: 48px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-weight: 500; font-size: 13.5px; transition: .15s; }
.m-presets button:hover { border-color: var(--primary); }
.m-presets button.on { background: var(--wine); border-color: var(--wine); color: #fff; }
.m-presets .m-last { display: inline-flex; align-items: center; gap: 6px; color: var(--wine); border-style: dashed; }
.m-presets .m-last .icon { width: 15px; height: 15px; }
.m-presets .m-clear { color: var(--muted); }
.m-summary { display: block; margin-top: 6px; padding: 8px 12px; border-radius: 8px; background: var(--cream); color: var(--wine); font-size: 12.5px; line-height: 1.6; }
