/* ==========================================================================
   MINSHENG — WooCommerce skins
   The theme styles WooCommerce's own markup; no template files are overridden.
   ========================================================================== */

/* Product grid ------------------------------------------------------------- */
ul.products {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: clamp(18px, 2.4vw, 34px) clamp(14px, 2vw, 28px);
	list-style: none;
	margin: 0;
	padding: 0;
}
ul.products::before,
ul.products::after { display: none; }

ul.products li.product {
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
	padding: 0;
	position: relative;
}

ul.products li.product a img {
	width: 100%;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	background: #e9e6e1;
	margin: 0 0 14px;
	transition: transform 0.7s var(--ease), filter 0.4s var(--ease);
}
ul.products li.product:hover a img { transform: scale(1.028); }

ul.products li.product .woocommerce-loop-product__title,
ul.products li.product .woocommerce-loop-category__title {
	font-family: var(--sans);
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.01em;
	line-height: 1.4;
	color: var(--ink);
	margin: 0 0 6px;
	padding: 0;
}

ul.products li.product .price {
	font-size: 12px;
	color: var(--muted);
	letter-spacing: 0.02em;
	font-variant-numeric: tabular-nums;
	margin: 0;
	display: flex;
	gap: 8px;
	align-items: baseline;
}
ul.products li.product .price del { opacity: 0.5; font-size: 11px; }
ul.products li.product .price ins { text-decoration: none; font-weight: 500; color: var(--ink); }

ul.products li.product .star-rating {
	font-size: 10px;
	margin: 0 0 6px;
	color: var(--ink);
}

.onsale,
ul.products li.product .onsale {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	background: var(--ink);
	color: var(--paper);
	font-size: 9px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	padding: 5px 9px;
	line-height: 1;
	border-radius: 0;
	min-height: 0;
	min-width: 0;
	margin: 0;
}
span.onsale { position: absolute; top: 16px; left: 16px; }

/* Quick add on card — a 38px disc in the corner, so it never covers the name */
.ms-card-add {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 38px;
	height: 38px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(246, 244, 241, 0.94);
	color: var(--ink);
	font-size: 19px;
	font-weight: 300;
	line-height: 1;
	box-shadow: 0 14px 28px -16px rgba(11, 11, 12, 0.7);
	opacity: 0;
	transform: translateY(-4px) scale(0.92);
	transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), background 0.25s, color 0.25s;
	pointer-events: none;
	z-index: 4;
}
ul.products li.product { overflow: hidden; }
ul.products li.product:hover .ms-card-add,
ul.products li.product:focus-within .ms-card-add {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}
.ms-card-add:hover { background: var(--ink); color: var(--paper); }
.ms-card-add.is-added { background: var(--navy); color: #fff; font-size: 13px; }
@media (hover: none) {
	.ms-card-add { display: none; }
}

/* Single product ----------------------------------------------------------- */
.single-product .ms-shop { padding-top: clamp(24px, 4vw, 56px); }

.single-product div.product {
	display: grid;
	grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
	gap: clamp(24px, 4.5vw, 72px);
	align-items: start;
	position: relative;
}
.single-product div.product .woocommerce-product-gallery {
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
}
.single-product div.product .woocommerce-product-gallery__wrapper { margin: 0; }
.single-product div.product .woocommerce-product-gallery img { width: 100%; }
.single-product div.product .flex-control-thumbs {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 10px;
	margin: 10px 0 0;
	padding: 0;
	list-style: none;
}
.single-product div.product .flex-control-thumbs li { width: 100%; margin: 0; }

.single-product div.product .summary {
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
	position: sticky;
	top: 108px;
	padding-top: 8px;
}

.single-product .product_title {
	font-size: clamp(28px, 3.4vw, 46px);
	letter-spacing: -0.036em;
	line-height: 1.04;
	font-weight: 500;
	margin: 0 0 14px;
}

.single-product .summary .price {
	font-size: 17px;
	color: var(--ink);
	margin: 0 0 22px;
	font-variant-numeric: tabular-nums;
	display: flex;
	gap: 10px;
	align-items: baseline;
}
.single-product .summary .price del { color: var(--steel); font-size: 14px; opacity: 1; }
.single-product .summary .price ins { text-decoration: none; font-weight: 500; }

.single-product .woocommerce-product-details__short-description {
	font-size: 14px;
	line-height: 1.7;
	color: var(--muted);
	margin-bottom: 26px;
	border-top: 1px solid var(--line);
	padding-top: 22px;
}

.single-product .summary .woocommerce-product-rating { margin-bottom: 16px; }
.single-product .summary .woocommerce-product-rating a { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--steel); }

/* Forms: variations, quantity, add to cart */
.woocommerce div.product form.cart {
	margin: 0 0 26px;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
}
.woocommerce div.product form.cart .variations {
	margin: 0 0 16px;
	width: 100%;
	border-collapse: collapse;
}
.woocommerce div.product form.cart .variations th,
.woocommerce div.product form.cart .variations td {
	padding: 0 0 12px;
	text-align: left;
	border: 0;
	vertical-align: middle;
}
.woocommerce div.product form.cart .variations label {
	font-size: 10px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--steel);
	font-weight: 500;
}
.woocommerce div.product form.cart .reset_variations {
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--steel);
}

.quantity {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--line);
	height: 46px;
}
.quantity .qty {
	width: 56px;
	border: 0;
	background: transparent;
	text-align: center;
	font-family: inherit;
	font-size: 13px;
	-moz-appearance: textfield;
	padding: 0;
	height: 44px;
}
.quantity .qty::-webkit-outer-spin-button,
.quantity .qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.woocommerce div.product form.cart .button,
.woocommerce #respond input#submit,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #place_order,
.wc-block-components-button {
	background: var(--ink);
	color: var(--paper);
	border: 1px solid var(--ink);
	border-radius: 0;
	font-family: var(--sans);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	padding: 16px 30px;
	line-height: 1;
	min-height: 46px;
	cursor: pointer;
	transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s;
}
.woocommerce div.product form.cart .button:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #place_order:hover {
	background: #232326;
	border-color: #232326;
	color: var(--paper);
}
.woocommerce a.button.alt,
.woocommerce button.button.alt {
	background: var(--navy);
	border-color: var(--navy);
	color: var(--paper);
}
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover { background: #16294a; border-color: #16294a; }

.woocommerce #respond input#submit.disabled,
.woocommerce button.button:disabled,
.woocommerce button.button:disabled[disabled] {
	background: #c9c5be;
	border-color: #c9c5be;
	color: #fff;
	opacity: 1;
}

/* Meta, tabs, related */
.single-product .product_meta {
	border-top: 1px solid var(--line);
	padding-top: 18px;
	margin-top: 8px;
	font-size: 11px;
	letter-spacing: 0.06em;
	color: var(--steel);
	display: grid;
	gap: 6px;
}
.single-product .product_meta a { color: var(--ink); }

.woocommerce-tabs {
	grid-column: 1 / -1;
	margin-top: clamp(40px, 6vw, 80px);
	border-top: 1px solid var(--line);
	padding-top: 8px;
}
.woocommerce-tabs ul.tabs {
	list-style: none;
	display: flex;
	gap: 28px;
	margin: 0 0 28px !important;
	padding: 0 !important;
	border: 0;
}
.woocommerce-tabs ul.tabs::before,
.woocommerce-tabs ul.tabs li::before,
.woocommerce-tabs ul.tabs li::after { display: none; }
.woocommerce-tabs ul.tabs li {
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	border-radius: 0;
}
.woocommerce-tabs ul.tabs li a {
	font-size: 11px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--steel);
	padding: 18px 0 !important;
	border-bottom: 1px solid transparent;
	font-weight: 500;
}
.woocommerce-tabs ul.tabs li.active a { color: var(--ink); border-bottom-color: var(--ink); }
.woocommerce-tabs .panel { max-width: 820px; font-size: 14px; line-height: 1.75; color: var(--muted); }
.woocommerce-tabs .panel h2 { font-size: 20px; color: var(--ink); margin: 0 0 12px; letter-spacing: -0.02em; }
.woocommerce-tabs .panel table { width: 100%; border-collapse: collapse; font-size: 13px; }
.woocommerce-tabs .panel table th,
.woocommerce-tabs .panel table td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; }

.related.products,
.upsells.products {
	margin-top: clamp(48px, 7vw, 96px);
}
.related.products > h2,
.upsells.products > h2,
.cross-sells > h2 {
	font-size: clamp(20px, 2.2vw, 28px);
	letter-spacing: -0.02em;
	margin: 0 0 26px;
}

/* Cart, checkout, account -------------------------------------------------- */
.woocommerce table.shop_table {
	border: 1px solid var(--line);
	border-radius: 0;
	border-collapse: collapse;
	font-size: 13px;
}
.woocommerce table.shop_table th {
	background: transparent;
	font-size: 10px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--steel);
	font-weight: 500;
	border-bottom: 1px solid var(--line);
	padding: 14px 12px;
}
.woocommerce table.shop_table td {
	border-top: 1px solid var(--line);
	padding: 16px 12px;
	vertical-align: middle;
}
.woocommerce table.shop_table img { width: 68px; height: auto; }

.woocommerce .cart_totals,
.woocommerce .woocommerce-checkout-review-order,
.woocommerce #customer_details {
	background: transparent;
	border: 1px solid var(--line);
	padding: clamp(18px, 2.4vw, 32px);
	border-radius: 0;
}
.woocommerce .cart_totals h2,
.woocommerce #order_review_heading { font-size: 18px; letter-spacing: -0.02em; margin: 0 0 18px; }

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
.woocommerce .select2-container--default .select2-selection--single {
	background: transparent;
	border: 1px solid var(--line);
	border-radius: 0;
	padding: 12px 14px;
	font-family: inherit;
	font-size: 14px;
	height: auto;
	line-height: 1.4;
	color: var(--ink);
}
.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus {
	outline: none;
	border-color: var(--ink);
}
.woocommerce form .form-row label {
	font-size: 10px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--steel);
	margin-bottom: 6px;
}
.woocommerce form .form-row.woocommerce-invalid input.input-text { border-color: #b3261e; }

.woocommerce .woocommerce-message,
.woocommerce .woocommerce-info,
.woocommerce .woocommerce-error {
	background: transparent;
	border: 1px solid var(--line);
	border-left: 2px solid var(--ink);
	border-radius: 0;
	color: var(--ink);
	font-size: 13px;
	padding: 14px 18px 14px 20px;
	margin-bottom: 24px;
	list-style: none;
}
.woocommerce .woocommerce-error { border-left-color: #b3261e; }
.woocommerce .woocommerce-message::before,
.woocommerce .woocommerce-info::before,
.woocommerce .woocommerce-error::before { display: none; }
.woocommerce .woocommerce-message .button,
.woocommerce .woocommerce-info .button {
	float: right;
	padding: 10px 18px;
	min-height: 0;
	font-size: 10px;
}

.woocommerce nav.woocommerce-pagination ul {
	border: 0;
	display: flex;
	gap: 8px;
	justify-content: center;
	margin: 48px 0 0;
	padding: 0;
}
.woocommerce nav.woocommerce-pagination ul li { border: 0; margin: 0; overflow: visible; }
.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
	min-width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--line);
	font-size: 12px;
	padding: 0;
}
.woocommerce nav.woocommerce-pagination ul li span.current {
	background: var(--ink);
	color: var(--paper);
	border-color: var(--ink);
}

/* Shop archive heading ----------------------------------------------------- */
.woocommerce-products-header {
	margin-bottom: clamp(24px, 3vw, 40px);
}
.woocommerce-products-header__title,
.woocommerce-products-header h1 {
	font-size: clamp(32px, 4.6vw, 64px);
	letter-spacing: -0.04em;
	line-height: 1;
	font-weight: 500;
	margin: 0 0 12px;
}
.woocommerce-products-header .term-description {
	font-size: 14px;
	color: var(--muted);
	max-width: 60ch;
}

.ms-shop > div[class*="notices"] { margin-bottom: 20px; }

/* Responsive --------------------------------------------------------------- */
@media (max-width: 1024px) {
	ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
	.single-product div.product { grid-template-columns: 1fr; }
	.single-product div.product .summary { position: static; }
	ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.woocommerce-tabs ul.tabs { gap: 18px; overflow-x: auto; }
	.woocommerce table.shop_table { font-size: 12px; }
}
@media (hover: none) {
	ul.products li.product a img { transition: none; }
}

/* ==========================================================================
   Single product — static gallery, colourway swatches, size picker
   The gallery is plain markup (inc/woo-single.php) instead of WooCommerce's
   flexSlider: one large image plus a thumbnail row, driven by 12 lines of JS.
   A lazyload plugin rewriting <img src> can no longer leave the column blank,
   and there is no slider width to recalculate on resize.
   ======================================================================== */

/* 只有主题自己的相册真的在页面上时，才隐藏 WooCommerce 的原生相册。
   以前是无条件隐藏：一旦商品匹配不上目录（批量导入的款号对不上），主题相册
   不会输出，原生相册又被这条规则藏掉 —— 商品页连主图都没有了。
   :has() 不支持的浏览器会两张都显示，难看但不会是白页。 */
.single-product div.product:has(.ms-pdp-gallery) .woocommerce-product-gallery { display: none; }
.single-product div.product .ms-pdp-gallery + .woocommerce-product-gallery { display: none; }

.ms-pdp-gallery {
	display: grid;
	gap: 10px;
	align-content: start;
}

.ms-pdp-gallery__main {
	margin: 0;
	background: #f2efe9;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

.ms-pdp-gallery__main img,
.ms-pdp-gallery__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity 0.2s ease;
}

.ms-pdp-gallery__thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ms-pdp-gallery__thumbs li { margin: 0; }

.ms-pdp-gallery__thumb {
	display: block;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 1px solid var(--line);
	background: none;
	cursor: pointer;
	overflow: hidden;
	opacity: 0.66;
	transition: opacity 0.18s ease, border-color 0.18s ease;
}

.ms-pdp-gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ms-pdp-gallery__thumb:hover { opacity: 1; }
.ms-pdp-gallery__thumb.is-active { border-color: var(--ink); opacity: 1; }

/* Both pickers sit inside the cart form, above the button. */
.ms-pdp-opt {
	margin: 0 0 20px;
	padding: 0 0 18px;
	border-bottom: 1px solid var(--line);
}

.ms-pdp-opt:last-of-type { border-bottom: 0; padding-bottom: 0; }

.ms-pdp-opt__k {
	display: block;
	margin-bottom: 10px;
	font-size: 10px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--steel);
}

.ms-pdp-opt__k em {
	margin-left: 6px;
	font-style: normal;
	letter-spacing: 0.08em;
	color: #a8442f;
}

.ms-pdp-swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.ms-pdp-swatch {
	position: relative;
	display: block;
	width: 48px;
	height: 48px;
	border: 1px solid var(--line);
	overflow: hidden;
	text-decoration: none;
	opacity: 0.7;
	transition: opacity 0.18s ease, border-color 0.18s ease;
}

.ms-pdp-swatch img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ms-pdp-swatch span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ms-pdp-swatch:hover { opacity: 1; }
.ms-pdp-swatch.is-active { border-color: var(--ink); border-width: 2px; opacity: 1; }
.ms-pdp-swatch__dot { display: block; width: 100%; height: 100%; background: var(--steel); }

.ms-pdp-sizes { display: flex; flex-wrap: wrap; gap: 8px; }

.ms-pdp-size { position: relative; display: inline-flex; }

.ms-pdp-size input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.ms-pdp-size span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 52px;
	height: 42px;
	padding: 0 14px;
	border: 1px solid var(--line);
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ink);
	transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.ms-pdp-size:hover span { border-color: var(--ink); }

.ms-pdp-size input:checked + span {
	background: var(--ink);
	border-color: var(--ink);
	color: var(--paper);
}

.ms-pdp-size input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

/* WooCommerce's own quantity field is styled on the cart page; on the product
   page it sits next to the size row, so tighten it up. */
.single-product div.product form.cart { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.single-product div.product form.cart .ms-pdp-opt { flex: 0 0 100%; }
.single-product div.product form.cart .quantity { margin: 0; }

@media (max-width: 860px) {
	.ms-pdp-gallery__thumb { width: 54px; height: 54px; }
	.single-product div.product form.cart .button { flex: 1 1 auto; }
}

/* The colour x size grid replaces the quantity box ---------------------------------
   A catalogue style is bought by the grid (inc/mix.php): the minimum is a
   per-style total, so the single "how many?" field has nothing left to say.
   It stays in the form — hidden, not removed — because WooCommerce reads it and
   main.js keeps it equal to the grid total. `~` covers a page rendered before
   the script has run; .ms-has-mix covers the rest. */
.single-product div.product form.cart .ms-mix { flex: 1 1 100%; margin-bottom: 4px; }

.single-product div.product form.cart .ms-mix ~ .quantity,
.single-product div.product form.cart.ms-has-mix .quantity { display: none; }

.single-product div.product form.cart .ms-mix ~ .quantity + .single_add_to_cart_button,
.single-product div.product form.cart.ms-has-mix .single_add_to_cart_button { flex: 1 1 auto; }

/* Belt and braces: a theme or plugin that wraps the quantity box would break
   the sibling selector above, so hide it by ancestry too. :has() is ignored by
   anything that does not understand it, which is why both rules exist. */
.single-product div.product form.cart:has(.ms-mix) .quantity { display: none; }
.single-product div.product form.cart:has(.ms-mix) .single_add_to_cart_button { flex: 1 1 auto; }
