/* Popups: various widgets that have popup windows. Dialogs, tooltips, hovercards, etc. */

/* ======================================================== */
/* Modal element - used to block out the screen under popup controls */
.ipsModal {
	background: color-mix(in srgb, var(--i-background_dark) 70%, transparent);
	position: fixed;
	inset: 0;
	z-index: 15000;
	margin: 0 !important; /* Remove the margin on primary column blocks */
}

@supports not (color:color-mix(in srgb, red, red)){
	.ipsModal{
		background: hsl(0 0% 0% / .7);
	}
}

.ipsModal > div{
	position: relative;
}

.ipsModal__close{
	position: absolute;
	top: 10px;
	inset-inline-end: 10px;
}

/* ======================================================== */
/* DIALOG WINDOWS */
.ipsDialog {
	position: absolute;
	inset-inline-start: calc(var(--i-manage-widgets-sidebar, 0px) * -1);
	bottom: 0;
	inset-inline-end: 0;
	height: 100%;
	z-index: 20000;
}
	
	.ipsDialog.ipsDialog_fixed {
		position: fixed;
	}

	.ipsDialog > div {
		display: block;
		width: 94vw;
		max-width: 1200px;
		background: var(--i-box--ba-co);
		margin: calc(5vh + env(safe-area-inset-top)) auto 0 auto;
		box-shadow: var(--i-dialog--bo-sh);
		position: relative;
		border-radius: var(--i-box--bo-ra);
	}

		.ipsDialog.ipsDialog_fixed > div {
			height: 90%;
			max-height: 90%;	
		}

	.ipsDialog .ipsDialog_loading {
		height: 200px;
	}

	/* Sizes */
	.ipsDialog.ipsDialog_narrow > div {
		max-width: 500px;
	}

	.ipsDialog.ipsDialog_medium > div {
		max-width: 850px;
	}

	.ipsDialog.ipsDialog_wide > div {
		max-width: 1000px;
	}

	.ipsDialog.ipsDialog_fullscreen > div {
		position: absolute;
		inset: 10px;
		max-width: 100%;
		max-height: 100%;
		width: auto;
		height: auto;
		margin: 0;
	}

	/* Dialog elements */
	.ipsDialog_close {
		position: absolute;
		top: 3px;
		inset-inline-end: 4px;
		display: block;
		color: var(--i-color_hard) !important;
		width: 44px;
		height: 44px;
		line-height: 48px;
		font-size: 34px;
		font-weight: 300;
		text-align: center;
		z-index: 1000;
		transition: 0.2s all linear;
	}

	.ipsDialog_title {
		color: var(--i-color_hard);
		font-size: 1.2em;
		font-weight: bold;
		text-align: start;
		line-height: 1.3;
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
		margin: 0;
		padding: 1.15em;
	}

	/* Hide any lingering hr elements in dialogs */
	.ipsDialog_title + .ipsHr{
		display: none;
	}

	.ipsDialog_fixed .ipsDialog_content {
		inset: 0;
		position: absolute;
		display: flex;
		flex-direction: column;
		overflow: auto;
	}

		.ipsDialog_fixed .ipsDialog_title ~ .ipsDialog_content {
			top: 56px;
		} 

	.ipsDialog_footer {
		position: fixed;
		bottom: 60px;
		left: 0;
		right: 0;
	}

/* This is used to hide content before it's placed inside a dialog. Eg, staff page bio */
.ipsDialog_inlineContent{
	display: none;
}

.ipsDialog .ipsDialog_inlineContent{
	display: block;
}

/* ======================================================== */
/* HOVERCARD */
.ipsHovercard {
	background: var(--i-background_1);
	box-shadow: color-mix(in srgb, var(--i-color_hard) 10%, transparent) 0px 0px 0px 1px, var(--i-popup--bo-sh);
	background-clip: padding-box;
	border-radius: var(--i-box--bo-ra);
	overflow: visible;
	position: absolute;

	opacity: 0;
	translate: 0 10px;
	transition-property: display, opacity, translate;
	transition-behavior: allow-discrete;
	transition-timing-function: ease-in-out;
	transition-duration: .3s;
}

.ipsHovercard:popover-open{
	opacity: 1;
	translate: 0 0;
}
@starting-style{
	.ipsHovercard:popover-open{
		opacity: 0;
		translate: 0 10px;
	}
}

	/* Stem */
	:where(.ipsHovercard:not( .ipsHovercard_noStem ) .ipsHovercard_stem) {
		color: var(--i-background_1);
		position: absolute;
		pointer-events: none;
		font-size: 10px;
		border: 1em solid transparent;
	}

	.ipsHovercard.ipsHovercard_stemTop { margin-top: -1em; }
	.ipsHovercard.ipsHovercard_stemBottom {	margin-top: 1em; }
	.ipsHovercard.ipsHovercard_stemLeft { margin-left: -20px; }
	.ipsHovercard.ipsHovercard_stemRight { margin-left: 20px; }

	.ipsHovercard_stemLeft .ipsHovercard_stem { left: 3em; }
	.ipsHovercard_stemRight .ipsHovercard_stem { right: 3em; }

	.ipsHovercard_stemTop .ipsHovercard_stem {
		top: 100%;
		border-top-color: currentColor;
		filter: drop-shadow(color-mix(in srgb, var(--i-color_hard) 10%, transparent) 0px 1px 0px);
	}

	.ipsHovercard_stemBottom .ipsHovercard_stem {
		bottom: 100%;
		border-bottom-color: currentColor;
		filter: drop-shadow(color-mix(in srgb, var(--i-color_hard) 10%, transparent) 0px -1px 0px);
	}

	/* Hovercard elements */
	.ipsHovercard_loading {
		width: 30px;
		height: 30px;
		border-radius: var(--i-box--bo-ra);
		padding: 5px;
		box-shadow: 0px 5px 40px rgba(0,0,0,0.4);
		background-color: var(--i-background_1);
		pointer-events: none;
	}

		.ipsHovercard_loading .ipsLoading--tinyIcon {
			width: 20px;
			height: 20px;
			font-size: 20px;
		}
		
		.ipsHovercard_loading::after {
			content: '';
			position: absolute;
			border: 5px solid transparent;
			border-top-color: var(--i-background_1);
			left: 50%;
			transform: translateX(-50%);
			top: 100%;
		}

.cUserHovercard__header {
	margin: 6px;
}

.cUserHovercard .ipsPhotoPanel{
	--i-photoPanelAvatar: 40px;
}
.cUserHovercard__grid{
	color: var(--i-color_soft);
	font-weight: 500;
}

	:where(.cUserHovercard__grid > *){
		padding: var(--i-sp_2);
	}

/* ======================================================== */
/* TOOLTIPS */
.ipsTooltip {
	inset: auto; /* Reset [popover] defaults. Required for RTL */
	background: var(--i-tooltip--ba-co);
	border-color: var(--i-tooltip--ba-co);
	-webkit-backdrop-filter: blur(20px);
	backdrop-filter: blur(20px);
	padding: .6em .9em;
	font-size: .9em;
	color: hsl(0 0% 100%);
	font-weight: 500;
	position: absolute;
	max-width: min(500px, 80vw);
	pointer-events: none;
	border-radius: min(var(--i-design-radius), 5px);
	box-shadow: hsl(0 0% 0% / .1) 0px 5px 20px;
	user-select: none;
	overflow: visible;
	transition-property: display, overlay, opacity, translate;
	transition-behavior: allow-discrete;
	transition-duration: .15s;
	opacity: 0;
	translate: 0 10px;
}

.ipsTooltip:popover-open{
	opacity: 1;
	translate: 0 0;
}

@starting-style{
	.ipsTooltip:popover-open{
		opacity: 0;
		translate: 0 10px;
	}	
}

	[data-dragging] .ipsTooltip {
		display: none !important;
	}

	.ipsTooltip_top {
		margin-top: -2px;
	}

	.ipsTooltip_bottom {
		margin-top: 2px;
	}

	.ipsTooltip::after {
		content: '';
		display: block;
		position: absolute;
		width: 0;
		height: 0;
		border: 5px solid transparent;
		left: 50%;
		margin-left: -5px;
		transform: translate(0,0);
	}

		.ipsTooltip_right::after {
			left: auto;
			right: 4px;
			margin-left: 0;
		}

		.ipsTooltip_left::after {
			left: 4px;
			margin-left: 0;
		}

	.ipsTooltip_top::after {
		border-top-color: inherit;
		top: 100%;
	}

	.ipsTooltip_bottom::after {
		border-bottom-color: inherit;
		top: -10px;
	}

	.ipsTooltip a {
		color: currentColor;
		border-bottom: 1px dotted currentColor;
	}

	.ipsTooltip--inlineQuoteTooltip {
		pointer-events: auto;
		padding: 0;
		font-weight: 600;
		left: var(--_left, 0px);
		top: var(--_top, 0px);
	}

		.ipsTooltip--inlineQuoteTooltip button{
			display: block;
			padding: .6em .9em;
		}
		.ipsTooltip--inlineQuoteTooltip .fa-solid{
			opacity: .6;
			margin-inline-end: .3em;
		}

/* Touch devices have their own contextual menu when text is selected, so lets move the Quote Selection button to the bottom of the screen */
@media (hover:none){
	.ipsTooltip--inlineQuoteTooltip{
		position: fixed;
		inset: auto;
		bottom: calc(max(var(--i-mobileFooter--he), env(safe-area-inset-bottom, 0px)) + 10px);
		inset-inline-start: 10px;
	}
	.ipsTooltip--inlineQuoteTooltip::after{
		content: none;
	}
}

/* ======================================================== */
/* PAGE ACTIONS */
/* Page actions are used primarily for moderation, presenting a floating toolbar of actions for selected items */
.ipsPageAction {
	position: fixed;
	left: 10px;
	right: 10px;
	bottom: calc(var(--i-mobileFooter--he) + 10px);
	z-index: 2000;
	display: flex;
	justify-content: center;
	/* Without the following, content to the sides of .ipsPageAction isn't clickable */
	margin: auto;
	width: fit-content;
}

.ipsPageAction > [data-role="actionItems"]{
	color: hsl(0 0% 100%);
	background: var(--if-light, hsl(0 0% 12% / .8)) var(--if-dark, color-mix(in srgb, var(--i-background_6) 80%, transparent));
	border-radius: 15px;
	font-weight: 500;
	text-align: center;
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	padding: 5px;
}

	.ipsPageAction__title,
	.ipsPageAction__button {
		padding: .7em 1.1em;
		border-radius: 10px;
	}

	.ipsPageAction__button:hover{
		background: hsl(0 0% 100% / .15);
		color: #fff;
		cursor: pointer;
	}

	.ipsPageAction__button[aria-selected="true"] {
		background: hsl(0 0% 100% / .25);
		color: #fff;
	}

	.ipsPageAction__button .fa-caret-up{
		opacity: .5;
		font-size: 11px;
		margin-inline-start: .4em;
	}

	.ipsPageAction_icon {
		font-size: 20px;
	}

	@media (min-width: 500px){
		.ipsPageAction i-dropdown{
			position: fixed;
		}
		@supports (-webkit-hyphens: auto) or (not (top: anchor(bottom))){
			.ipsPageAction i-dropdown{
				top: auto;
				bottom: calc(var(--i-mobileFooter--he) + 10px + 50px);
			}
		}
	}

	@media (min-width: 980px){
		.ipsPageAction {
			bottom: 30px;
		}
		@supports (-webkit-hyphens: auto) or (not (top: anchor(bottom))){
			.ipsPageAction i-dropdown{
				bottom: 80px;
			}
		}
	}

	@media screen and (max-width: 767px) {
		.ipsPageAction__title {
			flex: 1 1 100%;
			padding: .5em;
		}
	}

/* ======================================================== */
/* ALERT BOXES */
/* Gives the user choices, like OK, Cancel etc. Replaces the ugly javascript alert() */
.ipsAlert {
	background: var(--i-box--ba-co);
	color: var(--i-color_soft);
	padding: 1.5em;
	width: 480px;
	position: fixed;
	top: 100px;
	border-radius: var(--i-box--bo-ra);
	box-shadow: hsl(0 0% 0% / 40%) 0px 5px 55px 0px, hsl(0 0% 0% / 70%) 0px 7px 24px -12px;
	left: 50%;
	margin-left: -240px;
	text-align: center;
}

	.ipsAlert__icon {
		font-size: 3em;
		margin-bottom: .3em;
		color: var(--i-color_soft);
		opacity: .6;
	}

	.ipsAlert__title {
		display: block;
		color: var(--i-color_hard);
		font-weight: 600;
		font-size: 1.2em;
		margin-bottom: .6em;
	}		

	.ipsAlert .ipsButtons{
		margin-top: 2em;
	}

		.ipsAlert .ipsButtons .ipsButton{
			flex: 1 1 40%;
		}


@media screen and (max-width: 767px) {

	.ipsDialog.ipsDialog_fixed > div {
		position: fixed;
		inset: 0;
		margin-top: 0;
		width: auto;
		height: auto;
		max-width: 100%;
		max-height: 100%;
	}

	.ipsAlert {
		top: auto;
		bottom: 40px;
		left: 2%;
		right: 2%;
		margin: 0;
		width: auto;
	}

	.ipsHovercard.ipsHovercard_stemLeft { margin-left: 0; }
	.ipsHovercard.ipsHovercard_stemRight { margin-left: 0; }

}