/* ============================================================
   Floating Actions — global fixed-position action stack.
   Renders once (in parts/footer.html) and stays pinned to the
   viewport corner on every page. Position/offsets come from CSS
   custom properties set inline per-instance by PHP; colours per
   action type read the accent set below (brand colours are
   intentionally literal — they identify a specific external
   service's mark, not a themeable design decision).
   ============================================================ */

.wpdl-floating-actions {
	position: fixed;
	inset-block-end: max(var(--wpdl-fab-offset-y, 1.25rem), env(safe-area-inset-bottom));
	z-index: var(--wp--custom--z--sticky);
	margin: 0;
}

.wpdl-floating-actions[data-position="right"] {
	inset-inline-end: max(var(--wpdl-fab-offset-x, 1.25rem), env(safe-area-inset-right));
}

.wpdl-floating-actions[data-position="left"] {
	inset-inline-start: max(var(--wpdl-fab-offset-x, 1.25rem), env(safe-area-inset-left));
}

.wpdl-floating-actions__list {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: var(--wp--custom--space--2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.wpdl-floating-actions[data-position="left"] .wpdl-floating-actions__list {
	align-items: flex-start;
}

.wpdl-floating-actions__item {
	margin: 0;
}

/* ── Button: icon circle, label revealed on hover/focus ────────────── */
.wpdl-floating-actions__btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	padding: 0.625rem;
	border: none;
	border-radius: var(--wp--custom--radius--full);
	background-color: var(--wp--custom--semantic--color--text--primary);
	color: var(--wp--custom--semantic--color--background--canvas);
	box-shadow: var(--wp--custom--semantic--shadow--raised);
	cursor: pointer;
	text-decoration: none;
	transition: box-shadow var(--wp--custom--duration--fast) var(--wp--custom--easing--default);
}

.wpdl-floating-actions__btn:hover,
.wpdl-floating-actions__btn:focus-visible {
	box-shadow: var(--wp--custom--semantic--shadow--card);
}

.wpdl-floating-actions__btn:focus-visible {
	outline: 0.125rem solid var(--wp--custom--semantic--color--brand--primary);
	outline-offset: 0.125rem;
}

.wpdl-floating-actions__icon {
	display: inline-flex;
	flex: 0 0 auto;
	inline-size: 1.25rem;
	block-size: 1.25rem;
}

.wpdl-floating-actions__icon svg {
	inline-size: 100%;
	block-size: 100%;
}

.wpdl-floating-actions__label {
	display: inline-block;
	flex: 0 0 auto;
	max-inline-size: 0;
	overflow: hidden;
	font-family: var(--wp--custom--semantic--typography--body--font-family);
	font-size: 0.8125rem;
	font-weight: 500;
	white-space: nowrap;
	opacity: 0;
	transition:
		max-inline-size var(--wp--custom--duration--base) var(--wp--custom--easing--default),
		opacity var(--wp--custom--duration--fast) var(--wp--custom--easing--default);
}

.wpdl-floating-actions__btn:hover .wpdl-floating-actions__label,
.wpdl-floating-actions__btn:focus-visible .wpdl-floating-actions__label,
.wpdl-floating-actions__btn.is-expanded .wpdl-floating-actions__label {
	max-inline-size: 11rem;
	padding-inline-start: var(--wp--custom--space--2);
	opacity: 1;
}

/* ── Brand accents — literal service colours, not design tokens.
   These identify a specific external service's mark (Zalo/Messenger/
   WhatsApp/Telegram); token-guard exists to keep design decisions
   token-driven, not to make brand marks swappable. */
/* stylelint-disable color-no-hex */
.wpdl-floating-actions__btn--zalo { background-color: #0068ff; }
.wpdl-floating-actions__btn--messenger { background-color: #0084ff; }
.wpdl-floating-actions__btn--whatsapp { background-color: #25d366; }
.wpdl-floating-actions__btn--telegram { background-color: #26a5e4; }
/* stylelint-enable color-no-hex */

/* phone / email / back-to-top stay on the neutral ink background above */

.wpdl-floating-actions__btn[hidden] {
	display: none;
}

/* ── Reduced motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.wpdl-floating-actions__btn {
		transition: none;
	}
}

/* ── Mobile: smaller footprint, no hover — expand is tap-toggled via JS
   (adds/removes .is-expanded on the button; see floating-actions.js) ── */
@media (width <= 29.9375rem) {
	.wpdl-floating-actions {
		inset-block-end: max(calc(var(--wpdl-fab-offset-y, 1.25rem) * 0.75), env(safe-area-inset-bottom));
	}

	.wpdl-floating-actions[data-position="right"] {
		inset-inline-end: max(calc(var(--wpdl-fab-offset-x, 1.25rem) * 0.6), env(safe-area-inset-right));
	}

	.wpdl-floating-actions[data-position="left"] {
		inset-inline-start: max(calc(var(--wpdl-fab-offset-x, 1.25rem) * 0.6), env(safe-area-inset-left));
	}

	.wpdl-floating-actions__btn {
		padding: 0.5625rem;
	}

	/* No real hover on touch — label only opens via keyboard focus or a tap
	   toggling .is-expanded (progressive; buttons work with zero JS either way,
	   since each is already a plain link/button). */
	.wpdl-floating-actions__btn:hover .wpdl-floating-actions__label {
		max-inline-size: 0;
		padding-inline-start: 0;
		opacity: 0;
	}

	.wpdl-floating-actions__btn:focus-visible .wpdl-floating-actions__label,
	.wpdl-floating-actions__btn.is-expanded .wpdl-floating-actions__label {
		max-inline-size: 9rem;
		padding-inline-start: var(--wp--custom--space--2);
		opacity: 1;
	}
}

/* ── Editor preview (admin-only) ─────────────────────────────────── */
.wpdl-floating-actions-editor-preview {
	padding: var(--wp--custom--space--4);
	border: 1px dashed var(--wp--custom--semantic--color--border--base);
	border-radius: var(--wp--custom--radius--md);
}
