// variable support
@import 'const/static';

[data-theme="dark"] {
	* {
		background-color: $black !important;
		color: $white !important;
	}
	input, textarea, select {
		border-color: $white !important;
	}
	input::placeholder {
		color: $white;
		opacity: .675;
	}
	textarea::placeholder {
		color: $white;
		opacity: .675;
	}
	&[data-highlight="yes"]{
		button, a {
			outline: 1px solid $teal !important;
			&.link-fail {
				outline-color: red !important;
			}
		}
	}
	button, [role="button"] {
		border-color: $white !important;
		&.link-fail {
			outline-color: red !important;
		}
	}
	.candescent {
		hr {
			background-color: $green !important;
		}
	}
	.candescent__toggle {
		border-color: $teal;
		background-color: $green !important;
		svg {
			background-color: transparent !important;
			path {
				fill: $teal;
			}
		}
		&:hover, &:focus-visible {
			border-color: $teal-hover;
			svg {
				path {
					fill: $teal-hover;
				}
			}
		}
	}
	.candescent__options-container {
		.adjustment-container, .accessibility-container {
			> a {
				svg {
					path {
						stroke: $white;
					}
				}
				&:hover {
					svg {
						path {
							fill: $green;
						}
					}
				}
			}
		}
	}
	.candescent__options-container.active {
		border-color: $teal-hover;
	}
	.candescent__options-details-container {
		svg {
			path {
				fill: $teal-hover;
			}
		}
	}
	.candescent__widget-button {
		border-color: $green-dark !important;
		background-color: $green-dark !important;
		outline-offset: 2px;
		&:hover, &:focus-visible {
			background-color: $green-dark !important;
			border-color: $white !important;
		}
		&.active {
			background-color: $black !important;
		}
	}
	.candescent__widget-button--close {
		border-color: $green-dark !important;
		background-color: $black !important;
		&:hover, &:focus-visible {
			background-color: $black !important;
			border-color: $white !important;
		}
	}
	.candescent__widget-button:not(.candescent__widget-button--close) {
		span {
			svg {
				path {
					fill: $white;
				}
			}
		}
	}
	.candescent__notice-close, .candescent__notice {
		border-color: $teal;
	}
	.candescent__notice-close {
		svg {
			background-color: transparent !important;
			path {
				stroke: $white;
			}
		}
		&:hover {
			background-color: $green-dark !important;
		}
	}
	.candescent__notice ul li span.color-bg span, .candescent__notice ul li span.color-f span {
		border-color: $white;
	}
}

[data-zoom="large"] {
	zoom: 120%;
	@include medium {
		zoom: 130%;
	}
	@include xlarge {
		zoom: 135%;
	}
	.candescent__toggle {
		height: 44px;
		width: 44px;
		padding: 3px 0 0;
		@include large {
			height: 44px;
			width: 44px;
			padding: 4px 0 0;
		}
		svg {
			height: 48px;
		}
	}
	svg {
		zoom: 66.6667% !important;
	}
	.candescent__options-container {
		gap: 16px;
		p {
			font-size: .9375rem;
			@include large {
				font-size: 1.125rem;
			}
		}
		.adjustment-container, .accessibility-container {
			> a {
				svg {
					width: 24px;
				}
			}
		}
	}
	.candescent__options-container.active {
		height: 460px;
		max-height: 40vh;
		padding: 16px;
		@include large {
			height: 460px;
			padding: 16px 20px;
			max-height: 55vh;
		}
	}
	.candescent__options-details-container {
		h2 {
			flex-wrap: wrap;
			svg {
				height: 48px;
			}
		}
	}
	.candescent__widget-button {
		gap: 12px;
	}
	.candescent__notice-container {
		max-height: 45vh;
		overflow-y: auto;
		padding-right: 12px;
	}
	.candescent.admin {
		.candescent__options-container.active {
			height: 500px;
			max-height: 40vh;
			padding: 16px;
			@include large {
				height: 500px;
				padding: 16px 20px;
				max-height: 55vh;
			}
		}
	}
}

[data-highlight="yes"]{
	button, a {
		outline: 1px solid $purple-dark !important;
		outline-offset: 2px !important;
		&.candescent__contrast-fail {
			outline-color: red !important;
			outline-offset: 4px !important;
		}
	}
}

[data-focus="yes"]{
	button, a, [tabindex="0"] {
		&:focus-visible {
			outline: 1px auto Highlight !important;
			outline: -webkit-focus-ring-color auto 1px !important;
		}
	}
}

.candescent {
	*,
	* * {
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
		font-family: sans-serif !important;
	}
	h2, p, a, li {
		font-family: sans-serif !important;
	}
	&__toggle {
		position: fixed;
		bottom: 12px;
		width: 48px;
		height: 48px;
		left: 8px;
		background-color: $teal;
		border-radius: 8px;
		z-index: 9999999;
		box-shadow: 1px 1px 8px rgba(0, 0, 0, .33);
		display: flex;
		align-items: center;
		justify-content: center;
		border: 2px solid $green;
		background-image: none;
		padding: 6px 0 0;
		cursor: pointer;
		transition: all $trans-med ease;
		@include large {
			bottom: 20px;
			left: 15px;
			width: 52px;
			height: 52px;
		}
		svg {
			width: auto;
			height: 40px;
			path {
				fill: $green;
				transition: fill $trans-med ease;
			}
		}
		&:hover, &:focus-visible {
			box-shadow: 1px 1px 1px rgba(0, 0, 0, .33);
			background-color: $teal-hover;
		}
		&:focus-visible {
			outline-offset: 4px;
		}
		&:focus {
			background-color: $teal;
		}
	}
	&__options-container {
		position: fixed;
		bottom: 12px;
		width: 0;
		height: 0;
		left: 8px;
		background-color: $teal;
		border-radius: 8px;
		border: 0;
		padding: 0;
		z-index: 10000000;
		display: flex;
		flex-direction: column;
		gap: 16px;
		overflow-x: hidden;
		overflow-y: auto;
		visibility: hidden;
		box-shadow: 1px 1px 8px rgba(0, 0, 0, .33);
		transition: all $trans-fast ease;
		&.active {
			height: 290px;
			width: 325px;
			max-width: 80%;
			visibility: visible;
			padding: 16px 24px;
			border: 3px solid $green;
			@include medium {
				height: 460px;
        		max-height: 80vh;
			}
		}
		@include large {
			bottom: 20px;
			left: 15px;
		}
		p {
			font-size: 1.125rem;
			margin: 0;
			font-weight: $font-weight-med;
			line-height: 1.33;
			color: $green;
			text-align: left;
		}
		.adjustment-container, .accessibility-container {
			display: flex;
			align-items: center;
			margin-bottom: -8px;
			margin-top: -8px;
			> a {
				display: inline-flex;
				align-items: center;
				justify-content: center;
				width: 44px;
				height: 44px;
				outline-offset: -5px !important;
				border-radius: 10px;
				svg {
					width: 18px;
					height: auto;
					path {
						transition: fill $trans-med ease;
					}
				}
				&:hover {
					svg {
						path {
							fill: $teal-hover;
						}
					}
				}
			}
		}
	}
	&__options-details-container {
		h2 {
			font-size: 1.25rem;
			color: $green;
			margin: 0;
			font-weight: $font-weight-bold;
			display: flex;
			align-items: center;
			gap: 4px;
			flex-wrap: wrap;
			@include large {
				letter-spacing: .5px;
			}
			span {
				font-weight: normal;
				font-family: inherit;
				letter-spacing: normal;
				color: inherit;
			}
			svg {
				height: 35px;
				width: auto;
			}
		}
	}
	&__widget-button {
		display: inline-flex;
		align-items: center;
		justify-content: flex-start;
		gap: 16px;
		border: 3px solid $green;
		width: 100%;
		height: 44px;
		min-height: 44px;
		border-radius: 12px;
		background-color: $green;
		padding: 4px 20px;
		color: $white;
		font-size: .9375rem;
		text-transform: none;
		box-shadow: none;
		text-align: left;
		text-decoration: none;
		line-height: normal;
		letter-spacing: normal;
		background-image: none;
		font-weight: $font-weight-med;
		cursor: pointer;
		position: relative;
		transition: all $trans-med ease;
		span {
			width: 1.5rem;
			height: 1.125rem;
			background-color: transparent !important;
			transition: all $trans-med ease;
			svg {
				width: 100%;
				height: 100%;
				background-color: transparent !important;
				transition: all $trans-med ease;
				path {
					transition: all $trans-med ease;
					fill: $white;
				}
			}
		}
		&:hover, &:focus-visible {
			border-color: $white;
			background-color: $green;
		}
		&:focus-visible {
			outline-offset: 3px;
		}
		&:focus {
			background-color: $green;
		}
		&::after {
			content: '';
			position: absolute;
			inset: 0;
		}
		&.active {
			background-color: $green-dark;
			border-color: $green-dark;
			color: $white;
			span {
				svg {
					path {
						fill: $white;
					}
				}
			}
			&:hover, &:focus-visible {
				border-color: $white;
			}
		}
	}
	hr {
		min-height: 2px;
		width: 100%;
		background-color: $teal-hover;
		border: 0;
		margin: 0;
	}
	&__close {
		justify-content: center;
		background-color: transparent;
		color: $green;
		font-weight: $font-weight-semi;
		&:hover, &:focus, &:focus-visible {
			background-color: transparent;
		}
	}
	&__notice {
		visibility: hidden;
		z-index: 10000001;
		opacity: 0;
		transition: all 0s ease;
		padding: 16px;
		border: 1px solid $purple;
		background-color: #fff;
		width: 600px;
		width: 750px;
		max-width: 75%;
		position: fixed;
		top: 50%;
		left: 50%;
		box-shadow: 1px 1px 8px rgba(0, 0, 0, .33);
		transform: translate(-50%, -50%);
		border-radius: 8px;
		@include large {
			padding: 32px 24px;
		}
		p {
			font-size: 1rem;
			margin-bottom: 32px;
			color: #212721;
			&.link-fix-details {
				margin: 0 0 12px;
			}
			span {
				color: $purple;
				font-size: 1.125rem;
				font-weight: $font-weight-semi;
				border: 1px solid;
				padding: 2px;
				border-radius: 2px;
			}
			.dash {
				border: 1px dashed red;
				font-size: 1rem;
				font-weight: normal;
				color: $black;
			}
			.solid {
				border: 1px solid red;
				font-size: 1rem;
				font-weight: normal;
				color: $black;
			}
			.thick-solid {
				border: 2px solid red;
				font-size: 1rem;
				font-weight: normal;
				color: $black;
			}
			.dotted {
				border: 2px dotted red;
				font-size: 1rem;
				font-weight: normal;
				color: $black;
			}
			a {
				color: $green;
				font-weight: $font-weight-bold;
				text-decoration: underline;
				&:hover {
					text-decoration: underline;
				}
			}
		}
		ul {
			margin-bottom: 32px;
			padding-left: 14px;
			li {
				margin-bottom: 12px;
				padding-bottom: 12px;
				border-bottom: 1px solid $black;
				color: #212721;
				a {
					word-wrap: break-word;
					font-family: sans-serif;
					font-size: .9375rem;
					&:hover {
						text-decoration: underline;
					}
				}
				.img-error {
					background-size: contain;
					background-position: center;
					background-repeat: no-repeat;
					width: 135px;
					height: 135px;
					display: block;
					border-radius: 4px;
					box-shadow: 1px 1px 5px rgba(0, 0, 0, .33);
				}
				span.color-f, span.color-bg {
					display: flex;
					align-items: center;
					gap: 8px;
					margin-top: 8px;
					color: #212721;
					span {
						display: inline-block;
						height: 16px;
						width: 16px;
						border: 1px solid $black;
						margin: 0;
						border-radius: 50%;
					}
				}
				> ul {
					margin-top: 10px;
					margin-bottom: 0;
					li {
						border: 0;
						font-size: .9375rem;
						word-wrap: break-word;
						display: block;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						line-height: 1.33;
						max-height: 2.67rem;
						-webkit-box-orient: vertical;
						overflow: hidden;
						text-overflow: ellipsis;
						visibility: visible; 
						&:last-child {
							margin: 0;
						}
					}
				}
			}
			&.link-fix-list {
				margin: 0 0 24px;
				li {
					padding: 0;
					margin: 0 0 4px;
					border: 0;
				}
			}
		}
		.contrast-links {
			margin: 0 0 14px;
		}
		&.active {
			opacity: 1;
			visibility: visible;
		}
	}

	&__notice-container{
		max-height: 75vh;
		overflow-y: auto;
		padding-right: 24px;
		p:last-of-type {
			margin-bottom: 24px;
		}
		h2 {
			font-size: 1.375rem;
			font-weight: 700;
			color: #212721;
		}
		.help-list {
			margin-bottom: 0;
			li {
				h3 {
					font-size: 1.125rem;
					font-weight: 500;
					margin: 15px 0 0;
					color: #212721;
				}
				p {
					font-size: .9375rem;
    				margin: 12px 0 4px;
				}
			}
		}
		> ul {
			li {
				font-size: .9375rem;
			}
		}
	}


	.candescent__notice:has(.candescent__notice-container.none) {
		width: 400px;
		text-align: center;
	}
	
	&__notice-close {
		background-color: $white;
		border: 1px solid $purple;
		box-shadow: 1px 1px 4px rgba(0, 0, 0, .33);
		border-radius: 50%;
		position: absolute;
		top: -16px;
		right: -16px;
		width: 42px;
		height: 42px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		transition: all $trans-med ease;
		outline-offset: 3px;
		&:hover {
			background-color: $teal;
		}
	}
}

.ratio-help {
	color: $black;
	font-size: .9375rem;
	font-family: sans-serif;
	span {
		display: block;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-height: 1.33;
        max-height: 2.67rem;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        visibility: visible; 
		margin-bottom: 8px;
	}
}

img {
	&.candescent__missing-alt {
		outline: 4px solid red;
    	outline-offset: 4px;
	}
}

* {
	&.candescent__contrast-fail {
		outline: 2px dashed red;
    	outline-offset: 4px;
	}
	&.candescent__duplicate-fail {
		outline: 2px dotted red;
		outline-offset: 5px;
	}
}

a, button {
	&:focus {
		outline: 0;
	}
	&.candescent__link-fail {
		outline: 2px solid red;
    	outline-offset: 3px;
	}
}

.candescent.admin {
	.candescent__options-container.active {
		height: 340px;
		width: 325px;
		max-width: 80%;
		visibility: visible;
		padding: 16px 24px;
		border: 3px solid $green;
		@include large {
			height: 765px;
			max-height: 80vh;
		}
	}
}