@use "~@wordpress/base-styles/colors" as wp-colors;

.stick-to-top:last-child {
	position: sticky;
	top: 1rem;
}

.widget_newspack-ads-widget {
	overflow: hidden;
}

// TMP: the overflow: hidden should be removed in the theme.
#page {
	overflow: initial !important;
}

.newspack_global_ad {
	clear: both;
	max-width: 100%;
	flex: 1 1 auto;
	&.fixed-height {
		padding: 16px 0;
		box-sizing: content-box;
		> * {
			margin: 0;
		}
	}
}

.newspack-broadstreet-ad {
	max-width: 100%;
}

/**
 * Placement mock
 */
.newspack-ads__ad-placement-mock {
	&__content {
		position: relative;
		align-items: center;
		display: flex;
		font-family:
			-apple-system,
			BlinkMacSystemFont,
			"Segoe UI",
			Roboto,
			Oxygen-Sans,
			Ubuntu,
			Cantarell,
			"Helvetica Neue",
			sans-serif;
		justify-content: center;
	}
	&__svg {
		display: block;
		pointer-events: none;
		position: absolute;
		rect {
			fill: white;
			stroke: rgba(wp-colors.$gray-900, 0.4);
			stroke-width: 1px;
		}
		line {
			stroke: rgba(wp-colors.$gray-900, 0.4);
			stroke-width: 1px;
		}
	}
	&__label {
		background: white;
		border: 1px dashed rgba(wp-colors.$gray-900, 0.4);
		color: wp-colors.$gray-900;
		font-size: 10px;
		line-height: 1.6;
		padding: 4px 8px;
		pointer-events: none;
		position: absolute;
		text-align: center;
	}
}

.newspack_global_ad.left_side_rail,
.newspack_global_ad.right_side_rail {
	position: fixed;
	top: 40px;
	bottom: 40px;
	box-sizing: border-box;
	> * {
		margin: 0;
	}

	// Animation states
	.ad-slot {
		transition-property: display, opacity, transform;
		transition-duration: 0.2s;
		transition-timing-function: ease-in-out;
		/* stylelint-disable-next-line property-no-unknown */
		transition-behavior: allow-discrete;
		display: block;
		transform: translateX(0);
		@starting-style {
			opacity: 0;
			display: none;
		}
		&.ad-hidden {
			opacity: 0;
			display: none;
			pointer-events: none;
		}
		&.ad-visible {
			opacity: 1;
			display: block;
			pointer-events: auto;
		}
	}
}

.newspack_global_ad.left_side_rail {
	left: 0;
	.ad-slot {
		@starting-style {
			transform: translateX(-20%);
		}
		&.ad-hidden {
			transform: translateX(-20%);
		}
	}
}

.newspack_global_ad.right_side_rail {
	right: 0;
	.ad-slot {
		@starting-style {
			transform: translateX(20%);
		}
		&.ad-hidden {
			transform: translateX(20%);
		}
	}
}
