/*!
 * AZZABI Swatches v1.0.0 — charte AZZABI OPTIC (variables --az-* du design system, valeurs de repli incluses)
 */
.azsw,
.azsw-loop,
.azsw-admin {
	--azsw-ink: var(--az-ink, #131117);
	--azsw-paper: var(--az-ivory, #fbfbfb);
	--azsw-stone: var(--az-stone, #f2f0eb);
	--azsw-line: var(--az-line, rgba(19, 17, 23, .12));
	--azsw-gold: var(--az-gold-text, #8a6a24);
	--azsw-gold-soft: var(--az-gold-soft, #b8966a);
	--azsw-muted: var(--az-muted, #6b665d);
	--azsw-sans: var(--az-sans, "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
	--azsw-ease: var(--az-ease, cubic-bezier(.2, .7, .2, 1));
	--azsw-radius: var(--az-radius, 2px);
	--azsw-size: 36px;
}
.azsw--sm { --azsw-size: 28px; }
.azsw--lg { --azsw-size: 44px; }

/* ---------- Bloc ---------- */
.azsw {
	font-family: var(--azsw-sans);
	color: var(--azsw-ink);
	margin: 0 0 4px;
	width: 100%;
}
.azsw__head {
	display: flex;
	align-items: baseline;
	gap: .5em;
	margin: 0 0 12px;
	font-size: .75rem;
	line-height: 1.3;
	letter-spacing: .14em;
	text-transform: uppercase;
}
.azsw__label { font-weight: 600; }
.azsw__current {
	color: var(--azsw-muted);
	letter-spacing: .02em;
	text-transform: none;
	font-size: .875rem;
	font-weight: 400;
}
.azsw__current:not(:empty)::before { content: "· "; }

.azsw__list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
}

/* ---------- Élément (base commune) ---------- */
.azsw__item {
	-webkit-appearance: none;
	appearance: none;
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: opacity .2s var(--azsw-ease);
}
.azsw__item:focus { outline: none; }
.azsw__item:focus-visible { outline: 2px solid var(--azsw-gold); outline-offset: 3px; border-radius: var(--azsw-radius); }

/* ---------- Pastilles couleur ---------- */
.azsw__item--color {
	width: calc(var(--azsw-size) + 10px);
	height: calc(var(--azsw-size) + 10px);
	min-width: 44px;
	min-height: 44px;
}
.azsw__swatch {
	position: relative;
	display: block;
	width: var(--azsw-size);
	height: var(--azsw-size);
	border-radius: 50%;
	background: var(--azsw-bg, var(--azsw-stone));
	box-shadow: inset 0 0 0 1px rgba(19, 17, 23, .14), 0 0 0 0 transparent;
	overflow: hidden;
	transition: box-shadow .25s var(--azsw-ease), transform .25s var(--azsw-ease);
}
.azsw--square .azsw__swatch { border-radius: var(--azsw-radius); }
.azsw__swatch.is-light { box-shadow: inset 0 0 0 1px rgba(19, 17, 23, .22); }
.azsw__swatch.has-lens::after {
	content: "";
	position: absolute;
	inset: 26%;
	border-radius: 50%;
	background: var(--azsw-lens);
	box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .9), inset 0 1px 2px rgba(255, 255, 255, .35);
}
.azsw--square .azsw__swatch.has-lens::after { border-radius: 1px; }
.azsw__swatch--img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #fff;
}
.azsw__swatch--unknown {
	display: grid;
	place-items: center;
	font-size: 12px;
	color: var(--azsw-muted);
}

@media (hover: hover) {
	.azsw__item--color:hover .azsw__swatch { box-shadow: inset 0 0 0 1px rgba(19, 17, 23, .14), 0 0 0 2px var(--azsw-paper), 0 0 0 3px var(--azsw-gold-soft); }
}
.azsw__item--color[aria-checked="true"] .azsw__swatch {
	box-shadow: inset 0 0 0 1px rgba(19, 17, 23, .14), 0 0 0 3px var(--azsw-paper), 0 0 0 4.5px var(--azsw-ink);
}

/* Infobulle */
.azsw__tip {
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	z-index: 20;
	display: grid;
	justify-items: center;
	gap: 6px;
	width: max-content;
	max-width: 180px;
	padding: 8px 10px;
	border-radius: var(--azsw-radius);
	background: var(--azsw-ink);
	color: var(--azsw-paper);
	font-size: .75rem;
	line-height: 1.35;
	letter-spacing: .01em;
	text-align: center;
	white-space: normal;
	pointer-events: none;
	opacity: 0;
	transform: translate(-50%, 4px);
	transition: opacity .18s var(--azsw-ease), transform .18s var(--azsw-ease);
}
.azsw__tip img {
	display: block;
	width: 96px;
	height: 96px;
	object-fit: contain;
	background: #fff;
	border-radius: var(--azsw-radius);
}
.azsw__tip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	margin-left: -5px;
	border: 5px solid transparent;
	border-top-color: var(--azsw-ink);
}
@media (hover: hover) {
	.azsw__item--color:hover .azsw__tip { opacity: 1; transform: translate(-50%, 0); }
}
.azsw__item--color:focus-visible .azsw__tip { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Boutons (format, taille, couleur non reconnue) ---------- */
.azsw__item--btn,
.azsw__item--corr {
	min-height: 44px;
	padding: 0 16px;
	border: 1px solid var(--azsw-line);
	border-radius: var(--azsw-radius);
	background: var(--azsw-paper);
	font-size: .875rem;
	line-height: 1;
	letter-spacing: .01em;
	transition: border-color .2s var(--azsw-ease), background-color .2s var(--azsw-ease), color .2s var(--azsw-ease);
}
@media (hover: hover) {
	.azsw__item--btn:hover,
	.azsw__item--corr:hover { border-color: var(--azsw-ink); }
}
.azsw__item--btn[aria-checked="true"],
.azsw__item--corr[aria-checked="true"] {
	border-color: var(--azsw-ink);
	background: var(--azsw-ink);
	color: var(--azsw-paper);
}

/* ---------- Correction ---------- */
.azsw__corr { display: grid; gap: 14px; }
.azsw__corr-title {
	margin: 0 0 8px;
	font-size: .6875rem;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--azsw-muted);
}
.azsw__list--grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
	gap: 6px;
	max-height: 15.25rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	padding: 1px;
}
.azsw__item--corr {
	padding: 0 6px;
	font-variant-numeric: tabular-nums;
}
.azsw__note {
	margin: 12px 0 0;
	font-size: .8125rem;
	line-height: 1.55;
	color: var(--azsw-muted);
}
.azsw__help {
	color: var(--azsw-gold);
	text-decoration: underline;
	text-underline-offset: 3px;
	white-space: nowrap;
}

/* ---------- États ---------- */
.azsw__item.is-unavailable { opacity: .38; }
.azsw__item.is-unavailable::before {
	content: "";
	position: absolute;
	left: 18%;
	right: 18%;
	top: 50%;
	z-index: 2;
	height: 1px;
	background: var(--azsw-ink);
	transform: rotate(-45deg);
	pointer-events: none;
}
.azsw__item--btn.is-unavailable::before,
.azsw__item--corr.is-unavailable::before { left: 6%; right: 6%; transform: rotate(-18deg); }
.azsw--hide-unavailable .azsw__item.is-unavailable { display: none; }
.azsw__item.is-absent { display: none; }

/* Liste native conservée pour WooCommerce, masquée visuellement */
.azsw__native {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Tableau des variations : le libellé est déjà dans le bloc */
.azsw-on table.variations tr:has(.azsw) > th,
.azsw-on table.variations tr:has(.azsw) > .label { display: none; }
.azsw-on table.variations tr:has(.azsw) > td { display: block; width: 100%; padding: 0 0 18px; }
.azsw-on table.variations { border: 0; margin-bottom: 8px; }
.azsw-on table.variations .reset_variations {
	display: inline-block;
	margin-top: 10px;
	font-size: .8125rem;
	color: var(--az-muted, #6b665d);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---------- Cartes produit ---------- */
.azsw-loop {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: var(--azsw-loop-justify, inherit);
	gap: 2px;
	margin-top: 8px;
	--azsw-size: 18px;
}
.ct-woo-card-extra + .azsw-loop,
[data-alignment="center"] .azsw-loop,
.has-text-align-center .azsw-loop { justify-content: center; }
.azsw-loop__dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
}
.azsw-loop__dot .azsw__swatch { transition: box-shadow .2s var(--azsw-ease); }
.azsw-loop__dot.is-active .azsw__swatch,
.azsw-loop__dot:focus-visible .azsw__swatch { box-shadow: inset 0 0 0 1px rgba(19, 17, 23, .14), 0 0 0 2px var(--azsw-paper), 0 0 0 3px var(--azsw-ink); }
.azsw-loop__dot:focus-visible { outline: none; }
.azsw-loop .azsw__swatch.has-lens::after { inset: 24%; box-shadow: 0 0 0 1px rgba(255, 255, 255, .9); }
.azsw-loop__more {
	margin-left: 4px;
	font-family: var(--azsw-sans);
	font-size: .75rem;
	color: var(--azsw-muted);
	text-decoration: none;
	letter-spacing: .02em;
}
.azsw-loop img.azsw-fade,
img.azsw-fade { transition: opacity .25s var(--azsw-ease); }

/* ---------- Administration : nuancier ---------- */
.azsw-palette {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 6px 18px;
	max-width: 1200px;
	--azsw-size: 28px;
}
.azsw-palette__row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 8px;
	background: #fff;
	border: 1px solid #e4e1da;
	border-radius: 2px;
}
.azsw-palette__row small { margin-left: auto; color: #8a8579; }
.azsw-palette__row.is-unknown { border-color: #d63638; }
.azsw-palette .azsw__swatch { flex: none; }

@media (prefers-reduced-motion: reduce) {
	.azsw *,
	.azsw-loop * { transition: none !important; }
}
