/**
 * Avozova Theme - Floating Actions
 *
 * File: assets/css/floating-actions.css
 *
 * Handles (shared by every Floating Action):
 * - Floating container layout (position, gap)
 * - Button base look, size and visibility transition
 * - Hover and keyboard focus
 * - Gear button and its upward popup
 * - Mobile layout and Reduced Motion
 *
 * Colours, border, radius, margin, padding, icon size and Left / Center
 * position are printed by inc/dynamic-css/general/floating-actions-options.php
 * (they are NOT hard-coded here, the values below are only fallbacks).
 *
 * Markup (template-parts/floating-actions.php):
 *   .avozova-scroll-navigation
 *     > .avozova-gear
 *         > .avozova-gear__panel > button   (Actions inside the Gear)
 *         > button.avozova-gear-toggle      (the Gear itself)
 *     > button.avozova-scroll-top / button.avozova-scroll-bottom / ...
 *
 * Scroll buttons get .is-visible from script.js. The Gear and the buttons
 * inside its popup are always visible, they do not use .is-visible.
 *
 * FILE ORDER:
 *   1. Container
 *   2. Buttons
 *   3. Visible state
 *   4. Hover
 *   5. Keyboard focus
 *   6. Icons
 *   7. Gear and popup
 *   8. Mobile
 *   9. Reduced motion
 */


/* =========================================================
 * 1. CONTAINER
 * ========================================================= */

.avozova-scroll-navigation {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 9999;

	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;

	/* Only the buttons catch clicks, never the empty area around them. */
	pointer-events: none;
}


/* =========================================================
 * 2. BUTTONS
 *
 * No fixed width / height: the size is icon size + padding + border,
 * so the Icon Size, Padding and Border settings always fit.
 * ========================================================= */

.avozova-scroll-top,
.avozova-scroll-bottom,
.avozova-gear-toggle,
.avozova-gear__panel > button {
	margin: 0;
	padding: 10px;

	display: flex;
	align-items: center;
	justify-content: center;

	background-color: var(--avozova-color-surface);
	color: var(--avozova-color-heading);

	border: 1px solid var(--avozova-color-border);
	border-radius: 9999px;

	box-shadow: var(--avozova-shadow);

	line-height: 1;

	cursor: pointer;
	pointer-events: auto;

	opacity: 0;
	visibility: hidden;

	transform: translateY(15px);

	transition:
		opacity 0.25s ease,
		visibility 0.25s ease,
		transform 0.25s ease,
		background-color 0.25s ease,
		color 0.25s ease,
		border-color 0.25s ease;
}


/* =========================================================
 * 3. VISIBLE STATE
 * ========================================================= */

.avozova-scroll-top.is-visible,
.avozova-scroll-bottom.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}


/* =========================================================
 * 4. HOVER STATE
 * ========================================================= */

.avozova-scroll-top:hover,
.avozova-scroll-bottom:hover,
.avozova-gear-toggle:hover,
.avozova-gear__panel > button:hover {
	background-color: var(--avozova-color-primary);
	color: var(--avozova-color-white, #ffffff);

	border-color: var(--avozova-color-primary);

	transform: translateY(-2px);
}


/* =========================================================
 * 5. KEYBOARD FOCUS
 * ========================================================= */

.avozova-scroll-top:focus-visible,
.avozova-scroll-bottom:focus-visible,
.avozova-gear-toggle:focus-visible,
.avozova-gear__panel > button:focus-visible {
	outline: 2px solid var(--avozova-color-primary);
	outline-offset: 3px;
}


/* =========================================================
 * 6. SVG ICONS
 *
 * Icon Size comes from the dynamic CSS (width and height in px).
 * ========================================================= */

.avozova-scroll-top svg,
.avozova-scroll-bottom svg,
.avozova-gear-toggle svg,
.avozova-gear__panel > button svg {
	width: 15px;
	height: 15px;

	display: block;

	fill: none;
	stroke: currentColor;
}


/* =========================================================
 * 7. GEAR AND POPUP
 *
 * The Gear is always visible. Its popup opens upward, exactly as wide
 * as the Gear button, and the buttons inside it are always visible too.
 * Open / close is done by JavaScript through the [hidden] attribute.
 * ========================================================= */

.avozova-gear {
	position: relative;
}

/* Gear and popup buttons never wait for .is-visible. */
.avozova-gear-toggle,
.avozova-gear__panel > button {
	opacity: 1;
	visibility: visible;
	transform: none;
}

/* The popup buttons fill the Gear width. */
.avozova-gear__panel > button {
	box-sizing: border-box;
	width: 100%;
}

/* Popup panel: grows upward from the Gear. */
.avozova-gear__panel {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 0;
	width: 100%;

	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;

	animation: avozova-gear-panel-in 0.2s ease;
}

/* display: flex above would override the hidden attribute, so it is restated. */
.avozova-gear__panel[hidden] {
	display: none;
}

/* The Gear looks active while the popup is open. */
.avozova-gear-toggle[aria-expanded="true"] {
	background-color: var(--avozova-color-primary);
	color: var(--avozova-color-white, #ffffff);

	border-color: var(--avozova-color-primary);
}

/* The Gear icon turns a little while open. */
.avozova-gear-toggle svg {
	transition: transform 0.25s ease;
}

.avozova-gear-toggle[aria-expanded="true"] svg {
	transform: rotate(60deg);
}

@keyframes avozova-gear-panel-in {

	from {
		opacity: 0;
		transform: translateY(8px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}

}


/* =========================================================
 * 8. RESPONSIVE - MOBILE
 * ========================================================= */

@media (max-width: 480px) {

	.avozova-scroll-navigation {
		right: 16px;
		bottom: 16px;
		gap: 7px;
	}

	.avozova-gear__panel {
		bottom: calc(100% + 7px);
		gap: 7px;
	}

}


/* =========================================================
 * 9. REDUCED MOTION
 * ========================================================= */

@media (prefers-reduced-motion: reduce) {

	.avozova-scroll-top,
	.avozova-scroll-bottom,
	.avozova-gear-toggle,
	.avozova-gear__panel > button {
		transition: none;
	}

	.avozova-scroll-top:hover,
	.avozova-scroll-bottom:hover,
	.avozova-gear-toggle:hover,
	.avozova-gear__panel > button:hover {
		transform: none;
	}

	.avozova-gear__panel {
		animation: none;
	}

	.avozova-gear-toggle svg,
	.avozova-gear-toggle[aria-expanded="true"] svg {
		transition: none;
		transform: none;
	}

}