/* ASS Configurator — Frontend Styles
 * Swatch UI — mobile-first
 * All selectors sit inside #ass-configurator (or its children).
 * ============================================================ */

#ass-configurator {
	margin: 1.5em 0 2em;
}

/* ── Generic section wrapper ──────────────────────────────── */

.assc-section {
	margin-bottom: 1.5em;
}

/* Section title (h3) used by JS-built sections */
.assc-section__title,
.ass-section-title {
	font-size: 0.85em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #555;
	margin: 0 0 0.75em;
	padding-bottom: 0.4em;
	border-bottom: 2px solid #e5e5e5;
}

/* ── Skin-tone selector ───────────────────────────────────── */

.assc-skin-tones {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 2px 0 4px; /* room for focus ring */
}

/* Skin-tone buttons and colour swatches share the same size and shape */
.assc-skin-tone,
.assc-swatch {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 2px solid transparent;
	cursor: pointer;
	padding: 0;
	outline: none;
	flex-shrink: 0;
}

.assc-skin-tone {
	transition: transform 0.1s ease, border-color 0.15s ease;
}

.assc-skin-tone:hover {
	transform: scale( 1.2 );
}

/* Active = white inner ring + dark outer border via outline */
.assc-skin-tone[aria-pressed="true"] {
	border-color: #111;
	box-shadow: inset 0 0 0 2px #fff;
}

/* "No skin tone" transparent option — classic transparency checkerboard */
.assc-skin-tone--none {
	background-color: #fff;
	background-image:
		linear-gradient( 45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75% ),
		linear-gradient( 45deg, #ccc 25%, #fff        25%, #fff        75%, #ccc 75% );
	background-size:     8px 8px;
	background-position: 0 0, 4px 4px;
}

/* ── Preview — skin background + garment (band top, fabric below) ── */

/* Outer container: skin tone is the background.
   skin.png is added as background-image by JS when a tone is selected.
   Padding lets skin show around all edges of the garment. */
.assc-preview {
	position: relative;
	background-color: var( --ass-skin-tone, transparent );
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 1.25em;
	padding: 32px 20px 14px;
	transition: background-color 0.2s ease;
}

/* Garment: band on top, fabric below — stacked in a column */
.assc-preview__garment {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 3px;
}

/* Band: horizontal strip — height stamped by JS from the PNG's naturalHeight
   so different band sizes (6 mm, 10 mm, 20 mm …) render at correct thickness.
   min-height is a layout placeholder until the first PNG loads. */
.assc-preview__band {
	position: relative;
	min-height: 20px;
	flex-shrink: 0;
}

/* Fabric: fills the rest of the garment */
.assc-preview__fabric {
	position: relative;
	height: 160px;
}

/* Band PNG: tiles/covers the horizontal strip */
.assc-preview__band img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: left center;
	position: relative;
	z-index: 1;
}

/* Fabric PNG: covers the full container */
.assc-preview__fabric img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	position: relative;
	z-index: 1;
}

/* Solid-colour fallback behind each PNG */
.assc-preview__fallback {
	position: absolute;
	inset: 0;
	z-index: 0;
}

/* Seam shadow at the top edge of the fabric — band-to-fabric depth */
.assc-preview__fabric::before {
	content: '';
	position: absolute;
	inset: 0 0 auto 0;
	height: 10px;
	background: linear-gradient( to bottom, rgba( 0, 0, 0, 0.25 ), transparent );
	z-index: 2;
	pointer-events: none;
}


/* ── Swatch rows ──────────────────────────────────────────── */

.assc-swatch-row {
	margin-bottom: 1.1em;
}

/* Type label above the swatches (e.g. "Lycra") */
.assc-swatch-row__label {
	display: block;
	font-size: 0.8em;
	font-weight: 600;
	color: #777;
	margin-bottom: 6px;
	letter-spacing: 0.02em;
}

/* Flex wrap of individual swatch buttons */
.assc-swatch-row__swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* ── Individual swatch button — size & shape shared with .assc-skin-tone above ── */

.assc-swatch {
	overflow: hidden;
	background-size: cover;
	background-position: center;
	transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.assc-swatch:hover {
	transform: scale( 1.12 );
	box-shadow: 0 2px 6px rgba( 0, 0, 0, 0.22 );
}

/* Active state: white gap ring + dark outer ring */
.assc-swatch[aria-pressed="true"] {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111;
}

/* Swatch image fills the button; hides on 404 (JS handles fallback) */
.assc-swatch img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
	border-radius: 50%;
}

/* ── Pill buttons (sizes + closures + clips + variation) ─── */

.assc-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 1.1em;
}

.assc-pill {
	padding: 0.35em 0.85em;
	border: 1px solid #ccc;
	border-radius: 999px;
	font-size: 0.875em;
	font-weight: 600;
	color: #444;
	background: #fff;
	cursor: pointer;
	line-height: 1.4;
	transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.assc-pill:hover {
	border-color: #888;
	color: #111;
}

.assc-pill[aria-pressed="true"] {
	background: #111;
	border-color: #111;
	color: #fff;
}

/* ── Inline validation error ─────────────────────────────── */

.assc-error {
	font-size: 0.875em;
	color: #c00;
	margin: 0.25em 0 0.75em;
	min-height: 1.2em;
}

/* ── Per-product price row (built by appendPriceBlock) ───── */

.assc-price-row {
	display: flex;
	align-items: baseline;
	gap: 0.5em;
	margin: 0.5em 0 0.25em;
}

.assc-price-label {
	font-size: 0.8em;
	font-weight: 700;
	color: #888;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.assc-price-value {
	font-size: 1.05em;
	font-weight: 700;
	color: #111;
}

/* ── SKU preview block (shown below Add to Cart) ─────────── */

.assc-sku-preview {
	background: #f7f7f7;
	border: 1px solid #e2e2e2;
	border-radius: 5px;
	padding: 0.85em 1.1em;
	margin: 1em 0;
	line-height: 1.6;
}

/* ── SKU row (reused inside .assc-sku-preview and set pieces) */

.ass-sku-row {
	display: flex;
	align-items: center;
	gap: 0.6em;
	margin-bottom: 0.2em;
}

.ass-sku-label {
	font-size: 0.8em;
	font-weight: 700;
	color: #888;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	min-width: 2.8em;
}

.ass-sku-row code {
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
	font-size: 0.95em;
	color: #111;
	letter-spacing: 0.05em;
	word-break: break-all;
}

.ass-desc-row {
	font-size: 0.9em;
	color: #666;
}

/* Legacy .ass-price-row — used in PHP-rendered SKU block */
.ass-price-row {
	display: flex;
	align-items: baseline;
	gap: 0.6em;
	margin-top: 0.4em;
	padding-top: 0.35em;
	border-top: 1px solid #e2e2e2;
}

.ass-price-label {
	font-size: 0.8em;
	font-weight: 700;
	color: #888;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	min-width: 2.8em;
}

.ass-price-value {
	font-size: 1.05em;
	font-weight: 700;
	color: #111;
}

/* ── Messages (AJAX feedback) ────────────────────────────── */

.ass-messages {
	min-height: 1.8em;
	margin: 0.5em 0;
}

.ass-msg {
	padding: 0.65em 1em;
	border-radius: 4px;
	font-size: 0.9em;
}

.ass-msg-success {
	background: #edfae8;
	border: 1px solid #6ab257;
	color: #2a6520;
}

.ass-msg-error {
	background: #fff0ee;
	border: 1px solid #d9534f;
	color: #8b1a1a;
}

/* ── Submit button ───────────────────────────────────────── */

.ass-submit {
	margin-top: 1em;
}

.ass-add-to-cart {
	min-width: 160px;
	padding: 0.75em 1.5em;
	font-size: 1em;
}

.ass-add-to-cart:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

/* ── Set product layout ──────────────────────────────────── */

.ass-set-shared {
	margin-bottom: 1.5em;
}

.ass-set-columns {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 210px, 1fr ) );
	gap: 1.25em;
	margin-bottom: 1.5em;
}

.ass-set-piece {
	border: 1px solid #ddd;
	border-radius: 6px;
	padding: 1em 1.1em;
	background: #fafafa;
}

.ass-piece-title {
	font-size: 0.9em;
	font-weight: 700;
	color: #333;
	margin: 0 0 0.9em;
	padding-bottom: 0.35em;
	border-bottom: 1px solid #e8e8e8;
}

.ass-piece-preview {
	margin-top: 0.75em;
	padding-top: 0.65em;
	border-top: 1px solid #ebebeb;
}

.ass-piece-preview code {
	display: block;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
	font-size: 0.8em;
	color: #111;
	word-break: break-all;
	margin-bottom: 0.15em;
}

.ass-piece-preview small {
	font-size: 0.8em;
	color: #888;
}

.ass-piece-price {
	margin-top: 0.3em;
	font-size: 0.85em;
	font-weight: 700;
	color: #111;
}

/* Set grand total */
.ass-set-total {
	display: flex;
	align-items: baseline;
	gap: 0.6em;
	margin: 0.75em 0 0.25em;
	padding: 0.6em 0.9em;
	background: #f7f7f7;
	border: 1px solid #e2e2e2;
	border-radius: 4px;
}

.ass-set-total-label {
	font-size: 0.8em;
	font-weight: 700;
	color: #888;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.ass-set-total-value {
	font-size: 1.1em;
	font-weight: 700;
	color: #111;
}

/* ── Set badge in cart ───────────────────────────────────── */

.ass-set-badge {
	display: inline-block;
	font-size: 0.78em;
	padding: 0.1em 0.55em;
	background: #f0f0f0;
	border: 1px solid #ddd;
	border-radius: 10px;
	color: #666;
	vertical-align: middle;
	margin-left: 0.35em;
}

/* ── Email SKU display ───────────────────────────────────── */

.ass-sku-email {
	font-size: 0.9em;
	color: #555;
	margin-top: 4px;
}

/* ── Special product preview (ass_special multi-slot) ────── */

/* Outer container: landscape 16:7 aspect ratio.
   All layers stack via position:absolute inside it.
   Skin tone background mirrors .assc-preview behaviour. */
.assc-sp-preview {
	position: relative;
	aspect-ratio: 16 / 7;
	background-color: var( --ass-skin-tone, transparent );
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 1.25em;
}

/* Bands-only: keep the same 16:7 aspect-ratio as fabric products so the
   preview height is consistent. The skin tone fills the background;
   band strips sit on top as normal. */
.assc-sp-preview--bands-only {
	border-radius: 0;
}

/* Fabrics-only: no bands, everything else as normal. */
.assc-sp-preview--fabrics-only .assc-sp-bands-v,
.assc-sp-preview--fabrics-only .assc-sp-band-h {
	display: none;
}

/* ── Fabric panels: flex row, each takes equal width ─── */

.assc-sp-fabrics {
	position: absolute;
	inset: 20px 0 10px; /* 20px top + 10px bottom leave skin-tone strips visible */
	display: flex;
	flex-direction: row;
	z-index: 1; /* fabrics sit above skin-tone background */
}

.assc-sp-fabric {
	flex: 1;
	position: relative;
	overflow: hidden;
}

.assc-sp-fabric__fallback {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.assc-sp-fabric img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	position: relative;
	z-index: 1;
}

/* Seam effect at fabric panel boundaries */
.assc-sp-fabric + .assc-sp-fabric::before {
	content: '';
	position: absolute;
	inset: 0 auto 0 0;
	width: 6px;
	background: linear-gradient( to right, rgba( 0, 0, 0, 0.2 ), transparent );
	z-index: 2;
	pointer-events: none;
}

/* ── Vertical side band strips (slots 1+) ─────────────── */

.assc-sp-bands-v {
	position: absolute;
	inset: 20px 0 10px; /* matches fabrics inset so bands align with garment edges */
	display: flex;
	flex-direction: row;
	align-items: stretch;
	justify-content: center;
	/* gap is owned exclusively by JS (buildSpecialPreviewSection):
	   Math.max( 16, Math.round( 100 / bandCount ) ) px — no CSS default. */
	pointer-events: none;
	z-index: 2; /* vertical bands overlay fabrics */
}

.assc-sp-band-v {
	/* width is owned by JS: stamp() sets it to img.naturalHeight (e.g. 24 px for 06M).
	   The value below is a layout placeholder only — it is replaced before the element
	   is visible to the user. Do not rely on this value for any design decisions. */
	width: 18px;
	flex-shrink: 0;
	position: relative;
	overflow: hidden; /* clips the canvas-drawn img to the band strip height */
}

.assc-sp-band-v__fallback {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.assc-sp-band-v img {
	/* The band image is drawn rotated 90° onto a canvas by JS, producing a
	   naturally-vertical image (naturalHeight × naturalWidth px).
	   No CSS transform needed; overflow:hidden clips the excess height. */
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	width: auto;
	height: auto;
	max-width: none;
	max-height: none;
	z-index: 1;
}

/* ── Horizontal top band (slot 0) ─────────────────────── */

.assc-sp-band-h {
	position: absolute;
	top: 20px; /* aligns with the garment top edge (above = skin-tone strip) */
	left: 0;
	right: 0;
	min-height: 16px;
	overflow: hidden;
	z-index: 3; /* horizontal top band is the topmost layer */
}

.assc-sp-band-h__fallback {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.assc-sp-band-h img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: left center;
	position: relative;
	z-index: 1;
}

/* Depth shadow under the horizontal band */
.assc-sp-band-h::after {
	content: '';
	position: absolute;
	inset: auto 0 -8px 0;
	height: 8px;
	background: linear-gradient( to bottom, rgba( 0, 0, 0, 0.2 ), transparent );
	z-index: 2;
	pointer-events: none;
}

/* ── Responsive ──────────────────────────────────────────── */

@media ( max-width: 480px ) {
	/* Stack set pieces vertically */
	.ass-set-columns {
		grid-template-columns: 1fr;
	}

	/* Shrink preview on narrow screens */
	.assc-preview {
		padding: 20px 12px 10px;
	}

	/* Band height stays PNG-driven on mobile too — no override needed */

	.assc-preview__fabric {
		height: 110px;
	}

	/* Slightly smaller on narrow screens */
	.assc-skin-tone,
	.assc-swatch {
		width: 20px;
		height: 20px;
	}
}
