/**
 * Floating dock v1 — en enhet med läsläge + till toppen intill Mira (.aka-floating-tools).
 *
 * z-index 99989: under .aka-floating-tools (99990), Mira-panel, HV-overlay.
 *
 * @package Divi_Child
 */

body.aka-floating-dock-enabled .aka-floating-tools .aka-back-to-top,
body.aka-floating-dock-enabled .aka-reading-fab {
	display: none !important;
}

/* Dubbel Läsläge-pill döljs när panelen är öppen (panel ligger i samma kluster) */
body.aka-floating-dock-enabled.aka-reading-mode .aka-floating-dock__tool--reading {
	display: none !important;
}

.aka-floating-dock {
	position: fixed;
	z-index: 99989;
	right: calc(max(18px, env(safe-area-inset-right, 0px)) + 154px + 8px);
	bottom: max(22px, env(safe-area-inset-bottom, 0px));
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
	align-items: flex-end;
	width: auto;
	max-width: calc(100vw - 24px);
	pointer-events: none;
	box-sizing: border-box;
}

.aka-floating-dock__cluster {
	display: inline-flex;
	flex-direction: row;
	align-items: center;
	gap: 8px;
	pointer-events: auto;
	max-width: 100%;
}

@media (max-width: 700px) {
	.aka-floating-dock {
		left: 50%;
		right: auto;
		bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 58px);
		transform: translateX(-50%);
		justify-content: center;
	}

	.aka-floating-dock__cluster {
		flex-direction: column;
		align-items: center;
		gap: 6px;
	}
}

.aka-floating-dock__tools {
	display: inline-flex;
	flex-direction: row;
	align-items: center;
	gap: 8px;
	padding: 0;
	border: none;
	background: transparent;
	box-shadow: none;
}

.aka-floating-dock__tool-open-hint {
	display: inline-block;
	margin-right: 0.1rem;
	font-size: 1.05rem;
	font-weight: 800;
	line-height: 1;
	color: inherit;
	opacity: 0.85;
}

body.aka-floating-dock-enabled.aka-reading-mode .aka-floating-dock__tool-open-hint {
	display: none;
}

.aka-floating-dock__tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	min-height: 42px;
	height: 42px;
	padding: 0 12px;
	border-radius: 999px;
	border: 1px solid rgba(15, 118, 110, 0.2);
	background: rgba(255, 255, 255, 0.94);
	color: #0f766e !important;
	font: 800 0.84rem/1 var(--aka-font, 'Open Sans', system-ui, sans-serif);
	cursor: pointer;
	box-shadow: none;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.aka-floating-dock__tool:hover,
.aka-floating-dock__tool:focus-visible {
	background: #fff;
	border-color: rgba(13, 148, 136, 0.42);
	color: #0b5f59 !important;
	outline: none;
}

.aka-floating-dock__tool:focus-visible {
	box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.35);
}

.aka-floating-dock__tool--reading[hidden] {
	display: none !important;
}

/* Topp: plats reserverad — döljs med opacity/visibility så ordningen hoppar inte */
.aka-floating-dock__tool--top:not(.is-visible) {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.aka-floating-dock__tool--top.is-visible {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.aka-floating-dock.is-scrolled .aka-floating-dock__tool--top.is-visible {
	animation: aka-fd-nudge 0.35s ease 1;
}

@keyframes aka-fd-nudge {
	from {
		transform: translateY(4px);
		opacity: 0.65;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

.aka-floating-dock__tool-icon {
	font-size: 1rem;
	line-height: 1;
}

.aka-floating-dock__tool-label {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (max-width: 700px) {
	.aka-floating-dock__tool {
		min-height: 44px;
		height: 44px;
	}
}

@media (max-width: 400px) {
	.aka-floating-dock__tool-label {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}
	.aka-floating-dock__tool--reading {
		max-width: none;
		min-width: 44px;
		padding: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.aka-floating-dock__tool,
	.aka-floating-dock.is-scrolled .aka-floating-dock__tool--top {
		animation: none !important;
		transition: none !important;
	}
}
