/*
 * CustomPuzzle creator entry (all modes): puzzle, size and orientation selectors, the selection summary, the upload
 * area, the sticky bar on phones and the preparing state. Styled with the design tokens (--cp-*, child theme
 * tokens.css) and safe fallbacks, so the creator also works without the theme. Scoped to cp- classes only.
 */
.cp-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	opacity: 0;
}
/* The tokens are set on every creator container: on product pages the selectors (.cp-chooser) sit in the WooCommerce
   form, outside the entry element. */
.cp-creator-entry,
.cp-chooser {
	--ce-brand: var(--cp-brand, #1f4fb4);
	--ce-brand-strong: var(--cp-brand-strong, #173d8c);
	--ce-soft: var(--cp-brand-soft, #e9effb);
	--ce-ink: var(--cp-ink, #131b2b);
	--ce-muted: var(--cp-ink-muted, #4a5468);
	--ce-line: var(--cp-line, #dde2ea);
	--ce-line-strong: var(--cp-line-strong, #7a8496);
	--ce-sunken: var(--cp-surface-sunken, #f4f6f9);
	--ce-stage: var(--cp-stage, #e8e8e8);
	--ce-radius: var(--cp-radius-md, 10px);
	margin: 0 0 1em;
	width: 100%;
	color: var(--ce-ink);
	font-family: var(--cp-font-sans, inherit);
}
.cp-entry p { margin: 0; }
.cp-i { width: 18px; height: 18px; flex: none; }

/* ---------------------------------------------------------------- fields */
.cp-chooser { margin: 0 0 16px; display: grid; gap: 18px; }
.cp-entry__config { display: grid; gap: 18px; align-content: start; }
.cp-field { margin: 0; min-width: 0; }
.cp-field__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cp-field__label { font-size: 15px; line-height: 20px; font-weight: 600; color: var(--ce-ink); }
.cp-field__aside { font-size: 13px; line-height: 18px; color: var(--ce-muted); }

/* WooCommerce's selects stay in the form (the state) and are replaced visually by the selectors. */
form.cp-chips-on table.variations { display: none; }

/* ---------------------------------------------------------------- shared choice button */
.cp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-chip {
	position: relative;
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	min-height: 44px;
	margin: 0;
	padding: 8px 12px;
	border: 1px solid var(--ce-line-strong);
	border-radius: var(--ce-radius);
	background: var(--cp-surface, #fff);
	color: var(--ce-ink);
	font: inherit;
	font-size: 15px;
	line-height: 1.25;
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	cursor: pointer;
	transition: border-color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out;
}
.cp-chip:hover { background: var(--ce-sunken); color: var(--ce-ink); border-color: var(--ce-ink); }
.cp-chip[aria-checked="true"] {
	border-color: var(--ce-brand);
	box-shadow: inset 0 0 0 1px var(--ce-brand);
	background: var(--ce-soft);
	color: var(--ce-ink);
}
.cp-chip[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.cp-chip:focus-visible { outline: 2px solid var(--cp-focus, #131b2b); outline-offset: 2px; }
.cp-chip__sub, .cp-chip__note { font-weight: 400; font-size: 13px; color: var(--ce-muted); font-variant-numeric: tabular-nums; }
.cp-chip__best {
	display: inline-block;
	margin-top: 4px;
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--cp-accent, #f4b63f);
	color: var(--cp-on-accent, #131b2b);
	font-size: 12px;
	line-height: 18px;
	font-weight: 700;
}
.cp-q { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; line-height: 18px; font-weight: 600; }
.cp-q .cp-i { width: 14px; height: 14px; }
.cp-chip .cp-q, .cp-entry .cp-q { margin-top: 2px; }
.cp-q--great { color: var(--cp-great, #1d6b47); }
.cp-q--fine { color: var(--cp-fine, #3f4b5e); }
.cp-q--low { color: var(--cp-low, #8a4100); }

/* Check badge on selected cards: the selection is visible by colour, border and this mark. */
.cp-choice__check {
	position: absolute;
	top: -7px;
	right: -7px;
	box-shadow: 0 0 0 2px #fff;
	display: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--ce-brand);
	color: #fff;
	align-items: center;
	justify-content: center;
}
.cp-choice__check .cp-i { width: 14px; height: 14px; }
.cp-chip[aria-checked="true"] .cp-choice__check { display: inline-flex; }

/* ---------------------------------------------------------------- puzzle cards (home, collections) */
.cp-choice--card[data-group="product"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cp-choice--card[data-group="product"] .cp-chip { flex-direction: row; align-items: center; gap: 10px; width: 100%; padding: 10px 12px 10px 10px; min-height: 64px; }
.cp-prod__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--ce-sunken);
	color: var(--ce-brand);
}
.cp-chip[aria-checked="true"] .cp-prod__icon { background: #fff; }
.cp-prod__icon .cp-i { width: 20px; height: 20px; }
.cp-prod__text { display: flex; flex-direction: column; min-width: 0; }
.cp-prod__name { font-weight: 700; font-size: 15px; line-height: 20px; }
.cp-prod__meta, .cp-prod__price { font-size: 13px; line-height: 18px; color: var(--ce-muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- size cards: to-scale board, pieces, size, price */
.cp-choice--card[data-group="size"] { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; }
.cp-choice--card[data-group="size"] .cp-chip {
	display: grid;
	grid-template-columns: 40px minmax(0, 1fr);
	align-items: center;
	column-gap: 10px;
	width: 100%;
	padding: 10px 12px 10px 10px;
	min-height: 64px;
}
.cp-choice--card[data-group="size"] .cp-chip > .cp-q,
.cp-choice--card[data-group="size"] .cp-chip > .cp-chip__best,
.cp-choice--card[data-group="size"] .cp-chip > .cp-chip__note { grid-column: 1 / -1; justify-self: start; }
.cp-size__board {
	display: flex;
	align-items: flex-end;
	justify-content: flex-start;
	width: 40px;
	height: 40px;
}
.cp-size__shape {
	display: block;
	border: 1.5px solid var(--ce-line-strong);
	border-radius: 2px;
	background: var(--ce-stage);
}
.cp-chip[aria-checked="true"] .cp-size__shape { border-color: var(--ce-brand); background: #fff; }
.cp-size__text { display: flex; flex-direction: column; min-width: 0; }
.cp-size__pieces { font-size: 14px; line-height: 18px; color: var(--ce-muted); }
.cp-size__pieces strong { font-family: var(--cp-font-display, inherit); font-size: 18px; line-height: 22px; color: var(--ce-ink); font-variant-numeric: tabular-nums; }
.cp-size__dims { font-size: 13px; line-height: 18px; color: var(--ce-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cp-size__price { font-size: 14px; line-height: 18px; font-weight: 700; color: var(--ce-ink); font-variant-numeric: tabular-nums; }

/* Narrow phones: puzzle cards stack the icon above the words; size cards use a smaller outline. */
@media (max-width: 479px) {
	.cp-choice--card[data-group="product"] .cp-chip { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; }
	.cp-prod__icon { width: 30px; height: 30px; }
	.cp-prod__icon .cp-i { width: 17px; height: 17px; }
	.cp-choice--card[data-group="size"] .cp-chip { grid-template-columns: 30px minmax(0, 1fr); column-gap: 8px; padding: 10px 8px; }
	.cp-size__board { width: 30px; height: 30px; }
	.cp-size__pieces strong { font-size: 17px; }
}

/* ---------------------------------------------------------------- orientation: segmented control */
.cp-choice--segment {
	display: inline-flex;
	flex-wrap: nowrap;
	gap: 4px;
	padding: 4px;
	border-radius: 12px;
	background: var(--ce-sunken);
}
.cp-choice--segment .cp-chip {
	flex-direction: row;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 6px 14px;
	border-color: transparent;
	background: transparent;
	font-weight: 600;
}
.cp-choice--segment .cp-chip:hover { background: rgba(255, 255, 255, 0.6); border-color: transparent; }
.cp-choice--segment .cp-chip[aria-checked="true"] {
	background: #fff;
	border-color: var(--ce-brand);
	box-shadow: 0 1px 2px rgba(19, 27, 43, 0.12);
	color: var(--ce-brand-strong);
}
.cp-seg__icon { display: inline-flex; }

/* ---------------------------------------------------------------- selection summary, delivery, actions */
.cp-summary {
	display: grid;
	gap: 2px;
	padding: 12px 14px;
	border-radius: var(--ce-radius);
	background: var(--ce-sunken);
}
.cp-summary__label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ce-muted); }
.cp-summary__what { font-size: 15px; line-height: 22px; color: var(--ce-ink); font-variant-numeric: tabular-nums; }
.cp-summary__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 4px; }
.cp-summary__price strong { font-size: 24px; line-height: 30px; font-variant-numeric: tabular-nums; }
.cp-summary__price span { font-size: 14px; color: var(--ce-muted); }
.cp-entry__delivery {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-top: 10px !important;
	font-size: 14px;
	line-height: 20px;
	color: var(--ce-muted);
}
.cp-entry__delivery::before {
	content: "";
	flex: none;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	background: var(--ce-brand);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2'/%3E%3Cpath d='M15 18H9'/%3E%3Cpath d='M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.62l-3.48-4.35A1 1 0 0 0 17.52 8H14'/%3E%3Ccircle cx='17' cy='18' r='2'/%3E%3Ccircle cx='7' cy='18' r='2'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2'/%3E%3Cpath d='M15 18H9'/%3E%3Cpath d='M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.62l-3.48-4.35A1 1 0 0 0 17.52 8H14'/%3E%3Ccircle cx='17' cy='18' r='2'/%3E%3Ccircle cx='7' cy='18' r='2'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cp-entry__upload {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 52px;
	margin-top: 14px !important;
	font-size: 17px !important;
}
.cp-entry__upload::before {
	content: "";
	width: 20px;
	height: 20px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m17 8-5-5-5 5'/%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m17 8-5-5-5 5'/%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cp-entry__help, .cp-entry__msg { font-size: 13px; line-height: 18px; margin: 8px 0 0 !important; color: var(--ce-muted); }
.cp-entry__msg:empty { display: none; }
.cp-entry__design { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; }
.cp-entry__thumb { width: 96px; height: auto; border-radius: 2px; box-shadow: var(--cp-shadow-board, 0 2px 8px rgba(0, 0, 0, 0.15)); flex: none; }
.cp-entry__draftinfo { flex: 1; min-width: 0; }
.cp-entry__what { font-size: 14px; margin-bottom: 8px !important; }
.cp-entry__acts { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-entry__acts .button { min-height: 44px; }

/* ---------------------------------------------------------------- full / preset: preview area beside the choices */
.cp-entry--full .cp-entry__cols,
.cp-entry--preset .cp-entry__cols {
	display: grid;
	gap: 16px;
	padding: 12px;
	border: 1px solid var(--ce-line);
	border-radius: var(--cp-radius-lg, 16px);
	background: var(--cp-surface, #fff);
	box-shadow: 0 1px 2px rgba(19, 27, 43, 0.04), 0 12px 32px rgba(19, 27, 43, 0.06);
}
.cp-entry__stage {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	min-height: 200px;
	border-radius: var(--ce-radius);
	background: var(--ce-stage);
}
.cp-entry__preview {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	width: 100%;
	max-width: 440px;
	max-height: 52vh;
	padding: 12px;
	overflow: hidden;
	border: 0;
	border-radius: 2px;
	background: #fff;
	color: var(--ce-ink);
	font: inherit;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: var(--cp-shadow-board, 0 1px 0 #c8ced8, 0 6px 16px rgba(19, 27, 43, 0.1));
	cursor: pointer;
	transition: outline-color 150ms ease-out;
}
.cp-entry__preview:hover,
.cp-entry__preview.is-over { outline: 2px solid var(--ce-brand); outline-offset: 3px; background: #fff; color: var(--ce-ink); }
.cp-entry__pattern { position: absolute; inset: 0; background: center / cover no-repeat; opacity: 0.35; pointer-events: none; }
.cp-entry__previewicon {
	position: relative;
	width: 48px;
	height: 48px;
	margin-bottom: 6px;
	border-radius: 50%;
	background: var(--ce-soft);
}
.cp-entry__previewicon::after {
	content: "";
	position: absolute;
	inset: 12px;
	background: var(--ce-brand);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m17 8-5-5-5 5'/%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m17 8-5-5-5 5'/%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cp-entry__previewtext { position: relative; font-weight: 700; font-size: 17px; }
.cp-entry__drop { position: relative; font-size: 13px; color: var(--ce-muted); }
.cp-entry__previewdims { position: relative; margin-top: 6px; font-size: 12px; color: var(--ce-muted); font-variant-numeric: tabular-nums; }
.cp-entry__design-img { max-width: 100%; max-height: 52vh; height: auto; box-shadow: var(--cp-shadow-board, 0 2px 8px rgba(0, 0, 0, 0.15)); }
@media (min-width: 900px) {
	.cp-entry--full .cp-entry__cols,
	.cp-entry--preset .cp-entry__cols { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; gap: 28px; padding: 24px; }
	.cp-entry__stage { min-height: 420px; position: sticky; top: 24px; }
}

/* ---------------------------------------------------------------- compact: product and size in one row (guides) */
.cp-entry__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.cp-entry__lab { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; flex: 1 1 160px; }
.cp-entry__select { min-height: 44px; font: inherit; }
.cp-entry__row .cp-entry__upload { width: auto; flex: 1 1 160px; margin-top: 0 !important; }
.cp-entry__link { margin-top: 8px; padding: 0; border: 0; background: none; color: var(--ce-brand); text-decoration: underline; font: inherit; text-transform: none; box-shadow: none; cursor: pointer; }
.cp-entry__link:hover { background: none; color: var(--ce-brand-strong); }

/* ---------------------------------------------------------------- sticky action bar on phones (A2, B2) */
.cp-sticky {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: var(--cp-z-sticky, 40);
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
	background: #fff;
	border-top: 1px solid var(--cp-line, #dde2ea);
	box-shadow: var(--cp-shadow-sheet, 0 -8px 24px rgba(19, 27, 43, 0.14));
	font-family: var(--cp-font-sans, inherit);
}
.cp-sticky[hidden] { display: none; }
.cp-sticky__info { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 18px; color: var(--cp-ink-muted, #4a5468); }
.cp-sticky__info strong { font-size: 18px; line-height: 22px; color: var(--cp-ink, #131b2b); font-variant-numeric: tabular-nums; }
.cp-sticky .button { min-height: 48px; white-space: nowrap; }
@media (min-width: 900px) {
	.cp-sticky { display: none; }
}

/* ---------------------------------------------------------------- preparing state: shown only after 0.3 s; never a blank screen */
.cp-prep {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: var(--cp-surface-sunken, #f4f6f9);
	font-family: var(--cp-font-sans, inherit);
}
.cp-prep__box { width: min(360px, 80vw); text-align: center; }
.cp-prep__board {
	margin: 0 auto 18px;
	max-height: 50vh;
	border-radius: 2px;
	background: linear-gradient(100deg, #e8e8e8 30%, #f3f3f3 50%, #e8e8e8 70%) 0 0 / 300% 100%;
	box-shadow: var(--cp-shadow-board, 0 2px 8px rgba(0, 0, 0, 0.12));
	animation: cp-prep-shine 1.4s ease-in-out infinite;
}
.cp-prep__name { font-weight: 700; margin: 0 0 4px; color: var(--cp-ink, #131b2b); }
.cp-prep__what, .cp-prep__msg { margin: 0 0 4px; color: var(--cp-ink-muted, #4a5468); font-size: 14px; }
@keyframes cp-prep-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
	.cp-prep__board { animation: none; }
}
