/* Floating contact button (inc/contact-fab.php). Bottom-right, under the header/mobile menu (z 50) and dialogs. */
.cfab {
	--cfab-gap: 16px;
	--cfab-size: 54px;
	position: fixed;
	right: calc(var(--cfab-gap) + env(safe-area-inset-right, 0px));
	bottom: calc(var(--cfab-gap) + env(safe-area-inset-bottom, 0px) + var(--cfab-lift, 0px)); /* lift: set by JS to clear page controls */
	z-index: 40;
	display: none; /* needs JS (html.js) */
	font-family: var(--font-body);
	transition: bottom 0.25s var(--ease), opacity 0.2s, visibility 0s;
}
.js .cfab { display: block; }
/* Too crowded at its corner: label hidden, or the whole button steps aside until the page scrolls on. */
.cfab[data-fit='compact'] .cfab__label { display: none; }
.cfab[data-fit='away'] { opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0s 0.2s; }

.cfab__toggle {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--soot);
	font: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.cfab__label {
	display: flex;
	align-items: center;
	height: 40px;
	margin-right: -14px; /* tucks under the round button */
	padding: 0 26px 0 18px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--paper);
	box-shadow: 0 6px 18px rgba(30, 27, 26, 0.14);
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.cfab__btn {
	position: relative;
	display: grid;
	place-items: center;
	width: var(--cfab-size);
	height: var(--cfab-size);
	border-radius: 50%;
	background: var(--ember);
	color: #fff;
	box-shadow: 0 8px 22px rgba(152, 31, 21, 0.32), 0 2px 6px rgba(30, 27, 26, 0.18);
	transition: transform 0.2s var(--ease), background-color 0.2s, box-shadow 0.2s var(--ease);
}
.cfab__btn svg {
	position: absolute;
	width: 26px;
	height: 26px;
	transition: transform 0.25s var(--ease), opacity 0.2s;
}
.cfab__x { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.cfab[data-open='true'] .cfab__chat { opacity: 0; transform: rotate(90deg) scale(0.6); }
.cfab[data-open='true'] .cfab__x { opacity: 1; transform: none; }

@media (hover: hover) {
	.cfab__toggle:hover .cfab__btn { background: var(--ember-hot); transform: translateY(-2px); box-shadow: 0 12px 26px rgba(152, 31, 21, 0.36), 0 3px 8px rgba(30, 27, 26, 0.18); }
	.cfab__toggle:hover .cfab__label { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(30, 27, 26, 0.16); }
}
.cfab__toggle:active .cfab__btn, .cfab__toggle:active .cfab__label { transform: translateY(0) scale(0.97); }
.cfab__toggle:focus-visible { outline: none; }
.cfab__toggle:focus-visible .cfab__btn { outline: 3px solid var(--signal); outline-offset: 3px; }

/* Menu, above the button. */
.cfab__panel {
	position: absolute;
	right: 0;
	bottom: calc(var(--cfab-size) + 12px);
	width: min(300px, calc(100vw - 2 * var(--cfab-gap)));
	padding: 14px;
	box-sizing: border-box;
	border: 1px solid var(--line);
	border-radius: 16px;
	background: var(--paper);
	box-shadow: 0 18px 44px rgba(30, 27, 26, 0.2), 0 2px 8px rgba(30, 27, 26, 0.08);
	transform-origin: 90% 100%;
}
.cfab__panel:not([hidden]) { animation: cfab-in 0.18s var(--ease); }
@keyframes cfab-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.cfab__title {
	margin: 2px 6px 10px;
	color: var(--steel);
	font-size: var(--step--1);
	font-weight: 500;
}
.cfab__list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.cfab__item {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	padding: 8px 10px;
	border-radius: 12px;
	color: var(--soot);
	text-decoration: none;
	transition: background-color 0.15s;
}
.cfab__item:hover { background: var(--concrete); }
.cfab__item:focus-visible { outline: 3px solid var(--ember); outline-offset: -3px; background: var(--concrete); }
.cfab__ico {
	display: grid;
	flex: none;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--ember);
	color: #fff;
}
.cfab__ico svg { width: 20px; height: 20px; }
.cfab__item--line .cfab__ico { background: #06c755; } /* LINE brand green */
.cfab__item--quote .cfab__ico { background: var(--soot); }
.cfab__text { display: grid; min-width: 0; line-height: 1.3; }
.cfab__text strong { font-size: 0.95rem; font-weight: 600; }
.cfab__text span { overflow: hidden; color: var(--steel); font-size: var(--step--1); text-overflow: ellipsis; white-space: nowrap; }

/* Keep the last footer line clear of the button. */
.js .site-footer { padding-bottom: calc(40px + var(--cfab-size, 54px) + 16px); }

@media (max-width: 380px) {
	.cfab { --cfab-gap: 12px; --cfab-size: 50px; }
	.cfab__label { height: 36px; padding: 0 22px 0 14px; font-size: 0.9rem; }
}
@media (prefers-reduced-motion: reduce) {
	.cfab, .cfab__label, .cfab__btn, .cfab__btn svg, .cfab__item { transition: none; }
	.cfab__panel:not([hidden]) { animation: none; }
	.cfab__toggle:hover .cfab__btn, .cfab__toggle:hover .cfab__label, .cfab__toggle:active .cfab__btn, .cfab__toggle:active .cfab__label { transform: none; }
}
@media print { .cfab { display: none !important; } }
