/**
 * YK WC Grid Variations — Single product page styles.
 *
 * Consumes the same --yk-* design tokens defined in yk-wcgv.css
 * (which is also enqueued on is_product() pages).
 *
 * Scoped to .single-product body class (added by WooCommerce).
 */

/* ============================================================
   VARIATION TABLE
   ============================================================ */

/* Convert the table rows to a block layout so swatches sit
   directly under the label without the table column gap. */
.single-product .variations,
.single-product .variations tbody,
.single-product .variations tr {
	display: block;
	width: 100%;
	border: none;
}

.single-product .variations tr {
	margin-bottom: 1.25rem;
}

.single-product .variations th.label,
.single-product .variations td.value {
	display: block;
	padding: 0;
	text-align: left;
	vertical-align: top;
}

.single-product .variations th.label {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--yk-text);
	margin-bottom: 0.5rem;
	border: none;
}

.single-product .variations th.label label {
	margin: 0;
}

/* Reset variations link — hidden; our swatches/pills toggle off on re-click */
.single-product .reset_variations {
	display: none !important;
}

/* ============================================================
   COLOUR SWATCHES
   ============================================================ */
.yk-sp-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.yk-sp-swatch {
	position: relative;
	display: block;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	flex-shrink: 0;
	cursor: pointer;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
	transition: transform 0.12s ease;
}

.yk-sp-swatch:hover:not(.is-disabled) {
	transform: scale(1.1);
}

/* Image swatch — the term's uploaded image, same treatment as the archive card. */
.yk-sp-swatch.has-image {
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

/* Same rule as the archive (.yk-swatch.is-light): light fills and images get a stronger
   edge, driven by swatch.is_light. The old [style*="…#ffffff"] match is gone — here it could
   never fire anyway, because the JS sets the colour via style.backgroundColor and the
   browser serialises it to rgb(255, 255, 255). These swatches already carry a border, so
   only its colour changes and the box size is untouched. */
.yk-sp-swatch.is-light,
.yk-sp-swatch.has-image {
	border-color: rgba(0, 0, 0, 0.28);
}

.yk-sp-swatch.is-active {
	outline: 2.5px solid var(--yk-btn-bg);
	outline-offset: 2px;
}

/* Same corner badge as the archive card (.yk-swatch.is-active::after) — the two screens
   must show selection identically. Only the size differs, scaled to the 26px swatch. */
.yk-sp-swatch.is-active::after {
	content: '';
	position: absolute;
	top: -3px;
	right: -3px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background-color: var(--yk-btn-bg);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='4 13 9 18 20 6' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 62%;
	box-shadow: 0 0 0 1px var(--yk-bg-card, #ffffff);
	pointer-events: none;
}

.yk-sp-swatch.is-disabled {
	opacity: 0.35;
	cursor: not-allowed;
	pointer-events: none;
}

/* ============================================================
   SIZE PILLS
   ============================================================ */
.yk-sp-sizes {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.yk-sp-size {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.75rem;
	padding: 4px 10px;
	font-size: 0.8125rem;
	font-weight: 500;
	font-family: inherit;
	border: 1px solid #c8c8c8;
	border-radius: var(--yk-radius-pill);
	background: transparent;
	color: var(--yk-text);
	cursor: pointer;
	white-space: nowrap;
	line-height: 1.6;
	transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.yk-sp-size:hover:not(.is-disabled):not([disabled]) {
	background-color: var(--yk-neutral);
	border-color: var(--yk-text);
}

.yk-sp-size.is-active {
	background-color: var(--yk-text);
	border-color: var(--yk-text);
	color: #ffffff;
}

.yk-sp-size.is-active::before {
	content: '';
	display: inline-block;
	width: 11px;
	height: 11px;
	flex-shrink: 0;
	margin-right: 4px;
	background-color: #ffffff;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='2 13 9 20 22 4' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='2 13 9 20 22 4' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.yk-sp-size.is-disabled,
.yk-sp-size[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
	text-decoration: line-through;
	pointer-events: none;
}

/* ============================================================
   RESET SELECTION
   Only escape route once WooCommerce has disabled every remaining
   option and hidden its own "Clear" link. A button element styled
   as a text link — quiet enough not to compete with the options,
   and hidden entirely until something is actually selected.
   ============================================================ */
.yk-sp-reset {
	display: inline-block;
	margin-top: 8px;
	padding: 0;
	border: 0;
	background: transparent;
	font-family: inherit;
	font-size: 0.8125rem;
	line-height: 1.6;
	color: var(--yk-text-muted);
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.yk-sp-reset:hover,
.yk-sp-reset:focus-visible {
	color: var(--yk-text);
}

/* [hidden] loses to the display above, so restate it. */
.yk-sp-reset[hidden] {
	display: none;
}

/* ============================================================
   QUANTITY STEPPER
   ============================================================ */
.single-product div.quantity.yk-sp-qty-wrap {
	display: inline-flex !important;
	align-items: center;
	border: 1px solid var(--yk-border) !important;
	border-radius: 25px !important;
	overflow: hidden;
	height: 44px !important;
	width: auto !important;
	min-width: 0 !important;
	flex-shrink: 0;
	background: transparent;
	padding: 0 !important;
	margin: 0 !important;
}

/* WooCommerce adds a hidden label inside div.quantity — keep it hidden */
.single-product div.quantity.yk-sp-qty-wrap > label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.single-product .yk-sp-qty-minus,
.single-product .yk-sp-qty-plus {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 100%;
	flex-shrink: 0;
	background: transparent;
	border: none;
	color: var(--yk-text);
	cursor: pointer;
	padding: 0;
	font-family: inherit;
	transition: background 0.15s;
}

.single-product .yk-sp-qty-minus:hover,
.single-product .yk-sp-qty-plus:hover {
	background: var(--wp--preset--color--subtle, #FBF4C8);
}

.single-product input.qty.yk-sp-qty-input {
	width: 40px !important;
	min-width: 0 !important;
	text-align: center !important;
	border: none !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	font-size: 0.9375rem !important;
	font-weight: 400;
	font-family: inherit;
	background: transparent !important;
	color: var(--wp--preset--color--secondary, #000000);
	padding: 0 !important;
	/* The field sits between the two buttons, so anything on its side pushes the number
	   off the pill's centre. A host site put a 0.5em right margin on it — the number read
	   as left-aligned with a gap before the + button. The stepper owns this box. */
	margin: 0 !important;
	height: 100% !important;
	-moz-appearance: textfield;
	-webkit-appearance: textfield;
	appearance: textfield;
}

.single-product input.qty.yk-sp-qty-input::-webkit-inner-spin-button,
.single-product input.qty.yk-sp-qty-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* ============================================================
   CART ROW — qty stepper + add-to-cart button side by side
   ============================================================ */

/* Variable products — WooCommerce wraps qty+button in .variations_button */
.single-product .variations_button {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 1rem;
}

/* Simple products — qty+button are direct children of form.cart */
.single-product form.cart:not(.variations_form) {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.single-product .variations_button .single_add_to_cart_button,
.single-product form.cart:not(.variations_form) .single_add_to_cart_button {
	flex: 1;
	min-width: 0;
}

/* ============================================================
   ADD TO CART BUTTON
   ============================================================ */
.single-product .single_add_to_cart_button.button {
	display: flex !important;
	align-items: center;
	justify-content: center;
	padding: 0.65rem 1.5rem !important;
	font-size: 0.875rem !important;
	font-weight: 600 !important;
	font-family: inherit !important;
	letter-spacing: 0.02em;
	border-radius: var(--yk-radius-btn) !important;
	border: 1px solid var(--yk-btn-bg) !important;
	background-color: var(--yk-btn-bg) !important;
	color: var(--yk-btn-fg) !important;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	line-height: 1.4;
	height: 44px;
	transition: background-color 0.15s ease, border-color 0.15s ease !important;
	box-sizing: border-box;
}

.single-product .single_add_to_cart_button.button:hover {
	background-color: var(--yk-btn-bg-hover) !important;
	border-color: var(--yk-btn-bg-hover) !important;
	color: var(--yk-btn-fg) !important;
}

.single-product .single_add_to_cart_button.button.loading {
	opacity: 0.65;
	cursor: wait;
}

/* ============================================================
   PRICE
   ============================================================ */
.single-product .summary .price {
	font-size: 1.125rem !important;
	font-weight: 700;
	color: var(--yk-text);
	margin-bottom: 0.75rem !important;
	line-height: 1.4;
}

.single-product .summary .price del {
	color: var(--yk-text-subtle);
	font-size: 0.875rem;
	font-weight: 400;
	margin-right: 6px;
	text-decoration: line-through;
}

.single-product .summary .price del .woocommerce-Price-amount {
	color: var(--yk-text-subtle);
	font-weight: 400;
}

.single-product .summary .price ins {
	text-decoration: none;
	color: var(--yk-text);
	font-weight: 700;
}

/* Variation price (shown after selecting a variation) */
.single-product .woocommerce-variation-price .price {
	font-size: 1rem !important;
	font-weight: 700;
	color: var(--yk-text);
}

/* ============================================================
   SKU / Art.-Nr. + product meta
   ============================================================ */
.single-product .product_meta {
	font-size: 0.875rem;
	color: var(--yk-text-muted);
	margin-top: 0.75rem;
	line-height: 1.6;
}

.single-product .product_meta a {
	color: var(--yk-text-muted);
	text-decoration: none;
}

.single-product .product_meta a:hover {
	color: var(--yk-text);
	text-decoration: underline;
}

/* Hide the categories listing */
.single-product .product_meta .posted_in {
	display: none !important;
}

.single-product .sku_wrapper {
	display: block;
	font-size: 0.875rem;
	color: var(--yk-text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.6;
}

.single-product .sku {
	display: inline;
	color: var(--yk-text);
	font-weight: 700;
}

/* Breadcrumbs on single product — reinforce the generic rule */
.single-product .woocommerce-breadcrumb {
	font-size: 0.875rem;
	color: var(--yk-text-muted);
}

.single-product .woocommerce-breadcrumb a {
	color: var(--yk-text-muted);
	text-decoration: none;
}

.single-product .woocommerce-breadcrumb a:hover {
	color: var(--yk-text);
	text-decoration: underline;
}

/* ============================================================
   SHA OVERRIDES — body.yk-variant-shop-attack
   ============================================================ */
body.yk-variant-shop-attack .single-product .single_add_to_cart_button.button {
	background-color: var(--wp--preset--color--secondary, #000000) !important;
	border-color:     var(--wp--preset--color--secondary, #000000) !important;
	color: #ffffff !important;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	border-radius: 25px !important;
}

body.yk-variant-shop-attack .single-product .single_add_to_cart_button.button:hover {
	background-color: var(--wp--preset--color--contrast, #222222) !important;
	border-color:     var(--wp--preset--color--contrast, #222222) !important;
}

body.yk-variant-shop-attack .single-product .yk-sp-swatch.is-active {
	outline-color: var(--wp--preset--color--secondary, #000000);
}

body.yk-variant-shop-attack .single-product .yk-sp-size.is-active {
	background-color: var(--wp--preset--color--secondary, #000000);
	border-color:     var(--wp--preset--color--secondary, #000000);
}

body.yk-variant-shop-attack .single-product .summary .price ins,
body.yk-variant-shop-attack .single-product .summary .price ins .woocommerce-Price-amount {
	color: var(--wp--preset--color--contrast, #222222);
	font-weight: 700;
}
