/*
 * CustomPuzzle Core page components: forms, named image placeholders, owner-input marks, the draft banner and the
 * collage layout diagrams. Design tokens (--cp-*) with fallbacks; scoped to cp- classes.
 */

/* ---------------------------------------------------------------- named image placeholder (asset inventory) */
.cp-ph {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 16px;
	overflow: hidden;
	border-radius: var(--cp-radius-sm, 6px);
	background:
		radial-gradient(circle at 1px 1px, rgba(19, 27, 43, 0.07) 1px, transparent 1.5px) 0 0 / 14px 14px,
		var(--cp-stage, #e8e8e8);
	color: var(--cp-ink-muted, #4a5468);
	text-align: center;
	font-family: var(--cp-font-sans, inherit);
}
.cp-ph__icon {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	position: relative;
}
.cp-ph__icon::after {
	content: "";
	position: absolute;
	inset: 10px;
	background: var(--cp-line-strong, #7a8496);
	-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%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21'/%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%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cp-ph--product .cp-ph__icon::after, .cp-ph--packaging .cp-ph__icon::after {
	-webkit-mask-image: 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='M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z'/%3E%3Cpath d='M12 22V12'/%3E%3Cpath d='m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7'/%3E%3C/svg%3E");
	mask-image: 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='M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z'/%3E%3Cpath d='M12 22V12'/%3E%3Cpath d='m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7'/%3E%3C/svg%3E");
}
.cp-ph__label { max-width: 26ch; font-size: 13px; line-height: 18px; font-weight: 600; }
.cp-ph__id {
	position: absolute;
	left: 8px;
	bottom: 8px;
	padding: 1px 6px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.85);
	font: 600 11px/16px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color: var(--cp-ink-muted, #4a5468);
}

/* ---------------------------------------------------------------- owner input (missing business / legal fact) */
.cp-pending {
	padding: 1px 6px;
	border-radius: 4px;
	background: #fff4d6;
	box-shadow: inset 0 0 0 1px #e9b949;
	color: #5c3d00;
	font-weight: 600;
}
.cp-pending__id { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; opacity: 0.8; }
.cp-draft-banner {
	max-width: var(--cp-layout-max, 1200px);
	margin: 16px max(16px, calc((100% - var(--cp-layout-max, 1200px)) / 2)) 0;
	padding: 14px 16px;
	border-radius: var(--cp-radius-md, 10px);
	background: #fff4d6;
	box-shadow: inset 4px 0 0 #e9b949;
	color: #3d2900;
	font-size: 15px;
	line-height: 22px;
}

/* ---------------------------------------------------------------- collage layout diagrams */
.cp-layoutdemos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; padding: 0; list-style: none; }
.cp-layoutdemo { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--cp-ink-muted, #4a5468); }
.cp-layoutdemo svg { display: block; width: 100%; height: auto; border-radius: 2px; background: #fff; box-shadow: var(--cp-shadow-board, 0 1px 0 #c8ced8, 0 6px 16px rgba(19, 27, 43, 0.1)); }
.cp-layoutdemo rect { fill: #c9cfd9; stroke: #fff; stroke-width: 5; }
.cp-layoutdemo rect.is-big { fill: #9db3e2; }
@media (min-width: 600px) {
	.cp-layoutdemos { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- forms */
.cp-form {
	--f-line: var(--cp-line-strong, #7a8496);
	max-width: 760px;
	font-family: var(--cp-font-sans, inherit);
}
.cp-form__intro { margin: 0 0 16px; font-size: 14px; color: var(--cp-ink-muted, #4a5468); }
.cp-form__grid { display: grid; grid-template-columns: 1fr; gap: 18px 20px; }
@media (min-width: 700px) {
	.cp-form__grid { grid-template-columns: 1fr 1fr; }
	.cp-form__field--wide, .cp-form__field--topic, .cp-form__field--product { grid-column: 1 / -1; }
}
.cp-form__field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cp-form__field label { font-size: 15px; line-height: 20px; font-weight: 600; color: var(--cp-ink, #131b2b); }
.cp-form__req { color: var(--cp-danger, #b3261e); }
.cp-form__help { margin: 0; font-size: 13px; line-height: 18px; color: var(--cp-ink-muted, #4a5468); }
.cp-form input[type="text"],
.cp-form input[type="email"],
.cp-form input[type="number"],
.cp-form input[type="date"],
.cp-form select,
.cp-form textarea {
	width: 100%;
	min-height: 48px;
	padding: 10px 12px;
	border: 1px solid var(--f-line);
	border-radius: var(--cp-radius-sm, 6px);
	background: #fff;
	color: var(--cp-ink, #131b2b);
	font: inherit;
	font-size: 16px;
	line-height: 24px;
	box-shadow: none;
	transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
.cp-form textarea { min-height: 150px; resize: vertical; }
.cp-form :is(input, select, textarea):hover { border-color: var(--cp-ink, #131b2b); }
.cp-form :is(input, select, textarea):focus { outline: none; border-color: var(--cp-brand, #1f4fb4); box-shadow: 0 0 0 3px var(--cp-brand-soft, #e9effb); }
.cp-form :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--cp-danger, #b3261e); box-shadow: 0 0 0 3px var(--cp-danger-soft, #fcebe9); }
.cp-form__error {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	margin: 0;
	font-size: 14px;
	line-height: 20px;
	font-weight: 600;
	color: var(--cp-danger, #b3261e);
}
.cp-form__error[hidden] { display: none; }
.cp-form__error::before { content: "!"; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--cp-danger, #b3261e); color: #fff; font-size: 12px; line-height: 18px; text-align: center; }
.cp-form__hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cp-form__status:focus { outline: none; }
.cp-form__alert {
	margin: 0 0 18px;
	padding: 12px 16px;
	border-radius: var(--cp-radius-md, 10px);
	background: var(--cp-danger-soft, #fcebe9);
	box-shadow: inset 4px 0 0 var(--cp-danger, #b3261e);
	color: var(--cp-ink, #131b2b);
	font-size: 15px;
}
.cp-form__alert p { margin: 0 0 6px; font-weight: 600; }
.cp-form__alert ul { margin: 0; padding-left: 18px; }
.cp-form__alert a { color: var(--cp-danger, #b3261e); font-weight: 600; }
.cp-form__privacy { margin: 18px 0; font-size: 13px; color: var(--cp-ink-muted, #4a5468); }
.cp-form__submit { min-width: 200px; min-height: 52px; }
.cp-form-done {
	max-width: 760px;
	padding: 20px 22px;
	border-radius: var(--cp-radius-md, 10px);
	background: #e8f3ed;
	box-shadow: inset 4px 0 0 var(--cp-great, #1d6b47);
	color: var(--cp-ink, #131b2b);
}
.cp-form-done:focus { outline: none; }
.cp-form-done__title { margin: 0 0 4px; font-family: var(--cp-font-display, inherit); font-size: 20px; font-weight: 700; }
.cp-form-done p:last-child { margin: 0; }
