/**
 * PLP-QUICKVIEW — inline size select on the card.
 *
 * Spec: VATALY PLP Design Spec V4 §6 / §7.
 * Figma: PLP Card Size Select (3815:1610) — 358x65, Stone background at 80%
 * opacity, sizes Manrope Bold 12px Taupe, sitting over the foot of the image.
 *
 * Desktop reveals it on card hover; clicking an available size adds the
 * card's colour in that size to the bag (js/plp-quickview.js). Touch devices
 * show a persistent "Select Size" tap target instead, because there is no
 * hover there.
 *
 * Tokens only. No raw hex.
 */

.woocommerce-archive ul.products li.product .product-thumbnail {
	position: relative;
}

.vataly-size-select {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 0 12px;
	opacity: 0;
	/* Not visibility:hidden — that makes the links unfocusable, so the bar
	   could never be reached by keyboard and :focus-within would never fire.
	   pointer-events keeps it inert to the mouse while it is invisible. */
	pointer-events: none;
	transform: translateY(6px);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Correction pass: Figma's 80% opacity is on the Stone fill only — the size
   text itself is fully opaque. A single opacity on .vataly-size-select faded
   both together, so the tint moves to this background-only layer instead;
   the bar's own opacity (below) now only drives its show/hide reveal. */
.vataly-size-select::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	background-color: var(--bg_clr2); /* Stone */
	opacity: 0.8; /* Figma: Stone at 80% */
}

.woocommerce-archive ul.products li.product:hover .vataly-size-select,
.woocommerce-archive ul.products li.product:focus-within .vataly-size-select {
	opacity: 1;
	pointer-events: auto;
	transform: none;
}

/* The "Select Size" caption is the mobile affordance; on desktop the bar
   itself is the affordance, so the caption stays hidden. */
.vataly-size-select__label {
	display: none;
}

.vataly-size-select__list {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0;
	min-height: 65px; /* Figma bar height */
	margin: 0;
	padding: 0;
	list-style: none;
}

.vataly-size-select__item {
	flex: 1 1 0;
	text-align: center;
}

/* Sizes are buttons (add to bag); reset them to read exactly like the old
   links: Manrope Bold 12, Taupe, no chrome. */
.vataly-size-select__size {
	position: relative;
	display: block;
	width: 100%;
	margin: 0;
	padding: 22px 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	font-family: var(--font2);
	font-weight: 700;
	font-size: 12px;
	line-height: 21px; /* keeps the 65px bar: 22 + 21 + 22 */
	letter-spacing: 0; /* Correction pass: Figma's type token has no tracking, 0.04em was invented */
	color: var(--ink_text); /* Taupe */
	text-transform: none;
	cursor: pointer;
}

/* Hover / keyboard focus on an available size (user's reference screenshot,
   measured at 2x): the letter turns Ink and a 20x20 square, 1px solid Taupe,
   no fill, is centred on it. Drawn as ::before so nothing in the bar moves. */
.vataly-size-select__size:not(:disabled):hover,
.vataly-size-select__size:not(:disabled):focus-visible {
	color: var(--ink_text); /* Ink */
	background: none;
	outline: none;
}

.vataly-size-select__size:not(:disabled):hover::before,
.vataly-size-select__size:not(:disabled):focus-visible::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	box-sizing: border-box;
	border: 1px solid var(--h_clr); /* Taupe */
	transform: translate(-50%, -50%);
	pointer-events: none;
}

/* Not buyable in the card's current colour (real variation stock): same
   Taupe as the other sizes, only struck through; not clickable, no hover
   square, plain arrow cursor (no not-allowed sign). */
.vataly-size-select__item.is-unavailable .vataly-size-select__size,
.vataly-size-select__size:disabled {
	color: var(--h_clr); /* Taupe, as available sizes */
	text-decoration: line-through;
	cursor: default;
}

/* Adding: the bar stays put, sizes dim and ignore further clicks. */
.vataly-size-select.is-loading .vataly-size-select__list {
	opacity: 0.5;
	pointer-events: none;
}

/* Add-to-bag error (WooCommerce's own message), shown under the sizes. */
.vataly-size-select__status {
	display: none;
	margin: 0;
	padding: 0 0 8px;
	font-family: var(--font2);
	font-weight: 300;
	font-size: 12px;
	line-height: 1.3;
	color: var(--ink_text);
	text-align: center;
}

.vataly-size-select.has-status .vataly-size-select__status {
	display: block;
}

/* Desktop / tablet only: phones add from the card's "+" (inc/plp-quickadd.php). */
@media (max-width: 767.98px) {
	.vataly-size-select {
		display: none !important;
	}
}

/* =========================================================================
   Touch / mobile — V4 §7: tap "Select Size" to open the options.
   ========================================================================= */

@media (hover: none) {
	.vataly-size-select {
		opacity: 1;
		pointer-events: auto;
		transform: none;
	}

	.vataly-size-select__label {
		display: block;
		padding: 10px 0;
		font-family: var(--font2);
		font-weight: 700;
		font-size: 12px;
		letter-spacing: 0.04em;
		color: var(--ink_text);
		text-align: center;
		cursor: pointer;
	}

	.vataly-size-select__list {
		display: none;
		min-height: 0;
		padding-bottom: 8px;
	}

	.vataly-size-select.is-open .vataly-size-select__list {
		display: flex;
	}

	.vataly-size-select.is-open .vataly-size-select__label {
		color: var(--h_clr);
	}
}
