/* ==========================================================================
   NounCity — personalisation form
   Loaded only on single product pages.
   Values reference the theme's tokens, with fallbacks so the form still
   looks correct if another theme is ever activated.
   ========================================================================== */

.nc-personalise {
	margin: 0 0 1.5rem;
	padding: 1.25rem 1.25rem 0.5rem;
	border: 1.5px solid var(--wp--preset--color--saffron-200, #FCD1B0);
	border-radius: var(--wp--custom--radius--lg, 16px);
	background-color: var(--wp--preset--color--saffron-50, #FEF5EE);
}

.nc-personalise__legend {
	padding: 0 0.5rem;
	margin-inline-start: -0.5rem;
	font-family: var(--wp--preset--font-family--display, inherit);
	font-size: var(--wp--preset--font-size--h4, 1.1875rem);
	font-weight: 700;
	color: var(--wp--preset--color--ink, #1C1C1E);
}

.nc-personalise__intro {
	margin: 0 0 1.25rem;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	line-height: 1.55;
	color: var(--wp--preset--color--slate-700, #4A4A54);
}

.nc-personalise .nc-field {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	margin-bottom: 1.125rem;
}

.nc-personalise .nc-field__label {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.375rem;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 600;
	color: var(--wp--preset--color--ink, #1C1C1E);
}

.nc-personalise .nc-field__required {
	color: var(--wp--preset--color--error, #B91C1C);
}

.nc-personalise .nc-field__surcharge {
	margin-inline-start: auto;
	padding: 0.125rem 0.5rem;
	border-radius: 999px;
	background-color: var(--wp--preset--color--saffron-100, #FEE8D8);
	/* saffron-800: ember on this fill is 4.37:1 and fails AA. */
	color: var(--wp--preset--color--saffron-800, #903F01);
	font-size: var(--wp--preset--font-size--micro, 0.75rem);
	font-weight: 600;
	white-space: nowrap;
}

/* WooCommerce renders prices with its own markup inside the badge. */
.nc-personalise .nc-field__surcharge .woocommerce-Price-amount {
	color: inherit;
	font-weight: inherit;
}

.nc-personalise .nc-field__hint {
	margin: 0;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	line-height: 1.5;
	color: var(--wp--preset--color--slate-600, #60606C);
}

.nc-personalise .nc-input,
.nc-personalise .nc-textarea,
.nc-personalise .nc-select {
	width: 100%;
	min-height: 48px;
	padding: 0.75rem 0.875rem;
	background-color: var(--wp--preset--color--white, #FFFFFF);
	border: 1.5px solid var(--wp--preset--color--slate-200, #E6E6E8);
	border-radius: var(--wp--custom--radius--sm, 6px);
	/* 16px keeps iOS Safari from zooming the page when the field is focused. */
	font-size: 1rem;
	line-height: 1.5;
	color: var(--wp--preset--color--ink, #1C1C1E);
}

.nc-personalise .nc-textarea {
	min-height: 7rem;
	resize: vertical;
}

.nc-personalise .nc-input--file {
	padding: 0.625rem;
	background-color: var(--wp--preset--color--white, #FFFFFF);
}

.nc-personalise .nc-input:focus,
.nc-personalise .nc-textarea:focus,
.nc-personalise .nc-select:focus {
	outline: none;
	border-color: var(--wp--preset--color--saffron, #FD7207);
	box-shadow: 0 0 0 3px rgb(253 114 7 / 0.28);
}

.nc-personalise .nc-charcount {
	font-size: var(--wp--preset--font-size--micro, 0.75rem);
	color: var(--wp--preset--color--slate-600, #60606C);
	text-align: end;
	font-variant-numeric: tabular-nums;
}

.nc-personalise .nc-charcount--over {
	color: var(--wp--preset--color--error, #B91C1C);
	font-weight: 600;
}

/* The engraving preview reads better in the chosen lettering than in UI type. */
.nc-personalise .nc-field--name .nc-input {
	font-size: 1.125rem;
	letter-spacing: 0.01em;
}

@media (prefers-reduced-motion: no-preference) {
	.nc-personalise .nc-input,
	.nc-personalise .nc-textarea,
	.nc-personalise .nc-select {
		transition: border-color 150ms cubic-bezier(.4, 0, .2, 1), box-shadow 150ms cubic-bezier(.4, 0, .2, 1);
	}
}

/* --------------------------------------------------------------------------
   The house design collection.
   Tiles rather than a dropdown: nobody picks a picture by its name.
   -------------------------------------------------------------------------- */

.nc-personalise .nc-designs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
	gap: 0.625rem;
}

.nc-personalise .nc-design {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 0.5rem 0.5rem 0.625rem;
	border: 1.5px solid var(--wp--preset--color--slate-200, #E6E6E8);
	border-radius: var(--wp--custom--radius--md, 10px);
	background-color: var(--wp--preset--color--white, #FFFFFF);
	cursor: pointer;
}

/* The radio keeps its place in the accessibility tree and its arrow-key
   behaviour. Only its own box is hidden; the tile stands in for it. */
.nc-personalise .nc-design__input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	border: 0;
	clip-path: inset(50%);
	overflow: hidden;
}

.nc-personalise .nc-design__frame {
	position: relative;
	display: block;
	aspect-ratio: 1;
	/* Inset so the artwork never runs under the selection mark. */
	padding: 9%;
	box-sizing: border-box;
	border-radius: var(--wp--custom--radius--sm, 6px);
	background-color: var(--wp--preset--color--saffron-50, #FEF5EE);
}

.nc-personalise .nc-design__frame--none {
	background-image: repeating-linear-gradient(45deg, transparent 0 7px, rgb(28 28 30 / 0.07) 7px 14px);
}

.nc-personalise .nc-design__art {
	display: block;
	width: 100%;
	height: auto;
}

/* Selection is shown as a mark, not only as a colour. */
.nc-personalise .nc-design__frame::after {
	content: "";
	position: absolute;
	inset-block-start: 0.5rem;
	inset-inline-end: 0.5rem;
	width: 18px;
	height: 18px;
	border: 1.5px solid var(--wp--preset--color--slate-300, #CFCFD4);
	border-radius: 999px;
	background-color: var(--wp--preset--color--white, #FFFFFF);
}

.nc-personalise .nc-design__input:checked ~ .nc-design__frame::after {
	border-color: var(--wp--preset--color--saffron, #FD7207);
	box-shadow: inset 0 0 0 4px var(--wp--preset--color--saffron, #FD7207);
}

.nc-personalise .nc-design__input:checked ~ .nc-design__frame {
	box-shadow: 0 0 0 2px var(--wp--preset--color--saffron, #FD7207);
}

.nc-personalise .nc-design__input:focus-visible ~ .nc-design__frame {
	box-shadow: 0 0 0 3px rgb(253 114 7 / 0.45);
}

.nc-personalise .nc-design__input:checked:focus-visible ~ .nc-design__frame {
	box-shadow: 0 0 0 2px var(--wp--preset--color--saffron, #FD7207), 0 0 0 5px rgb(253 114 7 / 0.35);
}

/* An enhancement. Where :has() is missing the ring above still shows which
   tile is chosen, so nothing is lost. */
.nc-personalise .nc-design:has(.nc-design__input:checked) {
	border-color: var(--wp--preset--color--saffron, #FD7207);
}

.nc-personalise .nc-design__name {
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 600;
	color: var(--wp--preset--color--ink, #1C1C1E);
}

.nc-personalise .nc-design__note {
	font-size: var(--wp--preset--font-size--micro, 0.75rem);
	line-height: 1.4;
	color: var(--wp--preset--color--slate-600, #60606C);
}

@media (prefers-reduced-motion: no-preference) {
	.nc-personalise .nc-design,
	.nc-personalise .nc-design__frame {
		transition: border-color 150ms cubic-bezier(.4, 0, .2, 1), box-shadow 150ms cubic-bezier(.4, 0, .2, 1);
	}
}
