/* The demo fills its column. view.js scales the desktop layout down, and the page draws any frame around it. */
.affwpd {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #f3f4f6;
}

.affwpd-frame {
	display: block;
	border: 0;
	transform-origin: 0 0;
}

/* The next look or layout loads over the current one, hidden, then fades in once it has painted. */
.affwpd-frame.affwpd-incoming {
	position: absolute;
	top: 0;
	left: 0;
	opacity: 0;
	pointer-events: none;
	transition: opacity 400ms ease-out;
}

.affwpd-frame.affwpd-incoming.is-in {
	opacity: 1;
}

/* The Customize button in the demo's browser bar: filled, so it reads as a control and not as part of the bar. */
.affwpd-customize {
	display: inline-flex;
	align-items: center;
	height: 32px;
	padding: 0 14px;
	border: 0;
	border-radius: 9999px;
	background: #111827;
	color: #fff;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 150ms ease-out;
}

.affwpd-customize:hover,
.affwpd-customize[aria-expanded="true"] {
	background: #374151;
}

/* The store chips beside Customize. The pressed one follows the demo as it plays. */
.affwpd-chips {
	display: flex;
	gap: 2px;
	align-items: center;
	margin-right: 6px;
}

.affwpd-chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 9999px;
	background: transparent;
	cursor: pointer;
}

.affwpd-chip .affwpd-swatch {
	width: 22px;
	height: 22px;
	transition: box-shadow 200ms ease-out, transform 200ms ease-out;
}

/* One solid color per store. The accent dot is too small to read at this size. */
.affwpd-chip .affwpd-swatch::after {
	display: none;
}

.affwpd-chip:hover .affwpd-swatch {
	transform: scale(1.1);
}

.affwpd-chip[aria-pressed="true"] .affwpd-swatch {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--affwpd-brand);
}

/* The chips and Customize pop in as the demo comes into view, and out as it leaves. */
.affwpd-pop > * {
	opacity: 0;
	transform: translateY(6px) scale(0.92);
	transition: opacity 200ms ease-out, transform 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.affwpd-pop.is-in > * {
	opacity: 1;
	transform: none;
}

.affwpd-pop.is-in > :nth-child(2) {
	transition-delay: 80ms;
}

@media (max-width: 639px) {
	.affwpd-chip {
		width: 26px;
	}

	.affwpd-chip .affwpd-swatch {
		width: 18px;
		height: 18px;
	}

	.affwpd-customize {
		padding: 0 12px;
	}
}

.affwpd-customize[hidden] {
	display: none;
}

.affwpd-customize:focus-visible,
.affwpd-chip:focus-visible,
.affwpd-play:focus-visible,
.affwpd-input:focus-visible {
	outline: 2px solid #111827;
	outline-offset: 2px;
}

/* Pause and play, drawn in CSS so the slot needs no icon set. */
.affwpd-play {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 9999px;
	background: transparent;
	color: #4b5563;
	cursor: pointer;
}

.affwpd-play:hover {
	color: #111827;
	background: #f3f4f6;
}

.affwpd-play[hidden] {
	display: none;
}

.affwpd-play[data-playing="true"]::before,
.affwpd-play[data-playing="true"]::after {
	content: "";
	width: 3px;
	height: 11px;
	border-radius: 1px;
	background: currentColor;
}

.affwpd-play[data-playing="false"]::before {
	content: "";
	margin-left: 2px;
	border-style: solid;
	border-width: 6px 0 6px 10px;
	border-color: transparent transparent transparent currentColor;
}

/* Says why a click did nothing. It rises from the bottom edge and drops back out, as the settings save bar does. */
.affwpd-toast {
	position: absolute;
	z-index: 2;
	left: 50%;
	bottom: 20px;
	box-sizing: border-box;
	width: max-content;
	max-width: calc(100% - 32px);
	margin: 0;
	padding: 10px 18px;
	border-radius: 12px;
	background: #000;
	box-shadow: 0 12px 32px -8px rgb(0 0 0 / 0.45);
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	line-height: 20px;
	text-align: center;
	overflow-wrap: anywhere;
	opacity: 0;
	transform: translate(-50%, calc(100% + 20px));
	transition: opacity 160ms ease-in 60ms, transform 220ms cubic-bezier(0.4, 0, 1, 1);
	pointer-events: none;
}

.affwpd-toast.is-shown {
	opacity: 1;
	transform: translate(-50%, 0);
	transition: opacity 150ms ease-out, transform 420ms cubic-bezier(0.32, 0.72, 0, 1);
}

@media (prefers-reduced-motion: reduce) {
	.affwpd-pop > * {
		transform: none;
		transition: opacity 200ms ease-out;
	}

	.affwpd-frame.affwpd-incoming,
	.affwpd-customize,
	.affwpd-chip .affwpd-swatch {
		transition: none;
	}

	.affwpd-toast,
	.affwpd-toast.is-shown {
		transform: translate(-50%, 0);
		transition: opacity 150ms ease-out;
	}
}

/* The area's own phone layout, the height of a phone screen under the site's sticky header. */
.affwpd[data-phone] .affwpd-frame {
	height: min(720px, calc(100svh - 73px));
}

/*
 * Expanded: the stage the page marks becomes a large box over the page, capped in width so a wide screen
 * doesn't leave the area in empty space. It stays in place in the DOM, so the frame keeps its state.
 */
[data-affwp-live-demo-stage][data-expanded] {
	position: fixed;
	z-index: 100001;
	inset: 24px;
	display: flex;
	flex-direction: column;
	max-width: 1440px;
	margin: 0 auto;
	overflow: hidden;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 24px 64px rgb(0 0 0 / 0.3);
}

[data-affwp-live-demo-stage][data-expanded] .affwpd {
	flex: 1;
	min-height: 0;
}

[data-affwp-live-demo-stage][data-expanded] .affwpd-frame {
	height: 100%;
}

.affwpd-backdrop {
	position: fixed;
	z-index: 100000;
	inset: 0;
	background: rgb(17 24 39 / 0.6);
}

/*
 * The Customize drawer: dark, so it stands apart from the light marketing page and the demo it changes.
 * Beside the demo on a wide screen, and a sheet from the bottom on a phone. Not modal, so the demo stays usable.
 */
.affwpd-drawer {
	--affwpd-line: rgb(255 255 255 / 0.1);
	position: fixed;
	z-index: 100002;
	top: 12px;
	right: 12px;
	bottom: 12px;
	display: flex;
	flex-direction: column;
	width: min(360px, calc(100vw - 24px));
	background: #0b1120;
	border-radius: 16px;
	box-shadow: 0 0 0 1px var(--affwpd-line), 0 24px 48px -12px rgb(0 0 0 / 0.5);
	color: #f3f4f6;
	color-scheme: dark;
	font-size: 14px;
	line-height: 20px;
	/* Closing: a quick exit that speeds up toward the edge, with the fade at the end. */
	opacity: 0;
	transform: translateX(calc(100% + 12px));
	transition: opacity 160ms ease-in 80ms, transform 240ms cubic-bezier(0.4, 0, 1, 1);
}

/* Opening: slides in from the edge and settles, with no bounce. */
.affwpd-drawer.is-open {
	opacity: 1;
	transform: none;
	transition: opacity 150ms ease-out, transform 420ms cubic-bezier(0.32, 0.72, 0, 1);
}

/* The content arrives just behind the panel, so the panel leads. It leaves with the panel. */
.affwpd-drawer > * {
	opacity: 0;
	transform: translateX(12px);
	transition: opacity 120ms ease-in, transform 120ms ease-in;
}

.affwpd-drawer.is-open > * {
	opacity: 1;
	transform: none;
	transition: opacity 300ms ease-out 120ms, transform 400ms cubic-bezier(0.32, 0.72, 0, 1) 120ms;
}

.affwpd-drawer.is-open > .affwpd-drawer-body {
	transition-delay: 170ms;
}

.affwpd-drawer[hidden] {
	display: none;
}

.affwpd-drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 16px 12px 20px;
	border-bottom: 1px solid var(--affwpd-line);
}

.affwpd-drawer-title {
	margin: 0;
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	line-height: 24px;
	outline: 0;
}

.affwpd-drawer-close {
	position: relative;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 9999px;
	background: transparent;
	color: #9ca3af;
	cursor: pointer;
}

.affwpd-drawer-close:hover {
	background: rgb(255 255 255 / 0.08);
	color: #fff;
}

.affwpd-drawer-close::before,
.affwpd-drawer-close::after {
	content: "";
	position: absolute;
	top: 15px;
	left: 9px;
	width: 14px;
	height: 1.5px;
	background: currentColor;
	transform: rotate(45deg);
}

.affwpd-drawer-close::after {
	transform: rotate(-45deg);
}

.affwpd-drawer-body {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 16px 20px 24px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.affwpd-drawer-lead {
	margin: 0;
	color: #9ca3af;
	font-size: 13px;
}

.affwpd-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.affwpd-label {
	margin: 0;
	color: #d1d5db;
	font-size: 13px;
	font-weight: 600;
}

/* Two-tone swatch: the brand color, with the accent in the corner. */
.affwpd-swatch {
	position: relative;
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	border-radius: 9999px;
	background: var(--affwpd-brand);
	box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.1);
}

.affwpd-swatch::after {
	content: "";
	position: absolute;
	right: -2px;
	bottom: -2px;
	width: 9px;
	height: 9px;
	border: 2px solid #fff;
	border-radius: 9999px;
	background: var(--affwpd-accent);
}

.affwpd-drawer .affwpd-swatch::after {
	border-color: #0b1120;
}

.affwpd-stores {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
}

.affwpd-stores button,
.affwpd-segmented button {
	display: flex;
	gap: 8px;
	align-items: center;
	min-height: 36px;
	padding: 6px 10px;
	border: 0;
	border-radius: 10px;
	background: rgb(255 255 255 / 0.04);
	box-shadow: inset 0 0 0 1px var(--affwpd-line);
	color: #d1d5db;
	font: inherit;
	font-size: 13px;
	text-align: left;
	cursor: pointer;
	transition: box-shadow 150ms ease-out, background-color 150ms ease-out;
}

.affwpd-stores button:hover {
	box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.3);
}

.affwpd-stores button[aria-pressed="true"] {
	box-shadow: inset 0 0 0 2px #fff;
	color: #fff;
	font-weight: 600;
}

/* Color rows: quick picks, then a picker for any color. The pressed one wears a ring. */
.affwpd-colors {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

.affwpd-color {
	position: relative;
	display: inline-flex;
	flex-shrink: 0;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 9999px;
	background: var(--affwpd-brand);
	box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.15);
	cursor: pointer;
	transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.affwpd-color:hover {
	transform: scale(1.08);
}

.affwpd-color[aria-pressed="true"] {
	box-shadow: 0 0 0 2px #0b1120, 0 0 0 4px #fff;
}

/* No accent: a slashed circle. */
.affwpd-color-none {
	box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.35);
}

.affwpd-color-none::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 4px;
	right: 4px;
	height: 1.5px;
	background: rgb(255 255 255 / 0.5);
	transform: rotate(-45deg);
}

/* Any other color: a swatch and a hex field, and a popover with a saturation plane and a hue slider. */
.affwpd-picker {
	position: relative;
	display: flex;
	gap: 8px;
	align-items: center;
}

.affwpd-picker-swatch {
	position: relative;
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: var(--affwpd-picked, transparent);
	box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.15);
	cursor: pointer;
}

/* No accent: the slashed circle's slash. */
.affwpd-picker-swatch.is-empty::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 6px;
	right: 6px;
	height: 1.5px;
	background: rgb(255 255 255 / 0.5);
	transform: rotate(-45deg);
}

.affwpd-drawer .affwpd-picker-hex {
	width: 104px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 13px;
}

.affwpd-picker-pop {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 5;
	box-sizing: border-box;
	width: 240px;
	padding: 12px;
	border-radius: 12px;
	background: #1f2937;
	box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1), 0 12px 32px rgb(0 0 0 / 0.45);
}

.affwpd-picker-pop.is-above {
	top: auto;
	bottom: calc(100% + 8px);
}

.affwpd-picker-pop[hidden] {
	display: none;
}

.affwpd-picker-plane {
	position: relative;
	height: 128px;
	border-radius: 8px;
	background-image: linear-gradient(to top, #000, rgb(0 0 0 / 0)), linear-gradient(to right, #fff, rgb(255 255 255 / 0));
	cursor: crosshair;
	touch-action: none;
}

.affwpd-picker-handle {
	position: absolute;
	box-sizing: border-box;
	width: 16px;
	height: 16px;
	border: 2px solid #fff;
	border-radius: 9999px;
	box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35);
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.affwpd-picker-hue {
	display: block;
	width: 100%;
	height: 12px;
	margin: 12px 0 0;
	border-radius: 9999px;
	background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
}

.affwpd-picker-hue::-webkit-slider-thumb {
	width: 16px;
	height: 16px;
	border-radius: 9999px;
	background: #fff;
	box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35);
	-webkit-appearance: none;
}

.affwpd-picker-hue::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border: 0;
	border-radius: 9999px;
	background: #fff;
	box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35);
}

.affwpd-drawer .affwpd-picker-plane:focus-visible,
.affwpd-drawer .affwpd-picker-hue:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.affwpd-segmented {
	display: flex;
	gap: 2px;
	padding: 2px;
	border-radius: 10px;
	background: rgb(255 255 255 / 0.06);
}

.affwpd-segmented button {
	flex: 1;
	justify-content: center;
	min-height: 32px;
	border-radius: 8px;
	background: transparent;
	box-shadow: none;
	color: #9ca3af;
	text-align: center;
}

.affwpd-segmented button:hover {
	color: #fff;
}

.affwpd-segmented button[aria-pressed="true"] {
	background: rgb(255 255 255 / 0.14);
	color: #fff;
	font-weight: 600;
}

.affwpd-input {
	width: 100%;
	height: 36px;
	padding: 0 12px;
	border: 0;
	border-radius: 10px;
	background: rgb(255 255 255 / 0.04);
	box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.15);
	color: #fff;
	font: inherit;
	font-size: 14px;
	box-sizing: border-box;
}

.affwpd-input::placeholder {
	color: #6b7280;
}

.affwpd-switch-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.affwpd-switch {
	position: relative;
	width: 36px;
	height: 20px;
	padding: 0;
	border: 0;
	border-radius: 9999px;
	background: rgb(255 255 255 / 0.2);
	cursor: pointer;
	transition: background-color 150ms ease-out;
}

.affwpd-switch::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 9999px;
	background: #fff;
	box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
	transition: transform 150ms ease-out;
}

.affwpd-switch[aria-checked="true"] {
	background: #22c55e;
}

.affwpd-switch[aria-checked="true"]::after {
	transform: translateX(16px);
}

.affwpd-switch:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.affwpd-drawer button:focus-visible,
.affwpd-drawer .affwpd-input:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

@media (max-width: 639px) {
	.affwpd-drawer {
		top: auto;
		right: 0;
		bottom: 0;
		left: 0;
		width: auto;
		max-height: 55svh;
		border-radius: 16px 16px 0 0;
		transform: translateY(100%);
	}

	.affwpd-drawer > * {
		transform: translateY(12px);
	}
}

/* After the phone rules, so it wins over them: reduced motion keeps only a short fade. */
@media (prefers-reduced-motion: reduce) {
	.affwpd-drawer,
	.affwpd-drawer.is-open,
	.affwpd-drawer > *,
	.affwpd-drawer.is-open > * {
		transform: none;
		transition: opacity 150ms ease-out;
	}
}
