/*
 * Floating enquiry widget.
 *
 * Reproduces the launcher from the original site: a 60x60 navy rounded square
 * in the bottom-right corner carrying a white speech bubble, sitting inside a
 * 94x94 hit area. The panel that opens above it is new — the original opened a
 * hosted chat service; this sends an email instead.
 *
 * Tokens fall back to hard-coded values so the widget looks right even if the
 * plugin is used with a theme that does not define them.
 */

.nora-enquiry {
	--ne-blue: var(--nora-blue, #033b85);
	--ne-navy: var(--nora-navy, #1a2b6d);
	--ne-white: #fff;
	--ne-ink: #1c1c1c;
	--ne-panel: #fff;
	--ne-line: #d4d4d4;
	--ne-error: #a60d15;
	--ne-focus: #ffd400;

	position: fixed;
	right: 17px;
	bottom: 17px;
	z-index: 9990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: var(--font-body, "Helvetica Neue", Helvetica, Arial, sans-serif);
	font-size: 16px;
	line-height: 1.6;
	color: var(--ne-ink);
}

/* ---------- Launcher ---------------------------------------------------- */
.nora-enquiry__launcher {
	order: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	padding: 0;
	background: var(--ne-navy);
	color: var(--ne-white);
	border: 0;
	border-radius: 8px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	transition: background-color 0.18s ease, transform 0.18s ease;
}
.nora-enquiry__launcher:hover { background: var(--ne-blue); }
.nora-enquiry__launcher:focus-visible {
	/* Yellow alone is 1.4:1 on a white page; the navy halo keeps the ring
	   visible on any background (SC 1.4.11 / 2.4.7). */
	outline: 3px solid var(--ne-focus);
	outline-offset: 0;
	box-shadow: 0 0 0 6px var(--ne-navy);
}
.nora-enquiry__launcher svg { width: 30px; height: 30px; display: block; }

.nora-enquiry__launcher .nora-enquiry__icon-close { display: none; }
.nora-enquiry__launcher[aria-expanded="true"] .nora-enquiry__icon-chat { display: none; }
.nora-enquiry__launcher[aria-expanded="true"] .nora-enquiry__icon-close { display: block; }

/* ---------- Panel ------------------------------------------------------- */
.nora-enquiry__panel {
	order: 1;
	width: 360px;
	max-width: calc(100vw - 34px);
	max-height: min(660px, calc(100vh - 96px));
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--ne-panel);
	border-radius: 10px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
.nora-enquiry__panel[hidden] { display: none; }

.nora-enquiry__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 12px 12px 20px;
	background: var(--ne-blue);
	color: var(--ne-white);
	border-radius: 10px 10px 0 0;
}
.nora-enquiry__title {
	margin: 0;
	font-family: var(--font-display, inherit);
	font-size: 19px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--ne-white);
}
.nora-enquiry__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex: 0 0 auto;
	padding: 0;
	background: transparent;
	color: var(--ne-white);
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}
.nora-enquiry__close:hover { background: rgba(255, 255, 255, 0.16); }
.nora-enquiry__close:focus-visible {
	outline: 3px solid var(--ne-focus);
	outline-offset: 2px;
}
.nora-enquiry__close svg { width: 15px; height: 15px; }

.nora-enquiry__body { padding: 14px 20px 18px; }

.nora-enquiry__intro {
	margin: 0 0 12px;
	font-size: 14px;
	line-height: 1.5;
}

.nora-enquiry__field { margin: 0 0 10px; }
.nora-enquiry__field label {
	display: block;
	margin-bottom: 5px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.4;
}
.nora-req { color: var(--ne-error); }

.nora-enquiry__field input,
.nora-enquiry__field textarea {
	width: 100%;
	min-height: 44px;
	padding: 10px 12px;
	font-family: inherit;
	font-size: 16px;   /* keeps iOS from zooming the page on focus */
	line-height: 1.5;
	color: var(--ne-ink);
	background: #fff;
	border: 1px solid #767676;   /* 4.5:1 against white — SC 1.4.11 */
	border-radius: 4px;
}
.nora-enquiry__field textarea { min-height: 72px; resize: vertical; }
.nora-enquiry__captcha-input { max-width: 110px; }

.nora-enquiry__field input:focus-visible,
.nora-enquiry__field textarea:focus-visible {
	outline: 3px solid var(--ne-blue);
	outline-offset: 1px;
	border-color: var(--ne-blue);
}

.nora-enquiry__field.has-error input,
.nora-enquiry__field.has-error textarea {
	border-color: var(--ne-error);
	border-width: 2px;
}

/* Errors are never signalled by colour alone — there is an icon and words. */
.nora-enquiry__error {
	display: none;
	margin-top: 5px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.45;
	color: var(--ne-error);
}
.nora-enquiry__error:not(:empty) { display: block; }
.nora-enquiry__error:not(:empty)::before { content: "\26A0 "; }

.nora-enquiry__status:not(:empty) {
	margin: 0 0 14px;
	padding: 11px 14px;
	font-size: 14px;
	line-height: 1.5;
	border-left: 4px solid;
	border-radius: 3px;
}
.nora-enquiry__status.is-success { background: #eef7ee; border-color: #1d6b2b; color: #14501f; }
.nora-enquiry__status.is-error   { background: #fff2f2; border-color: var(--ne-error); color: #7a0a10; }
.nora-enquiry__status.is-busy    { background: #eef2fa; border-color: var(--ne-blue); color: #123; }

.nora-enquiry__actions { margin: 12px 0 0; }
.nora-enquiry__send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 46px;
	padding: 12px 20px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	color: var(--ne-white);
	background: var(--ne-navy);
	border: 1px solid var(--ne-navy);
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.18s ease;
}
.nora-enquiry__send:hover { background: var(--ne-blue); border-color: var(--ne-blue); }
.nora-enquiry__send:focus-visible { outline: 3px solid var(--ne-blue); outline-offset: 2px; }
.nora-enquiry__send[aria-disabled="true"] { opacity: 0.7; cursor: progress; }
.nora-enquiry__send[disabled] { opacity: 0.75; cursor: progress; }

.nora-enquiry__alt {
	margin: 10px 0 0;
	font-size: 13px;
	line-height: 1.5;
}
.nora-enquiry__alt a { color: var(--ne-blue); text-decoration: underline; text-underline-offset: 2px; }

/* Honeypot: off-screen, out of the tab order, hidden from assistive tech. */
.nora-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Provide the utility class in case the active theme does not. */
.nora-enquiry .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ---------- Small screens ----------------------------------------------- */
@media (max-width: 480px) {
	.nora-enquiry { right: 12px; bottom: 12px; left: 12px; align-items: flex-end; }
	/* The stretched container is invisible; don't let it swallow taps meant
	   for what is underneath (e.g. the footer's Back to top button). */
	.nora-enquiry { pointer-events: none; }
	.nora-enquiry > * { pointer-events: auto; }
	.nora-enquiry__panel {
		width: 100%;
		max-width: none;
		max-height: calc(100vh - 100px);
		max-height: calc(100dvh - 100px);
	}
}

/* Leave room for the WordPress admin bar on small screens. */
@media (max-width: 782px) {
	.admin-bar .nora-enquiry__panel { max-height: calc(100vh - 146px); }
}

@media (prefers-reduced-motion: reduce) {
	.nora-enquiry__launcher { transition: none; }
}

@media (forced-colors: active) {
	.nora-enquiry__launcher,
	.nora-enquiry__panel,
	.nora-enquiry__send { border: 1px solid ButtonText; }
}

@media print {
	.nora-enquiry { display: none !important; }
}
