/* Site pop up
 * Markup: templates/ficc-theme/views/popup.php
 * Behaviour: templates/ficc-theme/js/popup.js
 */

.site_popup {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1000000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
	overflow-y: auto;
}

.site_popup[hidden] {
	display: none;
}

.site_popup_overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(28, 28, 28, 0.62);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.site_popup_dialog {
	position: relative;
	display: flex;
	width: 100%;
	max-width: 880px;
	margin: auto;
	max-height: 90vh;
	background: #ffffff;
	border-radius: 18px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
	overflow: hidden;
	opacity: 0;
	transform: translateY(24px) scale(0.97);
	transition: opacity 0.35s ease, transform 0.35s ease;
}

/* text only - no featured image on the static block */
.site_popup_dialog_text {
	max-width: 620px;
}

.site_popup.is_open .site_popup_overlay {
	opacity: 1;
}

.site_popup.is_open .site_popup_dialog {
	opacity: 1;
	transform: none;
}

/* ---- media ---- */

.site_popup_media {
	flex: 0 0 42%;
	max-width: 42%;
	background: #f7f3e6;
}

.site_popup_media img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 260px;
	object-fit: cover;
}

/* ---- body ---- */

.site_popup_body {
	flex: 1 1 auto;
	/* sit centred against a tall photo instead of stranding it at the top.
	 * align-self (rather than justify-content) keeps the box at content
	 * height, so its own overflow scrolling still behaves for long copy. */
	align-self: center;
	padding: 44px 44px 40px;
	box-sizing: border-box;
	max-height: 82vh;
	overflow-y: auto;
	color: #1c1c1c;
	font-size: 17px;
	line-height: 1.6;
	text-align: left;
}

.site_popup_body_wide {
	max-width: 100%;
	text-align: center;
}

.site_popup_body > *:first-child {
	margin-top: 0;
}

.site_popup_body > *:last-child {
	margin-bottom: 0;
}

.site_popup_body h1,
.site_popup_body h2,
.site_popup_body h3,
.site_popup_body h4 {
	color: #1c1c1c;
	line-height: 1.2;
	margin: 0 0 14px;
}

.site_popup_body h1,
.site_popup_body h2 {
	font-size: 32px;
}

.site_popup_body h3 {
	font-size: 24px;
}

.site_popup_body p {
	margin: 0 0 16px;
}

.site_popup_body img {
	max-width: 100%;
	height: auto;
}

.site_popup_body a {
	color: #0077c0;
}

/* Buttons inside the pop up are outside .layout, so the theme's button
 * styling does not reach them - match it here. */
.site_popup_body .button,
.site_popup_body a.button {
	display: inline-block;
	margin: 6px 6px 0 0;
	padding: 12px 30px;
	border: 1px solid #76c5d3;
	border-radius: 35px;
	background-color: #76c5d3;
	color: #ffffff;
	font-size: 16px;
	font-weight: 700;
	text-decoration: none;
	transition: box-shadow 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

.site_popup_body .button:hover,
.site_popup_body a.button:hover,
.site_popup_body .button:focus,
.site_popup_body a.button:focus {
	background-color: #c8d9dc;
	border-color: #c8d9dc;
	color: #1c1c1c;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
	transform: translateY(-2px);
}

/* ---- close ---- */

.site_popup_close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
	color: #1c1c1c;
	font-size: 26px;
	line-height: 36px;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.site_popup_close:hover,
.site_popup_close:focus-visible {
	background: #76c5d3;
	color: #ffffff;
}

.site_popup_close:focus {
	outline: none;
}

.site_popup_close:focus-visible {
	outline: 2px solid #0077c0;
	outline-offset: 2px;
}

.site_popup_dialog:focus {
	outline: none;
}

/* ---- page scroll lock ---- */

body.site_popup_open {
	overflow: hidden;
}

/* ---- responsive ---- */

@media (max-width: 780px) {
	.site_popup {
		padding: 14px;
	}

	.site_popup_dialog {
		display: block;
		max-width: 480px;
	}

	.site_popup_media,
	.site_popup_body_wide {
		max-width: 100%;
	}

	/* Stacked on mobile there is no shape to match, so show the photo whole
	 * rather than cropping it - flyers and graphics with text on them lose
	 * their message to a fixed-height crop. */
	.site_popup_media img {
		height: auto;
		min-height: 0;
		max-height: 48vh;
		object-fit: contain;
	}

	.site_popup_body {
		padding: 28px 24px 26px;
		max-height: none;
		font-size: 16px;
	}

	.site_popup_body h1,
	.site_popup_body h2 {
		font-size: 26px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.site_popup_overlay,
	.site_popup_dialog,
	.site_popup_body .button,
	.site_popup_close {
		transition: none;
	}

	.site_popup_dialog {
		transform: none;
	}
}
