/* October Popups — frontend shell.
   Deliberately unopinionated about the popup body (that is the builder's job);
   this styles only the container, overlay, positioning and close control. */

html.ocpop-locked {
	overflow: hidden;
}

.ocpop-wrap[hidden] {
	display: none;
}

.ocpop-wrap {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	pointer-events: none;
}

.ocpop-overlay {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.6 );
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: auto;
}
.ocpop-wrap.is-open .ocpop-overlay {
	opacity: 1;
}

/* The dialog itself */
.ocpop {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	/* Desktop width comes from the --ocpop-w variable set inline per popup. */
	max-width: var( --ocpop-w, 600px );
	max-height: 90vh;
	/* Clip horizontally (kills builder overflow), scroll vertically. */
	overflow-x: hidden;
	overflow-y: auto;
	margin: auto;
	background: #fff;
	border-radius: var( --ocpop-radius, 0px );
	box-shadow: 0 12px 48px rgba( 0, 0, 0, 0.28 );
	pointer-events: auto;
	outline: none;
}

.ocpop-body {
	/* Builder content lives here; keep it from bleeding past the corners. */
	max-width: 100%;
	overflow: hidden;
	border-radius: inherit;
}

/* --- Builder content normalisation --------------------------------------
   Page builders (WP Bakery, Elementor) assume the full page width. Inside a
   narrow popup their media and grid can overflow or clip, so constrain them.
   Scoped strictly to .ocpop-body so nothing else on the page is touched. */
.ocpop-body img,
.ocpop-body video,
.ocpop-body iframe {
	max-width: 100%;
	height: auto;
}
/* WP Bakery rows use negative side margins that overflow a narrow container. */
.ocpop-body .vc_row,
.ocpop-body .wpb_row {
	margin-left: 0;
	margin-right: 0;
}
/* Drop the trailing bottom margin WP Bakery adds after the last element. */
.ocpop-body .wpb_row:last-child,
.ocpop-body .vc_row:last-child,
.ocpop-body .wpb_content_element:last-child {
	margin-bottom: 0;
}

/* Close button — reset hard so the theme's global button styles (padding,
   pill radius, min-width) can't stretch it into an oval. */
.ocpop .ocpop-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px !important;
	height: 36px !important;
	min-width: 0 !important;
	max-width: 36px !important;
	margin: 0 !important;
	padding: 0 !important;
	font-size: 24px;
	line-height: 1;
	color: #333;
	background: rgba( 255, 255, 255, 0.92 );
	border: 0;
	border-radius: 50% !important;
	box-shadow: 0 1px 6px rgba( 0, 0, 0, 0.25 );
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	text-transform: none;
	letter-spacing: normal;
	transition: transform 0.15s ease, background 0.15s ease;
}
.ocpop .ocpop-close:hover {
	background: #fff;
	transform: scale( 1.08 );
}

/* --- Simple template layout ----------------------------------------- */

.ocpop-tpl {
	display: flex;
	align-items: stretch;
	width: 100%;
}
.ocpop-tpl--image-left { flex-direction: row; }
.ocpop-tpl--image-right { flex-direction: row-reverse; }
.ocpop-tpl--image-top { flex-direction: column; }
.ocpop-tpl--text-only,
.ocpop-tpl--no-image { display: block; }

.ocpop-tpl__media {
	flex: 0 0 45%;
	max-width: 45%;
	overflow: hidden;
}
.ocpop-tpl--image-top .ocpop-tpl__media {
	flex-basis: auto;
	max-width: 100%;
}
.ocpop-tpl__media .ocpop-tpl__img,
.ocpop-tpl__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.ocpop-tpl--image-top .ocpop-tpl__img {
	height: auto;
}

.ocpop-tpl__content {
	flex: 1 1 auto;
	min-width: 0;
	padding: 32px 34px;
	box-sizing: border-box;
}
.ocpop-tpl__heading {
	margin: 0 0 14px;
	font-size: 1.9em;
	line-height: 1.15;
}
.ocpop-tpl__text {
	font-size: 1em;
	line-height: 1.55;
}
.ocpop-tpl__text p { margin: 0 0 0.8em; }
.ocpop-tpl__text p:last-child { margin-bottom: 0; }

.ocpop-tpl__btn {
	display: inline-block;
	margin-top: 20px;
	padding: 13px 30px;
	background: #222;
	color: #fff;
	font-size: 1em;
	line-height: 1;
	text-decoration: none;
	border-radius: 4px;
	transition: opacity 0.15s ease;
}
.ocpop-tpl__btn:hover { opacity: 0.88; }

@media ( max-width: 600px ) {
	.ocpop-tpl { flex-direction: column; }
	.ocpop-tpl__media {
		flex-basis: auto;
		max-width: 100%;
		max-height: 40vh;
	}
	.ocpop-tpl--hide-image-mobile .ocpop-tpl__media { display: none; }
}

/* --- Positions ------------------------------------------------------- */

.ocpop-wrap { align-items: center; justify-content: center; padding: 20px; }

/* Top / bottom bars span the width and stick to an edge. */
.ocpop--top-bar,
.ocpop--bottom-bar {
	max-width: 100% !important;
	width: 100%;
	max-height: none;
	margin: 0;
	border-radius: 0;
}
.ocpop-wrap--top-bar { align-items: flex-start; padding: 0; }
.ocpop-wrap--bottom-bar { align-items: flex-end; padding: 0; }

/* Slide-in corners */
.ocpop-wrap--slide-left { align-items: flex-end; justify-content: flex-start; }
.ocpop-wrap--slide-right { align-items: flex-end; justify-content: flex-end; }
.ocpop--slide-left,
.ocpop--slide-right { margin: 0; }

/* --- Animations ------------------------------------------------------ */

.ocpop { opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease; }
.ocpop-wrap.is-open .ocpop { opacity: 1; transform: none; }

.ocpop--anim-fade .ocpop { transform: translateY( 0 ); }
.ocpop--anim-zoom .ocpop { transform: scale( 0.9 ); }
.ocpop--anim-slide.ocpop--top-bar { transform: translateY( -100% ); opacity: 1; }
.ocpop--anim-slide.ocpop--bottom-bar,
.ocpop--anim-slide.ocpop--slide-left,
.ocpop--anim-slide.ocpop--slide-right { transform: translateY( 100% ); opacity: 1; }
.ocpop--anim-none .ocpop { transition: none; }

/* Open-state resets for the sliding variants */
.ocpop-wrap.is-open .ocpop--anim-slide { transform: none; }

/* --- Mobile ---------------------------------------------------------- */

@media ( max-width: 600px ) {
	.ocpop-wrap { padding: 12px; }
	/* Mobile width comes from --ocpop-w-mobile, but never exceed the screen. */
	.ocpop {
		max-width: min( var( --ocpop-w-mobile, 360px ), calc( 100vw - 24px ) );
		max-height: 88vh;
	}
	/* Bars stay full-bleed on mobile too. */
	.ocpop--top-bar,
	.ocpop--bottom-bar { max-width: 100% !important; }
}

@media ( prefers-reduced-motion: reduce ) {
	.ocpop,
	.ocpop-overlay { transition: opacity 0.01ms; }
}
