/**
 * AEQUAR Configurator, front end and editor.
 *
 * Colour, radius and font come from the custom properties on .aq. Map them to
 * the theme once in the child theme; see README section 7.
 *
 * @package Aequar\Configurator
 */

.aq {
	--aq-paper: #f7f7f5;
	--aq-card: #fff;
	--aq-stage: #080808;
	--aq-ink: #101112;
	--aq-ink-2: #5b5d61;
	--aq-ink-3: #8e9095;
	--aq-rule: #dedcd8;
	--aq-rule-2: #c4c2bb;
	--aq-accent: #f5a800;
	--aq-on-bg: #101112;
	--aq-on-ink: #ffffff;
	--aq-radius: 3px;
	--aq-aspect: 16/9;
	--aq-font: inherit;
	--aq-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

	font-family: var(--aq-font);
	color: var(--aq-ink);
}

@media (prefers-color-scheme: dark) {
	.aq {
		--aq-paper: #0b0b0c;
		--aq-card: #131416;
		--aq-ink: #f0efed;
		--aq-ink-2: #9ea1a7;
		--aq-ink-3: #6e7176;
		--aq-rule: #26282b;
		--aq-rule-2: #3a3d42;
		--aq-on-bg: #f0efed;
		--aq-on-ink: #0b0b0c;
	}
}

.aq *,
.aq *::before,
.aq *::after { box-sizing: border-box; }

.aq-heading {
	margin: 0 0 1rem;
	font-size: clamp( 1.25rem, 3vw, 1.6rem );
	letter-spacing: -0.01em;
}

/* ---------- stage ---------- */

.aq-stage {
	position: relative;
	aspect-ratio: var(--aq-aspect);
	overflow: hidden;
	background: var(--aq-stage);
	border-radius: var(--aq-radius);
	touch-action: pan-y;
	/* Full width for impact, but never taller than the screen. */
	max-height: min( 82vh, 1120px );
}

@media (max-width: 600px) {
	.aq-stage { aspect-ratio: 5/4; }
}

.aq-layer {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity 0.28s ease;
}

.aq-layer.is-on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
	.aq-layer { transition: none; }
}

.aq-meta,
.aq-swipe {
	position: absolute;
	z-index: 3;
	pointer-events: none;
	font-family: var(--aq-mono);
	font-size: 0.6875rem;
	color: rgba( 255, 255, 255, 0.42 );
}

.aq-meta {
	top: 0.9rem;
	left: 1rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.aq-swipe {
	right: 1rem;
	bottom: 0.9rem;
}

@media (hover: hover) {
	.aq-swipe { display: none; }
}

/* ---------- dimension guides ---------- */

/* While the guides are on the render must be whole, not cropped, or the
   percentages from the manifest no longer line up with the craft. */
.aq-stage.has-guides .aq-layer { object-fit: contain; }

.aq-guides {
	position: absolute;
	z-index: 2;
	pointer-events: none;
	color: rgba( 255, 255, 255, 0.85 );
}

.aq-guide {
	position: absolute;
	display: block;
}

.aq-guide::before,
.aq-guide::after {
	content: "";
	position: absolute;
	background: currentColor;
	opacity: 0.75;
}

/* Horizontal: a rule with a tick at each end. */
.aq-guide-h {
	height: 1px;
	background: currentColor;
	opacity: 0.75;
}

.aq-guide-h::before,
.aq-guide-h::after {
	top: -5px;
	width: 1px;
	height: 11px;
}

.aq-guide-h::before { left: 0; }
.aq-guide-h::after { right: 0; }

/* Vertical: the same, rotated. */
.aq-guide-v {
	width: 1px;
	background: currentColor;
	opacity: 0.75;
}

.aq-guide-v::before,
.aq-guide-v::after {
	left: -5px;
	width: 11px;
	height: 1px;
}

.aq-guide-v::before { top: 0; }
.aq-guide-v::after { bottom: 0; }

.aq-guide-tag {
	position: absolute;
	padding: 0.25rem 0.5rem;
	border-radius: 2px;
	background: rgba( 8, 8, 8, 0.72 );
	backdrop-filter: blur( 4px );
	-webkit-backdrop-filter: blur( 4px );
	font-family: var(--aq-mono);
	font-size: 0.6875rem;
	letter-spacing: 0.04em;
	line-height: 1;
	color: #fff;
	white-space: nowrap;
	opacity: 1;
}

.aq-guide-h .aq-guide-tag {
	left: 50%;
	top: 0.4rem;
	transform: translateX( -50% );
}

.aq-guide-v .aq-guide-tag {
	top: 50%;
	left: 0.5rem;
	transform: translateY( -50% );
}

@media (min-width: 1200px) {
	.aq-guide-tag { font-size: 0.75rem; padding: 0.3rem 0.6rem; }
}

/* ---------- controls ---------- */

.aq-controls {
	display: grid;
	gap: 1.4rem;
	margin-top: 1.5rem;
}

@media (min-width: 1100px) {
	.aq-controls {
		grid-template-columns: auto 1fr;
		column-gap: clamp( 2.5rem, 5vw, 6rem );
		align-items: start;
	}
	.aq-picked,
	.aq-status { grid-column: 1 / -1; }
}

.aq-field {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1.25rem;
}

.aq-label {
	flex: 0 0 100%;
	margin-bottom: -0.25rem;
	font-family: var(--aq-mono);
	font-size: 0.6875rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--aq-ink-3);
}

.aq .aq-views {
	display: flex;
	overflow: hidden;
	border: 1px solid var(--aq-rule);
	border-radius: var(--aq-radius);
	background: var(--aq-card);
}

/* Scoped to .aq so theme button styles cannot win: without this the selected
   tab loses its background and reads as white on white. */
.aq .aq-views button {
	appearance: none;
	margin: 0;
	padding: 0.75rem 1.4rem;
	border: 0;
	border-right: 1px solid var(--aq-rule);
	border-radius: 0;
	background: var(--aq-card);
	box-shadow: none;
	text-decoration: none;
	text-shadow: none;
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.2;
	color: var(--aq-ink-2);
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.aq .aq-views button:last-child { border-right: 0; }

.aq .aq-views button:hover:not( [disabled] ),
.aq .aq-views button:focus:not( [disabled] ) {
	color: var(--aq-ink);
	background: rgba( 128, 128, 128, 0.09 );
}

.aq .aq-views button[aria-selected="true"],
.aq .aq-views button[aria-selected="true"]:hover,
.aq .aq-views button[aria-selected="true"]:focus {
	background: var(--aq-on-bg);
	color: var(--aq-on-ink);
}

.aq .aq-views button[disabled] {
	color: var(--aq-ink-3);
	background: var(--aq-card);
	opacity: 0.45;
	cursor: not-allowed;
}

@media (min-width: 1200px) {
	.aq .aq-views button { padding: 0.85rem 1.9rem; font-size: 1rem; }
	.aq .aq-sw i { width: 32px; height: 32px; }
}

.aq-swatches { display: flex; flex-wrap: wrap; gap: 0.625rem; }

.aq-sw {
	appearance: none;
	padding: 3px;
	border: 1px solid var(--aq-rule-2);
	border-radius: 50%;
	background: none;
	line-height: 0;
	cursor: pointer;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.aq-sw i { display: block; width: 28px; height: 28px; border-radius: 50%; background: var(--aq-c); }
.aq-sw:hover { transform: translateY( -2px ); }
.aq-sw[aria-pressed="true"] { border-color: var(--aq-ink); box-shadow: inset 0 0 0 2px var(--aq-card); }

.aq-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.625rem;
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	user-select: none;
}

.aq-toggle input { position: absolute; width: 0; height: 0; opacity: 0; }
.aq-toggle small { display: inline; font-weight: 400; color: var(--aq-ink-2); }
.aq-toggle.is-off { opacity: 0.38; cursor: not-allowed; }

.aq-track {
	position: relative;
	flex: none;
	width: 42px;
	height: 23px;
	border-radius: 12px;
	background: var(--aq-rule-2);
	transition: background 0.2s ease;
}

.aq-track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 17px;
	height: 17px;
	border-radius: 50%;
	background: var(--aq-card);
	transition: transform 0.2s ease;
}

.aq-toggle input:checked + .aq-track { background: var(--aq-accent); }
.aq-toggle input:checked + .aq-track::after { transform: translateX( 19px ); }

.aq :where( button, input ):focus-visible { outline: 2px solid var(--aq-ink); outline-offset: 2px; }

.aq-status {
	margin: 0;
	min-height: 1.4em;
	font-size: 0.875rem;
	color: var(--aq-ink-2);
}

/* ---------- actions on the stage ---------- */

.aq-actions {
	position: absolute;
	top: 0.75rem;
	right: 0.85rem;
	z-index: 4;
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.4rem;
}

.aq-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.9rem 0.5rem 0.7rem;
	border: 1px solid rgba( 255, 255, 255, 0.18 );
	border-radius: 99px;
	background: rgba( 255, 255, 255, 0.09 );
	backdrop-filter: blur( 6px );
	-webkit-backdrop-filter: blur( 6px );
	color: #fff;
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.aq-pill:hover { background: rgba( 255, 255, 255, 0.16 ); }
.aq-pill svg { width: 1rem; height: 1rem; flex: none; transition: transform 0.2s ease; }
.aq-fav[aria-pressed="true"] { border-color: var(--aq-accent); color: var(--aq-accent); }
.aq-fav[aria-pressed="true"] svg { transform: scale( 1.12 ); }

@media (min-width: 1200px) {
	.aq-actions { top: 1.1rem; right: 1.25rem; gap: 0.5rem; }
	.aq-pill { padding: 0.6rem 1.1rem 0.6rem 0.85rem; font-size: 0.875rem; }
	.aq-pill svg { width: 1.125rem; height: 1.125rem; }
	.aq-meta { top: 1.25rem; left: 1.4rem; font-size: 0.75rem; }
}

@media (max-width: 420px) {
	.aq-pill span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset( 50% ); }
	.aq-pill { padding: 0.55rem; }
}

/* ---------- the visitor's own set ---------- */

.aq-picked { align-items: center; }

.aq-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.aq-chip {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid var(--aq-rule);
	border-radius: 99px;
	background: var(--aq-card);
	overflow: hidden;
}

.aq-chip.is-current { border-color: var(--aq-ink); }

.aq-chip-go,
.aq-chip-off {
	appearance: none;
	border: 0;
	background: none;
	font: inherit;
	color: var(--aq-ink);
	cursor: pointer;
}

.aq-chip-go {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.35rem 0.35rem 0.35rem 0.6rem;
	font-size: 0.8125rem;
	font-weight: 500;
	white-space: nowrap;
}

.aq-chip-go i {
	width: 13px;
	height: 13px;
	border-radius: 50%;
	flex: none;
	box-shadow: inset 0 0 0 1px rgba( 128, 128, 128, 0.45 );
}

.aq-chip-off {
	padding: 0 0.6rem 0 0.4rem;
	font-size: 1rem;
	line-height: 1;
	color: var(--aq-ink-3);
}

.aq-chip-off:hover { color: var(--aq-ink); }
.aq-chip-go:hover { background: rgba( 128, 128, 128, 0.09 ); }

.aq-clear {
	appearance: none;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	font-size: 0.8125rem;
	color: var(--aq-ink-3);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.aq-clear:hover { color: var(--aq-ink); }

.aq-error {
	padding: 1rem;
	border: 1px dashed var(--aq-rule-2);
	border-radius: var(--aq-radius);
	color: var(--aq-ink-2);
}
