/* ============================================================
   FREE WEBSITE AUDIT POPUP + sticky reopen button
   Markup: inc/lead-popup.php · Behaviour: assets/js/lead-popup.js
   Form fields reuse the Lead Form block styles (.ced-field etc).
   ============================================================ */

html.ced-audit-open { overflow: hidden; }

.ced-audit {
	padding: 0;
	margin: auto;
	border: 0;
	background: transparent;
	width: min(1040px, calc(100vw - 2rem));
	max-width: none;
	max-height: calc(100dvh - 2rem);
	color: var(--wp--preset--color--paper);
	overflow: visible;
}
.ced-audit::backdrop {
	background: rgba(6, 6, 9, 0.72);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.ced-audit[open] { animation: ced-audit-in 420ms var(--ease-emph) both; }
.ced-audit[open]::backdrop { animation: ced-audit-fade 320ms ease both; }
@keyframes ced-audit-in {
	from { opacity: 0; transform: translateY(24px) scale(0.98); }
	to   { opacity: 1; transform: none; }
}
@keyframes ced-audit-fade { from { opacity: 0; } to { opacity: 1; } }

.ced-audit__panel {
	position: relative;
	max-height: calc(100dvh - 2rem);
	overflow-y: auto;
	overscroll-behavior: contain;
	border: 1px solid var(--ced-line-10);
	border-radius: var(--wp--custom--radius--lg);
	background: linear-gradient(160deg, #15131d 0%, #0c0c10 100%);
	box-shadow:
		0 40px 90px -20px rgba(0, 0, 0, 0.7),
		0 0 0 1px rgba(203, 108, 230, 0.08);
}

.ced-audit__close {
	position: absolute;
	top: 1rem; right: 1rem;
	z-index: 2;
	width: 40px; height: 40px;
	display: inline-flex; align-items: center; justify-content: center;
	border: 1px solid var(--ced-line-18);
	border-radius: 999px;
	background: var(--ced-veil-50);
	color: var(--wp--preset--color--paper);
	cursor: pointer;
	transition: border-color var(--wp--custom--transition--swift), transform 280ms var(--ease-emph);
}
.ced-audit__close:hover { border-color: var(--wp--preset--color--lime); transform: rotate(90deg); }

.ced-audit__layout {
	display: grid;
	grid-template-columns: 1fr;
}
@media (min-width: 900px) {
	.ced-audit__layout { grid-template-columns: 0.9fr 1.1fr; align-items: stretch; }
}

/* --- Left: Black Friday banner ------------------------------------- */
/* The site uses system fonts only, so the banner leans on heavy weights
   (Segoe UI Black / SF Pro Heavy) instead of a display face. */
.ced-audit__banner {
	--bf-font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
	position: relative;
	overflow: hidden;
	min-height: 180px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 2rem;
	padding: clamp(1.5rem, 3vw, 2.25rem);
	background:
		radial-gradient(90% 55% at 0% 100%, rgba(203, 108, 230, 0.42) 0%, transparent 70%),
		#060608;
	isolation: isolate;
	font-family: var(--bf-font);
}
/* Faint grid texture, fading out toward the edges */
.ced-audit__banner::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
	background-size: 28px 28px;
	mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
	-webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
/* Divider glow against the form column */
.ced-audit__banner::after {
	content: "";
	position: absolute;
	top: 0; right: 0; bottom: 0;
	width: 1px;
	background: linear-gradient(180deg, transparent, rgba(203, 108, 230, 0.55), transparent);
}

.ced-audit__banner-top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
}

.ced-audit__banner-tag {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--micro);
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--wp--preset--color--paper);
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 9999px;
	padding: 0.4rem 0.8rem;
	margin-top: 0.4rem;
}

.ced-audit__banner-sticker {
	flex: 0 0 auto;
	width: 96px; height: 96px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.1rem;
	border-radius: 50%;
	background: var(--wp--preset--color--lime);
	color: #fff;
	transform: rotate(-10deg);
	box-shadow: 0 0 0 5px rgba(203, 108, 230, 0.2), 0 16px 36px -10px rgba(203, 108, 230, 0.7);
	animation: ced-audit-sticker 5s ease-in-out infinite;
}
.ced-audit__banner-sticker strong {
	font-weight: 900;
	font-size: 1.7rem;
	line-height: 1;
	letter-spacing: -0.03em;
}
.ced-audit__banner-sticker span {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.7rem;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	font-weight: 700;
	margin-right: -0.24em; /* optically centre the tracked text */
}
@keyframes ced-audit-sticker {
	0%, 100% { transform: rotate(-10deg) translateY(0); }
	50%      { transform: rotate(-6deg) translateY(-5px); }
}

.ced-audit__banner-word {
	display: flex;
	flex-direction: column;
	font-weight: 900;
	text-transform: uppercase;
	line-height: 0.88;
	letter-spacing: -0.045em;
	font-size: clamp(3.5rem, 7.4vw, 6rem);
}
.ced-audit__banner-word span:first-child {
	color: transparent;
	-webkit-text-stroke: 2px var(--wp--preset--color--paper);
}
.ced-audit__banner-word span:last-child {
	color: var(--wp--preset--color--lime);
	text-shadow: 0 0 36px rgba(203, 108, 230, 0.45);
}

.ced-audit__banner-foot {
	display: grid;
	gap: 0.5rem;
	padding-top: 1.1rem;
	border-top: 1px solid rgba(255, 255, 255, 0.14);
}
.ced-audit__banner-foot strong {
	font-weight: 800;
	font-size: clamp(1.35rem, 2.2vw, 1.75rem);
	letter-spacing: -0.02em;
	text-transform: uppercase;
	color: var(--wp--preset--color--paper);
	line-height: 1;
}
.ced-audit__banner-list {
	list-style: none;
	margin: 0.35rem 0 0;
	padding: 0;
	display: grid;
	gap: 0.55rem;
}
.ced-audit__banner-list li {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0;
	font-size: 0.95rem;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.85);
}
.ced-audit__banner-list svg {
	flex: 0 0 auto;
	width: 22px; height: 22px;
	padding: 4px;
	border-radius: 50%;
	background: rgba(203, 108, 230, 0.18);
	color: var(--wp--preset--color--lime);
}

/* Drop-in image variant */
.ced-audit__banner--image { padding: 0; }
.ced-audit__banner--image img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* --- Right: title + form ------------------------------------------- */
.ced-audit__body {
	display: grid;
	gap: 1.5rem;
	align-content: center;
	padding: clamp(1.5rem, 3.5vw, 2.5rem);
	padding-top: clamp(3.5rem, 5vw, 3.25rem); /* clear the close button */
	min-width: 0;
}

.ced-audit__title {
	margin: 0;
	padding-right: 2.5rem; /* keep clear of the close button */
	font-size: clamp(1.4rem, 2.3vw, 1.85rem);
	font-weight: 500;
	letter-spacing: -0.02em;
	line-height: 1.1;
	color: var(--wp--preset--color--paper);
}
.ced-audit__title em {
	font-style: normal;
	color: var(--wp--preset--color--lime);
}

/* The shared form carries .ced-reveal, which waits for an
   IntersectionObserver that never fires inside a modal. */
.ced-audit .ced-reveal { opacity: 1; transform: none; }

.ced-audit .ced-field textarea { min-height: 96px; }

/* Full-width button with the fine print centred beneath it. */
.ced-audit .ced-lead__submit-row {
	flex-direction: column-reverse;
	align-items: stretch;
	gap: 0.7rem;
	margin-top: 0.25rem;
}
.ced-audit .ced-lead__submit-row .ced-btn {
	width: 100%;
	justify-content: center;
	padding-block: 1rem;
}
/* style.css repaints .ced-lead__* dark for the cream contact section. */
.ced-audit .ced-lead__legal {
	color: var(--wp--preset--color--fog) !important;
	max-width: none;
	text-align: center;
	font-size: 0.75rem;
}
.ced-audit .ced-lead__result:empty { display: none; }

/* --- Desktop, shorter screens only ----------------------------------
   The full-size layout needs ~800px of viewport height. Below that (e.g. a
   1536×864 laptop shows ~730px) switch to a compact layout so the popup fits
   without scrolling. Taller screens keep the full-size design untouched. */
@media (min-width: 900px) and (max-height: 800px) {
	.ced-audit__banner { gap: 1.25rem; padding: 1.75rem; }
	.ced-audit__banner-sticker { width: 84px; height: 84px; }
	.ced-audit__banner-sticker strong { font-size: 1.45rem; }
	/* Scale with height too, so the banner never out-grows the form column. */
	.ced-audit__banner-word { font-size: min(7.4vw, 9vh, 6rem); }
	.ced-audit__banner-foot { gap: 0.4rem; padding-top: 0.9rem; }
	.ced-audit__banner-list { gap: 0.4rem; }
	.ced-audit__banner-list li { font-size: 0.88rem; }

	.ced-audit__body { gap: 1.1rem; padding: 2.75rem 2.25rem 2rem; }
	.ced-audit__title { font-size: clamp(1.3rem, 2vw, 1.65rem); }

	/* Two-column form grid: captcha beside the submit button. */
	.ced-audit .ced-lead__form {
		grid-template-columns: 1fr 1fr;
		gap: 0.8rem 1rem;
		align-items: end;
	}
	.ced-audit .ced-lead__form > * { grid-column: 1 / -1; }
	.ced-audit .ced-lead__form > .ced-lead__captcha { grid-column: 1; max-width: none; }
	.ced-audit .ced-lead__form > .ced-lead__submit-row { grid-column: 2; }
	.ced-audit .ced-lead__form:not(:has(.ced-lead__captcha)) > .ced-lead__submit-row { grid-column: 1 / -1; }
	.ced-audit .ced-lead__captcha input[type="number"] { max-width: none; }

	.ced-audit .ced-field { gap: 0.35rem; }
	.ced-audit .ced-field input,
	.ced-audit .ced-field select { padding-block: 0.7rem; }
	.ced-audit .ced-field textarea { min-height: 0; height: 76px; padding-block: 0.7rem; }
	.ced-audit .ced-lead__submit-row { gap: 0.4rem; margin-top: 0; }
	.ced-audit .ced-lead__submit-row .ced-btn { padding-block: 0.8rem; }
	.ced-audit .ced-lead__legal { font-size: 0.68rem; }
}

/* Short laptop screens (e.g. 1366×650 visible) — squeeze a bit more. */
@media (min-width: 900px) and (max-height: 640px) {
	.ced-audit__banner { gap: 0.9rem; padding: 1.4rem; }
	.ced-audit__banner-sticker { width: 72px; height: 72px; }
	.ced-audit__banner-sticker strong { font-size: 1.25rem; }
	.ced-audit__banner-list li { font-size: 0.8rem; }
	.ced-audit__body { gap: 0.85rem; padding: 2.5rem 2rem 1.5rem; }
	.ced-audit .ced-lead__form { gap: 0.65rem 1rem; }
	.ced-audit .ced-field textarea { height: 60px; }
	.ced-audit .ced-lead__legal { display: none; }
}

@media (max-width: 899px) {
	.ced-audit__banner { min-height: 0; gap: 1rem; padding: 1.25rem; }
	.ced-audit__banner::after {
		top: auto; left: 0; width: auto; height: 1px;
		background: linear-gradient(90deg, transparent, rgba(203, 108, 230, 0.55), transparent);
	}
	.ced-audit__banner-word { flex-direction: row; gap: 0.5rem; font-size: clamp(2.2rem, 10vw, 3.25rem); }
	/* Sticker becomes an inline pill beside the tag — no overlap with the headline. */
	.ced-audit__banner-top { justify-content: flex-start; align-items: center; gap: 0.5rem; padding-right: 3rem; }
	.ced-audit__banner-tag { margin-top: 0; }
	.ced-audit__banner-sticker {
		width: auto; height: auto;
		flex-direction: row;
		gap: 0.35rem;
		padding: 0.35rem 0.75rem;
		border-radius: 9999px;
		transform: none;
		animation: none;
		box-shadow: 0 6px 18px -6px rgba(203, 108, 230, 0.7);
	}
	.ced-audit__banner-sticker strong { font-size: 0.85rem; }
	.ced-audit__banner-sticker span { font-size: 0.62rem; }
	.ced-audit__banner-foot { padding-top: 0.8rem; }
	.ced-audit__banner-foot strong { font-size: 1.1rem; }
	.ced-audit__banner--image { min-height: 180px; }
	.ced-audit__body { padding-top: 1.5rem; }
	.ced-audit__title { padding-right: 0; }
}

@media (max-width: 640px) {
	.ced-audit { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); }
	.ced-audit__panel { max-height: calc(100dvh - 1rem); border-radius: var(--wp--custom--radius--md); }
	.ced-audit__close { top: 0.75rem; right: 0.75rem; }
	.ced-audit__body { padding: 1.25rem 1.15rem 1.5rem; gap: 1.1rem; }
	.ced-audit__title { font-size: 1.25rem; }
	.ced-audit__banner { padding: 1rem 1.15rem 1.1rem; gap: 0.85rem; }
	.ced-audit__banner-word { font-size: clamp(2rem, 10.5vw, 2.75rem); gap: 0.4rem; }
	.ced-audit__banner-foot { padding-top: 0.7rem; gap: 0.35rem; }
	.ced-audit__banner-foot strong { font-size: 0.95rem; }
	.ced-audit .ced-lead__form { gap: 0.75rem; }
	.ced-audit .ced-field { gap: 0.35rem; }
	.ced-audit .ced-field input,
	.ced-audit .ced-field select { padding-block: 0.75rem; }
	.ced-audit .ced-field textarea { min-height: 80px; }
	.ced-audit__banner-list { grid-template-columns: 1fr 1fr; gap: 0.45rem 0.75rem; }
	.ced-audit__banner-list li { font-size: 0.78rem; gap: 0.45rem; }
	.ced-audit__banner-list svg { width: 18px; height: 18px; padding: 3px; }
}

@media (prefers-reduced-motion: reduce) {
	.ced-audit[open],
	.ced-audit[open]::backdrop,
	.ced-audit__banner-sticker { animation: none; }
}

/* --- Sticky reopen button — vertical tab on the right edge ---------- */
/* writing-mode stacks the label vertically; rotate(180deg) makes it read
   bottom-to-top like a classic side tab. The icon is counter-rotated. */
.ced-audit-fab {
	position: fixed;
	right: 0;
	top: 50%;
	z-index: 48; /* under header (50) + mobile menu (49) */
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	padding: 1.1rem 0.7rem;
	writing-mode: vertical-rl;
	transform: translateY(-50%) rotate(180deg);
	border: 0;
	/* Rounded on the side facing the page (left, after the 180° flip = right). */
	border-radius: 0 12px 12px 0;
	background: var(--wp--preset--color--lime);
	color: var(--wp--preset--color--ink);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: 6px 0 24px -6px rgba(203, 108, 230, 0.7);
	transition: padding 240ms var(--ease-emph), filter 200ms ease, opacity 200ms ease;
	animation: ced-audit-glow 2.8s ease-in-out infinite;
}
.ced-audit-fab svg { transform: rotate(180deg); flex: 0 0 auto; }
.ced-audit-fab:hover { padding-left: 0.95rem; filter: brightness(1.08); } /* left = outer edge after flip */
.ced-audit-fab:focus-visible { outline: 2px solid var(--wp--preset--color--paper); outline-offset: 3px; }
html.ced-audit-open .ced-audit-fab { opacity: 0; pointer-events: none; }

@keyframes ced-audit-glow {
	0%, 100% { box-shadow: 6px 0 24px -6px rgba(203, 108, 230, 0.7); }
	50%      { box-shadow: 6px 0 34px -2px rgba(203, 108, 230, 0.95); }
}
@media (prefers-reduced-motion: reduce) {
	.ced-audit-fab { animation: none; }
}

@media (max-width: 480px) {
	.ced-audit-fab { padding: 0.9rem 0.55rem; font-size: 0.72rem; gap: 0.45rem; }
	.ced-audit-fab svg { width: 14px; height: 14px; }
}
