/* Accessibility controller theme tokens */
:root {
	--a11y-surface: var(--addams-tan);
	--a11y-text: var(--font-color);
	--a11y-contrast-bg: var(--black);
	--a11y-contrast-fg: var(--addams-tan);
	--a11y-rule: var(--color__rule);
	--a11y-toggle-track: var(--addams-tan);
	--a11y-toggle-thumb: var(--black);
	--a11y-focus: var(--black);
}

html.theme-dark {
	--a11y-surface: var(--addams-black);
	--a11y-text: var(--addams-footer-tan);
	--a11y-contrast-bg: var(--addams-footer-tan);
	--a11y-contrast-fg: var(--addams-black);
	--a11y-rule: var(--addams-footer-tan);
	--a11y-toggle-track: var(--addams-black);
	--a11y-toggle-thumb: var(--addams-footer-tan);
	--a11y-focus: var(--addams-footer-tan);
}

.menu-btn:focus,
.controls button:focus,
.controls button.accessibility-toggle.is-active {
	outline: 1px solid rgba(160, 159, 159, 0.8) !important;
	outline-offset: 2px;
	border-radius: 5px;
}

.controls button.accessibility-toggle.is-active .text,
.mobile-controls button.accessibility-toggle .text {
	position: relative;
	left: inherit;
	width: auto;
	height: auto;
	padding-left: .25rem;
}

.accessibility-close .svg-fill,
.accessibility-toggle .svg-fill,
.accessibility-header .svg-fill {
	fill: currentColor;
}

html.theme-dark .accessibility-close svg[stroke="black"] {
	stroke: var(--addams-tan);
}

.accessibility-close img {
	width: 14px;
	height: 14px;
}

@media (min-width: 767px) {
	.menu-btn:focus,
	.controls button:focus,
	.controls button.accessibility-toggle.is-active {
		border: 1px solid rgba(0, 0, 0, 1);
		color: var(--a11y-contrast-fg);
		background: var(--a11y-contrast-bg);
	}
	.accessibility-toggle:focus .svg-fill,
	.accessibility-toggle.is-active .svg-fill {
		fill: var(--a11y-contrast-fg);
	}
}


.accessibility-modal {
	position: fixed;
	top: 2rem;
	right: 1.6rem;
	width: 36%;
	z-index: 1000;
	background-color: var(--a11y-surface);
}

.accessibility-modal * {
	font-size: 2.2rem;
}

.accessibility-modal-dialog {
	display: flex;
	flex-flow: column nowrap;
	align-items: flex-start;
	justify-content: space-between;
	width: 100%;
	height: 100%;
	border-radius: var(--border-radius);
	background-color: var(--a11y-surface);
	color: var(--a11y-text);
	padding: 2rem 2rem 4rem 2rem;
	border: 1px solid var(--a11y-rule, transparent);
}

.accessibility-header {
	width: 100%;
	position: relative;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.accessibility-center {
	display: flex;
	gap: .5rem;
}

.accessibility-close {
	position: absolute;
	right: 0;
	top: unset;
	transform: unset;
	margin: 0;
	background: transparent;
	border: none;
	display: flex;
	flex-flow: column nowrap;
	justify-content: center;
	align-items: center;
	width: 14px;
	height: 14px;
	padding: 0;
}

.accessibility-wrapper button {
	background: transparent;
	padding: 0 .5rem;
	border: none;
}

.control-wrapper {
	display: flex;
	flex-flow: row nowrap;
	justify-content: flex-start;
	align-items: center;
	/* margin-bottom: 1rem; */
}

.accessibility-wrapper {
	display: flex;
	flex-flow: row nowrap;
	padding-top: 2rem;
	margin-inline: var(--margin-inline__header);
}

.outside-controls {
	padding: 0 2rem;
	background: var(--a11y-surface);
	border-radius: var(--border-radius);
	border: 1px solid var(--a11y-rule, var(--colorWhite));
}

.accessibility-controls {
	background: var(--a11y-surface);
}

#theme-toggle {
	-moz-appearance: none;
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background: transparent;
	padding: 0;
	margin: 0 1rem 0 0;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
}

#theme-toggle .theme-toggle-icon {
	position: relative;
	width: 44px;
	height: 24px;
	border-radius: 999px;
	border: 2px solid var(--a11y-rule);
	background: var(--a11y-toggle-track);
	display: inline-block;
}

#theme-toggle .theme-toggle-icon::before {
	content: "";
	position: absolute;
	width: 20px;
	height: 20px;
	background: var(--a11y-toggle-thumb);
	border-radius: 50%;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	transition: transform 0.2s ease;
}

#theme-toggle[aria-pressed="true"] .theme-toggle-icon {
	background: var(--a11y-toggle-thumb);
	border-color: var(--a11y-rule);
}

#theme-toggle[aria-pressed="false"] .theme-toggle-icon::before {
	transform: translate(20px, -50%);
}

#theme-toggle[aria-pressed="true"] .theme-toggle-icon::before {
	transform: translateY(-50%) scale(105%);
	background: var(--a11y-toggle-track);
}

#theme-toggle:focus-visible .theme-toggle-icon {
	outline: 2px solid var(--a11y-focus);
	outline-offset: 3px;
}

#theme-toggle:active .theme-toggle-icon::before {
	transform: translateY(-50%) scale(0.96);
}

#theme-toggle[aria-pressed="true"]:active .theme-toggle-icon::before {
	transform: translate(20px, -50%) scale(0.96);
}

#theme-toggle:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

#motion-toggle,
#motion-setting,
.act-well-animation__motion-toggle {
	-moz-appearance: none;
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background: transparent;
	padding: 0;
	margin: 0 1rem 0 0;
	cursor: pointer;
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
}

/* Circle background */
#motion-toggle::before,
#motion-setting::before,
.act-well-animation__motion-toggle::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid var(--a11y-rule);
	background: var(--a11y-toggle-thumb);
}

/* Icon (default: PAUSE) */
#motion-toggle::after,
#motion-setting::after,
.act-well-animation__motion-toggle::after {
	content: "";
	position: relative;
	width: 14px;
	height: 14px;
	background-image: url(../images/pause.svg);
	background-size: 8px 8px;
	background-repeat: no-repeat;
	background-position: center;
}
html.theme-dark #motion-toggle::after,
html.theme-dark #motion-setting::after,
html.theme-dark .act-well-animation__motion-toggle::after {
	background-image: url(../images/pause_k.svg);
}

/* Paused: PLAY icon */
#motion-toggle[aria-pressed="true"]::after,
#motion-setting[aria-pressed="true"]::after,
.act-well-animation__motion-toggle[aria-pressed="true"]::after {
	background-image: url(../images/play.svg);
	background-size: 10px 10px;
	background-repeat: no-repeat;
	background-position: 3px 2.5px;
}
html.theme-dark #motion-toggle[aria-pressed="true"]::after,
html.theme-dark #motion-setting[aria-pressed="true"]::after,
html.theme-dark .act-well-animation__motion-toggle[aria-pressed="true"]::after {
	background-image: url(../images/play_k.svg);
}

/* Focus ring (don’t swap icons on focus) */
#motion-toggle:focus-visible::before,
#motion-setting:focus-visible::before,
.act-well-animation__motion-toggle:focus-visible::before {
	outline: 2px solid var(--a11y-focus);
	outline-offset: 3px;
}

/* Active feedback */
#motion-toggle:active,
#motion-setting:active,
.act-well-animation__motion-toggle:active {
	transform: scale(0.96);
}

#motion-toggle:disabled,
#motion-setting:disabled,
.act-well-animation__motion-toggle:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

#motion-toggle-label .activated,
#theme-toggle-label .activated {
	display: none;
}

#motion-toggle-label.is-active .activated,
#theme-toggle-label.is-active .activated {
	display: inline;
}

#motion-toggle:focus,
#motion-setting:focus,
.act-well-animation__motion-toggle:focus,
#theme-toggle:focus {
	border-radius: 999px;
}

/* When motion is paused, freeze CSS animation + smooth scrolling + transitions */
html.motion-paused *:not(.mandatory-animation),
html.motion-paused *:not(.mandatory-animation)::before,
html.motion-paused *:not(.mandatory-animation)::after {
	animation-play-state: paused !important;
	transition-property: none !important;
	scroll-behavior: auto !important;
}
html.motion-paused *.mandatory-animation {
	animation-duration: 0s !important;
	animation-delay: 0s !important;
}

h2#accessibility-modal-title {
	margin:0;
}
.accessibility-info h3 {
	margin-bottom:0;
	line-height: 3rem;
}
p#theme-toggle-desc,
.accessibility-info p:last-child {
	margin-bottom:0;
}

.accessibility-info a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}

@media (max-width: 767px) {
	.accessibility-header {
		justify-content: space-between;
	}
	.accessibility-wrapper {
		flex-direction: column;
		gap: 2rem 0;
		overflow-y: scroll;
	}
	.accessibility-modal-dialog {
		max-height: calc(100lvh - 5rem);
	}
}