/* EDCO Swatch Viewer */
.edco-sv {
	--edco-sv-ratio: 28 / 9;         /* Image shape on desktop (override with ratio="" on the shortcode). */
	--edco-sv-ratio-small: 16 / 9;   /* Image shape on phones. */
	--edco-sv-accent: #c6202c;       /* EDCO red. */
	--edco-sv-size: 28px;            /* Swatch size. */
	--edco-sv-gap: 6px;
	--edco-sv-per-row: 10;
	position: relative;
	width: 100%; /* Fill the column; otherwise it shrinks to the current image's size and jumps between colors. */
	margin: 0 auto 40px;
}

.edco-sv__stage {
	position: relative;
	aspect-ratio: var(--edco-sv-ratio);
	background: #e6e6e6;
}

.edco-sv__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: opacity 0.25s ease;
}

.edco-sv.is-loading .edco-sv__image {
	opacity: 0.6;
}

.edco-sv .edco-sv__name { /* Extra class beats the theme's paragraph margin, which left a band under the caption. */
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	margin: 0;
	padding: 56px 36px 22px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
	color: #fff;
	font-size: clamp(15px, 1.6vw, 20px);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.02em;
	pointer-events: none;
}

/* Prev / next arrows */
.edco-sv__nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: -20px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
	color: #222;
	cursor: pointer;
	transition: color 0.15s ease, transform 0.15s ease;
}

.edco-sv__nav--prev { left: -20px; }
.edco-sv__nav--next { right: -20px; }

.edco-sv__nav:hover { color: var(--edco-sv-accent); }
.edco-sv__nav:active { transform: scale(0.94); }

.edco-sv__nav:focus-visible,
.edco-sv__swatch:focus-visible {
	outline: 2px solid var(--edco-sv-accent);
	outline-offset: 2px;
}

/* Swatches */
.edco-sv__swatches {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--edco-sv-gap);
	max-width: calc((var(--edco-sv-size) + var(--edco-sv-gap)) * var(--edco-sv-per-row));
	margin: 18px auto 0;
}

.edco-sv__swatch {
	position: relative;
	display: block;
	flex: 0 0 auto;
	box-sizing: border-box;
	width: var(--edco-sv-size);
	height: var(--edco-sv-size);
	border: 1px solid rgba(0, 0, 0, 0.18);
	background: var(--c1, #ccc);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.edco-sv__swatch.is-two-tone {
	background: linear-gradient(135deg, var(--c1, #ccc) 50%, var(--c2, #999) 50%);
}

.edco-sv__swatch:hover {
	transform: translateY(-2px);
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.edco-sv__swatch.is-active {
	box-shadow: 0 0 0 2px #fff, 0 0 0 3px #333;
}

/* White checkmark on the active swatch (shadowed so it reads on light colors). */
.edco-sv__swatch.is-active::after {
	content: "";
	position: absolute;
	top: 45%;
	left: 50%;
	width: 28%;
	height: 50%;
	border: solid #fff;
	border-width: 0 3px 3px 0;
	transform: translate(-50%, -50%) rotate(45deg);
	filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.7));
}

.edco-sv__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Phones */
@media (max-width: 640px) {
	.edco-sv {
		--edco-sv-size: 32px;
		--edco-sv-per-row: 8;
	}
	.edco-sv__stage { aspect-ratio: var(--edco-sv-ratio-small); }
	.edco-sv__name { padding: 40px 16px 14px; }
	.edco-sv__nav {
		width: 36px;
		height: 36px;
		margin-top: -18px;
	}
	.edco-sv__nav--prev { left: 8px; }
	.edco-sv__nav--next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
	.edco-sv__image,
	.edco-sv__nav,
	.edco-sv__swatch {
		transition: none;
	}
	.edco-sv__swatch:hover { transform: none; }
}
