/*
 * The designer ships as a translucent modal meant to float over a product page.
 * On its own page that let the site's header, title and footer show through it.
 */
body .product-designer {
	background: #f2f4f8;
	z-index: 100000;
}

/* Back link, so a full-screen designer is not a dead end. */
.cn-du-back {
	position: fixed;
	top: 12px;
	right: 16px;
	z-index: 100001;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 15px;
	border-radius: 999px;
	background: rgba(24, 30, 42, 0.82);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	backdrop-filter: blur(4px);
}

.cn-du-back:hover {
	background: #181e2a;
	color: #fff;
}

/*
 * The plugin nudges the canvas 300px right to clear its 360px menu, which leaves
 * the product off-centre. Centre it in the space that is actually free instead.
 */
body .product-designer .canvas-container {
	transform: none;
}

body .product-designer .designer {
	transform: translate(calc(-50% + 180px), -50%);
}

/*
 * Small screens cannot fit the 360px tool panel beside a 600px canvas, so stack the
 * product above the tools and shrink it to the viewport. Fabric maps pointer input
 * through the canvas bounding box, so a CSS resize keeps dragging accurate.
 */
@media (max-width: 900px) {
	body .product-designer {
		display: flex;
		flex-direction: column;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* Pinned to the top so the product stays in view while the tools scroll under it. */
	body .product-designer .designer {
		order: 1;
		position: sticky;
		top: 0;
		left: auto;
		/* The tool panel sits at 999, so climb above it. */
		z-index: 1000;
		width: 100%;
		margin: 0;
		padding: 46px 0 58px;
		background: #f2f4f8;
		box-shadow: 0 8px 20px rgba(24, 30, 42, 0.14);
		transform: none;
	}

	body .product-designer .canvas-container {
		width: min(66vw, 300px) !important;
		height: auto !important;
		aspect-ratio: var(--cn-canvas-w, 1) / var(--cn-canvas-h, 1);
		margin: 0 auto;
	}

	body .product-designer .cn-side-nav {
		bottom: 8px;
	}

	body .product-designer .canvas-container canvas {
		width: 100% !important;
		height: 100% !important;
	}

	body .product-designer .menu {
		order: 2;
		position: relative;
		width: 100%;
		height: auto;
		max-height: none;
		overflow: visible;
	}

	body .product-designer .editor-tabs {
		height: auto;
	}
}

/* Tablets have room for a bigger pinned preview than a phone does. */
@media (min-width: 600px) and (max-width: 900px) {
	body .product-designer .canvas-container {
		width: min(58vw, 420px) !important;
	}
}

/* The colour picker is appended to <body> with z-index 5000, which puts it behind
   the opaque designer above. Lift it back over the top. */
body .jscolor-picker-wrap {
	z-index: 100001 !important;
}

/* The bold/italic/underline buttons are floated but their row is never cleared,
   so it collapses to zero height and the fields below land on top of it. */
body .product-designer .setting-field::after {
	content: '';
	display: table;
	clear: both;
}

/* The bold/italic/underline/strikethrough labels are relabelled in JS because the
   plugin escapes their icon markup. Give the letters the matching typography. */
body .product-designer #text-bold {
	font-weight: 800;
}

body .product-designer #text-italic {
	font-style: italic;
}

body .product-designer #text-underline {
	text-decoration: underline;
}

body .product-designer #text-strikethrough {
	text-decoration: line-through;
}

/* Paragraph alignment, added by our script. Sized to match the B/I/U/S buttons. */
body .product-designer .cn-align-buttons {
	display: flex;
	gap: 6px;
	padding: 2px 0;
}

body .product-designer .cn-align-btn {
	width: 30px;
	height: 30px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 3px;
	background: #fff;
	color: #3a5673;
	cursor: pointer;
	transition: background 0.15s ease;
}

body .product-designer .cn-align-btn svg {
	display: block;
	fill: currentColor;
}

body .product-designer .cn-align-btn:hover {
	background: #dce6f2;
}

body .product-designer .cn-align-btn.is-active {
	background: #5b8fd9;
	color: #fff;
}

/* Shown in place of the per-object panels, which are empty until something on the
   canvas is selected. Without it the Editor tab looks broken. */
.cn-select-hint {
	margin: 14px;
	padding: 12px 14px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.1);
	color: #e7ecf5;
	font-size: 13px;
	line-height: 1.55;
}

/* These English tooltips overflow the narrow panel and their boxes swallow the
   clicks meant for the colour fields underneath. */
body .product-designer [class*='hint--']::after,
body .product-designer [class*='hint--']::before {
	display: none !important;
}

/* Keep the colour fields above neighbouring rows so nothing can cover them. */
body .product-designer .setting-field .field-input {
	position: relative;
	z-index: 1;
}

/* An empty clipart library otherwise shows as a bare transparency-checkerboard
   strip. The markup contains whitespace, so :empty alone never matches. */
body .product-designer .clipart-list:empty,
body .product-designer .clipart-list:not(:has(*)) {
	display: none;
}

/* Inactive sides ship at opacity 0.3, which makes light garments unreadable. */
body .product-designer .side-list li {
	opacity: 1;
}

/* The side thumbnails default to white artwork on a dark panel with the label on top. */
body .product-designer .side-list {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

body .product-designer .side-list li {
	position: relative;
	margin: 0;
	padding: 6px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
	text-align: center;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body .product-designer .side-list li:hover {
	border-color: #5b8fd9;
	box-shadow: 0 0 0 2px rgba(91, 143, 217, 0.35);
}

body .product-designer .side-list li.active {
	border-color: #5b8fd9;
	box-shadow: 0 0 0 2px #5b8fd9;
}

body .product-designer .side-list li img {
	position: static;
	width: 100%;
	height: 76px;
	object-fit: contain;
	background: #fff;
	border-radius: 4px;
}

body .product-designer .side-list li .name {
	position: static;
	display: block;
	margin-top: 5px;
	background: none;
	color: #2c3444;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	opacity: 1;
}

/* Arrows either side of the canvas to step through front, back and sleeves. */
.cn-side-nav {
	position: absolute;
	left: 50%;
	bottom: -62px;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 6px 10px;
	border-radius: 999px;
	background: #fff;
	box-shadow: 0 2px 10px rgba(20, 24, 32, 0.14);
}

.cn-side-arrow {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #eef2f8;
	color: #2c3444;
	font-size: 22px;
	line-height: 34px;
	cursor: pointer;
	transition: background 0.15s ease;
}

.cn-side-arrow:hover {
	background: #5b8fd9;
	color: #fff;
}

.cn-side-label {
	min-width: 132px;
	text-align: center;
	font-size: 14px;
	font-weight: 600;
	color: #2c3444;
}

/*
 * Invitations: one field per line of the card, so personalising it is typing over
 * the wording rather than hunting for text on the canvas.
 */
.cn-inv__hint {
	margin: 0 0 12px;
	color: #cfd8e6;
	font-size: 12px;
	line-height: 1.55;
}

.cn-inv__field {
	display: block;
	margin-bottom: 12px;
}

.cn-inv__field span {
	display: block;
	margin-bottom: 4px;
	color: #e7ecf5;
	font-size: 12px;
	font-weight: 600;
}

.cn-inv__field textarea {
	display: block;
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #d5dae4;
	border-radius: 8px;
	background: #fff;
	color: #2c3444;
	font-family: inherit;
	/* 16px, or iOS Safari zooms the whole designer in on focus. */
	font-size: 1rem;
	line-height: 1.4;
	resize: vertical;
}

.cn-inv__field textarea:focus {
	border-color: #5b8fd9;
	outline: none;
	box-shadow: 0 0 0 2px rgba(91, 143, 217, 0.35);
}

.cn-inv__reset {
	width: 100%;
	min-height: 40px;
	padding: 9px 14px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 8px;
	background: transparent;
	color: #e7ecf5;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.cn-inv__reset:hover {
	background: rgba(255, 255, 255, 0.12);
}

/*
 * A choice of artwork for the same wording: twelve wreaths for one sticker. Shown with the
 * sample names still on them, because a bare ring at this size tells a customer nothing.
 */
.cn-designs__hint {
	margin: 0 0 12px;
	color: #cfd8e6;
	font-size: 12px;
	line-height: 1.55;
}

.cn-designs__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.cn-designs__item {
	display: block;
	padding: 4px 4px 6px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.06);
	color: #cfd8e6;
	font: inherit;
	text-align: center;
	cursor: pointer;
}

.cn-designs__item:hover {
	border-color: rgba(255, 255, 255, 0.45);
	background: rgba(255, 255, 255, 0.12);
}

.cn-designs__item.is-active {
	border-color: #5b8fd9;
	background: rgba(91, 143, 217, 0.22);
	color: #fff;
}

.cn-designs__item img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 5px;
	background: #fff;
}

.cn-designs__item span {
	display: block;
	margin-top: 4px;
	font-size: 10px;
	line-height: 1.3;
}

/* Background removal */
.cn-bg-controls {
	margin: 12px 0 0;
}

.cn-bg-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: #2c3444;
}

.cn-bg-tolerance {
	display: block;
	width: 100%;
	margin-top: 4px;
}

.cn-bg-cut {
	position: absolute;
	bottom: 2px;
	left: 2px;
	right: 2px;
	padding: 3px 0;
	border: 0;
	border-radius: 4px;
	background: rgba(20, 24, 32, 0.72);
	color: #fff;
	font-size: 10px;
	font-weight: 600;
	cursor: pointer;
}

.cn-bg-cut:hover {
	background: #5b8fd9;
}

/*
 * Floating tools for whichever image is selected on the product. Fixed to the
 * bottom of the screen so it is reachable from the canvas without hunting through
 * the panels, on a phone as much as on a desktop.
 */
.cn-img-tools {
	position: fixed;
	left: 50%;
	bottom: 18px;
	z-index: 100002;
	display: none;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 12px;
	width: min(94vw, 540px);
	padding: 12px 14px;
	transform: translateX(-50%);
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.97);
	box-shadow: 0 14px 38px rgba(18, 24, 36, 0.26);
	font-size: 13px;
}

.cn-img-tools.is-visible {
	display: flex;
}

.cn-img-tools.is-busy {
	opacity: 0.65;
	pointer-events: none;
}

.cn-img-tools__cut {
	flex: 1 0 100%;
	min-height: 44px;
	padding: 10px 18px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(120deg, #e891b0 0%, #5b8fd9 100%);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}

.cn-img-tools__undo {
	flex: 0 0 auto;
	min-height: 44px;
	padding: 10px 16px;
	border: 1px solid #d5dae4;
	border-radius: 999px;
	background: #fff;
	color: #3a4356;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.cn-img-tools__undo.is-hidden {
	display: none;
}

.cn-img-tools__range {
	display: flex;
	flex: 1 1 55%;
	align-items: center;
	gap: 8px;
	color: #3a4356;
	font-size: 12px;
	font-weight: 600;
}

.cn-img-tools__tolerance {
	flex: 1;
	min-width: 0;
}

.cn-img-tools__status {
	flex: 1 0 100%;
	margin: 0;
	text-align: center;
	color: #5b6478;
	font-size: 12px;
	line-height: 1.45;
}

.cn-img-tools__status:empty {
	display: none;
}

.cn-img-tools__status.is-error {
	color: #b3261e;
}

/* Beside the tool panel on a wide screen, where it cannot cover the side arrows
   that sit under the canvas. */
@media (min-width: 901px) {
	.cn-img-tools {
		left: 10px;
		bottom: 10px;
		width: 340px;
		transform: none;
	}
}

/*
 * Finish the design and put it in the cart, replacing the plugin's own Generate
 * and Add to cart controls, which died on a nonce their script never sent.
 */
.cn-finish-bar {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 100002;
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 10px;
	max-width: min(94vw, 460px);
}

.cn-finish-bar button {
	min-height: 48px;
	padding: 12px 20px;
	border: 0;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 12px 30px rgba(18, 24, 36, 0.22);
}

.cn-finish-bar button[disabled] {
	opacity: 0.6;
	cursor: default;
}

.cn-finish-bar__review {
	background: #fff;
	color: #2c3444;
}

.cn-finish-bar__cart {
	background: linear-gradient(120deg, #e891b0 0%, #5b8fd9 100%);
	color: #fff;
}

.cn-finish-bar__hint {
	flex: 1 0 100%;
	margin: 0;
	padding: 8px 12px;
	border-radius: 10px;
	background: #fff;
	color: #b3261e;
	font-size: 12px;
	line-height: 1.45;
	text-align: right;
	box-shadow: 0 12px 30px rgba(18, 24, 36, 0.18);
}

.cn-finish-bar__hint:empty {
	display: none;
}

.cn-finish {
	position: fixed;
	inset: 0;
	z-index: 100003;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(20, 26, 38, 0.55);
}

.cn-finish.is-open {
	display: flex;
}

.cn-finish__box {
	position: relative;
	width: min(100%, 620px);
	max-height: 90vh;
	overflow-y: auto;
	padding: 26px 24px 22px;
	border-radius: 20px;
	background: #fff;
	text-align: center;
}

.cn-finish.is-busy .cn-finish__box {
	pointer-events: none;
}

.cn-finish.is-busy .cn-finish__close {
	pointer-events: auto;
}

.cn-finish__close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: #f1f3f7;
	color: #3a4356;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.cn-finish__title {
	margin: 0 0 6px;
	color: #232a36;
	font-size: 21px;
	font-weight: 800;
}

.cn-finish__lead {
	margin: 0 0 18px;
	color: #5b6478;
	font-size: 13px;
	line-height: 1.5;
}

.cn-finish__sides {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin-bottom: 18px;
}

.cn-finish__side {
	width: 130px;
	font-size: 12px;
	font-weight: 600;
	color: #3a4356;
}

.cn-finish__side img {
	display: block;
	width: 100%;
	height: 130px;
	margin-bottom: 6px;
	object-fit: contain;
	border: 1px solid #e6e9ef;
	border-radius: 12px;
	background: #f7f8fb;
}

.cn-finish__box.is-done .cn-finish__sides {
	display: none;
}

.cn-finish__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.cn-finish__qty {
	display: flex;
	align-items: center;
	gap: 8px;
	color: #3a4356;
	font-size: 13px;
	font-weight: 600;
}

.cn-finish__qty-input {
	width: 76px;
	min-height: 46px;
	padding: 8px 10px;
	border: 1px solid #d5dae4;
	border-radius: 10px;
	font-size: 15px;
	text-align: center;
}

.cn-finish__cart {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 22px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(120deg, #e891b0 0%, #5b8fd9 100%);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}

.cn-finish__keep {
	min-height: 48px;
	padding: 12px 20px;
	border: 1px solid #d5dae4;
	border-radius: 999px;
	background: #fff;
	color: #3a4356;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.cn-finish__status {
	margin: 14px 0 0;
	color: #5b6478;
	font-size: 13px;
	line-height: 1.45;
}

.cn-finish__status:empty {
	display: none;
}

.cn-finish__status.is-error {
	color: #b3261e;
}

@media (max-width: 900px) {
	.cn-finish-bar {
		right: 10px;
		left: 10px;
		bottom: 10px;
		max-width: none;
		justify-content: stretch;
	}

	.cn-finish-bar button {
		flex: 1 1 0;
		padding: 12px 10px;
		font-size: 13px;
	}

	.cn-finish-bar__hint {
		text-align: center;
	}

	/* Clear of the finish bar, which is always on screen here. */
	.cn-img-tools {
		bottom: 84px;
	}
}

.cn-du {
	margin: 0 0 18px;
	padding: 14px;
	border: 1px solid #e3e6ec;
	border-radius: 10px;
	background: #fbfcfe;
}

.cn-du-title {
	margin: 0 0 10px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #2c3444;
}

/* Kept in the layout (not display:none) so it stays reachable by assistive tech. */
.cn-du-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.cn-du-button {
	display: inline-block;
	width: 100%;
	padding: 11px 14px;
	border: 0;
	border-radius: 8px;
	background: #5b8fd9;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
}

.cn-du-button:hover {
	background: #4a7cc4;
}

.cn-du.is-busy .cn-du-button {
	opacity: 0.6;
	pointer-events: none;
}

.cn-du-hint {
	margin-top: 8px;
	font-size: 12px;
	line-height: 1.5;
	color: #6b7280;
}

.cn-du-status {
	margin-top: 8px;
	font-size: 12px;
	color: #4a7cc4;
}

.cn-du-status:empty {
	margin-top: 0;
}

.cn-du-status.is-error {
	color: #c2410c;
}

.cn-du-list {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	margin-top: 12px;
}

.cn-du-list:empty {
	margin-top: 0;
}

.cn-du-item {
	position: relative;
	border: 1px solid #e3e6ec;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}

.cn-du-item img {
	display: block;
	width: 100%;
	height: 74px;
	object-fit: contain;
	cursor: pointer;
}

.cn-du-remove {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 20px;
	height: 20px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(20, 24, 32, 0.65);
	color: #fff;
	font-size: 14px;
	line-height: 18px;
	cursor: pointer;
}

.cn-du-remove:hover {
	background: rgba(20, 24, 32, 0.9);
}
