/* ===================================================
   WP Background Effects — Frontend Styles
   =================================================== */

/* Canvas container */
#wbe-container {
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	overflow: hidden;
	will-change: transform;
	transform: translateZ(0);
}

#wbe-canvas {
	display: block;
	width: 100%;
	height: 100%;
	opacity: 0;
}

/* html mantiene il colore di sfondo come base universale per nav mobile,
   dropdown e overlay trasparenti. I valori esatti vengono iniettati via PHP
   con selettori [data-wbe-theme]; questo è il fallback pre-JS. */
html { background-color: #0b0d10; }
html[data-wbe-theme="light"] { background-color: #f0f2f5; }

/* body e wrapper di contenuto trasparenti per far vedere il canvas */
body { background-color: transparent !important; }
.site-content,
.wp-site-blocks { background: transparent; }

/* ===================================================
   Switcher — Floating trigger button
   =================================================== */

#wbe-switcher {
	position: fixed;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
}

.wbe-position-bottom-right { bottom: 24px; right: 24px; align-items: flex-end; }
.wbe-position-bottom-left  { bottom: 24px; left: 24px;  align-items: flex-start; }
.wbe-position-top-right    { top: 24px; right: 24px; flex-direction: column-reverse; align-items: flex-end; }
.wbe-position-top-left     { top: 24px; left: 24px;  flex-direction: column-reverse; align-items: flex-start; }

/* ===================================================
   Switcher — Trigger row (hint + button affiancati)
   =================================================== */

.wbe-trigger-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wbe-position-bottom-right .wbe-trigger-row,
.wbe-position-top-right    .wbe-trigger-row {
	flex-direction: row-reverse;
}

/* ===================================================
   Switcher — Hint tooltip
   =================================================== */

#wbe-hint {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 5px 11px 5px 10px;
	background: rgba(14, 18, 26, 0.90);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 87, 34, 0.28);
	border-radius: 20px;
	color: rgba(255, 255, 255, 0.78);
	font-size: 11px;
	font-family: inherit;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	animation:
		wbe-hint-in  0.45s ease 2.2s both,
		wbe-hint-out 0.45s ease 7.5s both forwards;
}

#wbe-hint.wbe-hint-exit {
	animation: wbe-hint-out 0.4s ease both forwards !important;
}

.wbe-hint-text::before {
	content: '✦';
	font-size: 8px;
	opacity: 0.6;
	margin-right: 5px;
	vertical-align: middle;
}

@keyframes wbe-hint-in {
	from { opacity: 0; transform: translateX(8px); }
	to   { opacity: 1; transform: translateX(0); }
}
@keyframes wbe-hint-out {
	from { opacity: 1; }
	to   { opacity: 0; }
}

.wbe-position-bottom-right #wbe-hint,
.wbe-position-top-right    #wbe-hint {
	animation-name: wbe-hint-in-r, wbe-hint-out;
}

@keyframes wbe-hint-in-r {
	from { opacity: 0; transform: translateX(-8px); }
	to   { opacity: 1; transform: translateX(0); }
}

/* ===================================================
   Switcher — Trigger button
   =================================================== */

#wbe-trigger {
	position: relative;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: linear-gradient(135deg, #FF6B35, #FF5722);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 17px;
	box-shadow:
		0 0 18px rgba(255, 87, 34, 0.55),
		0 3px 10px rgba(0, 0, 0, 0.4);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	flex-shrink: 0;
	outline-offset: 3px;
}

/* Pulse ring animato */
#wbe-trigger::before {
	content: '';
	position: absolute;
	inset: -3px;
	border-radius: 50%;
	border: 2px solid rgba(255, 87, 34, 0.55);
	animation: wbe-pulse-ring 2.4s ease-out infinite;
	pointer-events: none;
}

@keyframes wbe-pulse-ring {
	0%   { transform: scale(1);    opacity: 0.8; }
	65%  { transform: scale(1.42); opacity: 0; }
	100% { transform: scale(1.42); opacity: 0; }
}

#wbe-trigger:hover {
	transform: scale(1.12);
	box-shadow:
		0 0 28px rgba(255, 87, 34, 0.78),
		0 4px 14px rgba(0, 0, 0, 0.5);
}

#wbe-trigger:hover::before {
	animation-duration: 1.2s;
}

#wbe-trigger:focus-visible {
	outline: 2px solid #FF5722;
}

.wbe-trigger-icon {
	display: block;
	line-height: 1;
	color: #fff;
	transition: transform 0.3s ease;
}

#wbe-trigger[aria-expanded="true"] .wbe-trigger-icon {
	transform: rotate(90deg);
}

/* ===================================================
   Switcher — Panel
   =================================================== */

#wbe-panel {
	background: rgba(14, 18, 26, 0.95);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: 12px;
	padding: 5px;
	width: 202px;
	box-sizing: border-box;
	box-shadow:
		0 8px 36px rgba(0, 0, 0, 0.65),
		0 0 0 1px rgba(255, 87, 34, 0.08);
	animation: wbe-panel-appear 0.18s ease both;
	overflow: hidden;
}

#wbe-panel[hidden] { display: none; }

@keyframes wbe-panel-appear {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.wbe-position-top-right #wbe-panel,
.wbe-position-top-left  #wbe-panel {
	animation-name: wbe-panel-appear-top;
}

@keyframes wbe-panel-appear-top {
	from {
		opacity: 0;
		transform: translateY(-8px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* ===================================================
   Switcher — Effect items
   =================================================== */

.wbe-effect-item {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	box-sizing: border-box;
	padding: 5px 8px;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: rgba(255, 255, 255, 0.6);
	font-size: 10px !important;
	line-height: 1.2;
	font-family: inherit;
	cursor: pointer;
	text-align: left;
	transition: background 0.12s ease, color 0.12s ease;
	position: relative;
	overflow: hidden;
}

.wbe-effect-item:hover {
	background: rgba(255, 255, 255, 0.06);
	color: rgba(255, 255, 255, 0.9);
}

.wbe-effect-item.wbe-active {
	background: rgba(255, 87, 34, 0.13);
	color: #FF5722;
}

.wbe-effect-item.wbe-active::before {
	content: '';
	position: absolute;
	left: 0;
	top: 20%;
	bottom: 20%;
	width: 2px;
	border-radius: 2px;
	background: #FF5722;
}

.wbe-effect-item:focus-visible {
	outline: 2px solid rgba(255, 87, 34, 0.6);
	outline-offset: -2px;
}

.wbe-effect-icon {
	font-size: 14px;
	width: 26px;
	min-width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	line-height: 1;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 7px;
	border: 1px solid rgba(255, 255, 255, 0.06);
	transition: background 0.15s ease, border-color 0.15s ease;
}

.wbe-effect-item:hover .wbe-effect-icon {
	background: rgba(255, 255, 255, 0.10);
	border-color: rgba(255, 255, 255, 0.12);
}

.wbe-effect-item.wbe-active .wbe-effect-icon {
	background: rgba(255, 87, 34, 0.18);
	border-color: rgba(255, 87, 34, 0.25);
}

.wbe-effect-label {
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-weight: 400;
	letter-spacing: 0.01em;
	min-width: 0;
}

/* Random item — visually separated from fixed effects */
.wbe-effect-random {
	border-bottom: 1px solid rgba(255, 255, 255, 0.07);
	margin-bottom: 3px;
	padding-bottom: 8px !important;
}

[data-wbe-theme="light"] .wbe-effect-random {
	border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* ===================================================
   Switcher — Theme toggle row
   =================================================== */

#wbe-panel-separator {
	height: 1px;
	background: rgba(255, 255, 255, 0.07);
	margin: 4px 6px;
}

#wbe-theme-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	box-sizing: border-box;
	padding: 5px 8px;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: rgba(255, 255, 255, 0.55);
	font-size: 10px !important;
	line-height: 1.2;
	font-family: inherit;
	cursor: pointer;
	text-align: left;
	transition: background 0.12s ease, color 0.12s ease;
}

#wbe-theme-toggle:hover {
	background: rgba(255, 255, 255, 0.06);
	color: rgba(255, 255, 255, 0.85);
}

#wbe-theme-toggle:focus-visible {
	outline: 2px solid rgba(255, 87, 34, 0.6);
	outline-offset: -2px;
}

.wbe-theme-icon {
	font-size: 14px;
	width: 26px;
	min-width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	line-height: 1;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 7px;
	border: 1px solid rgba(255, 255, 255, 0.06);
	transition: background 0.15s ease, border-color 0.15s ease;
}

#wbe-theme-toggle:hover .wbe-theme-icon {
	background: rgba(255, 255, 255, 0.10);
	border-color: rgba(255, 255, 255, 0.12);
}

.wbe-theme-label {
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-weight: 400;
	letter-spacing: 0.01em;
	min-width: 0;
}

/* ===================================================
   Light theme overrides
   =================================================== */

[data-wbe-theme="light"] #wbe-panel {
	background: rgba(240, 242, 245, 0.97);
	border-color: rgba(0, 0, 0, 0.10);
	box-shadow:
		0 8px 36px rgba(0, 0, 0, 0.18),
		0 0 0 1px rgba(255, 87, 34, 0.10);
}

[data-wbe-theme="light"] .wbe-effect-item {
	color: rgba(30, 30, 40, 0.65);
}

[data-wbe-theme="light"] .wbe-effect-item:hover {
	background: rgba(0, 0, 0, 0.06);
	color: rgba(30, 30, 40, 0.95);
}

[data-wbe-theme="light"] .wbe-effect-item.wbe-active {
	background: rgba(200, 68, 0, 0.10);
	color: #b83e00;
}

[data-wbe-theme="light"] .wbe-effect-item.wbe-active::before {
	background: #b83e00;
}

[data-wbe-theme="light"] .wbe-effect-item:focus-visible {
	outline-color: rgba(180, 60, 0, 0.6);
}

[data-wbe-theme="light"] .wbe-effect-icon {
	background: rgba(0, 0, 0, 0.05);
	border-color: rgba(0, 0, 0, 0.08);
}

[data-wbe-theme="light"] .wbe-effect-item:hover .wbe-effect-icon {
	background: rgba(0, 0, 0, 0.09);
	border-color: rgba(0, 0, 0, 0.13);
}

[data-wbe-theme="light"] .wbe-effect-item.wbe-active .wbe-effect-icon {
	background: rgba(200, 68, 0, 0.12);
	border-color: rgba(200, 68, 0, 0.22);
}

[data-wbe-theme="light"] #wbe-panel-separator {
	background: rgba(0, 0, 0, 0.08);
}

[data-wbe-theme="light"] #wbe-theme-toggle {
	color: rgba(30, 30, 40, 0.60);
}

[data-wbe-theme="light"] #wbe-theme-toggle:hover {
	background: rgba(0, 0, 0, 0.06);
	color: rgba(30, 30, 40, 0.90);
}

[data-wbe-theme="light"] .wbe-theme-icon {
	background: rgba(0, 0, 0, 0.05);
	border-color: rgba(0, 0, 0, 0.08);
}

[data-wbe-theme="light"] #wbe-theme-toggle:hover .wbe-theme-icon {
	background: rgba(0, 0, 0, 0.09);
	border-color: rgba(0, 0, 0, 0.13);
}

[data-wbe-theme="light"] #wbe-hint {
	background: rgba(240, 242, 245, 0.94);
	border-color: rgba(200, 68, 0, 0.25);
	color: rgba(30, 30, 40, 0.80);
}

/* Logo — transition smooth (l'inversione/swap è gestita via inline CSS + JS) */
.site-logo img,
.navigation-logo img,
.navigation-branding img {
	transition: filter .3s ease;
}

/* ===================================================
   Mobile
   =================================================== */

@media (max-width: 767px) {
	#wbe-switcher {
		bottom: 16px !important;
		left: 16px !important;
		right: auto !important;
		top: auto !important;
		align-items: flex-start !important;
		flex-direction: column !important;
	}

	.wbe-trigger-row {
		flex-direction: row !important;
	}

	#wbe-panel {
		width: min(202px, calc(100vw - 40px));
	}

	#wbe-hint {
		font-size: 10px;
		padding: 4px 9px 4px 8px;
	}
}
