/* =========================================================================
   GKFC Buddy — official assistant chat for the Contact page.
   Component: launcher FAB + floating chat window + in-form CTA button.
   ========================================================================= */

:root {
	--gkfc-chat-maroon: #831d21;
	--gkfc-chat-maroon-deep: #5f1216;
	--gkfc-chat-red: #a3262d;
	--gkfc-chat-accent: #ff7b2b;
	--gkfc-chat-gold: #c9a227;
	--gkfc-chat-ink: #232b3a;
	--gkfc-chat-muted: #9aa0ad;
	--gkfc-chat-surface: #fff;
	--gkfc-chat-bg: #f6f5f8;
	--gkfc-chat-ring: rgba(255, 123, 43, 0.55);
	--gkfc-chat-gradient-btn: linear-gradient(115deg, var(--gkfc-chat-maroon-deep) 0%, var(--gkfc-chat-red) 55%, var(--gkfc-chat-accent) 130%);
	--gkfc-chat-gradient-head: linear-gradient(120deg, #6e1419 0%, #8c1e24 55%, #a3262d 130%);
	--gkfc-chat-shadow: 0 40px 80px -30px rgba(20, 10, 10, 0.55), 0 12px 32px -18px rgba(0, 0, 0, 0.35);
	--gkfc-chat-radius: 20px;
}

/* ---- In-form "Chat With Us" button ------------------------------------- */

.gkfc-chatl { margin: 0 0 18px; }

.gkfc-blb {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	appearance: none;
	border: 0;
	cursor: pointer;
	text-align: left;
	padding: 14px 16px;
	border-radius: 16px;
	background: var(--gkfc-chat-gradient-btn);
	color: #fff;
	box-shadow: 0 18px 40px -20px rgba(131, 29, 33, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.18);
	transition: transform 0.25s cubic-bezier(0.22, 0.68, 0.35, 1.1), box-shadow 0.3s ease, filter 0.3s ease;
	overflow: hidden;
}
.gkfc-blb::before {
	content: "";
	position: absolute;
	top: 0;
	left: -80%;
	width: 55%;
	height: 100%;
	background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.16), transparent);
	transform: skewX(-20deg);
	transition: left 0.65s ease;
	pointer-events: none;
}
.gkfc-blb:hover { transform: translateY(-2px); box-shadow: 0 26px 50px -22px rgba(131, 29, 33, 0.8); filter: brightness(1.03); }
.gkfc-blb:hover::before { left: 120%; }
.gkfc-blb:active { transform: translateY(0) scale(0.985); }
.gkfc-blb:focus-visible { outline: 3px solid var(--gkfc-chat-ring); outline-offset: 3px; }

.gkfc-blb__ic {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.15);
	border: 1px solid rgba(255, 255, 255, 0.22);
	font-size: 1.45rem;
	line-height: 1;
}
.gkfc-blb__txt { flex: 1 1 auto; min-width: 0; }
.gkfc-blb__txt b { display: block; font-size: 1.02rem; font-weight: 800; letter-spacing: 0.01em; }
.gkfc-blb__txt span { display: block; font-size: 0.76rem; line-height: 1.4; opacity: 0.88; margin-top: 2px; }
.gkfc-blb__arrow {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
	font-size: 0.76rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	color: #ffd9a8;
}
.gkfc-blb__arrow svg { transition: transform 0.25s ease; }
.gkfc-blb:hover .gkfc-blb__arrow svg { transform: translateX(4px); }

/* ---- Chat root ---------------------------------------------------------- */

.gkfc-chat { position: relative; }

/* ---- Chat launcher FAB, stacked above the back-to-top button -------------- */

.gkfc-chat__launcher {
	position: fixed;
	right: 24px;
	bottom: 86px;
	z-index: 99989;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 50%;
	cursor: pointer;
	appearance: none;
	color: #fff;
	background: linear-gradient(140deg, var(--gkfc-chat-maroon) 0%, var(--gkfc-chat-maroon-deep) 100%);
	box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.14);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease, opacity 0.28s ease, visibility 0.28s ease;
}
.gkfc-chat__launcher.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
}
.gkfc-chat__launcher svg { width: 20px; height: 20px; fill: none; }
.gkfc-chat__launcher:hover {
	background: linear-gradient(140deg, var(--gkfc-chat-maroon) 0%, var(--gkfc-chat-accent) 140%);
	border-color: rgba(255, 255, 255, 0.4);
	transform: translateY(-3px);
	box-shadow: 0 14px 34px rgba(255, 123, 43, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.gkfc-chat__launcher:active { transform: translateY(0) scale(0.95); }
.gkfc-chat__launcher:focus-visible { outline: 2px solid var(--gkfc-chat-gold); outline-offset: 3px; }
.gkfc-chat.is-open .gkfc-chat__launcher { opacity: 0; visibility: hidden; transform: translateY(6px); pointer-events: none; }

/* ---- Chat window -------------------------------------------------------- */

.gkfc-chat__window {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	display: flex;
	flex-direction: column;
	width: min(420px, calc(100vw - 40px));
	height: min(660px, calc(100vh - 48px));
	overflow: hidden;
	background: var(--gkfc-chat-surface);
	border: 1px solid rgba(20, 10, 10, 0.08);
	border-radius: var(--gkfc-chat-radius);
	box-shadow: var(--gkfc-chat-shadow);
	opacity: 0;
	visibility: hidden;
	transform: translateY(26px) scale(0.96);
	transform-origin: bottom right;
	transition: opacity 0.28s ease, transform 0.3s cubic-bezier(0.22, 0.68, 0.35, 1.1), visibility 0.28s ease;
	pointer-events: none;
}
.gkfc-chat.is-open .gkfc-chat__window {
	opacity: 1;
	visibility: visible;
	transform: none;
	pointer-events: auto;
}

/* ---- Header ------------------------------------------------------------- */

.gkfc-chat__head {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 12px 12px 14px;
	background: var(--gkfc-chat-gradient-head);
	color: #fff;
}
.gkfc-chat__head::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--gkfc-chat-accent), var(--gkfc-chat-gold), transparent);
}
.gkfc-chat__avatar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	overflow: hidden;
	/* Was #fff, which showed as a white disc behind the mascot and hid the
	   artwork's own transparent edge. The Buddy mark carries its own shape, so
	   the slot is left transparent and only a light ring defines the circle. */
	background: transparent;
	border: 2px solid rgba(255, 255, 255, 0.4);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.gkfc-chat__avatar picture { display: block; width: 100%; height: 100%; }
.gkfc-chat__avatar img {
	width: 100%; height: 100%; object-fit: contain; padding: 2px;
}
.gkfc-chat__avatar img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.gkfc-chat__avatar--mono {
	font-weight: 900;
	font-size: 0.85rem;
	letter-spacing: 0.05em;
	color: var(--gkfc-chat-maroon);
}
.gkfc-chat__titles { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.gkfc-chat__name { font-weight: 800; font-size: 0.96rem; letter-spacing: 0.02em; }
.gkfc-chat__sub { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; opacity: 0.82; }
.gkfc-chat__status {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.66rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	background: rgba(0, 0, 0, 0.18);
	padding: 4px 10px;
	border-radius: 999px;
	white-space: nowrap;
}
.gkfc-chat__status i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #3ddc84;
	box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.25);
}
.gkfc-chat__btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 9px;
	appearance: none;
	background: rgba(255, 255, 255, 0.13);
	color: #fff;
	font-size: 1.02rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}
.gkfc-chat__btn:hover { background: rgba(255, 255, 255, 0.24); transform: translateY(-1px); }
.gkfc-chat__btn:active { transform: scale(0.92); }
.gkfc-chat__btn:focus-visible { outline: 2px solid var(--gkfc-chat-gold); outline-offset: 2px; }

/* ---- Message list ------------------------------------------------------- */

.gkfc-chat__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px 14px 10px;
	background: linear-gradient(180deg, #fbfafc, var(--gkfc-chat-bg));
	scroll-behavior: smooth;
}
.gkfc-chat__body::-webkit-scrollbar { width: 6px; }
.gkfc-chat__body::-webkit-scrollbar-thumb { background: rgba(20, 10, 10, 0.16); border-radius: 6px; }
.gkfc-chat__body::-webkit-scrollbar-track { background: transparent; }

.gkfc-chat__msg { display: flex; flex-direction: column; margin-bottom: 12px; animation: gkfcChatMsgIn 0.28s ease both; }
.gkfc-chat__msg--bot { align-items: flex-start; }
.gkfc-chat__msg--user { align-items: flex-end; }
.gkfc-chat__bubble {
	max-width: 84%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 0.9rem;
	line-height: 1.5;
	letter-spacing: 0.005em;
	overflow-wrap: break-word;
	word-break: break-word;
}
.gkfc-chat__msg--bot .gkfc-chat__bubble {
	background: #fff;
	border: 1px solid rgba(20, 10, 10, 0.06);
	border-bottom-left-radius: 6px;
	color: var(--gkfc-chat-ink);
	box-shadow: 0 3px 12px -6px rgba(0, 0, 0, 0.18);
}
.gkfc-chat__msg--user .gkfc-chat__bubble {
	background: linear-gradient(120deg, var(--gkfc-chat-maroon) 0%, var(--gkfc-chat-red) 60%, #d9642b 130%);
	border-bottom-right-radius: 6px;
	color: #fff;
	box-shadow: 0 4px 14px -8px rgba(140, 30, 36, 0.6);
}
.gkfc-chat__meta { font-size: 0.64rem; color: var(--gkfc-chat-muted); margin-top: 4px; padding: 0 3px; }

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

.gkfc-chat__actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 2px 2px; }
.gkfc-chat__act {
	appearance: none;
	border: 1.5px solid rgba(140, 30, 36, 0.3);
	border-radius: 999px;
	background: #fff;
	color: var(--gkfc-chat-maroon);
	padding: 8px 14px;
	font-family: inherit;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	transition: transform 0.18s ease, background 0.2s ease, border-color 0.2s ease,
		color 0.2s ease, box-shadow 0.2s ease;
	animation: gkfcChatMsgIn 0.28s ease both;
}
.gkfc-chat__act:hover { border-color: var(--gkfc-chat-maroon); background: rgba(140, 30, 36, 0.06); transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(140, 30, 36, 0.45); }
.gkfc-chat__act:active { transform: scale(0.95); }
.gkfc-chat__act:focus-visible { outline: 3px solid var(--gkfc-chat-ring); outline-offset: 2px; }
.gkfc-chat__act:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.gkfc-chat__act--primary {
	border-color: transparent;
	background: linear-gradient(120deg, var(--gkfc-chat-maroon) 0%, var(--gkfc-chat-red) 55%, var(--gkfc-chat-accent) 140%);
	color: #fff;
	box-shadow: 0 8px 18px -10px rgba(140, 30, 36, 0.7);
}
.gkfc-chat__act--primary:hover { filter: brightness(1.05); color: #fff; background: linear-gradient(120deg, var(--gkfc-chat-maroon) 0%, var(--gkfc-chat-red) 55%, var(--gkfc-chat-accent) 140%); }
.gkfc-chat__act--primary:focus-visible { outline-color: var(--gkfc-chat-accent); }
.gkfc-chat__act .gkfc-chat__act-arrow svg { transition: transform 0.2s ease; width: 11px; height: 11px; }
.gkfc-chat__act:hover .gkfc-chat__act-arrow svg { transform: translateX(3px); }

.gkfc-chat__topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 2px 2px; }
.gkfc-chat__topic {
	appearance: none;
	border: 1.5px solid rgba(140, 30, 36, 0.3);
	border-radius: 999px;
	background: #fff;
	color: var(--gkfc-chat-maroon);
	padding: 9px 15px;
	font-family: inherit;
	font-size: 0.8rem;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.18s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
	animation: gkfcChatMsgIn 0.28s ease both;
}
.gkfc-chat__topic:hover { border-color: var(--gkfc-chat-maroon); background: rgba(140, 30, 36, 0.06); transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(140, 30, 36, 0.45); }
.gkfc-chat__topic:active { transform: scale(0.95); }
.gkfc-chat__topic:focus-visible { outline: 3px solid var(--gkfc-chat-ring); outline-offset: 2px; }
.gkfc-chat__topic:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- Typing indicator --------------------------------------------------- */

.gkfc-chat__typing {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 13px 16px;
}
.gkfc-chat__typing i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9aa0ad;
	animation: gkfcChatBlink 1.2s infinite;
}
.gkfc-chat__typing i:nth-child(2) { animation-delay: 0.2s; }
.gkfc-chat__typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes gkfcChatBlink {
	0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-3px); }
}
@keyframes gkfcChatMsgIn {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: none; }
}

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

.gkfc-chat__composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px 12px;
	background: var(--gkfc-chat-surface);
	border-top: 1px solid rgba(20, 10, 10, 0.08);
}
.gkfc-chat__input {
	flex: 1 1 auto;
	min-width: 0;
	appearance: none;
	border: 1.5px solid rgba(20, 10, 10, 0.14);
	border-radius: 12px;
	padding: 12px 14px;
	font-family: inherit;
	font-size: 0.9rem;
	background: #faf9fb;
	color: var(--gkfc-chat-ink);
	outline: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.gkfc-chat__input::placeholder { color: var(--gkfc-chat-muted); }
.gkfc-chat__input:focus { border-color: var(--gkfc-chat-maroon); box-shadow: 0 0 0 3px rgba(140, 30, 36, 0.12); background: #fff; }
.gkfc-chat__input:disabled { opacity: 0.6; }
.gkfc-chat__send {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border: 0;
	border-radius: 12px;
	background: linear-gradient(120deg, var(--gkfc-chat-maroon) 0%, var(--gkfc-chat-red) 70%, var(--gkfc-chat-accent));
	color: #fff;
	cursor: pointer;
	box-shadow: 0 8px 20px -8px rgba(140, 30, 36, 0.6);
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}
.gkfc-chat__send:hover { transform: translateY(-1px); filter: brightness(1.06); }
.gkfc-chat__send:active { transform: scale(0.94); }
.gkfc-chat__send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.gkfc-chat__send:focus-visible { outline: 3px solid var(--gkfc-chat-ring); outline-offset: 2px; }
.gkfc-chat__send svg { width: 18px; height: 18px; }

/* ---- Screen-reader-only ------------------------------------------------- */

.gkfc-chat__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Responsive --------------------------------------------------------- */

@media (max-width: 560px) {
	.gkfc-chat__window {
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		height: 100dvh;
		border-radius: 0;
		border: 0;
		transform: translateY(30px) scale(1);
	}
	.gkfc-chat__composer { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
	.gkfc-chat__send { width: 52px; height: 52px; }
	.gkfc-chat__input { padding: 14px 15px; font-size: 0.95rem; }

	/* The window is pinned to the top of the viewport at this width, so the
	   header has to clear the notch / status bar. Previously only the bottom
	   inset was handled, on the composer. */
	.gkfc-chat__head { padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px 14px; }

	/* 44px minimum touch target. The old `padding: 12px` on these buttons was
	   applied to a fixed 30x30 border-box, which crushed the glyph down to a
	   6px content box. */
	.gkfc-chat__btn { width: 44px; height: 44px; padding: 0; border-radius: 12px; }

	/* Let the titles take the slack and truncate, so the uppercase subtitle
	   can never wrap onto a second line and grow the header. */
	.gkfc-chat__titles { flex: 1 1 auto; }
	.gkfc-chat__name,
	.gkfc-chat__sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

	.gkfc-chat__status { display: none; }
	/* The minimise button duplicates close, and is redundant on a full-screen sheet. */
	.gkfc-chat__min { display: none; }
	.gkfc-chat__act, .gkfc-chat__topic { padding: 11px 16px; font-size: 0.84rem; min-height: 40px; }
	.gkfc-blb { padding: 16px; border-radius: 18px; }
}

@media (prefers-reduced-motion: reduce) {
	.gkfc-chat__window,
	.gkfc-chat__msg,
	.gkfc-chat__act,
	.gkfc-chat__topic,
	.gkfc-chat__act-arrow svg,
	.gkfc-chat__typing i,
	.gkfc-blb,
	.gkfc-blb__arrow svg {
		animation: none !important;
		transition: none !important;
	}
	.gkfc-chat__body { scroll-behavior: auto; }
}