// 2.0 storefront features that apply in both looks (docs/redevelopment/PLAN.md Phase 5c).
// Loaded after swatches.css. Every rule here is neutral for the values an upgraded store reads
// (1.1.7 behaviour), which the storefront baseline checks: border style "solid", button colours equal
// to the colour & image colours, spacing 8 px, Attribute Label "theme" (no body class), area 100%.

// The 1.x markup's class names (kept for compatibility, PLAN §6.5) are not BEM.
/* stylelint-disable selector-class-pattern */

$product-form: "form.variations_form:not(.spswp_variations_form)";

// Swatch border style: the selected swatch keeps a frame when the style is "None".
.sp-smart-selected-swatch.sp-smart-swatches-item {
	outline-style: var(--ssw-p-border-style-active);
}

// Button swatches have their own colours (1.x shared the colour & image ones). One class more than
// each 1.x rule they replace, so the 1.x order of states is kept: hover beats selected.
.sp-smart-swatch-label-option.sp-smart-swatches-item {
	outline-color: var(--ssw-p-btn-border);
	background: var(--ssw-p-btn-bg);
}

.sp-smart-swatch-label-option.sp-smart-selected-swatch.sp-smart-swatches-item {
	outline-color: var(--ssw-p-btn-border-active);
	background: var(--ssw-p-btn-bg-active);
}

.sp-smart-swatch-label-option.sp-smart-swatches-item:not(.sp-smart-swatches-out-of-stock):hover {
	outline-color: var(--ssw-p-btn-border-hover);
	background: var(--ssw-p-btn-bg-hover);
}

// Shop cards with their own styles: buttons take the shop button colours, state by state as 1.1.7
// resolved its rules (selected + hover shows the hover outline and the active fill).
.ssw-shop-own .spswp-shop-variations .sp-smart-swatch-label-option.sp-smart-swatches-item {
	outline-color: var(--ssw-s-btn-border);
	background: var(--ssw-s-btn-bg);
}

/* stylelint-disable-next-line @stylistic/max-line-length */
.ssw-shop-own .spswp-shop-variations .sp-smart-swatch-label-option.sp-smart-swatches-item:not(.sp-smart-swatches-out-of-stock):hover {
	outline-color: var(--ssw-s-btn-border-hover);
	background: var(--ssw-s-btn-bg-hover);
}

.ssw-shop-own .spswp-shop-variations .sp-smart-swatch-label-option.sp-smart-selected-swatch.sp-smart-swatches-item {
	outline-color: var(--ssw-s-btn-border-active);
	background: var(--ssw-s-btn-bg-active);
}

/* stylelint-disable-next-line @stylistic/max-line-length */
.ssw-shop-own .spswp-shop-variations .sp-smart-swatch-label-option.sp-smart-selected-swatch.sp-smart-swatches-item:not(.sp-smart-swatches-out-of-stock):hover {
	outline-color: var(--ssw-s-btn-border-hover);
	background: var(--ssw-s-btn-bg-active);
}

// Swatch spacing (product page).
#{$product-form} .sp-smart-swatches-container {
	gap: var(--ssw-p-gap);
}

// Swatch Area Max Width (product page).
.ssw-area-limited #{$product-form} .sp-smart-swatches-container {
	max-width: var(--ssw-p-area);
}

// Attribute Label: above, beside or hidden ("theme" leaves the theme's table layout alone). The table
// is a full-width block: with rows no longer table rows, block themes would shrink it to its
// narrowest content.
.ssw-label-above #{$product-form} table.variations,
.ssw-label-above #{$product-form} table.variations tbody,
.ssw-label-beside #{$product-form} table.variations,
.ssw-label-beside #{$product-form} table.variations tbody,
.ssw-label-hidden #{$product-form} table.variations,
.ssw-label-hidden #{$product-form} table.variations tbody {
	display: block;
	width: 100%;
}

.ssw-label-above #{$product-form} table.variations tr {
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

// The layouts space the rows themselves: theme margins on the cells (Storefront's 16 px under each
// value) would push the name off the swatches' centre and widen the rows.
.ssw-label-above #{$product-form} table.variations tr .label,
.ssw-label-above #{$product-form} table.variations tr td.value,
.ssw-label-beside #{$product-form} table.variations tr .label,
.ssw-label-beside #{$product-form} table.variations tr td.value,
.ssw-label-hidden #{$product-form} table.variations tr td.value {
	margin: 0;
}

.ssw-label-above #{$product-form} table.variations tr .label,
.ssw-label-above #{$product-form} table.variations tr td.value {
	display: block;
	width: auto;
	text-align: left;
}

.ssw-label-above #{$product-form} table.variations tr .label {
	padding: 0 0 6px;
}

.ssw-label-above #{$product-form} table.variations tr td.value {
	padding: 0 0 14px;
}

// Beside: one grid for every row, so the names share a column and the swatches of every attribute
// start at the same place (the preview's "sizer" does the same).
.ssw-label-beside #{$product-form} table.variations tbody {
	display: grid;
	grid-template-columns: fit-content(40%) minmax(0, 1fr);
	align-items: center;
	column-gap: 16px;
}

.ssw-label-beside #{$product-form} table.variations tr {
	display: contents;
}

.ssw-label-beside #{$product-form} table.variations tr .label,
.ssw-label-beside #{$product-form} table.variations tr td.value {
	display: block;
	width: auto;
	padding: 0 0 14px;
}

.ssw-label-beside #{$product-form} table.variations tr .label {
	grid-column: 1;
}

.ssw-label-beside #{$product-form} table.variations tr td.value {
	grid-column: 2;
}

// The name and the selected value stay on one line beside the swatches.
.ssw-label-beside #{$product-form} table.variations tr .label {
	white-space: nowrap;
}

// Hidden: no name column and no empty space. Rows stack as with "above", without the name.
.ssw-label-hidden #{$product-form} table.variations tr {
	display: block;
}

.ssw-label-hidden #{$product-form} table.variations tr td.value {
	display: block;
	width: auto;
	padding: 0 0 14px;
	text-align: left;
}

// Rows with a swatch group drop the name: the group carries it (aria-label). Accordion rows keep it,
// it is their toggle.
/* stylelint-disable-next-line @stylistic/max-line-length */
.ssw-label-hidden #{$product-form} table.variations tr:has(.sp-smart-swatches-container[role="radiogroup"]):not(:has([data-product-showstyle="accordion"])) .label {
	display: none !important;
}

// Other rows (WooCommerce's dropdown, radio buttons) keep it for screen readers only.
.ssw-label-hidden #{$product-form} table.variations tr .label {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

// Accordion rows keep their name in sight: it is their toggle (both looks, and the live preview).
/* stylelint-disable-next-line @stylistic/max-line-length */
.ssw-label-hidden #{$product-form} table.variations tr:has(.sp-smart-swatches-container[data-product-showstyle="accordion"]) .label {
	display: block;
	position: static !important;
	width: auto;
	height: auto;
	padding: 0 0 6px;
	overflow: visible;
	clip-path: none;
}

// Variation Label Separator, both looks, as the live preview draws it (resources/js/frontend/
// display.js puts it in its own span after the name): only before the selected value ("Color: Sky"),
// in every Attribute Label layout, as 1.x wrote it. The value alone is bold (look-v2.scss).
.ssw-label-sep {
	display: none;
}

#{$product-form} table.variations .label .ssw-label-sep:has(+ .sp-smart-swatches-selected-label) {
	display: inline;
}

// Selected Variation Label off while "Always show selected value as text" is on (Render\StyleVars):
// the value stays for screen readers only, and the separator drawn before it goes with it.
.ssw-label-sr .sp-smart-swatches-selected-label {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.ssw-label-sr #{$product-form} table.variations .label .ssw-label-sep {
	display: none !important;
}

// The preview's cross (12 × 12 view box, 1.6 stroke), drawn in the link's colour as a mask.
/* stylelint-disable-next-line @stylistic/max-line-length */
$clear-cross: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 3l6 6M9 3l-6 6' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E";

// Clear (WooCommerce's reset link), both looks, as the live preview draws it: a small link with a
// cross, 14 px after the swatches on their line (on the next one when they fill it). Hidden, it takes
// no room. Above theme styles (OceanWP floats it in a grey box, Storefront adds a refresh icon).
body #{$product-form} table.variations td.value:has(> .sp-smart-swatches-container):has(> .reset_variations) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
}

body #{$product-form} table.variations td.value:has(> .reset_variations) > .sp-smart-swatches-container {
	min-width: 0;
}

// Slider and scroll boxes contain their width, so as flex items they would have none: scroll boxes
// take their max-width (N swatches), the slider its window and buttons, and Clear follows them.
body #{$product-form} table.variations td.value:has(> .reset_variations) > .sp-smart-swatches-container.ssw-boxed {
	flex: 0 1 auto;
	width: 100%;
}

body #{$product-form} table.variations td.value:has(> .reset_variations) > .sp-smart-swatches-container.ssw-slider {
	width: auto;
	contain: none;
}

body #{$product-form} table.variations td.value .reset_variations {
	display: inline-flex;
	float: none;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: #2271b1;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: normal;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
}

body #{$product-form} table.variations td.value .reset_variations:hover {
	color: #2271b1;
	text-decoration: none;
}

body #{$product-form} table.variations td.value .reset_variations::before {
	content: "";
	display: block;
	flex: 0 0 10px;
	width: 10px;
	height: 10px;
	margin: 0;
	color: inherit;
	background: currentcolor;
	-webkit-mask: url($clear-cross) center / 10px 10px no-repeat;
	mask: url($clear-cross) center / 10px 10px no-repeat;
}

body #{$product-form} table.variations td.value .reset_variations[style*="visibility: hidden"] {
	display: none;
}

// "Wrap (+N more)": swatches past the per-view count stay hidden until the chip is pressed.
.sp-smart-swatches-container .ssw-wrap-hidden {
	display: none !important;
}

.sp-smart-swatches-container .ssw-more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	padding: 0 8px;
	border: 1px dashed #c3c4c7;
	border-radius: var(--ssw-p-radius);
	background: none;
	color: inherit;
	font: inherit;
	font-size: 13px;
	line-height: 1.3;
	box-shadow: none;
	cursor: pointer;
}

.sp-smart-swatches-container .ssw-more:hover {
	border-color: #8c8f94;
}

// Cards, both looks (the preview draws cards one way): the preview's grey chip, as tall as the
// swatches. `body` keeps it above theme button styles.
body .spswp_variations_form .sp-smart-swatches-container .ssw-more {
	align-self: stretch;
	box-sizing: border-box;
	min-width: 0;
	margin: 0;
	padding: 0 5px;
	border: 1px dashed #c3c4c7;
	background: #f6f7f7;
	color: #50575e;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	text-transform: none;
}

body .spswp_variations_form .sp-smart-swatches-container .ssw-more:hover {
	background: #eef0f2;
}

// Cards with their own styles: the chip takes the shop swatches' corners.
body.ssw-shop-own .spswp-shop-variations .sp-smart-swatches-container .ssw-more {
	border-radius: var(--ssw-s-radius);
}

// Slider, both looks, as the settings' live preview draws it (resources/js/frontend/display.js): a
// window of N swatches, 26 px round buttons on the product page, 22 px side bars at a card's edges.
// Scroll boxes and slider windows take the width they are given, so they never widen the variations
// table or the card (1.x makes shop cells flex rows that grow with their content). `body` keeps the
// buttons above theme button styles; display.js sets their outer margins.
body .sp-smart-swatches-container .ssw-slide-hidden {
	display: none !important;
}

body .sp-smart-swatches-container.ssw-boxed {
	contain: inline-size;
	min-width: 0;
	max-width: 100%;
}

// Card scroll boxes sized by Swatches Per View sit where the shop's Swatch Alignment says (the 1.x
// stylesheet centres every shop cell).
.spswp-shop-variations tr td.value {
	justify-content: var(--ssw-s-justify);
}

// Swatches keep their size in a box sized by Swatches Per View: the rest scrolls instead of squeezing.
body .sp-smart-swatches-container.ssw-boxed > .sp-smart-swatches-item {
	flex-shrink: 0;
}

// Card sliders and vertical scroll boxes (display.js and the live preview set --ssw-fit-width): a
// swatch wider than the room it has (Image with Label on a narrow card) shrinks to it and its label
// ends in an ellipsis, so no swatch is cut and no box scrolls sideways.
body .sp-smart-swatches-container[style*="--ssw-fit-width"] > .sp-smart-swatches-item {
	box-sizing: border-box;
	min-width: 0;
	max-width: var(--ssw-fit-width);
}

body .sp-smart-swatches-container[style*="--ssw-fit-width"] > .sp-smart-swatches-item > .sp-smart-swatches-item-text {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

body .sp-smart-swatches-container button.ssw-step {
	display: inline-flex;
	flex: 0 0 26px;
	align-items: center;
	align-self: center;
	justify-content: center;
	box-sizing: border-box;
	width: 26px;
	min-width: 0;
	height: 26px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	box-shadow: inset 0 0 0 1px #dddee1;
	color: #3c434a;
	line-height: 1;
	text-transform: none;
	cursor: pointer;
	transition: opacity 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

body .sp-smart-swatches-container button.ssw-step:hover {
	background: #fff;
	box-shadow: inset 0 0 0 1px #8c8f94;
	color: #3c434a;
}

body .sp-smart-swatches-container button.ssw-step--prev {
	margin-right: 4px;
}

body .sp-smart-swatches-container button.ssw-step--next {
	margin-left: 4px;
}

body .sp-smart-swatches-container button.ssw-step--prev svg {
	transform: rotate(180deg);
}

body .sp-smart-swatches-container button.ssw-step[aria-disabled="true"] {
	opacity: 0.35;
	cursor: default;
}

body .spswp_variations_form .sp-smart-swatches-container button.ssw-step {
	flex: 0 0 22px;
	align-self: stretch;
	width: 22px;
	height: auto;
	border-radius: 4px;
	background: #f6f7f7;
	box-shadow: none;
}

body .spswp_variations_form .sp-smart-swatches-container button.ssw-step:hover {
	background: #eef0f2;
	box-shadow: none;
}

// Accordion on the product page, both looks, as the live preview draws it (resources/js/frontend/
// display.js): the attribute name opens and closes the row. Its caret is the preview's: 12 px, grey,
// down while open and turned toward the name while closed (RTL builds flip it). Past N swatches,
// "Show all" / "Show less" are links. `body` keeps the toggle above theme button styles.
body tr.ssw-accordion .label label,
body tr.ssw-accordion .label {
	cursor: pointer;
}

// The caret stays beside the name in a narrow name column.
body tr.ssw-accordion .ssw-accordion-name {
	white-space: nowrap;
}

body tr.ssw-accordion button.ssw-accordion-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 12px;
	min-width: 0;
	height: 12px;
	margin: 0 4px 0 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: #8c8f94;
	vertical-align: -1px;
	cursor: pointer;
}

body tr.ssw-accordion button.ssw-accordion-toggle:hover {
	background: none;
	color: #8c8f94;
}

body tr.ssw-accordion button.ssw-accordion-toggle svg {
	display: block;
	transition: transform 180ms ease;
}

body tr.ssw-accordion-closed button.ssw-accordion-toggle svg {
	transform: rotate(-90deg);
}

body tr.ssw-accordion-closed .sp-smart-swatches-container {
	display: none;
}

body #{$product-form} .sp-smart-swatches-container .ssw-more.ssw-more--link {
	min-width: 0;
	padding: 0 4px;
	border: 0;
	background: none;
	color: #2271b1;
	font-size: 12px;
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {

	body tr.ssw-accordion button.ssw-accordion-toggle svg {
		transition: none;
	}
}

// The fold chip, the slider buttons and the accordion toggle draw no focus outline, ring or shadow,
// theirs or the theme's: focused they look as at rest (hover still shows), and taps don't flash.
body .sp-smart-swatches-container .ssw-more,
body .sp-smart-swatches-container button.ssw-step,
body tr.ssw-accordion button.ssw-accordion-toggle {
	-webkit-tap-highlight-color: transparent;
}

body .sp-smart-swatches-container .ssw-more:focus,
body .sp-smart-swatches-container .ssw-more:focus-visible,
body .sp-smart-swatches-container button.ssw-step:focus,
body .sp-smart-swatches-container button.ssw-step:focus-visible,
body tr.ssw-accordion button.ssw-accordion-toggle:focus,
body tr.ssw-accordion button.ssw-accordion-toggle:focus-visible {
	outline: none;
}

// Variation Stock Info, both looks, as the design draws it (appendix D §9.1): a pill on the swatch's
// top-right corner, coloured by stock (the renderer adds the level class), on the product page and on
// shop and archive cards (display.js keeps room for it in the boxes that clip). Colours: Stock Badge
// Colors of each page (StyleVars: --ssw-p-stock-* and, on cards, --ssw-s-stock-*).
.sp-smart-swatches-item > .sp-smart-swatches-stock-info.sp-smart-swatches-style-top {
	position: absolute;
	top: -7px;
	right: -7px;
	bottom: auto;
	left: auto;
	z-index: 3;
	box-sizing: border-box;
	width: auto;
	min-width: 16px;
	height: 16px;
	margin: 0;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--ssw-p-stock-in, #00a32a);
	box-shadow: 0 0 0 2px #fff;
	color: var(--ssw-p-stock-in-text, #fff);
	font-size: 10px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	line-height: 16px;
	letter-spacing: 0;
	text-align: center;
	white-space: nowrap;
	pointer-events: none;
}

.sp-smart-swatches-item > .sp-smart-swatches-stock-info.ssw-stock-low {
	background: var(--ssw-p-stock-low, #dba617);
	color: var(--ssw-p-stock-low-text, #1d2327);
}

.sp-smart-swatches-item > .sp-smart-swatches-stock-info.ssw-stock-out {
	background: var(--ssw-p-stock-out, #dcdcde);
	color: var(--ssw-p-stock-out-text, #1d2327);
}

.spswp-shop-variations .sp-smart-swatches-item > .sp-smart-swatches-stock-info.sp-smart-swatches-style-top {
	background: var(--ssw-s-stock-in, #00a32a);
	color: var(--ssw-s-stock-in-text, #fff);
}

.spswp-shop-variations .sp-smart-swatches-item > .sp-smart-swatches-stock-info.ssw-stock-low {
	background: var(--ssw-s-stock-low, #dba617);
	color: var(--ssw-s-stock-low-text, #1d2327);
}

.spswp-shop-variations .sp-smart-swatches-item > .sp-smart-swatches-stock-info.ssw-stock-out {
	background: var(--ssw-s-stock-out, #dcdcde);
	color: var(--ssw-s-stock-out-text, #1d2327);
}

// Above the disabled styles' cross, which 1.x draws at z-index 9999 inside the sold-out swatch.
.sp-smart-swatches-out-of-stock > .sp-smart-swatches-stock-info {
	z-index: 10000;
}

// Keyboard focus sits on the swatch group, never on a swatch, and draws no ring, border or shadow:
// the arrow keys choose as they move, so the selected style shows where the shopper is (themes that
// outline every :focus would otherwise frame the group).
.sp-smart-swatches-container[role="radiogroup"]:focus,
.sp-smart-swatches-container[role="radiogroup"]:focus-visible {
	outline: none;
	box-shadow: none;
}

// Shop cards (PLAN Phase 6). The position classes exist only for the 2.0 positions and the body
// classes only for 2.0 values; resources/js/frontend/cards.js does the measuring.

// Over the image: a light strip on the image's bottom edge (cards.js sets top, left and width).
.spswp_variations_form.ssw-pos-over_image {
	position: absolute;
	z-index: 2;
	margin: 0;
	background: rgba(255, 255, 255, 0.9);
	box-sizing: border-box;
}

.ssw-pos-over_image .spswp-shop-variations,
.ssw-pos-below_image .spswp-shop-variations {
	margin: 0;
}

// Show on hover. Over the image the strip is revealed upwards; below the image the block opens
// (cards.js animates the height) and the card is lifted over the next row.
.ssw-card-hover .spswp_variations_form.ssw-pos-over_image {
	clip-path: inset(100% 0 0 0);
	opacity: 0;
	pointer-events: none;
	transition: clip-path 320ms cubic-bezier(0.4, 0, 0.2, 1), opacity 260ms ease;
}

.ssw-card-hover .ssw-card-active .spswp_variations_form.ssw-pos-over_image {
	clip-path: inset(0);
	opacity: 1;
	pointer-events: auto;
}

.ssw-card-hover .spswp_variations_form.ssw-pos-below_image {
	height: 0;
	overflow: hidden;
	opacity: 0;
	transition: height 320ms cubic-bezier(0.4, 0, 0.2, 1), opacity 260ms ease;
}

.ssw-card-hover .ssw-card-active .spswp_variations_form.ssw-pos-below_image {
	opacity: 1;
}

// The raised card (cards.js animates its margin with the block's height, so nothing around it moves).
.ssw-card-raised {
	z-index: 3;
	background-color: var(--ssw-card-bg, #fff);
	box-shadow: 0 14px 30px rgba(16, 17, 20, 0.14);
}

// Touch screens have no hover: "Always Show" keeps the swatches in view, "Hide" removes them.
@media (hover: none) {

	.ssw-card-hover:not(.ssw-card-touch-hide) .spswp_variations_form.ssw-pos-over_image {
		clip-path: none;
		opacity: 1;
		pointer-events: auto;
	}

	.ssw-card-hover:not(.ssw-card-touch-hide) .spswp_variations_form.ssw-pos-below_image {
		height: auto;
		overflow: visible;
		opacity: 1;
	}

	.ssw-card-touch-hide .spswp_variations_form.ssw-pos-over_image,
	.ssw-card-touch-hide .spswp_variations_form.ssw-pos-below_image {
		display: none;
	}
}

// Default style on cards: one row, the rest clipped (cards.js sets the height).
.ssw-card-row .spswp_variations_form .sp-smart-swatches-container.ssw-row-clipped {
	overflow: hidden;
}

// Room kept by cards without swatches ("Reserve Consistent Swatch Height").
.ssw-card-placeholder {
	display: block;
}

// Shop cards with their own styles: Button Inner Padding. The product page's button padding is
// !important (swatches.scss, as 1.x generated it), so without this the shop's value never applied.
.ssw-shop-own .spswp-shop-variations .sp-smart-swatches-item.sp-smart-swatch-label-option {
	padding: var(--ssw-s-button-padding) !important;
}

// Block themes: WooCommerce's block-theme stylesheet styles every `table.variations` as the product
// page form (`display: block`, cell padding and text-align), which shrank the cards' table to its
// swatches, so Swatch Alignment had no room to act, and replaced the bottom of the Swatch Margin.
// Scoped to block themes (Assets::body_class()), where that stylesheet loads.
.ssw-block-theme .spswp_variations_form table.spswp-shop-variations {
	display: table;
	width: 100%;
}

.ssw-block-theme .spswp_variations_form .spswp-shop-variations tr td.value {
	padding: var(--ssw-s-margin);
	text-align: var(--ssw-s-align);
}

.ssw-block-theme .spswp_variations_form .spswp-shop-variations tr td.label {
	padding: 0;
}

@media (prefers-reduced-motion: reduce) {

	.ssw-card-hover .spswp_variations_form.ssw-pos-over_image,
	.ssw-card-hover .spswp_variations_form.ssw-pos-below_image,
	.ssw-card-hover [data-ssw-grow] {
		transition: none !important;
	}
}

// Swatch tooltip, in both looks and in the settings live preview: the design's bubble (appendix D
// §9.4). resources/js/shared/tooltip.js sets its side, effect, colours and sizes from the settings
// and places it; frontend/tooltips.js shows it on the storefront instead of the 1.x tooltip
// (.spf-swatch-tooltip). Theme text styles are reset so it looks the same in every theme.
.ssw-tip {
	position: fixed;
	z-index: 99999;
	pointer-events: none;
}

.ssw-tip__arrow {
	position: absolute;
	width: 10px;
	height: 10px;
	border-radius: 2px;
	transform: rotate(45deg);
}

.ssw-tip__bubble {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	box-sizing: border-box;
	// Never wider than Max Width (inline): text wraps, long words break, a larger image scales down.
	width: max-content;
	padding: 7px 10px;
	border-radius: 6px;
	font-style: normal;
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: normal;
	text-align: center;
	text-transform: none;
	white-space: normal;
	overflow-wrap: anywhere;
	box-shadow: 0 6px 18px rgba(16, 17, 20, 0.16), 0 0 0 1px rgba(16, 17, 20, 0.05);
}

.ssw-tip__img {
	display: block;
	box-sizing: border-box;
	max-width: 100%;

	// Width and proportions are set inline (resources/js/shared/tooltip.js).
	img {
		display: block;
		max-width: 100%;
		height: auto;
		margin: 0;
		border: 0;
		border-radius: 4px;
		background: #eef1f2;
		box-shadow: none;
		object-fit: cover;
	}
}

@media (prefers-reduced-motion: reduce) {

	// The effect is set inline.
	.ssw-tip {
		transition: none !important;
	}
}
