/* FY Kit - variation swatches: colour circles and buttons on the product page,
 * colour dots on product cards and in shop filters. Themes restyle through the
 * --fyek-sw-* variables and the classes. */
:root {
	--fyek-sw-size: 30px;
	--fyek-sw-gap: 10px;
	--fyek-sw-ring: currentColor;
	--fyek-sw-radius: 999px;
	--fyek-sw-border: color-mix(in srgb, currentColor 24%, transparent);
	--fyek-sw-bg: transparent;
	--fyek-sw-on-bg: var(--fyek-ink, #111);
	--fyek-sw-on-ink: var(--fyek-paper, #fff);
	--fyek-sw-strike: color-mix(in srgb, currentColor 55%, transparent);
}

/* The real dropdown stays in the form, out of sight. */
.fyek-sw { position: relative; }
.fyek-sw > select { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; clip-path: inset(50%) !important; border: 0 !important; white-space: nowrap !important; opacity: 0 !important; }

.fyek-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fyek-sw-gap); margin: 0; padding: 0; }
.fyek-swatches__chosen { margin-left: .5em; font-weight: 400; color: var(--fyek-muted, inherit); }
.fyek-swatches__chosen:empty { display: none; }
.fyek-swatches__chosen::before { content: ""; }

.fyek-swatch { position: relative; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; line-height: 1; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.fyek-swatch__dot { display: block; box-sizing: border-box; width: var(--fyek-sw-size); height: var(--fyek-sw-size); border-radius: 50%; background: var(--fyek-sw, transparent); }
.fyek-swatch.is-split .fyek-swatch__dot { background: linear-gradient(135deg, var(--fyek-sw) 0 50%, var(--fyek-sw2) 50% 100%); }
.fyek-swatch.is-light .fyek-swatch__dot { box-shadow: inset 0 0 0 1px color-mix(in srgb, #000 18%, transparent); }
.fyek-swatch__label { font-size: 15px; }

/* Colour circles: the name is for screen readers and the tooltip. */
.fyek-swatches--color .fyek-swatch:not(.is-text) { padding: 4px; border-radius: 50%; }
.fyek-swatches--color .fyek-swatch:not(.is-text) .fyek-swatch__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.fyek-swatches--color .fyek-swatch:not(.is-text)::before { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .18s ease; }
.fyek-swatches--color .fyek-swatch:not(.is-text):hover::before { box-shadow: inset 0 0 0 1px var(--fyek-sw-border); }
.fyek-swatches--color .fyek-swatch.is-selected:not(.is-text)::before { box-shadow: inset 0 0 0 1.5px var(--fyek-sw-ring); }

/* Buttons (sizes, and colours without a colour). */
.fyek-swatch.is-text { min-width: 48px; min-height: 44px; padding: 0 14px; border-radius: var(--fyek-sw-radius); background: var(--fyek-sw-bg); box-shadow: inset 0 0 0 1px var(--fyek-sw-border); transition: background-color .18s ease, color .18s ease, box-shadow .18s ease; overflow: hidden; }
.fyek-swatch.is-text .fyek-swatch__dot { display: none; }
.fyek-swatch.is-text:hover { box-shadow: inset 0 0 0 1px var(--fyek-sw-ring); }
.fyek-swatch.is-text.is-selected { background: var(--fyek-sw-on-bg); color: var(--fyek-sw-on-ink); box-shadow: inset 0 0 0 1px var(--fyek-sw-on-bg); }

/* Not available with the other choices: crossed out. */
.fyek-swatch.is-unavailable { color: color-mix(in srgb, currentColor 52%, transparent); }
.fyek-swatch.is-unavailable::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top right, transparent calc(50% - .75px), var(--fyek-sw-strike) calc(50% - .75px), var(--fyek-sw-strike) calc(50% + .75px), transparent calc(50% + .75px)); border-radius: inherit; }
.fyek-swatches--color .fyek-swatch.is-unavailable:not(.is-text) .fyek-swatch__dot { opacity: .55; }
.fyek-swatches--color .fyek-swatch.is-unavailable:not(.is-text)::after { inset: 4px; border-radius: 50%; }
.fyek-swatch.is-text.is-unavailable.is-selected { background: transparent; color: inherit; box-shadow: inset 0 0 0 1.5px var(--fyek-sw-ring); }

.fyek-swatch:focus-visible { outline: 2px solid var(--fyek-accent, currentColor); outline-offset: 2px; }

/* WooCommerce's table: room for the buttons. */
form.has-fyek-swatches table.variations td.value { padding-bottom: .6em; }
form.has-fyek-swatches table.variations .reset_variations { display: inline-block; margin-top: .6em; }

/* Product cards. */
.fyek-swatches--card { --fyek-sw-size: 14px; --fyek-sw-gap: 4px; margin-top: .5em; }
.fyek-swatches--card.is-medium { --fyek-sw-size: 18px; --fyek-sw-gap: 6px; }
.fyek-swatches--card .fyek-swatch { padding: 3px; border-radius: 50%; }
.fyek-swatches--card .fyek-swatch::before { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .18s ease; }
.fyek-swatches--card .fyek-swatch:hover::before,
.fyek-swatches--card .fyek-swatch:focus-visible::before,
.fyek-swatches--card .fyek-swatch.is-on::before { box-shadow: inset 0 0 0 1px var(--fyek-sw-ring); }
.fyek-swatches--card .fyek-swatch.is-unavailable::after { inset: 3px; border-radius: 50%; }
.fyek-swatches--card .fyek-swatch.is-text { min-width: 0; min-height: 0; padding: 2px 6px; font-size: 12px; box-shadow: none; }
.fyek-swatches--card .fyek-swatch.is-text .fyek-swatch__label { font-size: 12px; }
.fyek-swatches__more, .fyek-swatches__count { font-size: 12px; line-height: 1; color: var(--fyek-muted, inherit); margin-left: 2px; }
.fyek-swatches.is-centered { justify-content: center; }
.fyek-swatches.is-right { justify-content: flex-end; }

/* A card's second photo on hover. */
.fyek-sw-alt-host { position: relative; display: block; }
.fyek-sw-alt { position: absolute; inset: 0; width: 100% !important; height: 100% !important; object-fit: cover; opacity: 0; transition: opacity .45s ease; pointer-events: none; }
.fyek-sw-card:hover .fyek-sw-alt, .fyek-sw-card:focus-within .fyek-sw-alt { opacity: 1; }
.fyek-sw-card.is-fyek-sw-swapped .fyek-sw-alt { opacity: 0 !important; }


@media (prefers-reduced-motion: reduce) {
	.fyek-swatch, .fyek-swatch::before, .fyek-sw-alt { transition: none !important; }
}
/* Colour dots in WooCommerce's attribute filter (the colours come from rules printed with the filter). */
.has-fyek-swatches label:has(input) .wc-block-product-filter-checkbox-list__text::before,
.has-fyek-swatches button.wc-block-product-filter-chips__item::before { content: ""; display: inline-block; flex: none; width: 16px; height: 16px; margin-right: .55em; border-radius: 50%; vertical-align: -3px; background: var(--fyek-sw, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, #000 calc(var(--fyek-sw-edge, 0) * 18%), transparent); }
.has-fyek-swatches label:has(input) .wc-block-product-filter-checkbox-list__text { display: inline-flex; align-items: center; }
