/* The embed wizard (front-page.php), scoped under .ddew so it does not leak into the DD theme. */
.ddew {
	--ddew-border: #d8dce3;
	--ddew-accent: #1d4ed8;
	--ddew-muted: #5b6472;
	--ddew-bg-soft: #f6f8fb;
	box-sizing: border-box;
	max-width: 1100px;
	margin: 0 auto;
	padding: 1.5rem;
	color: #1a1f29;
	font-family:
		system-ui,
		-apple-system,
		"Segoe UI",
		Roboto,
		sans-serif;
}

.ddew *,
.ddew *::before,
.ddew *::after {
	box-sizing: border-box;
}

/* State-driven parts set `display`, which beats the reset's [hidden]. */
.ddew [hidden] {
	display: none;
}

.ddew__header {
	margin-bottom: 1.5rem;
}

.ddew__title {
	margin: 0 0 0.25rem;
	font-size: 1.5rem;
}

.ddew__subtitle {
	margin: 0;
	color: var(--ddew-muted);
	max-width: 60ch;
}

.ddew__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
	gap: 2rem;
	align-items: start;
}

@media (max-width: 860px) {
	.ddew__layout {
		grid-template-columns: 1fr;
	}
}

.ddew__step {
	padding: 1.25rem 0;
	border-bottom: 1px solid var(--ddew-border);
}

.ddew__step:first-child {
	padding-top: 0;
}

.ddew__step-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 1rem;
	font-size: 1.05rem;
}

.ddew__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.6rem;
	height: 1.6rem;
	border-radius: 999px;
	background: var(--ddew-accent);
	color: #fff;
	font-size: 0.85rem;
	font-weight: 700;
}

.ddew__field {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.ddew__label {
	display: block;
	font-size: 0.8rem;
	font-weight: 600;
	flex: 1;
	color: var(--ddew-muted);
}

.ddew__select,
.ddew__input {
	width: 100%;
	padding: 0.55rem 0.65rem;
	border: 1px solid var(--ddew-border);
	border-radius: 8px;
	font-size: 0.95rem;
	background: #fff;
}

/* The search field with its own clear button. The browser's clear button is hidden: it can't take keyboard focus and has no accessible name. */
.ddew__search {
	position: relative;
	width: 100%;
}

.ddew__search .ddew__input {
	padding-right: 2.5rem;
}

.ddew__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	display: none;
}

.ddew__search-clear {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--ddew-muted);
    cursor: pointer;
    justify-content: center;
    align-items: center;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    position: absolute;
    top: 50%;
    right: .5rem;
    transform: translateY(-55%);
}

.ddew__search-clear:focus-visible,
.ddew__selection-clear:focus-visible {
	outline: 2px solid var(--ddew-accent);
	outline-offset: 2px;
}

.ddew__cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 0.75rem;
}

.ddew__card {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 0.85rem;
	border: 1px solid var(--ddew-border);
	border-radius: 10px;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ddew__card.is-selected {
	border-color: var(--ddew-accent);
	box-shadow: 0 0 0 1px var(--ddew-accent);
}

.ddew__card.is-disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.ddew__card input {
	position: absolute;
	opacity: 0;
}

.ddew__card-label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 600;
}

.ddew__card-hint {
	font-size: 0.8rem;
	color: var(--ddew-muted);
}

.ddew__pill {
	font-size: 0.65rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 0.1rem 0.4rem;
	border-radius: 999px;
	background: var(--ddew-bg-soft);
	color: var(--ddew-muted);
}

.ddew__results {
	list-style: none;
	margin: 0.5rem 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	max-height: 220px;
	overflow: auto;
}

.ddew__results-empty {
	color: var(--ddew-muted);
	font-size: 0.9rem;
	padding: 0.5rem 0;
}

.ddew__result {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 0.65rem;
	width: 100%;
	text-align: left;
	padding: 0.55rem 0.65rem;
	border: 1px solid var(--ddew-border);
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
}

.ddew__result.is-selected {
	border-color: var(--ddew-accent);
	box-shadow: 0 0 0 1px var(--ddew-accent);
}

/* ── Locked selection chip (replaces search after a pick) ───────────────── */
.ddew__selection {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.55rem 0.65rem;
	border: 1px solid var(--ddew-accent);
	box-shadow: 0 0 0 1px var(--ddew-accent);
	border-radius: 8px;
	background: #fff;
}

.ddew__selection .ddew__result-body {
	flex: 1 1 0;
}

.ddew__selection-clear {
	flex: 0 0 auto;
	margin-left: auto;
	width: 1.5rem;
	height: 1.5rem;
	color: var(--ddew-muted);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ── Color picker: swatch + hex text input ──────────────────────────────── */
.ddew__color-row {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.ddew__color-swatch {
	flex: 0 0 auto;
	width: 2rem;
	height: 2rem;
	padding: 0.1rem;
	border: 1px solid var(--ddew-border);
	border-radius: 6px;
	background: none;
	cursor: pointer;
}

.ddew__color-hex {
	width: 6rem;
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--ddew-border);
	border-radius: 6px;
	font-size: 0.85rem;
	font-family: ui-monospace, monospace;
	text-transform: uppercase;
}

.ddew__result-thumb {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--ddew-border);
}

.ddew__result-body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ddew__result-body span {
	font-size: 0.8rem;
	color: var(--ddew-muted);
}

.ddew__sections {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.ddew__section-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.5rem 0.65rem;
	border: 1px solid var(--ddew-border);
	border-radius: 8px;
}

.ddew__section-label {
	flex: 1;
	font-weight: 500;
}

.ddew__switch {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.8rem;
	color: var(--ddew-muted);
}

.ddew__hint {
	margin: 1rem 0;
	font-size: 0.8rem;
	color: var(--ddew-muted);
}

.ddew__note {
	margin: 0.5rem 0 1rem;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--ddew-border);
	border-radius: 8px;
	background: var(--ddew-bg-soft);
	font-size: 0.8rem;
	color: var(--ddew-muted);
}

.ddew__note summary {
	cursor: pointer;
	font-weight: 500;
	color: var(--ddew-accent);
}

.ddew__note ol,
.ddew__note ul {
	margin: 0.5rem 0 0;
	padding-left: 1.1rem;
}

.ddew__note li + li {
	margin-top: 0.35rem;
}

.ddew__note code {
	background: #fff;
	border: 1px solid var(--ddew-border);
	border-radius: 3px;
	padding: 0.05rem 0.3rem;
}

.ddew__link-btn {
	margin-left: auto;
	border: 0;
	background: none;
	color: var(--ddew-accent);
	cursor: pointer;
	font-size: 0.8rem;
}

.ddew__preview {
	position: sticky;
	top: 1rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.ddew__preview-pane {
	border: 1px solid var(--ddew-border);
	border-radius: 12px;
	background: var(--ddew-bg-soft);
	min-height: 320px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.ddew__iframe {
	width: 100%;
	height: 420px;
	border: 0;
}

.ddew__preview-empty {
	color: var(--ddew-muted);
	padding: 1.5rem;
	text-align: center;
}

.ddew__output {
	border: 1px solid var(--ddew-border);
	border-radius: 12px;
	padding: 0.75rem;
}

.ddew__code {
	width: 100%;
	font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
	font-size: 0.78rem;
	border: 1px solid var(--ddew-border);
	border-radius: 8px;
	padding: 0.6rem;
	resize: vertical;
	background: #fff;
	margin-top: 0.5rem;
}

.ddew__copy {
	margin-top: 0.5rem;
	width: 100%;
	padding: 0.55rem;
	border: 0;
	border-radius: 8px;
	background: var(--ddew-accent);
	color: #fff;
	cursor: pointer;
	font-weight: 600;
}

.ddew__copy:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Editor placeholder */
.dd-embed-wizard-placeholder {
	border: 1px dashed #c3c9d4;
	border-radius: 10px;
	padding: 1.25rem;
	text-align: center;
	color: #5b6472;
}
