/*
 * WEWIRA Variants - structural styles only.
 * Colour, type, spacing scale, focus ring and states belong to the theme.
 */

/* The WooCommerce selects stay in the DOM and keep working; they are only moved out of sight. */
.variations_form:has(> .variants) table.variations,
.variations_form.variants-ready table.variations {
	/* display: block is required: a CSS table treats width as a minimum and would keep its
	   min-content width, so the classic visually-hidden box does not shrink a <table>. */
	display: block;
	position: absolute;
	width: 1px;
	max-width: 1px;
	height: 1px;
	max-height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	clip-path: inset(50%);
	white-space: nowrap;
}

.variants {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.variants__group {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	min-width: 0;
}

.variants__label {
	display: block;
}

.variants__options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.variants__option {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 3rem;
	min-height: 2.75rem;
	padding: 0.5rem 0.75rem;
	font: inherit;
	color: inherit;
	text-align: center;
	cursor: pointer;
	border: 0;
}

.variants__option.is-impossible .variants__value {
	text-decoration: line-through;
}

.variants__matrix {
	display: grid;
	/* max-content as the column minimum keeps article numbers and headers from overlapping;
	   the container scrolls instead of clipping. */
	grid-template-columns: auto repeat(var(--variants-columns, 1), minmax(max-content, 1fr));
	gap: 2px;
	max-width: 100%;
	overflow-x: auto;
	overscroll-behavior-x: contain;
}

.variants__matrix .variants__option {
	min-width: 0;
	width: 100%;
	padding: 0.5rem;
}

.variants__matrix .variants__value {
	white-space: nowrap;
}

.variants__matrix-head {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.25rem 0.5rem;
	white-space: nowrap;
}

.variants__specs {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
	gap: 0.5rem;
	margin: 0;
}

.variants__spec {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.variants__spec dt,
.variants__spec dd {
	margin: 0;
}

.variants__reset {
	align-self: flex-start;
	font: inherit;
	color: inherit;
	cursor: pointer;
	background: none;
	border: 0;
	padding: 0;
	text-decoration: underline;
}

.variants__status {
	margin: 0;
}

.variants .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	clip-path: inset(50%);
	white-space: nowrap;
}

.variants__option:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}
