/* CWD Modal Popups (extracted from cwd_utilities.css for CPEP child theme)
   - Styles for the popup/lightbox system used by cwd_popups.js
   - Gallery navigation (next/prev) for image gallery popup mode
   ------------------------------------------------------------------ */

#popup .hidden { /* reinforce the "visually hidden" class used, to allow compatibility with Bootstrap class names */
	position: absolute;
	left: -10000em;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
	display: block !important;
}

#popup-wrapper {
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	z-index: 3001;
	display: none;
}

@keyframes popup-finesse {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}
#popup-wrapper.calculating {
	opacity: 0;
}

#popup-wrapper.calculating-done {
	opacity: 1;
	animation-name: popup-finesse;
	animation-duration: 0.2s;
}

#popup-wrapper > .vertical-align {
	width: 100%;
	height: 100%;
}

#popup {
	background: #fff;
	border: 1px solid #666;
	border-bottom-color: #333;
	padding: 10px;
	position: relative;
	left: auto !important;
	margin: 0 auto;
	max-width: 100%;
	max-height: 100%;
	box-sizing: border-box;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
	-webkit-font-smoothing: subpixel-antialiased;
}

.touch #popup {
	-webkit-overflow-scrolling: touch;
	overflow-y: auto;
}

#popup.image {
	padding: 2px;
	border: 0;
}

#popup.fullscreen {
	position: fixed;
	border: 0;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	width: auto !important;
	height: auto !important;
	max-width: none !important;
	left: 0 !important;
	right: 0 !important;
	top: 0 !important;
	bottom: 0 !important;
	background: #f7f7f7;
}
@media (min-width: 768px) {
	#popup.fullscreen {
		top: auto !important;
		bottom: auto !important;
		left: 2% !important;
		right: 2% !important;
		left: 2vw !important;
		right: 2vw !important;
	}
}
#popup.fullscreen:not(.video) .caption {
	background: #fff;
	color: #707070;
}

@media only screen and (max-width: 767px) {
	#popup:not(.image) {
		position: fixed;
		border: 0;
		overflow: auto;
		-webkit-overflow-scrolling: touch;
		width: auto !important;
		height: auto !important;
		max-width: none !important;
		left: 0 !important;
		right: 0 !important;
		top: 0 !important;
		bottom: 0 !important;
	}
	#popup {
		max-height: 100vh;
	}
	#popup:not(.image) > div > h2:first-child, #popup:not(.image) > div > h2:first-child, #popup:not(.image) > div > h3:first-child, #popup:not(.image) > div > h4:first-child {
		padding-right: 48px;
	}
}
#popup.scroll {
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}

#popup-background {
	background: #000;
	opacity: 0.5;
	position: fixed;
	display: none;
	width: 100%;
	height: 100%;
	left: 0;
	top: 0;
	z-index: 2000;
}

@keyframes loading-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(359deg);
	}
}
#popup-background > .spinner {
	display: none;
	width: 70px;
	height: 70px;
	background: url("../images/cwd_utilities/spinner.svg") 0 0 no-repeat;
	background-size: 100%;
	animation: loading-spin 0.75s infinite linear;
	position: absolute;
	top: 49%;
	left: 49%;
	top: calc(50% - 35px);
	left: calc(50% - 35px);
	opacity: 0.6;
}

#popup-background.image {
	opacity: 0.8;
}

#popup-background.image > .spinner {
	display: block;
	transition: opacity 0.25s;
}

#popup-background > .spinner.off {
	opacity: 0;
	transition: opacity 0.25s;
}

#popup-panel {
	padding-left: 40px;
	padding-right: 40px;
}

#popup .panel .fa {
	padding-left: 1px;
	position: relative;
	top: -1px;
}

#popup .caption {
	font-family: Avenir Next, -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica Neue, sans-serif;
	-webkit-font-smoothing: subpixel-antialiased;
	color: #333;
	font-size: 15px;
	line-height: 1.5;
	margin: 0;
	padding: 10px 15px 10px;
}

#popup iframe {
	width: 100%;
	height: 100%;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}

#popup-close, .popup-close {
	position: absolute;
	z-index: 2002;
	top: 8px;
	right: 8px;
	width: 35px;
	height: 34px;
	padding: 0;
	margin: 0;
	border: 0;
	background: url("../images/cwd_utilities/modal_close_hd.png") 0 0 no-repeat;
	background-size: 35px;
	opacity: 0;
	border-radius: 4px;
	cursor: pointer;
	transition: opacity 0.25s;
}

#popup:hover #popup-close, #popup.fullscreen #popup-close, .touch #popup #popup-close, #popup.video #popup-close {
	opacity: 0.6;
}

#popup:hover #popup-close:hover, .popup-close:hover {
	opacity: 1;
}

#popup-close:focus {
	opacity: 1;
}

#popup-anchor:focus, .popup-close:focus {
	outline: 0;
}

#popup-image {
	vertical-align: middle;
}

#popup.video {
	background: #000 !important;
	background: linear-gradient(to bottom, #000000 0%, #222222 100%) !important;
	max-width: 100%;
}

#popup .popup-video {
	width: 720px;
	max-width: calc(100% - 20px);
	padding-bottom: 56.25%;
	padding-bottom: calc(56.25% - 11px);
	margin: 50px 10px 10px;
}

#popup.image-gallery .popup-video {
	margin-left: 40px;
	margin-right: 40px;
	margin-bottom: 18px;
	max-width: calc(100% - 80px);
	padding-bottom: calc(56.25% - 45px);
}

@media (min-width: 768px) {
	#popup.image.fullscreen {
		max-width: 100vh !important;
	}
	#popup.image.fullscreen > .content {
		margin: 0 auto;
		max-width: 100vh;
		display: flex;
		flex-direction: column;
		height: 100%;
	}
	#popup.image.fullscreen > .content #popup-image {
		width: 100% !important;
		border: 4px solid #fff;
	}
	#popup.video.fullscreen {
		max-width: 110vh !important;
	}
	#popup.video.fullscreen > .content {
		max-width: 110vh;
		display: flex;
		flex-direction: column;
		height: 100%;
	}
	#popup.video.fullscreen > .content .popup-video {
		width: 100% !important;
	}
}
.popup-fields {
	display: none;
	opacity: 0;
}

#popup .popup-fields {
	position: relative;
	display: block;
	padding: 17px 15px 10px;
	font-size: 15px;
	line-height: 1.4;
	background: #fff;
	opacity: 1;
	flex-grow: 100;
}

#popup.video .popup-fields {
	margin: 0 10px 10px;
	background: #f7f7f7;
}
#popup.video .popup-fields.dark {
	margin-bottom: 0;
	background: none !important;
}

#popup .popup-fields.dark {
	background: #222;
	color: #ededed;
}
#popup .popup-fields.dark h2, #popup .popup-fields.dark h3, #popup .popup-fields.dark h4, #popup .popup-fields.dark h5, #popup .popup-fields.dark h6 {
	color: #f7f7f7;
}
#popup .popup-fields.dark a {
	color: #fff;
}
#popup .popup-fields.dark a:active {
	color: #ddd;
}

#popup:not(.video) .caption + .popup-fields:before {
	content: "";
	position: absolute;
	left: 15px;
	right: 15px;
	top: 1px;
	border-bottom: 1px solid #ebebeb;
}

#popup.image-gallery.video .prev {
	left: -40px;
	min-width: 36px;
}

#popup.image-gallery.video .next {
	right: -40px;
	min-width: 36px;
}

#popup.video .caption {
	position: absolute;
	top: 5px;
	color: #bbb;
	max-width: calc(100% - 80px);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Gallery Navigation */
.gallery-nav .next-prev a, .gallery-nav .next-prev button {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	border: 0;
	cursor: pointer;
	position: absolute;
	color: #fff;
	text-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
	min-width: 60px;
	min-height: 52px;
	top: 0;
	bottom: 0;
	opacity: 0;
	text-align: center;
	transition: opacity 0.25s;
	background: url("../images/cwd_utilities/chevron-left-rect.svg") 25% 50% no-repeat, radial-gradient(ellipse at left center, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 50%);
}

#popup.video .gallery-nav .next-prev a,
#popup.video .gallery-nav .next-prev button {
	background: url("../images/cwd_utilities/chevron-left-rect.svg") 40% 50% no-repeat, radial-gradient(ellipse at left center, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 50%);
}

.gallery-nav .next-prev .prev {
	left: 0;
}

.gallery-nav .next-prev .next {
	right: 0;
	background: url("../images/cwd_utilities/chevron-right-rect.svg") 75% 50% no-repeat, radial-gradient(ellipse at right center, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 50%);
}

#popup.video .gallery-nav .next-prev .next {
	background: url("../images/cwd_utilities/chevron-right-rect.svg") 65% 50% no-repeat, radial-gradient(ellipse at right center, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 50%);
}

#popup:hover .gallery-nav .next-prev a, .cwd-gallery.viewer .slide:hover .gallery-nav .next-prev a, #popup.video .next-prev a,
#popup:hover .gallery-nav .next-prev button, .cwd-gallery.viewer .slide:hover .gallery-nav .next-prev button, #popup.video .next-prev button {
	opacity: 0.7;
}

#popup:hover .gallery-nav .next-prev a:hover, .gallery-nav .next-prev a:hover, .gallery-nav .next-prev a:focus,
.cwd-gallery.viewer:hover .gallery-nav .next-prev a:hover, .cwd-gallery.viewer .gallery-nav .next-prev a:hover, .cwd-gallery.viewer .gallery-nav .next-prev a:focus,
#popup:hover .gallery-nav .next-prev button:hover, .gallery-nav .next-prev button:hover, .gallery-nav .next-prev button:focus,
.cwd-gallery.viewer:hover .gallery-nav .next-prev button:hover, .cwd-gallery.viewer .gallery-nav .next-prev button:hover, .cwd-gallery.viewer .gallery-nav .next-prev button:focus {
	opacity: 1;
}

#popup.error .gallery-nav .next-prev .prev {
	background-position: 13% 100%;
}

#popup.error .gallery-nav .next-prev .next {
	background-position: 87% 100%;
}

#popup.error:hover .gallery-nav .next-prev a,
#popup.error:hover .gallery-nav .next-prev button {
	opacity: 0.2;
}

#popup.error:hover .gallery-nav .next-prev a:hover, #popup.error .gallery-nav .next-prev a:hover, #popup.error .gallery-nav .next-prev a:focus,
#popup.error:hover .gallery-nav .next-prev button:hover, #popup.error .gallery-nav .next-prev button:hover, #popup.error .gallery-nav .next-prev button:focus {
	opacity: 0.8;
}

.gallery-nav .next-prev a:active,
.gallery-nav .next-prev button:active {
	filter: contrast(200%);
}

.touch #popup .gallery-nav .next-prev a, .touch .cwd-gallery.viewer .slide .gallery-nav .next-prev a,
.touch #popup .gallery-nav .next-prev button, .touch .cwd-gallery.viewer .slide .gallery-nav .next-prev button {
	opacity: 0 !important;
}

.touch #popup {
	transition: transform 0.25s ease-in-out;
}

.touch #popup.swipe-left {
	transform: translate(-200px, 0);
}

.touch #popup.swipe-right {
	transform: translate(200px, 0);
}
