/*
 * Generative Canvas block. Section mode: art behind inner blocks. Fixed mode: a viewport-wide backdrop
 * (place it in the header template part to cover the whole site).
 */

.cd-gen {
	--cd-gen-min: 70vh;
	--cd-gen-dim: 0.25;
	position: relative;
	isolation: isolate;
	overflow: hidden;
	min-height: var(--cd-gen-min);
	display: flex;
	flex-direction: column;
	/* Visible before JS runs, and when canvas is unavailable. */
	background:
		radial-gradient(ellipse at 20% 10%, color-mix(in srgb, var(--wp--preset--color--primary, #00e5ff) 18%, transparent), transparent 55%),
		radial-gradient(ellipse at 85% 90%, color-mix(in srgb, var(--wp--preset--color--secondary, #ff2bd6) 14%, transparent), transparent 50%),
		var(--wp--preset--color--void, #06070d);
}

.cd-gen__canvas {
	position: absolute;
	inset: 0;
	z-index: -2;
	width: 100%;
	height: 100%;
	display: block;
}

/* Keeps text readable over busy art. */
.cd-gen::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background: linear-gradient(to bottom, rgb(0 0 0 / calc(var(--cd-gen-dim) * 0.6)), rgb(0 0 0 / var(--cd-gen-dim)));
}

.cd-gen__content {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: var(--wp--style--block-gap, 1.5rem);
	padding: var(--wp--preset--spacing--xl, 4rem) var(--wp--preset--spacing--sm, 1rem);
}
.cd-gen__content > * {
	width: 100%;
	max-width: var(--wp--style--global--content-size, 880px);
	margin-inline: auto;
	margin-block: 0;
}
.cd-gen__content > .alignwide {
	max-width: var(--wp--style--global--wide-size, 1320px);
}
.cd-gen__content > .alignfull {
	max-width: none;
}
.cd-gen__content:empty {
	display: none;
}

/* Fixed backdrop */
.cd-gen.is-mode-fixed {
	position: fixed;
	inset: 0;
	z-index: -1;
	min-height: 0;
	pointer-events: none;
}
.cd-gen.is-mode-fixed .cd-gen__content {
	display: none;
}

@media print {
	.cd-gen.is-mode-fixed {
		display: none;
	}
}

/* Source: an existing minted generative work (poster first, live embed when allowed). */
.cd-gen__frame {
	position: absolute;
	inset: 0;
	z-index: -2;
	overflow: hidden;
}
.cd-gen__poster,
.cd-gen__iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
.cd-gen__poster {
	object-fit: cover;
}
.cd-gen__iframe {
	opacity: 0;
	transition: opacity 900ms ease;
}
.cd-gen__frame.is-live .cd-gen__iframe {
	opacity: 1;
}
.cd-gen__credit {
	position: absolute;
	right: 0.75rem;
	bottom: 0.6rem;
	z-index: 1;
	padding: 0.15em 0.6em;
	font-size: 0.7rem;
	text-decoration: none;
	color: var(--wp--preset--color--ink, #d5e1f2);
	background: color-mix(in srgb, var(--wp--preset--color--void, #06070d) 70%, transparent);
	border: 1px solid var(--wp--preset--color--line, #1f2a47);
}
.cd-gen__credit:hover {
	color: var(--wp--preset--color--primary, #00e5ff);
}
.cd-gen.is-mode-fixed .cd-gen__credit {
	display: none;
}
.cd-gen__note {
	position: absolute;
	left: 0.75rem;
	bottom: 0.6rem;
	z-index: 1;
	margin: 0;
	padding: 0.2em 0.6em;
	font-size: 0.72rem;
	color: var(--wp--preset--color--warn, #ffb000);
	background: var(--wp--preset--color--void, #06070d);
	border: 1px dashed var(--wp--preset--color--warn, #ffb000);
}
