/**
 * Helix widget styles.
 *
 * Colours come from MyDNA-Company-Core.md section 11. Two contrast rules from
 * that section are honoured here:
 *   - Primary teal #12808A on mist #EAF5F5 is 4.21:1 and fails AA for body
 *     text, so links and small text on tinted backgrounds use #0E6A72.
 *   - Errors use Helix red #D6202D, which passes on white at 5.12:1.
 *
 * Everything is namespaced .helix- and scoped tightly, because this loads on
 * top of Elementor, which is generous with global selectors.
 */

.helix-root {
	--helix-teal: #12808A;
	--helix-teal-dark: #0E6A72;
	--helix-teal-bright: #29BEBA;
	--helix-mist: #EAF5F5;
	--helix-mist-2: #D9EFEF;
	--helix-ink: #17282B;
	--helix-grey: #5B6D6F;
	--helix-red: #D6202D;
	--helix-deep: #0A3A3E;

	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999999;
	font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 15px;
	line-height: 1.55;
	color: var(--helix-ink);
}

.helix-root *,
.helix-root *::before,
.helix-root *::after {
	box-sizing: border-box;
}

/* ---------- Launcher ---------- */

.helix-launcher {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0;
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: var(--helix-teal);
	color: #fff;
	cursor: pointer;
	transition: transform 0.18s ease, background 0.18s ease;
	justify-content: center;
	margin-left: auto;
	position: relative;
}

/**
 * Safari does not reliably clip a <video> element to a parent's
 * border-radius — the video's own compositing layer can ignore it and
 * render at whatever size it decides, which showed up on iPhone as the
 * launcher button stretching into a wide pill. overflow:hidden on this
 * wrapper forces the clip regardless. Kept separate from .helix-launcher
 * itself (which stays overflow:visible) so the unread badge, which is
 * meant to peek outside the circle's edge, is never clipped.
 *
 * z-index:0 here, against z-index:1 on .helix-badge below, is load-bearing:
 * both are position:absolute children of .helix-launcher with no stacking
 * order otherwise, and this element comes second in the markup — without an
 * explicit order it paints over the badge, leaving only the sliver that
 * pokes past the circle's edge visible as a crescent instead of a dot.
 */
.helix-launcher-media {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	overflow: hidden;
}

.helix-launcher:hover,
.helix-launcher:focus-visible {
	background: var(--helix-teal-dark);
	transform: translateY(-2px);
}

.helix-launcher:focus-visible {
	outline: 3px solid var(--helix-teal-bright);
	outline-offset: 3px;
}

.helix-launcher-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

.helix-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	z-index: 1;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--helix-red);
	border: 2px solid #fff;
	display: none;
}

.helix-root.is-unread .helix-badge {
	display: block;
}

/* ---------- Teaser ---------- */

.helix-teaser {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: 268px;
	/* Extra right padding reserves room for .helix-teaser-close, which is
	   absolutely positioned in that corner — without it the close button has
	   no space of its own and sits on top of the first line of text. */
	padding: 14px 40px 14px 16px;
	background: #fff;
	border: 1px solid var(--helix-mist-2);
	border-radius: 14px 14px 4px 14px;
	box-shadow: 0 8px 24px rgba(10, 58, 62, 0.16);
	cursor: pointer;
	animation: helix-rise 0.28s ease;
}

.helix-teaser p {
	margin: 0;
	font-size: 14px;
	color: var(--helix-ink);
}

.helix-teaser-close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 24px;
	height: 24px;
	border: 0;
	background: transparent;
	color: var(--helix-grey);
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	border-radius: 50%;
}

.helix-teaser-close:hover {
	background: var(--helix-mist);
}

/* ---------- Panel ---------- */

.helix-panel {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 16px 48px rgba(10, 58, 62, 0.24);
	display: none;
	flex-direction: column;
	overflow: hidden;
	animation: helix-rise 0.22s ease;
}

.helix-root.is-open .helix-panel {
	display: flex;
}

.helix-root.is-open .helix-teaser {
	display: none;
}

/* The floating launcher stays fixed to the corner even while the panel is
   open, which on mobile's full-screen layout put it directly on top of the
   composer's send button — worse once it became an eye-catching animated
   circle instead of a plain icon. The panel's own close (×) button in the
   header already covers closing, so hide the launcher entirely while open. */
.helix-root.is-open .helix-launcher {
	display: none;
}

@keyframes helix-rise {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

.helix-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--helix-teal);
	color: #fff;
	flex-shrink: 0;
}

.helix-header-logo {
	width: 34px;
	height: 34px;
	flex-shrink: 0;
	border-radius: 50%;
	overflow: hidden;
	background: #fff;
}

.helix-header-logo video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

.helix-header-text { flex: 1; min-width: 0; }

.helix-header h2 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #fff;
	line-height: 1.2;
}

.helix-header p {
	margin: 2px 0 0;
	font-size: 12px;
	opacity: 0.85;
}

.helix-close {
	width: 32px;
	height: 32px;
	border: 0;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	border-radius: 8px;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	flex-shrink: 0;
}

.helix-close:hover { background: rgba(255, 255, 255, 0.28); }

/* ---------- Messages ---------- */

.helix-log {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #fff;
	scroll-behavior: smooth;
	/* Without this, a scroll gesture that reaches the top or bottom of the
	   log chains through to the page behind the panel instead of stopping —
	   the page appears to scroll first, ahead of the chat. */
	overscroll-behavior: contain;
	touch-action: pan-y;
}

.helix-msg {
	margin-bottom: 12px;
	display: flex;
}

.helix-msg-bubble {
	max-width: 84%;
	padding: 10px 14px;
	border-radius: 14px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.helix-msg.is-bot .helix-msg-bubble {
	background: var(--helix-mist);
	border-bottom-left-radius: 4px;
	color: var(--helix-ink);
}

.helix-msg.is-user {
	justify-content: flex-end;
}

.helix-msg.is-user .helix-msg-bubble {
	background: var(--helix-teal);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.helix-msg.is-error .helix-msg-bubble {
	background: #fff;
	border: 1px solid var(--helix-red);
	color: var(--helix-red);
}

.helix-msg-bubble a {
	color: var(--helix-teal-dark);
	text-decoration: underline;
}

.helix-msg.is-user .helix-msg-bubble a { color: #fff; }

/* Typing indicator */

.helix-typing {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 8px 14px;
	overflow: hidden;
}

.helix-typing-video {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	object-fit: cover;
	pointer-events: none;
}

.helix-typing-dots { display: none; gap: 4px; }

.helix-typing-dots span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--helix-teal);
	opacity: 0.4;
	animation: helix-blink 1.2s infinite;
}

.helix-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.helix-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes helix-blink {
	0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
	30%           { opacity: 1;    transform: translateY(-3px); }
}

/* ---------- Actions ---------- */

.helix-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 14px 0;
}

.helix-action {
	display: inline-block;
	padding: 9px 15px;
	border-radius: 999px;
	border: 1.5px solid var(--helix-teal);
	background: #fff;
	color: var(--helix-teal-dark);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	font-family: inherit;
}

.helix-action:hover {
	background: var(--helix-teal);
	color: #fff;
}

.helix-action.is-primary {
	background: var(--helix-teal);
	color: #fff;
}

.helix-action.is-primary:hover { background: var(--helix-teal-dark); }

/* ---------- Lead capture ---------- */

/* Each step (name / email / whatsapp / consent / marketing) renders as its
   own small inline block directly under Helix's prompt bubble — a light
   touch rather than a boxed form, since only one is ever on screen at once. */
.helix-lead-step {
	margin: 0 0 14px;
	padding: 0 2px;
}

.helix-lead-prompt {
	font-size: 13px;
	font-weight: 600;
	margin: 0 0 8px;
	color: var(--helix-deep);
}

.helix-lead-row {
	display: flex;
	gap: 8px;
}

/* Country-code field on the WhatsApp step — fixed narrow width so it sits
   beside the number field rather than splitting the row 50/50 like the
   other flex:1 inputs. */
.helix-lead-row input.helix-lead-cc {
	flex: 0 0 64px;
	min-width: 0;
}

.helix-lead-row input[type="text"],
.helix-lead-row input[type="email"],
.helix-lead-row input[type="tel"] {
	flex: 1;
	min-width: 0;
	padding: 9px 11px;
	border: 1px solid var(--helix-mist-2);
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	background: #fff;
	color: var(--helix-ink);
}

.helix-lead-row input:focus {
	outline: 2px solid var(--helix-teal);
	outline-offset: -1px;
	border-color: var(--helix-teal);
}

.helix-lead-skip {
	display: block;
	margin: 6px 0 0;
	padding: 0;
	border: 0;
	background: none;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--helix-grey);
	text-decoration: underline;
	cursor: pointer;
	font-family: inherit;
}

.helix-consent {
	display: flex;
	gap: 9px;
	align-items: flex-start;
	margin: 0 0 10px;
	font-size: 12.5px;
	line-height: 1.5;
	font-weight: 400;
	color: var(--helix-ink);
}

.helix-consent input[type="checkbox"] {
	margin: 3px 0 0;
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	accent-color: var(--helix-teal);
}

.helix-consent a {
	color: var(--helix-teal-dark);
	text-decoration: underline;
}

.helix-lead-error {
	display: none;
	margin: 0 0 8px;
	font-size: 13px;
	color: var(--helix-red);
	font-weight: 600;
}

.helix-lead-step.has-error .helix-lead-error { display: block; }

.helix-lead-actions {
	display: flex;
	gap: 8px;
}

/* Prefixed with .helix-panel to out-specificity the site theme's global
   button style (uppercase, full pill, oversized padding) — a bare
   .helix-lead-btn class loses that fight, which is why these were
   rendering huge before this fix (Cam's feedback, 25 Aug 2026). */
.helix-panel .helix-lead-btn {
	width: auto;
	min-width: 0;
	padding: 9px 16px;
	border: 0;
	border-radius: 8px;
	background: var(--helix-teal);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: normal;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	font-family: inherit;
	white-space: nowrap;
}

.helix-panel .helix-lead-btn:hover { background: var(--helix-teal-dark); }
.helix-panel .helix-lead-btn:disabled { opacity: 0.5; cursor: default; }

.helix-panel .helix-lead-btn-secondary {
	width: auto;
	min-width: 0;
	padding: 9px 16px;
	border: 1px solid var(--helix-mist-2);
	border-radius: 8px;
	background: #fff;
	color: var(--helix-ink);
	font-size: 14px;
	font-weight: 600;
	line-height: normal;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	font-family: inherit;
	white-space: nowrap;
}

.helix-panel .helix-lead-btn-secondary:hover { background: var(--helix-mist); }

/* ---------- Composer ---------- */

.helix-composer {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--helix-mist-2);
	background: #fff;
	flex-shrink: 0;
}

/* Footer row: WhatsApp icon badge on the left, disclaimer/privacy text
   stacked beside it on the right — Cam's mockup, 25 Aug 2026. */
.helix-footer {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 2px 12px 10px;
	flex-shrink: 0;
}

.helix-footer-text {
	flex: 1;
	min-width: 0;
}

.helix-footer-text .helix-disclaimer,
.helix-footer-text .helix-storage-notice {
	padding: 0;
	text-align: left;
}

.helix-footer-text .helix-disclaimer { margin-bottom: 2px; }

/* WhatsApp escalate icon, footer — WhatsApp's own brand icon, not the
   site teal, so it reads as a distinct "leave to a different channel"
   affordance rather than blending in as just another Helix control.
   Moved here from the header 24 Aug 2026 (Cam's feedback: cramped,
   unreadable against the teal header background). Icon-only badge, not
   a labelled pill, since 25 Aug 2026 (Cam's mockup). Uses Cam's own
   WhatsApp icon file, not a drawn SVG, since 25 Aug 2026. */
.helix-panel .helix-wa-footer {
	/* display is NOT !important — the JS gates this button's visibility
	   with an inline style="display:none" until lead capture completes
	   (see waButtonStartsVisible / unlockChatAfterGate() in
	   helix-widget.js), and a stylesheet !important would beat that
	   inline style and show the button immediately. Everything else here
	   stays !important to out-muscle the theme's global button bleed. */
	display: flex;
	align-items: center !important;
	justify-content: center !important;
	width: 40px !important;
	height: 40px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none !important;
	max-height: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: none !important;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0 !important;
	cursor: pointer;
	flex-shrink: 0;
	opacity: 1;
	line-height: 0 !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	transition: opacity 0.15s;
}

.helix-panel .helix-wa-footer:hover { opacity: 0.75; background: none !important; }

.helix-panel .helix-wa-footer img {
	display: block !important;
	width: 40px !important;
	height: 40px !important;
	max-width: none !important;
	border-radius: 0 !important;
	background: none !important;
	flex-shrink: 0;
}

.helix-input {
	flex: 1;
	padding: 10px 12px;
	border: 1px solid var(--helix-mist-2);
	border-radius: 10px;
	font-size: 15px;
	font-family: inherit;
	resize: none;
	max-height: 110px;
	line-height: 1.4;
	color: var(--helix-ink);
	background: #fff;
}

.helix-input:focus {
	outline: 2px solid var(--helix-teal);
	outline-offset: -1px;
	border-color: var(--helix-teal);
}

.helix-send {
	width: 42px;
	height: 42px;
	flex-shrink: 0;
	border: 0;
	border-radius: 10px;
	background: var(--helix-teal);
	color: #fff;
	cursor: pointer;
	align-self: flex-end;
}

.helix-send:hover { background: var(--helix-teal-dark); }
.helix-send:disabled { opacity: 0.45; cursor: default; }

.helix-send svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.helix-disclaimer {
	padding: 0 12px 10px;
	margin: 0;
	font-size: 11px;
	color: var(--helix-grey);
	text-align: center;
	background: #fff;
	flex-shrink: 0;
}

.helix-storage-notice {
	padding: 0 12px 10px;
	margin: 0;
	font-size: 10.5px;
	line-height: 1.5;
	color: var(--helix-grey);
	text-align: center;
	background: #fff;
	flex-shrink: 0;
}

.helix-storage-notice a {
	color: var(--helix-teal-dark);
	text-decoration: underline;
}

/* Honeypot — visually hidden and off the tab order, but present in the DOM
   for a scripted submission to fill in, unlike display:none, which some
   bots skip. A real visitor never sees or reaches this field. */
.helix-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

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

/* Applied to <body> by JS while the full-screen mobile panel is open. See the
   comment above lockBodyScroll() in helix-widget.js — overscroll-behavior
   below is kept as a backstop for browsers that do honour it, but iOS Safari
   is not reliably one of them, so this is the fix that actually holds there. */
body.helix-body-locked {
	position: fixed;
	left: 0;
	right: 0;
	width: 100%;
	overflow: hidden;
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
	.helix-root { right: 14px; bottom: 14px; }

	.helix-panel {
		position: fixed;
		right: 0;
		left: 0;
		bottom: 0;
		top: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
		/* Backstop for the same scroll-chaining issue: on the full-screen
		   mobile panel, nothing should scroll the page behind it. */
		overscroll-behavior: none;
	}

	.helix-teaser { width: 240px; }

	/* iOS Safari auto-zooms the whole page when a focused text input's
	   font-size is under 16px. With the panel fixed full-screen on mobile,
	   that zoom throws off the fixed layout entirely — the composer's send
	   button gets pushed off-screen and the page behind becomes visible
	   and scrollable through the gap. 16px on every text input here is
	   the fix, not a style choice. */
	.helix-input,
	.helix-lead-row input[type="text"],
	.helix-lead-row input[type="email"],
	.helix-lead-row input[type="tel"] {
		font-size: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.helix-panel,
	.helix-teaser { animation: none; }
	.helix-typing-dots span { animation: none; opacity: 0.5; }
	.helix-launcher { transition: none; }
	.helix-log { scroll-behavior: auto; }

	/* Animated helix video is motion the visitor asked not to see — fall
	   back to the static dots for the typing indicator. The header and
	   launcher videos just disappear, leaving the plain brand-teal circle
	   behind them — hiding the <video> hides its poster too, so there is
	   no static image fallback for those two without a separate <img>. */
	.helix-header-logo video,
	.helix-launcher-video,
	.helix-typing-video { display: none; }

	.helix-typing-dots { display: inline-flex; }
}

/* Screen-reader only */
.helix-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
