/*
 * Fixed Footer Harmonizer - frontend styles.
 * Design tokens (--ffh-*) and breakpoint layouts are injected from the settings.
 */
.ffh-dock {
	--ffh-ease: cubic-bezier(0.22, 1, 0.36, 1);
	position: fixed;
	bottom: calc(var(--ffh-offset, 16px) + env(safe-area-inset-bottom, 0px));
	z-index: var(--ffh-z, 9990);
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

.ffh-dock *,
.ffh-dock *::before,
.ffh-dock *::after {
	box-sizing: border-box;
}

.ffh-dock[data-empty] {
	display: none;
}

/* List and items */
.ffh-dock__list {
	display: flex;
	gap: var(--ffh-gap, 12px);
	margin: 0;
	padding: 0;
	list-style: none;
	transition: opacity var(--ffh-duration, 700ms) var(--ffh-ease), transform var(--ffh-duration, 700ms) var(--ffh-ease), visibility var(--ffh-duration, 700ms);
}

.ffh-dock__item {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
	opacity: 0;
	transform: scale(0.6);
	transition: opacity var(--ffh-duration, 700ms) var(--ffh-ease), transform var(--ffh-duration, 700ms) var(--ffh-ease);
}

.ffh-dock__item.is-in {
	opacity: 1;
	transform: none;
}

/* Leaving items wait a moment before they fade, so a change never feels abrupt. */
.ffh-dock__item:not(.is-in) {
	transition-delay: var(--ffh-exit-delay, 100ms);
}

.ffh-dock__item[hidden] {
	display: none !important;
}

/* Buttons: a circle that grows into a pill and reveals its label */
.ffh-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: flex-start;
	width: auto;
	min-width: var(--ffh-size, 48px);
	max-width: var(--ffh-size, 48px);
	height: var(--ffh-size, 48px);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--ffh-radius, 50%);
	background: var(--ffh-bg, #2271b1);
	color: var(--ffh-icon-color, #fff);
	box-shadow: var(--ffh-shadow, none);
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	-webkit-tap-highlight-color: transparent;
	transition: max-width var(--ffh-duration, 700ms) var(--ffh-ease), box-shadow var(--ffh-duration, 700ms) var(--ffh-ease), filter 0.2s ease;
}

.ffh-btn:hover {
	color: var(--ffh-icon-color, #fff);
	filter: brightness(1.08);
}

.ffh-btn:focus-visible {
	outline: 3px solid var(--ffh-bg, #2271b1);
	outline-offset: 3px;
}

.ffh-btn__icon {
	display: grid;
	flex: none;
	place-items: center;
	width: var(--ffh-size, 48px);
	height: var(--ffh-size, 48px);
	pointer-events: none;
}

.ffh-icon {
	display: block;
	width: var(--ffh-icon-size, 22px);
	height: var(--ffh-icon-size, 22px);
}

.ffh-icon--mask {
	background-color: currentColor;
	-webkit-mask: var(--ffh-icon-url) center / contain no-repeat;
	mask: var(--ffh-icon-url) center / contain no-repeat;
}

.ffh-btn .ffh-icon--divi {
	width: auto;
	height: auto;
	font-size: var(--ffh-icon-size, 22px);
	line-height: 1;
	color: inherit;
}

/* Label: screen-reader text by default, revealed as pill text when enabled */
.ffh-btn__label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.ffh-dock--reveal .ffh-btn__label {
	position: static;
	width: auto;
	height: auto;
	max-width: 0;
	margin: 0;
	opacity: 0;
	clip: auto;
	transition: max-width var(--ffh-duration, 700ms) var(--ffh-ease), opacity calc(var(--ffh-duration, 700ms) * 0.8) var(--ffh-ease), padding var(--ffh-duration, 700ms) var(--ffh-ease);
}

.ffh-dock--reveal .ffh-btn:focus-visible,
.ffh-dock--reveal .ffh-dock__item.is-open > .ffh-btn {
	max-width: 320px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.32);
}

.ffh-dock--reveal .ffh-btn:focus-visible .ffh-btn__label,
.ffh-dock--reveal .ffh-dock__item.is-open > .ffh-btn .ffh-btn__label {
	max-width: 220px;
	padding-right: 18px;
	opacity: 1;
}

@media (hover: hover) {
	.ffh-dock--reveal .ffh-btn:hover {
		max-width: 320px;
		box-shadow: 0 6px 20px rgba(0, 0, 0, 0.32);
	}

	.ffh-dock--reveal .ffh-btn:hover .ffh-btn__label {
		max-width: 220px;
		padding-right: 18px;
		opacity: 1;
	}
}

/* Toggle button never carries a label */
.ffh-toggle {
	max-width: var(--ffh-size, 48px);
}

/* Dark mode toggle: sun while the toggle is off, moon while it is on */
.ffh-btn[data-ffh-id="darkmode"] .ffh-icon--moon {
	display: none;
}

.ffh-btn[data-ffh-id="darkmode"][aria-pressed="true"] .ffh-icon--sun {
	display: none;
}

.ffh-btn[data-ffh-id="darkmode"][aria-pressed="true"] .ffh-icon--moon {
	display: block;
}

/* Submenu (AI providers) */
.ffh-submenu {
	position: absolute;
	min-width: 190px;
	margin: 0;
	padding: 8px;
	list-style: none;
	border-radius: 20px;
	background: var(--ffh-menu-bg, #fff);
	color: var(--ffh-menu-text, #111);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translate(calc(var(--ffh-sub-x, 0px) + var(--ffh-sub-shift, 0px)), var(--ffh-sub-y, 0)) scale(0.96);
	transition: opacity calc(var(--ffh-duration, 700ms) * 0.8) var(--ffh-ease), transform calc(var(--ffh-duration, 700ms) * 0.8) var(--ffh-ease), visibility calc(var(--ffh-duration, 700ms) * 0.8);
}

.ffh-dock__item.is-open > .ffh-submenu {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translate(calc(var(--ffh-sub-x, 0px) + var(--ffh-sub-shift, 0px)), var(--ffh-sub-y, 0)) scale(1);
}

.ffh-submenu li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ffh-submenu__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 14px;
	color: inherit;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease;
}

.ffh-submenu__info {
	margin-top: 4px;
	padding-top: 4px;
	border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.ffh-submenu__item:hover,
.ffh-submenu__item:focus-visible {
	background: rgba(127, 127, 127, 0.16);
	color: inherit;
}

.ffh-submenu__item:focus-visible {
	outline: 2px solid var(--ffh-bg, #2271b1);
	outline-offset: -2px;
}

.ffh-submenu__icon {
	flex: none;
	width: 28px;
	height: 28px;
	border-radius: 0;
	object-fit: contain;
}

.ffh-submenu__mono {
	display: grid;
	flex: none;
	place-items: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--ffh-bg, #2271b1);
	color: var(--ffh-icon-color, #fff);
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
	.ffh-dock__list,
	.ffh-dock__item,
	.ffh-btn,
	.ffh-btn__label,
	.ffh-submenu {
		transition: none;
	}
}
