/**
 * Modal presentation for [ceo_lead_quiz mode="modal"].
 *
 * Loaded ONLY in modal mode. It adds the trigger button and the dialog shell;
 * the quiz inside keeps the brand styling already defined in quiz.css, so
 * nothing here restyles the component itself.
 *
 * Colours and fonts are the same production values documented in quiz.css
 * (Elementor global kit #74). Nothing new is introduced.
 */

/* ---------- trigger button ---------- */

/*
 * Matches the kit's .elementor-button: Carrot Orange background, white text,
 * Manrope 800, 10px radius -- so it sits on the Contact page looking like
 * every other button there.
 */
button.ceoq-trigger,
.ceoq-trigger {
	/* Host pages style buttons broadly -- the live Contact page applies
	   text-transform: capitalize to every button. Pin the casing so
	   button_text renders exactly as configured. */
	text-transform: none;
	font-style: normal;
	display: inline-block;
	min-height: 52px;
	padding: 15px 30px;
	font-family: 'Manrope', sans-serif;
	font-weight: 800;
	font-size: 16px;
	line-height: 1.2;
	color: #ffffff;
	background: #ff8f34;
	border: 1px solid #ff8f34;
	border-radius: 10px;
	cursor: pointer;
	text-align: center;
	transition: background-color 140ms ease, color 140ms ease;
}

.ceoq-trigger:hover,
.ceoq-trigger:focus {
	/* The kit's own button hover: white background, black text. */
	background: #ffffff;
	color: #000000;
	border-color: #ffffff;
}

.ceoq-trigger:focus-visible {
	outline: 2px solid #ff8f34;
	outline-offset: 3px;
}

/*
 * One step up from the site's standard CTA.
 *
 * Measured on the live About page, CEO Exchange's buttons are Elementor
 * size-md: 16px/800, padding 15px 30px, 59px tall. These values are
 * Elementor's own next step (size-lg), so the button reads as deliberately
 * larger within the same scale rather than an arbitrary size.
 */
button.ceoq-trigger--lg,
.ceoq-trigger--lg {
	min-height: 62px;
	padding: 20px 40px;
	font-size: 18px;
}

@media (max-width: 480px) {
	button.ceoq-trigger--lg,
	.ceoq-trigger--lg {
		padding: 18px 28px;
		font-size: 17px;
	}
}

/* ---------- dialog ---------- */

.ceoq-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	padding: 24px 16px;
	box-sizing: border-box;
}

.ceoq-modal[hidden] {
	display: none;
}

.ceoq-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.72 );
	opacity: 0;
	transition: opacity 180ms ease;
}

.ceoq-modal.is-open .ceoq-modal-backdrop {
	opacity: 1;
}

.ceoq-modal-panel {
	position: relative;
	/* margin:auto centres on both axes and, unlike align-items:center, keeps
	   a panel taller than the viewport fully scrollable. */
	margin: auto;
	width: 100%;
	max-width: 620px;
	max-height: calc( 100vh - 48px );
	max-height: calc( 100dvh - 48px );
	overflow-y: auto;
	/* Stop a scroll gesture inside the panel from chaining to the page
	   behind it once the panel hits its end. */
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: #101010;
	border: 1px solid #1a1a1a;
	border-radius: 10px;
	opacity: 0;
	transform: translateY( 12px ) scale( 0.99 );
	transition: opacity 180ms ease, transform 180ms ease;
}

.ceoq-modal.is-open .ceoq-modal-panel {
	opacity: 1;
	transform: translateY( 0 ) scale( 1 );
}

/* Inside the dialog the card sits on the panel, so it drops its own
   background and the options invert to black for separation. */
.ceoq-modal-panel > .ceoq {
	background: transparent;
	max-width: none;
	padding: 28px 24px 32px;
}

.ceoq-modal-panel > .ceoq .ceoq-option,
.ceoq-modal-panel > .ceoq .ceoq-input,
.ceoq-modal-panel > .ceoq .ceoq-progress-track {
	background: #000000;
}

/* ---------- close button ---------- */

/*
 * Specificity is deliberate. The host page styles every <button> -- the live
 * Contact page paints them Carrot Orange -- and a single-class rule here loses
 * to it, leaving a solid orange square over the dialog corner. Two classes
 * plus the element selector keeps the close control looking like a close
 * control wherever the quiz is embedded.
 */
.ceoq-modal button.ceoq-modal-close,
.ceoq-modal .ceoq-modal-close {
	background: transparent;
	border: 0;
	box-shadow: none;
	color: #969696;
}

.ceoq-modal button.ceoq-modal-close:hover,
.ceoq-modal .ceoq-modal-close:hover {
	background: #000000;
	color: #ffffff;
}

.ceoq-modal-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	/* 44px keeps it a comfortable tap target. */
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	line-height: 1;
	color: #969696;
	background: transparent;
	border: 0;
	border-radius: 10px;
	cursor: pointer;
	transition: color 140ms ease, background-color 140ms ease;
}

.ceoq-modal-close:hover {
	color: #ffffff;
	background: #000000;
}

.ceoq-modal-close:focus-visible {
	outline: 2px solid #ff8f34;
	outline-offset: -2px;
}

/* ---------- scroll lock ---------- */

/*
 * The body is set to position:fixed from JS while the dialog is open, because
 * iOS Safari ignores overflow:hidden on body. This only hides the resulting
 * scrollbar space on desktop.
 */
body.ceoq-scroll-locked {
	overflow: hidden;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.ceoq-modal-backdrop,
	.ceoq-modal-panel {
		transition: none;
	}

	.ceoq-modal-panel {
		transform: none;
	}
}

/* ---------- small screens ---------- */

@media (max-width: 480px) {
	.ceoq-modal {
		padding: 12px 10px;
	}

	.ceoq-modal-panel {
		max-height: calc( 100vh - 24px );
		max-height: calc( 100dvh - 24px );
	}

	.ceoq-modal-panel > .ceoq {
		padding: 22px 16px 26px;
	}

	.ceoq-trigger {
		/* Full width on a phone: easier to hit, and it reads as a primary
		   action rather than a stray inline link. */
		display: block;
		width: 100%;
	}
}
