/* Contacts & Popup Toolkit — front end.
   Every size, weight, spacing, corner and colour below comes from a CSS
   variable set on the settings screen. The value after each comma is only a
   fallback if a variable is missing; change things in the settings, not here.
   Everything is namespaced .cpt- so it cannot touch your theme. */

/* ================= SHOW ON ================= */
@media (max-width: 782px) { .cpt-on-desktop { display: none !important; } }
@media (min-width: 783px) { .cpt-on-mobile  { display: none !important; } }

/* ================= POPUP: BACKDROP ================= */
.cpt-overlay {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: var(--cpt-ov, rgba(0,0,0,0.7));
	-webkit-backdrop-filter: blur(var(--cpt-ov-blur, 0px));
	backdrop-filter: blur(var(--cpt-ov-blur, 0px));
	z-index: 999999;
	padding: 16px;
	opacity: 0;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	transition: opacity 0.25s ease;
}
.cpt-overlay.cpt-visible { display: flex; opacity: 1; }
body.cpt-lock { overflow: hidden; }

/* Opening animation — a setting, so each option is a class. */
.cpt-overlay .cpt-box { transition: transform 0.25s ease; }
.cpt-anim-none .cpt-box { transition: none; }
.cpt-anim-zoom .cpt-box { transform: scale(0.96); }
.cpt-anim-zoom.cpt-visible .cpt-box { transform: scale(1); }
.cpt-anim-slide .cpt-box { transform: translateY(24px); }
.cpt-anim-slide.cpt-visible .cpt-box { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
	.cpt-overlay, .cpt-overlay .cpt-box { transition: none; }
	.cpt-anim-zoom .cpt-box, .cpt-anim-slide .cpt-box { transform: none; }
}

/* ================= POPUP: CARD ================= */
.cpt-box {
	position: relative;
	width: auto;
	max-width: min(var(--cpt-pop-w, 600px), 94vw);
	line-height: 0;
	outline: none;
}
.cpt-box:focus, .cpt-box:focus-visible { outline: none; }

.cpt-pop-img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 88vh;
	margin: 0 auto;
	border-radius: var(--cpt-img-radius, 6px);
	box-shadow: var(--cpt-pop-shadow, 0 12px 40px rgba(0,0,0,0.22));
}

.cpt-box-form {
	background: var(--cpt-pop-bg, #fff);
	border-radius: var(--cpt-pop-radius, 10px);
	padding: var(--cpt-pop-pad, 32px);
	text-align: var(--cpt-pop-align, left);
	line-height: normal;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	box-shadow: var(--cpt-pop-shadow, 0 12px 40px rgba(0,0,0,0.22));
	box-sizing: border-box;
}

/* ================= POPUP: CLOSE BUTTON ================= */
.cpt-pop-close {
	position: absolute;
	top: calc(var(--cpt-close-size, 34px) / -2.4);
	right: calc(var(--cpt-close-size, 34px) / -2.4);
	width: var(--cpt-close-size, 34px);
	height: var(--cpt-close-size, 34px);
	border-radius: 50%;
	border: none;
	background: #fff;
	color: var(--cpt-close-color, #111827);
	font-size: calc(var(--cpt-close-size, 34px) * 0.62);
	line-height: 1;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 2px 8px rgba(0,0,0,0.3);
	transition: transform 0.15s ease;
	z-index: 2;
}
.cpt-pop-close:hover { transform: scale(1.08); }

/* On a card, the button sits inside the corner instead of over the edge. */
.cpt-overlay-form .cpt-pop-close {
	position: sticky;
	float: right;
	top: 0;
	right: 0;
	margin: -6px -6px 4px 14px;
	background: var(--cpt-pop-bg, #fff);
	border: 1px solid rgba(0,0,0,0.14);
	box-shadow: 0 1px 6px rgba(0,0,0,0.14);
}
.cpt-pop-close-inside {
	position: absolute;
	float: none;
	top: 14px;
	right: 14px;
	margin: 0;
	background: transparent;
	border: none;
	box-shadow: none;
	opacity: .45;
	z-index: 3;
}
.cpt-pop-close-inside:hover { opacity: .85; background: rgba(0,0,0,0.05); transform: none; }

/* ================= POPUP: TEXT ================= */
.cpt-pop-headline {
	margin: 0 0 10px;
	color: var(--cpt-pop-head, #111827);
	font-size: var(--cpt-pop-head-size, 28px);
	font-weight: var(--cpt-pop-head-weight, 700);
	line-height: var(--cpt-pop-head-lh, 1.2);
	text-transform: var(--cpt-pop-head-transform, none);
	overflow-wrap: break-word;
}
.cpt-pop-desc {
	margin: 0 0 18px;
	color: var(--cpt-pop-text, #4b5563);
	font-size: var(--cpt-pop-text-size, 15px);
	line-height: var(--cpt-pop-text-lh, 1.55);
}
.cpt-pop-desc p { margin: 0 0 10px; }
.cpt-pop-desc p:last-child { margin-bottom: 0; }
.cpt-pop-desc a { color: inherit; text-decoration: underline; }

.cpt-pop-divider {
	width: 56px;
	height: 4px;
	margin: 0 0 22px;
	border-radius: 2px;
	background: linear-gradient(90deg, var(--cpt-accent, #2563eb), rgba(0,0,0,0));
}

.cpt-pop-trust {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 14px 0 0;
	font-size: var(--cpt-pop-trust-size, 12px);
	line-height: 1.4;
	color: var(--cpt-pop-text, #6b7280);
	opacity: .9;
}
.cpt-pop-trust svg { flex: 0 0 auto; color: var(--cpt-accent, #2563eb); }

/* ================= POPUP: THE FORM ================= */
/* Your form plugin's own styling shows through by default. The two "styled"
   blocks further down only apply when you switch them on in the settings. */
.cpt-pop-form { text-align: left; }
.cpt-pop-form * { max-width: 100%; box-sizing: border-box; }
.cpt-pop-form .forminator-ui { margin: 0 !important; }
.cpt-pop-form .wpcf7 { margin: 0; }

/* Trim the empty space form plugins leave under the last row. */
.cpt-pop-form > *:last-child,
.cpt-pop-form form,
.cpt-pop-form form > *:last-child,
.cpt-pop-form .forminator-row:last-child,
.cpt-pop-form .forminator-pagination-footer { margin-bottom: 0 !important; }
.cpt-pop-form .forminator-response-message:empty,
.cpt-pop-form .wpcf7-response-output:empty {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
}
/* Forminator's grid keeps a right gutter, so fields stop short of the card
   edge while the heading runs full width. Only the last column is adjusted,
   so side-by-side fields keep the gap between them. */
.cpt-pop-form .forminator-row { margin-right: 0 !important; }
.cpt-pop-form .forminator-row > *:last-child { padding-right: 0 !important; }

/* --- Only when "Style the fields here" is on --- */
.cpt-fields-styled .cpt-pop-form input[type="text"],
.cpt-fields-styled .cpt-pop-form input[type="tel"],
.cpt-fields-styled .cpt-pop-form input[type="email"],
.cpt-fields-styled .cpt-pop-form input[type="number"],
.cpt-fields-styled .cpt-pop-form input[type="url"],
.cpt-fields-styled .cpt-pop-form select,
.cpt-fields-styled .cpt-pop-form textarea {
	min-height: var(--cpt-field-h, 48px) !important;
	border-radius: var(--cpt-field-radius, 8px) !important;
	border: 1px solid var(--cpt-field-border, #d8dbe0) !important;
	background: var(--cpt-field-bg, #fff) !important;
	font-size: var(--cpt-field-size, 14px) !important;
	padding: 0 14px !important;
	width: 100% !important;
	box-sizing: border-box !important;
}
.cpt-fields-styled .cpt-pop-form textarea {
	min-height: calc(var(--cpt-field-h, 48px) * 1.8) !important;
	padding-top: 12px !important;
}

/* --- Only when "Style the send button here" is on --- */
.cpt-sbtn-styled .cpt-pop-form .forminator-button-submit,
.cpt-sbtn-styled .cpt-pop-form button[type="submit"],
.cpt-sbtn-styled .cpt-pop-form input[type="submit"],
.cpt-sbtn-styled .cpt-pop-form .wpcf7-submit,
.cpt-sbtn-styled .cpt-pop-form .wpforms-submit,
.cpt-sbtn-styled .cpt-pop-form .gform_button {
	background: var(--cpt-sbtn-bg, #2563eb) !important;
	background-image: none !important;
	color: var(--cpt-sbtn-fg, #fff) !important;
	border-color: var(--cpt-sbtn-bg, #2563eb) !important;
	border-radius: var(--cpt-sbtn-radius, 8px) !important;
	font-size: var(--cpt-sbtn-size, 15px) !important;
	font-weight: var(--cpt-sbtn-weight, 700) !important;
	min-height: var(--cpt-sbtn-h, 48px) !important;
}
.cpt-sbtn-styled .cpt-pop-form .forminator-button-submit:hover,
.cpt-sbtn-styled .cpt-pop-form button[type="submit"]:hover,
.cpt-sbtn-styled .cpt-pop-form input[type="submit"]:hover { filter: brightness(0.94); }

.cpt-sbtn-full .cpt-pop-form .forminator-button-submit,
.cpt-sbtn-full .cpt-pop-form button[type="submit"],
.cpt-sbtn-full .cpt-pop-form input[type="submit"] { width: 100% !important; }

/* ================= POPUP: SIDE BY SIDE ================= */
.cpt-box-split {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	background: var(--cpt-pop-bg, #fff);
	border-radius: var(--cpt-pop-radius, 10px);
	overflow: hidden;
	width: 100%;
	max-height: 92vh;
	box-shadow: var(--cpt-pop-shadow, 0 12px 40px rgba(0,0,0,0.22));
	box-sizing: border-box;
	line-height: normal;
	position: relative;
	outline: none;
}
.cpt-box-split:focus, .cpt-box-split:focus-visible { outline: none; }

.cpt-split-media {
	/* A starting split. With "Image side width" left at 0 a small script
	   measures the image and sets an exact width, so it is never cropped;
	   entering a percentage skips the measuring and uses your number. */
	flex: 0 1 var(--cpt-split-w, 55%);
	position: relative;
	overflow: hidden;
}
.cpt-split-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}
.cpt-split-content {
	flex: 1 1 380px;
	min-width: 160px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: var(--cpt-pop-pad, 32px);
	/* Always leave room for the close button, however small the padding. */
	padding-top: max(var(--cpt-pop-pad, 32px), 56px);
	box-sizing: border-box;
	text-align: var(--cpt-pop-align, left);
}
.cpt-split-content .cpt-pop-inner { max-width: 480px; width: 100%; margin: 0 auto; }

/* ================= POPUP BUTTON ================= */
/* With "Use my theme's style" the plugin adds no class at all, so the button
   is entirely your theme's. Everything below applies only to .cpt-btn, which
   is added when you choose "Style it here". */
.cpt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--cpt-btn-pad-y, 12px) var(--cpt-btn-pad-x, 24px);
	background: var(--cpt-btn-bg, #111827);
	color: var(--cpt-btn-fg, #fff);
	border: var(--cpt-btn-border, 0px) solid var(--cpt-btn-border-color, #111827);
	border-radius: var(--cpt-btn-radius, 6px);
	font-family: inherit;
	font-size: var(--cpt-btn-size, 15px);
	font-weight: var(--cpt-btn-weight, 600);
	letter-spacing: var(--cpt-btn-letter, 0);
	text-transform: var(--cpt-btn-transform, none);
	line-height: var(--cpt-btn-line-height, 20px);
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.18s ease;
}
.cpt-btn:hover { filter: brightness(0.92); color: var(--cpt-btn-fg, #fff); }
.cpt-btn:focus-visible { outline: 2px solid var(--cpt-btn-bg, #111827); outline-offset: 2px; }

/* ================= CONTACT BUTTONS ================= */
.cpt-fab-wrap {
	position: fixed;
	bottom: var(--cpt-fab-y, 22px);
	z-index: 99998;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.cpt-fab-wrap.cpt-left  { left: var(--cpt-fab-x, 20px);  align-items: flex-start; }
.cpt-fab-wrap.cpt-right { right: var(--cpt-fab-x, 20px); align-items: flex-end; }

.cpt-items {
	display: flex;
	flex-direction: column;
	align-items: inherit;
	gap: var(--cpt-fab-gap, 12px);
	margin-bottom: var(--cpt-fab-gap, 12px);
}
.cpt-static .cpt-items { margin-bottom: 0; }

.cpt-item, .cpt-fab {
	width: var(--cpt-fab-size, 48px);
	height: var(--cpt-fab-size, 48px);
	border-radius: var(--cpt-fab-radius, 50%);
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	background: var(--cpt-fab-color, #111827);
	box-shadow: var(--cpt-fab-shadow, 0 4px 14px rgba(0,0,0,0.18));
	text-decoration: none;
	position: relative;
	cursor: pointer;
	padding: 0;
	transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}
.cpt-item:hover { color: #fff; filter: brightness(1.08); }
.cpt-fab:hover { transform: scale(1.06); color: #fff; }
.cpt-item svg, .cpt-fab svg {
	display: block;
	width: var(--cpt-fab-icon, 24px);
	height: var(--cpt-fab-icon, 24px);
}
.cpt-fab { z-index: 2; }
.cpt-fab .cpt-ic-close { display: none; }
.cpt-open .cpt-fab .cpt-ic-open  { display: none; }
.cpt-open .cpt-fab .cpt-ic-close { display: block; }

/* Tap to expand: the buttons start collapsed. */
.cpt-fab-wrap:not(.cpt-static) .cpt-item {
	opacity: 0;
	transform: translateY(10px) scale(0.6);
	pointer-events: none;
}
.cpt-open .cpt-items .cpt-item { opacity: 1; transform: none; pointer-events: auto; }
.cpt-open .cpt-items .cpt-item:nth-child(1) { transition-delay: .02s; }
.cpt-open .cpt-items .cpt-item:nth-child(2) { transition-delay: .06s; }
.cpt-open .cpt-items .cpt-item:nth-child(3) { transition-delay: .10s; }
.cpt-open .cpt-items .cpt-item:nth-child(4) { transition-delay: .14s; }
.cpt-open .cpt-items .cpt-item:nth-child(n+5) { transition-delay: .18s; }

.cpt-tip {
	position: absolute;
	white-space: nowrap;
	background: #111827;
	color: #fff;
	font-family: inherit;
	font-size: 12px;
	padding: 4px 8px;
	border-radius: 6px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease;
}
.cpt-left  .cpt-tip { left: calc(var(--cpt-fab-size, 48px) + 10px); }
.cpt-right .cpt-tip { right: calc(var(--cpt-fab-size, 48px) + 10px); }
.cpt-item:hover .cpt-tip { opacity: 1; }
.cpt-no-tip .cpt-tip { display: none; }

/* ================= SIDE TAB ================= */
.cpt-cta {
	position: fixed;
	top: calc(50% + var(--cpt-cta-off, 0px));
	transform: translateY(-50%);
	z-index: 99997;
	background: var(--cpt-cta-bg, #111827);
	color: var(--cpt-cta-fg, #fff);
	text-decoration: none;
	box-shadow: var(--cpt-cta-shadow, 0 4px 14px rgba(0,0,0,0.18));
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--cpt-cta-pad-y, 12px) var(--cpt-cta-pad-x, 8px);
	/* Themes often restyle links site-wide; keep the tab's own shape. */
	border: none;
	box-sizing: border-box;
	min-width: 0;
	min-height: 0;
	width: auto;
	height: auto;
	text-transform: none;
	transition: filter 0.18s ease;
}
.cpt-cta:hover { filter: brightness(0.92); color: var(--cpt-cta-fg, #fff); }
.cpt-cta:focus-visible { outline: 2px solid var(--cpt-cta-fg, #fff); outline-offset: 2px; }
.cpt-cta-right { right: 0; border-radius: var(--cpt-cta-radius, 8px) 0 0 var(--cpt-cta-radius, 8px) !important; }
.cpt-cta-left  { left: 0;  border-radius: 0 var(--cpt-cta-radius, 8px) var(--cpt-cta-radius, 8px) 0 !important; }
.cpt-cta-txt {
	writing-mode: vertical-rl;
	font-family: inherit;
	font-size: var(--cpt-cta-size, 14px);
	font-weight: var(--cpt-cta-weight, 700);
	letter-spacing: var(--cpt-cta-letter, 0.5px);
	text-transform: var(--cpt-cta-transform, uppercase);
	line-height: 1;
}
.cpt-cta-right .cpt-cta-txt { transform: rotate(180deg); }

/* ================= PHONES ================= */
@media (max-width: 680px) {
	.cpt-box-split {
		flex-direction: column;
		max-height: 94vh;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}
	/* Stacked: the image on top at its own shape, the form underneath.
	   !important guards against a stale inline width left by the script. */
	.cpt-split-media, .cpt-split-content { max-width: 100%; min-width: 0; flex: 0 0 auto !important; }
	.cpt-split-media { width: 100% !important; height: auto !important; }
	.cpt-split-img { width: 100%; height: auto; object-fit: contain; }
	.cpt-split-content { overflow: visible; }
	.cpt-split-content .cpt-pop-inner { max-width: none; }
	/* Over a photo a faint dark × can vanish, so give it a backdrop here. */
	.cpt-pop-close-inside { background: rgba(17,17,17,0.45); color: #fff; opacity: 1; }
	.cpt-pop-close-inside:hover { background: rgba(17,17,17,0.65); }
}

@media (max-width: 600px) {
	.cpt-overlay { padding: 10px; }
	.cpt-pop-img { max-height: 85vh; }
	.cpt-box-form, .cpt-split-content { padding: var(--cpt-pop-pad-m, 20px); }
	.cpt-split-content { padding-top: max(var(--cpt-pop-pad-m, 20px), 52px); }
	.cpt-pop-headline { font-size: var(--cpt-pop-head-size-m, 22px); }
	.cpt-item, .cpt-fab { width: var(--cpt-fab-size-m, 46px); height: var(--cpt-fab-size-m, 46px); }
	.cpt-tip { display: none; }
	/* A phone-only position for the side tab, falling back to the desktop one. */
	.cpt-cta { top: calc(50% + var(--cpt-cta-off-m, var(--cpt-cta-off, 0px))); }
}
