/* ==========================================================================
   Imagint Dark Mode (front end)
   ========================================================================== */

/* --- Show in light / dark mode only (Advanced > Dark Mode > Show in) ------ */
html[data-theme="dark"] body:not(.elementor-editor-active) .imagint-show-light,
html:not([data-theme="dark"]) body:not(.elementor-editor-active) .imagint-show-dark {
	display: none !important;
}

/* In the Elementor editor keep hidden elements selectable, just faded. */
html[data-theme="dark"] body.elementor-editor-active .imagint-show-light,
html:not([data-theme="dark"]) body.elementor-editor-active .imagint-show-dark {
	opacity: .4;
	outline: 1px dashed rgba(127, 127, 127, .7);
}

/* --- Smooth color change while switching (class is removed after 350ms) --- */
html.imagint-theme-transition,
html.imagint-theme-transition *,
html.imagint-theme-transition *::before,
html.imagint-theme-transition *::after {
	transition: background-color .3s ease, color .3s ease, border-color .3s ease, fill .3s ease, stroke .3s ease !important;
}

@media (prefers-reduced-motion: reduce) {
	html.imagint-theme-transition,
	html.imagint-theme-transition *,
	html.imagint-theme-transition *::before,
	html.imagint-theme-transition *::after {
		transition: none !important;
	}
}

/* --- Ready-made toggle button ([imagint_dark_toggle]) --------------------- */
.imagint-dark-toggle--icon,
.imagint-dark-toggle--switch {
	--imagint-dt-size: 22px;
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	line-height: 0;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.imagint-dark-toggle--icon:focus-visible,
.imagint-dark-toggle--switch:focus-visible,
.imagint-dark-toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.imagint-dt-icon {
	display: none;
	align-items: center;
	justify-content: center;
}

.imagint-dt-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Light mode shows the moon (click to go dark); dark mode shows the sun. */
.imagint-dt-moon { display: inline-flex; }
html[data-theme="dark"] .imagint-dt-moon { display: none; }
html[data-theme="dark"] .imagint-dt-sun { display: inline-flex; }

/* Icon style */
.imagint-dark-toggle--icon .imagint-dt-track {
	display: inline-flex;
}

.imagint-dark-toggle--icon .imagint-dt-icon {
	width: var(--imagint-dt-size);
	height: var(--imagint-dt-size);
	transition: transform .35s ease;
}

.imagint-dark-toggle--icon:hover .imagint-dt-icon {
	transform: rotate(18deg);
}

/* Switch style */
.imagint-dark-toggle--switch .imagint-dt-track {
	position: relative;
	display: inline-block;
	width: calc(var(--imagint-dt-size) * 2.5);
	height: calc(var(--imagint-dt-size) * 1.3);
	border-radius: 999px;
	border: 1.5px solid currentColor;
	box-sizing: border-box;
}

.imagint-dark-toggle--switch .imagint-dt-icon {
	position: absolute;
	top: 50%;
	width: calc(var(--imagint-dt-size) * .85);
	height: calc(var(--imagint-dt-size) * .85);
	margin-top: calc(var(--imagint-dt-size) * -.425);
	left: calc(var(--imagint-dt-size) * .18);
	transition: left .25s ease;
}

html[data-theme="dark"] .imagint-dark-toggle--switch .imagint-dt-icon {
	left: calc(100% - var(--imagint-dt-size) * 1.03);
}

@media (prefers-reduced-motion: reduce) {
	.imagint-dark-toggle--icon .imagint-dt-icon,
	.imagint-dark-toggle--switch .imagint-dt-icon {
		transition: none;
	}
	.imagint-dark-toggle--icon:hover .imagint-dt-icon {
		transform: none;
	}
}

/* Any custom element used as a toggle */
.imagint-dark-toggle {
	cursor: pointer;
}

/* --- Floating toggle ------------------------------------------------------ */
.imagint-dark-floating {
	position: fixed;
	z-index: 9998;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	color: #1b1f27;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .22);
}

html[data-theme="dark"] .imagint-dark-floating {
	background: #1b1f27;
	color: #f2f2f2;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .6);
}

.imagint-dark-floating--bottom-right { right: 20px; bottom: 20px; }
.imagint-dark-floating--bottom-left { left: 20px; bottom: 20px; }
.imagint-dark-floating--top-right { right: 20px; top: 20px; }
.imagint-dark-floating--top-left { left: 20px; top: 20px; }

body.admin-bar .imagint-dark-floating--top-right,
body.admin-bar .imagint-dark-floating--top-left {
	top: 52px;
}
