/**
 * AEDV Dark Mode toggle only; no page palette overrides.
 * Stacking contract (host values from the plan; verify in browser):
 * cookie banners / desktop live chat: 1039–1050 / 9999–10000
 * toggle: 99000; WordPress admin bar / some cookie layers: 99999
 * cookie modal / mobile chat panel: 999999
 * The latter layers intentionally cover this button.
 */
#aedv-dm-toggle {
	position: fixed;
	top: calc(var(--wp-admin--admin-bar--height, 0px) + 8px);
	right: max(8px, env(safe-area-inset-right));
	bottom: auto;
	left: auto;
	z-index: 99000;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 44px;
	min-width: 44px;
	height: 44px;
	min-height: 44px;
	margin: 0;
	padding: 8px;
	border: 2px solid #222;
	border-radius: 50%;
	background: #fff;
	color: #222;
	box-shadow: 0 0 0 2px #fff;
	cursor: pointer;
	line-height: 1;
	text-transform: none;
	transition: background-color 120ms ease, color 120ms ease;
	-webkit-tap-highlight-color: transparent;
}

/* Do not let a theme's button display rule defeat progressive enhancement. */
#aedv-dm-toggle[hidden] {
	display: none !important;
}

#aedv-dm-beta-notice[hidden] {
	display: none !important;
}

#aedv-dm-beta-notice {
	position: fixed;
	inset: 0;
	z-index: 1000000;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 24px;
	background: rgb(0 0 0 / 65%);
}

#aedv-dm-beta-notice .aedv-dm-beta-notice__panel {
	box-sizing: border-box;
	width: min(100%, 560px);
	padding: 28px;
	border: 1px solid #555;
	border-radius: 8px;
	background: #fff;
	color: #222;
	box-shadow: 0 12px 36px rgb(0 0 0 / 35%);
}

#aedv-dm-beta-notice h2 {
	margin: 0 0 12px;
	color: inherit;
	font-size: 1.35rem;
}

#aedv-dm-beta-notice p {
	margin: 0 0 20px;
	color: inherit;
}

#aedv-dm-beta-notice .aedv-dm-beta-notice__close {
	padding: 9px 16px;
	border: 2px solid #222;
	border-radius: 4px;
	background: #222;
	color: #fff;
	cursor: pointer;
}

#aedv-dm-beta-notice .aedv-dm-beta-notice__close:focus-visible {
	outline: 3px solid #1a73e8;
	outline-offset: 3px;
}

html[data-aedv-theme="dark"] #aedv-dm-beta-notice .aedv-dm-beta-notice__panel {
	border-color: #666;
	background: #1e1e1e;
	color: #f5f5f5;
}

body.admin-bar #aedv-dm-toggle {
	top: calc(var(--wp-admin--admin-bar--height, 32px) + 8px);
}

#aedv-dm-toggle[data-aedv-position$="left"] {
	right: auto;
	left: max(8px, env(safe-area-inset-left));
}

#aedv-dm-toggle[data-aedv-position^="bottom"] {
	top: auto;
	bottom: max(8px, env(safe-area-inset-bottom));
}

#aedv-dm-toggle:hover {
	background: #e8e8e8;
	color: #111;
}

#aedv-dm-toggle[aria-pressed="true"] {
	background: #222;
	color: #fff;
}

#aedv-dm-toggle[aria-pressed="true"]:hover {
	background: #444;
}

#aedv-dm-toggle:active {
	border-color: currentColor;
	box-shadow: 0 0 0 2px #fff, inset 0 0 0 2px currentColor;
}

/* Two-tone focus indicator remains distinct on both light and dark pages. */
#aedv-dm-toggle:focus-visible {
	outline: 3px solid #111;
	outline-offset: 3px;
	box-shadow: 0 0 0 3px #fff;
}

#aedv-dm-toggle .aedv-dm-icon {
	display: block;
	flex: none;
	width: 24px;
	height: 24px;
	pointer-events: none;
}

#aedv-dm-toggle .aedv-dm-icon-sun,
#aedv-dm-toggle[aria-pressed="true"] .aedv-dm-icon-moon {
	display: none;
}

#aedv-dm-toggle[aria-pressed="true"] .aedv-dm-icon-sun {
	display: block;
}

@media screen and (max-width: 782px) {
	body.admin-bar #aedv-dm-toggle {
		top: calc(var(--wp-admin--admin-bar--height, 46px) + 8px);
	}
}

/* Keep bottom positions independent of the admin bar, at all breakpoints. */
body.admin-bar #aedv-dm-toggle[data-aedv-position^="bottom"] {
	top: auto;
}

@media (prefers-reduced-motion: reduce) {
	#aedv-dm-toggle {
		transition: none;
	}
}

@media (forced-colors: active) {
	#aedv-dm-toggle {
		border: 2px solid ButtonText;
		background: ButtonFace;
		color: ButtonText;
	}

	#aedv-dm-toggle:focus-visible {
		outline-color: Highlight;
	}
}

@media print {
	#aedv-dm-toggle,
	#aedv-dm-beta-notice {
		display: none !important;
	}
}
