/*
 * The badge and marketing-materials maker on the Certification page
 * (template-parts/materials-maker.php, assets/js/materials-maker.js).
 *
 * Every colour here comes from the look's tokens, so the maker follows whichever look is active.
 * The only fixed colours are the artwork's own and the swatches that stand for them: those are
 * set in the template part and must not change with the look.
 *
 * Its labels, boxes and radio rows are the request form's (the form- classes in assets/css/request-form.css,
 * which inc/materials-maker.php loads before this file); only what the maker adds to them is here. Buttons
 * come from the theme's .button.
 */
.maker {
	/* The squares behind the artwork that show which parts of it are see-through. */
	--maker-check-a: color-mix(in srgb, var(--ink) 6%, var(--paper));
	--maker-check-b: color-mix(in srgb, var(--ink) 2%, var(--paper));

	margin-top: 1.5rem;
}
.maker,
.maker *,
.maker *::before,
.maker *::after {
	box-sizing: border-box;
}
.maker p {
	margin: 0;
}
/* Beats the display values below, so the hidden attribute always hides. */
.maker [hidden] {
	display: none;
}

.maker-app {
	display: grid;
	gap: 1.5rem;
}
.maker-stage {
	background: var(--surface);
}
@supports (background: color-mix(in srgb, red, blue)) {
	.maker-stage {
		background: repeating-conic-gradient(var(--maker-check-a) 0 25%, var(--maker-check-b) 0 50%) 0 0 /
			1.5rem 1.5rem;
	}
}
.maker-preview {
	display: grid;
	place-items: center;
	min-height: 14rem;
	padding: 1.5rem;
	border-radius: min(1rem, var(--radius-card));
}
.maker-preview svg {
	display: block;
	width: 100%;
	max-width: 32rem;
	max-height: 28rem;
	height: auto;
}
.maker-controls {
	display: grid;
	gap: 1.5rem;
	align-content: start;
}

/* The code box is also an input, which sets its font size. */
.maker-controls .maker-code {
	font-family: ui-monospace, Menlo, Consolas, monospace;
	font-size: 1rem;
	word-break: break-all;
}

/* Colours */
.maker-swatches {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.75rem;
}
.maker-swatches .maker-swatch {
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	padding-inline: 0.5rem;
	text-align: center;
}
.maker-swatch input {
	position: absolute;
	opacity: 0;
}
/*
 * The chip's fill and border are the artwork's own colours. The ring around it comes from the
 * look, so a dark chip still shows on a dark page, and it thickens on the chosen colours.
 */
.maker-chip {
	width: 2.5rem;
	height: 2.5rem;
	border: 3px solid;
	border-radius: 50%;
	outline: 2px solid var(--line-strong);
	outline-offset: 2px;
}
.maker-swatch input:checked + .maker-chip {
	outline: 3px solid var(--cta);
}

.maker-actions {
	display: grid;
	gap: 0.75rem;
}
.maker-status {
	min-height: 1.5rem;
	color: var(--link);
	font-weight: 700;
}

/* Ready-made badges, shown until the script starts and whenever it cannot. */
.maker-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
	gap: 1.5rem 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}
.maker-gallery-item {
	display: grid;
	gap: 0.75rem;
	align-content: start;
}
.maker-gallery-stage {
	padding: 1rem;
	border-radius: min(1rem, var(--radius-card));
}
.maker-gallery-stage img {
	display: block;
	width: 100%;
	height: auto;
}
.maker-gallery-name {
	color: var(--ink);
	font-weight: 700;
}

@media (min-width: 40rem) {
	.maker-actions {
		display: flex;
		flex-wrap: wrap;
	}
}
@media (min-width: 64rem) {
	.maker-app {
		grid-template-columns: 1.2fr 1fr;
		gap: 2.5rem;
		align-items: start;
	}
	.maker-preview {
		position: sticky;
		top: calc(var(--header-height) + 1.5rem);
		min-height: 24rem;
	}
}
