/* Think Clever Popups: front end */

html.tcp-locked {
	overflow: hidden;
	padding-right: var(--tcp-sbw, 0px); /* Replaces the scrollbar so the page doesn't shift. */
}

.tc-popup-wrap {
	position: fixed;
	inset: 0;
	z-index: var(--tcp-z, 99999);
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}
.tc-popup-wrap.is-open,
.tc-popup-wrap.is-closing {
	display: flex;
}
.tc-popup-wrap *,
.tc-popup-wrap *::before,
.tc-popup-wrap *::after {
	box-sizing: border-box;
}

.tc-popup__overlay {
	position: absolute;
	inset: 0;
	background: var(--tcp-overlay, rgba(20, 24, 26, 0.6));
}

.tc-popup {
	position: relative;
	width: 100%;
	max-width: var(--tcp-width, 600px);
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--tcp-bg, #ffffff);
	color: var(--tcp-text, #14181a);
	border-radius: var(--tcp-radius, 12px);
	padding: var(--tcp-pad, 40px);
	box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
	outline: none;
}
.tc-popup--no-shadow .tc-popup {
	box-shadow: none;
}
.tc-popup__content > :first-child {
	margin-top: 0;
}
.tc-popup__content > :last-child {
	margin-bottom: 0;
}

/* Image popups: the box hugs the image so the close button and the shadow
   sit on the picture itself, not on a phantom box around it. */
.tc-popup--image .tc-popup {
	overflow: hidden;
	width: auto;
	padding: 0;
	max-width: min(var(--tcp-width, 600px), 100%);
}
.tc-popup--image .tc-popup__content > a,
.tc-popup--image .tc-popup__content > img,
.tc-popup--image .tc-popup__content > a > img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	margin: 0;
	border-radius: inherit;
}

/* Close button: fully reset so theme <button> styles can't distort it. */
.tc-popup-wrap .tc-popup__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	min-width: 0;
	min-height: 0;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	line-height: 1;
	box-shadow: none;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}
.tc-popup-wrap .tc-popup__close svg {
	width: 18px;
	height: 18px;
	display: block;
}
.tc-popup-wrap .tc-popup__close:hover {
	background: rgba(0, 0, 0, 0.8);
	transform: scale(1.06);
}
.tc-popup-wrap .tc-popup__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}
.tc-popup-wrap .tc-popup__close--light {
	background: rgba(255, 255, 255, 0.85);
	color: #14181a;
}
.tc-popup-wrap .tc-popup__close--light:hover {
	background: #fff;
}

/* ---- Positions ---- */
.tc-popup--top { align-items: flex-start; }
.tc-popup--bottom { align-items: flex-end; }
.tc-popup--top-left { align-items: flex-start; justify-content: flex-start; }
.tc-popup--top-right { align-items: flex-start; justify-content: flex-end; }
.tc-popup--bottom-left { align-items: flex-end; justify-content: flex-start; }
.tc-popup--bottom-right { align-items: flex-end; justify-content: flex-end; }

/* ---- Animations ---- */
.tc-popup-wrap.is-open .tc-popup__overlay { animation: tcp-fade 0.25s ease both; }
.tc-popup-wrap.is-closing .tc-popup__overlay { animation: tcp-fade 0.25s ease both reverse; }

.tc-anim-fade.is-open .tc-popup { animation: tcp-fade 0.3s ease both; }
.tc-anim-zoom.is-open .tc-popup { animation: tcp-zoom 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.tc-anim-slide-up.is-open .tc-popup { animation: tcp-slide-up 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.tc-anim-slide-down.is-open .tc-popup { animation: tcp-slide-down 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

.tc-anim-fade.is-closing .tc-popup { animation: tcp-fade 0.25s ease both reverse; }
.tc-anim-zoom.is-closing .tc-popup { animation: tcp-zoom 0.25s ease both reverse; }
.tc-anim-slide-up.is-closing .tc-popup { animation: tcp-slide-up 0.25s ease both reverse; }
.tc-anim-slide-down.is-closing .tc-popup { animation: tcp-slide-down 0.25s ease both reverse; }
.tc-anim-none.is-closing .tc-popup { animation: tcp-fade 0.15s ease both reverse; }

@keyframes tcp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tcp-zoom { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes tcp-slide-up { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tcp-slide-down { from { opacity: 0; transform: translateY(-40px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
	.tc-popup-wrap .tc-popup,
	.tc-popup-wrap .tc-popup__overlay {
		animation: none !important;
	}
}

@media (max-width: 600px) {
	.tc-popup-wrap {
		padding: 12px;
	}
	.tc-popup {
		padding: min(var(--tcp-pad, 40px), 24px);
		max-height: calc(100vh - 24px);
		max-height: calc(100dvh - 24px);
	}
}
