/*
 * Welcome modal: small bottom-left card that fades in 2s after page load,
 * once per 24h per visitor (localStorage timestamp). Image left, content
 * right, primary CTA + close button.
 *
 * Visibility model: we never use `display:none` for the open/close state.
 * The element stays `display:flex` from first paint and we toggle
 * `visibility + opacity + pointer-events` so the opacity+transform
 * transition fires reliably (`display` changes break CSS transitions in
 * most browsers — the new computed style is applied without an animation
 * frame in between). `data-state="hidden"` is the closed state, set on
 * load AND on dismiss; `data-state="visible"` is the open state.
 *
 * z-index 999999 sits above sticky headers, cookie banners, Elementor
 * popups, and most third-party widgets without colliding with WP admin
 * bar (1000) or modal libraries that respect a 100000-tier ceiling.
 */

.ghq-match-welcome-modal {
	position: fixed;
	bottom: 1.5rem;
	right: 1.5rem;
	z-index: 999999;
	display: flex; /* always rendered — visibility toggles open/close */
	width: min( 480px, calc( 100vw - 2rem ) );
	max-width: 100%;
	background: #ffffff;
	box-shadow: 0 16px 44px rgba( 0, 0, 51, 0.22 ), 0 2px 8px rgba( 0, 0, 51, 0.08 );
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transform: translateY( 32px );
	/* Closing path: linear ease for the fade-out + delayed visibility
	 * swap so the element stays clickable until fully invisible. */
	transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
	font-family: var( --uicore-primary-font-family, 'Montserrat', system-ui, sans-serif );
	color: #000033;
}

.ghq-match-welcome-modal[ data-state='visible' ] {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
	transform: translateY( 0 );
	/* Opening path: swap visibility immediately (no delay) so the
	 * slide-up is seen, and use a small-overshoot cubic-bezier on
	 * transform for a subtle bounce. The delayed-visibility on the
	 * base rule only applies when CLOSING. */
	transition:
		opacity 0.45s ease-out,
		transform 0.55s cubic-bezier( 0.34, 1.56, 0.64, 1 ),
		visibility 0s linear 0s;
}

.ghq-match-welcome-modal__inner {
	position: relative; /* anchor the absolutely-positioned close button */
	display: flex;
	flex-direction: row;
	align-items: stretch;
	width: 100%;
}

.ghq-match-welcome-modal__media {
	flex: 0 0 38%;
	max-width: 38%;
	background: #f2f2f2;
	overflow: hidden;
}

.ghq-match-welcome-modal__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.ghq-match-welcome-modal__body {
	flex: 1 1 auto;
	min-width: 0;
	padding: 1.25rem 1.5rem 1.5rem;
	display: flex;
	flex-direction: column;
}

.ghq-match-welcome-modal__title {
	margin: 0;
	font-family: var( --uicore-primary-font-family, 'Montserrat', system-ui, sans-serif );
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.2;
	color: #000033;
	text-transform: uppercase;
	letter-spacing: 0.01em;
	padding-right: 1.75rem; /* room for the close button */
}

.ghq-match-welcome-modal__description {
	margin: 8px 0 0;
	font-family: 'Montserrat', system-ui, sans-serif;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
	color: #000033;
}

.ghq-match-welcome-modal__cta {
	display: inline-flex;
	align-self: flex-start;
	align-items: center;
	justify-content: center;
	margin-top: 16px;
	padding: 6px 8px;
	background: #006FFF;
	color: #ffffff;
	font-size: 14px;
	line-height: 24px;
	font-weight: 600;
	text-transform: uppercase;
	text-decoration: none;
	border: 0;
	border-radius: 0;
	transition: background-color 0.2s ease;
}

.ghq-match-welcome-modal__cta:hover,
.ghq-match-welcome-modal__cta:focus-visible {
	background: #000033;
	color: #ffffff;
	text-decoration: none;
	outline: none;
}

.ghq-match-welcome-modal__close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 2rem;
	height: 2rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	cursor: pointer;
	color: #000033;
	padding: 0;
}

.ghq-match-welcome-modal__close:hover,
.ghq-match-welcome-modal__close:focus-visible {
	background: rgba( 0, 0, 51, 0.06 );
	outline: none;
}

.ghq-match-welcome-modal__close svg {
	display: block;
	width: 20px;
	height: 20px;
}

@media ( max-width: 600px ) {
	.ghq-match-welcome-modal {
		bottom: 1rem;
		left: 1rem;
		right: 1rem;
		width: auto;
		max-width: 100%;
	}

	.ghq-match-welcome-modal__media {
		flex: 0 0 40%;
		max-width: 40%;
	}

	.ghq-match-welcome-modal__body {
		padding: 1rem 1.125rem 1.125rem;
	}

	.ghq-match-welcome-modal__title {
		font-size: 1rem;
	}
}

/*
 * Persistent launcher tab: small vertical pill anchored to the right edge,
 * always reachable so the visitor can reopen the modal after dismissing.
 * Shares the modal's z-index so it sits above the same layers (sticky
 * headers, cookie banners, Elementor popups, …) — see the modal block
 * above for the rationale.
 *
 * Visibility model mirrors the modal: never `display:none`, just toggle
 * `visibility + opacity + transform` so we get a clean slide-in/out.
 */
/*
 * Floating square launcher: 88x88 px FAB-style block in brand blue, with
 * an icon stacked over a two-word label ("MON COURTIER" / "MY BROKER").
 * Detached from the right edge (right: 2em) so it doesn't crash into the
 * vertically-centered fixed-button stack the site renders mid-screen.
 * Square corners — `border-radius: 0` is the GHQ style language. Slight
 * lift + shadow on hover for the "prominent but tactile" feel.
 */
.ghq-match-welcome-modal__tab {
	position: fixed;
	bottom: 16px;
	right: 16px;
	z-index: 999999;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	width: 5.5rem;
	height: 5.5rem;
	padding: 0.5rem;
	background: #006FFF;
	color: #ffffff;
	border: 0;
	border-radius: 0;
	box-shadow:
		0 10px 24px rgba( 0, 51, 153, 0.32 ),
		0 2px 6px rgba( 0, 0, 51, 0.18 );
	cursor: pointer;
	font-family: var( --uicore-primary-font-family, 'Montserrat', system-ui, sans-serif );
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transform: translateY( 16px );
	transition:
		opacity 0.3s ease,
		transform 0.4s cubic-bezier( 0.34, 1.56, 0.64, 1 ),
		visibility 0s linear 0.4s,
		background-color 0.2s ease,
		box-shadow 0.2s ease;
}

.ghq-match-welcome-modal__tab[ data-state='visible' ] {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
	transform: translateY( 0 );
	transition:
		opacity 0.3s ease,
		transform 0.4s cubic-bezier( 0.34, 1.56, 0.64, 1 ),
		visibility 0s linear 0s,
		background-color 0.2s ease,
		box-shadow 0.2s ease;
}

.ghq-match-welcome-modal__tab:hover,
.ghq-match-welcome-modal__tab:focus-visible {
	background: #000033;
	outline: none;
	box-shadow:
		0 14px 30px rgba( 0, 51, 153, 0.4 ),
		0 4px 10px rgba( 0, 0, 51, 0.22 );
}

/* Subtle press-down to keep the interaction tactile. Only when the
 * tab is currently in the visible state — avoids a flicker if a stray
 * click lands while it's mid-transition. */
.ghq-match-welcome-modal__tab[ data-state='visible' ]:active {
	transform: translateY( 1px );
	transition:
		transform 0.1s ease,
		opacity 0.3s ease,
		visibility 0s linear 0s,
		background-color 0.2s ease,
		box-shadow 0.2s ease;
}

.ghq-match-welcome-modal__tab-icon {
	display: block;
	width: 26px;
	height: 26px;
	flex: 0 0 auto;
}

.ghq-match-welcome-modal__tab-label {
	font-size: 0.6875rem; /* 11px */
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	text-align: center;
	/* Two-word labels wrap to two lines inside the 88px square; one-word
	 * labels stay on a single line. `text-wrap: balance` keeps the wrap
	 * visually centred on supporting browsers. */
	text-wrap: balance;
}

@media ( max-width: 600px ) {
	.ghq-match-welcome-modal__tab {
		bottom: 12px;
		right: 12px;
		width: 5rem;
		height: 5rem;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.ghq-match-welcome-modal {
		transition: opacity 0.01ms, visibility 0s linear 0.01ms;
		transform: none;
	}

	.ghq-match-welcome-modal[ data-state='visible' ] {
		transition: opacity 0.01ms, visibility 0s linear 0s;
		transform: none;
	}

	.ghq-match-welcome-modal__tab {
		transition: opacity 0.01ms, visibility 0s linear 0.01ms, background-color 0.2s ease;
		transform: translate( 0, 0 );
	}

	.ghq-match-welcome-modal__tab[ data-state='visible' ] {
		transition: opacity 0.01ms, visibility 0s linear 0s, background-color 0.2s ease;
	}
}
