/* Shared wizard for Design with AI, Name Badges, and Engraved Gifts.
   Desktop (>=1000px): one step in a ~42% column. The page scrolls; the column does not.
   The preview is the other ~58% and stays stuck under the site header.
   Mobile: a short "Step n of n" line, a collapsible preview, and Back/Next fixed
   above the site's bottom bar. */

.ade.ap-wizard,
.apai.ap-wizard {
	--ap-sticky-top: 72px;
	--ap-sticky-bottom: 0px;
	max-width:none;
	margin-top:0 !important;
	margin-bottom:36px;
	box-sizing:border-box;
}

.ap-wizard [data-wiz].ap-wiz-off { display:none !important; }

.ap-wizard > .ap-wiz-stepper { margin:0 0 8px !important; }
.ap-wizard > .ade-gated { margin:0 0 8px !important; }
.ap-wiz-stepper ol {
	display:flex;
	flex-wrap:wrap;
	gap:8px;
	list-style:none;
	margin:0;
	padding:0;
}
.ap-wizard .ap-wiz-stepper button {
	background:var(--ap-tool-surface) !important;
	color:var(--ap-tool-text) !important;
	-webkit-text-fill-color:var(--ap-tool-text) !important;
	border:1px solid var(--ap-tool-border);
	border-radius:999px;
	min-height:40px;
	height:auto !important;
	width:auto !important;
	max-width:none !important;
	padding:6px 12px;
	font:inherit;
	font-size:14px !important;
	font-weight:650;
	line-height:1.2 !important;
	cursor:pointer;
	overflow: visible !important;
	white-space:nowrap !important;
	text-overflow:clip !important;
}
.ap-wizard .ap-wiz-stepper button[aria-current="step"] {
	background:var(--ap-tool-accent) !important;
	color:var(--ap-tool-accent-text) !important;
	-webkit-text-fill-color:var(--ap-tool-accent-text) !important;
	border-color:var(--ap-tool-accent);
}
.ap-wiz-stepper button:disabled { opacity:.45; cursor:default; }
.ap-wiz-compact {
	display:none;
	margin:0 0 8px;
	font-weight:700;
	color:var(--ap-tool-text);
}

.ap-wiz-nav {
	display:flex;
	align-items:center;
	gap:12px;
	padding:12px 0 4px;
}
.ap-wiz-back,
.ap-wiz-next {
	min-height:48px;
	padding:12px 22px;
	border-radius:999px;
	font:inherit;
	font-weight:700;
	font-size:16px;
	cursor:pointer;
}
.ap-wizard .ap-wiz-back {
	background:var(--ap-tool-surface) !important;
	color:var(--ap-tool-text) !important;
	-webkit-text-fill-color:var(--ap-tool-text) !important;
	border:1px solid var(--ap-tool-border);
	font-size:16px !important;
	overflow: visible !important;
	white-space:nowrap !important;
}
.ap-wizard .ap-wiz-next {
	margin-left:auto;
	background:var(--ap-tool-accent) !important;
	color:var(--ap-tool-accent-text) !important;
	-webkit-text-fill-color:var(--ap-tool-accent-text) !important;
	border:0;
	font-size:16px !important;
	overflow: visible !important;
	white-space:nowrap !important;
}
.ap-wiz-next:disabled { opacity:.45; cursor:not-allowed; }
.ap-wiz-hint {
	margin:0;
	flex:1 1 auto;
	color:#6b4a12;
	font-size:14px;
	font-weight:650;
}
html[data-theme="dark"] .ap-wiz-hint { color:#f0d7a0; }
.ap-wiz-preview-toggle {
	display:none;
	width:100%;
	margin:0 0 8px;
	min-height:44px;
	border:1px solid var(--ap-tool-border);
	border-radius:12px;
	background:var(--ap-tool-surface);
	color:var(--ap-tool-text);
	font:inherit;
	font-weight:700;
	cursor:pointer;
}

.ap-wizard .apai-modes,
.ap-wizard .apai-methods { gap:12px; }
.ap-wizard .apai-modes label,
.ap-wizard .apai-methods label,
.ap-wizard .apai-cmode label { padding:14px 16px; }
.ap-wizard .ade-step { margin-top:0; }

/* Step titles sit beside the number. Theme rules (tiny spans, ellipsis, flex shrink)
   cannot clip them. Only .ap-wiz-num is the badge. */
.ade.ap-wizard h3,
.apai.ap-wizard legend,
.apai.ap-wizard h3 {
	display:flex !important;
	align-items:center !important;
	flex-wrap:wrap !important;
	gap:10px !important;
	margin:0 0 12px !important;
	overflow: visible !important;
	white-space:normal !important;
	text-overflow:clip !important;
	width:auto !important;
	max-width:none !important;
	height:auto !important;
	font-size:22px !important;
	font-weight:700 !important;
	line-height:1.3 !important;
	color:var(--ap-tool-text) !important;
	-webkit-text-fill-color:var(--ap-tool-text) !important;
}
.ap-wizard .ap-wiz-num {
	display:inline-grid !important;
	place-items:center !important;
	flex:0 0 32px !important;
	width:32px !important;
	height:32px !important;
	min-width:32px !important;
	max-width:32px !important;
	margin:0 !important;
	padding:0 !important;
	border-radius:50% !important;
	background:var(--ap-tool-accent) !important;
	color:var(--ap-tool-accent-text) !important;
	-webkit-text-fill-color:var(--ap-tool-accent-text) !important;
	font-size:16px !important;
	font-weight:700 !important;
	line-height:1 !important;
	overflow: visible !important;
	text-overflow:clip !important;
	white-space:nowrap !important;
}
.ade.ap-wizard h3 span:not(.ap-wiz-num),
.ade.ap-wizard h3 .ade-namesh,
.apai.ap-wizard legend span:not(.ap-wiz-num),
.apai.ap-wizard h3 span:not(.ap-wiz-num) {
	display:inline !important;
	flex:1 1 auto !important;
	width:auto !important;
	height:auto !important;
	min-width:0 !important;
	max-width:none !important;
	margin:0 !important;
	padding:0 !important;
	border-radius:0 !important;
	background:none !important;
	color:var(--ap-tool-text) !important;
	-webkit-text-fill-color:var(--ap-tool-text) !important;
	font-size:22px !important;
	font-weight:700 !important;
	line-height:1.3 !important;
	overflow: visible !important;
	white-space:normal !important;
	text-overflow:clip !important;
}
.ade.ap-wizard h3 .ade-opt {
	flex:0 1 auto !important;
	font-size:15px !important;
	font-weight:500 !important;
	color:var(--ap-tool-muted) !important;
	-webkit-text-fill-color:var(--ap-tool-muted) !important;
}

/* Checking… on Generate, Update, and the other submits. */
.apai-busy::before,
.ade-busy::before {
	content:"";
	display:inline-block;
	width:14px;
	height:14px;
	margin-right:8px;
	border:2px solid var(--ap-tool-border);
	border-top-color:var(--ap-tool-accent);
	border-radius:50%;
	vertical-align:-2px;
	animation:ap-wiz-spin .7s linear infinite;
}
@keyframes ap-wiz-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) {
	.apai-busy::before,
	.ade-busy::before { animation:none; border-top-color:var(--ap-tool-accent); }
}

@media (min-width: 1000px) {
	.ade.ap-wizard,
	.apai.ap-wizard {
		width:100vw;
		max-width:100vw;
		margin-left:calc(50% - 50vw);
		margin-right:calc(50% - 50vw);
		margin-bottom: 48px;
		padding-left:24px;
		padding-right:24px;
	}
	.ap-wizard .ap-split-work {
		display:grid;
		grid-template-columns:minmax(280px, 42%) minmax(0, 1fr);
		gap:28px;
		align-items:start;
	}
	.ap-wizard .ap-split-form {
		min-width:0;
		overflow: visible;
		max-height:none;
		display:flex;
		flex-direction:column;
	}
	/* Desktop:Back/Next follows the step. A sticky bar was covering the lower gift cards. */
	.ap-wizard .ap-wiz-nav {
		position: static !important;
		margin-top:12px;
		background:transparent;
		z-index:1;
	}
	.ap-wizard .ap-split-form .ade-step.ap-wiz-on,
	.ap-wizard .ap-split-preview .ade-previewbox,
	.ap-wizard .ap-split-preview .apai-preview {
		margin-top:0 !important;
	}
	.ap-wizard .ap-split-preview {
		position: sticky;
		top:var(--ap-sticky-top);
		max-height:calc(100vh - var(--ap-sticky-top) - 16px);
		overflow-y: auto;
		align-self:start;
		min-width:0;
	}
	.ap-wizard .ap-split-mini { display:none !important; }
	.ap-wizard .ap-wiz-compact,
	.ap-wizard .ap-wiz-preview-toggle { display:none; }
}

@media (max-width:999px) {
	.ap-wizard .ap-split-work {
		display:flex;
		flex-direction:column;
	}
	.ap-wizard .ap-split-preview { order:1; min-width:0; max-width:100%; }
	.ade-canvaswrap, .ade-previewbox, .ade-canvaswrap canvas { max-width:100%; }
	.ap-wizard .ap-split-form {
		order:2;
		display:flex;
		flex-direction:column;
		min-width:0;
		overflow: visible;
		max-height:none;
	}
	.ap-wizard .ap-wiz-stepper ol { display:none; }
	.ap-wizard .ap-wiz-compact { display:block; }
	.ap-wizard .ap-wiz-preview-toggle { display:block; }
	.ap-wizard .ap-split-preview.is-collapsed > :not(.ap-wiz-preview-toggle) { display:none; }
	.ap-wizard .ap-split-mini { display:none !important; }
	.ade.ap-wizard,
	.apai.ap-wizard { padding-bottom:calc(120px + var(--ap-sticky-bottom)); }
	.ap-wizard .ap-wiz-nav {
		position: fixed !important;
		left:0;
		right:0;
		bottom:var(--ap-sticky-bottom);
		z-index:25;
		background:var(--ap-tool-surface);
		padding:10px 16px;
		box-shadow:0 -2px 12px rgba(20, 28, 40, .12);
	}
	.ap-wizard .ap-wiz-nav.is-parked {
		position: static !important;
		box-shadow:none;
		padding-left:0;
		padding-right:0;
	}
}
