/* Simple Popup – front end. Mobile-first tweaks at the bottom. */

.spop[hidden] { display: none !important; }

.spop {
	--spop-bg: var(--spop-primary, #f2676a);
	--spop-fg: var(--spop-secondary, #ffffff);
	box-sizing: border-box;
	font-family: inherit;
	line-height: 1.35;
	-webkit-text-size-adjust: 100%;
}
.spop *, .spop *::before, .spop *::after { box-sizing: border-box; }
.spop img { display: block; max-width: 100%; height: auto; margin: 0; border: 0; box-shadow: none; }
.spop p { margin: 0; padding: 0; }
.spop a { -webkit-tap-highlight-color: transparent; }

/* ---------- Shared: text + button ---------- */

.spop__text {
	color: var(--spop-fg);
	font-weight: 700;
	overflow-wrap: anywhere;
}

.spop .spop__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	min-height: 48px;
	padding: 12px 34px;
	border: 0;
	border-radius: 999px;
	background: var(--spop-fg);
	color: var(--spop-bg);
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .03em;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	transition: transform .15s ease, box-shadow .15s ease;
}
.spop .spop__button:hover,
.spop .spop__button:focus-visible {
	color: var(--spop-bg);
	text-decoration: none;
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}
.spop a:focus-visible { outline: 3px solid var(--spop-fg); outline-offset: 3px; }

/* ---------- Close button (reset theme button styles) ---------- */

.spop .spop__close {
	all: unset;
	box-sizing: border-box;
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: var(--spop-fg);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.spop .spop__close svg { display: block; width: 18px; height: 18px; }
.spop .spop__close:focus-visible { outline: 3px solid currentColor; outline-offset: -5px; }

/* ---------- Bars (top + bottom) ---------- */

.spop--bar {
	position: fixed;
	left: 0;
	right: 0;
	z-index: 99990;
	opacity: 0;
	transition: transform .35s ease, opacity .35s ease;
}
.spop--bar.is-open { transform: none; opacity: 1; }

.spop--bottom { bottom: 0; transform: translateY(100%); }
.spop--top    { top: 0;    transform: translateY(-100%); }
.admin-bar .spop--top { top: 32px; }

.spop--bar .spop__box {
	position: relative;
	background: var(--spop-bg);
	color: var(--spop-fg);
}
.spop--bottom .spop__box {
	border-radius: 16px 16px 0 0;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	box-shadow: 0 -6px 24px rgba(0, 0, 0, .14);
}
.spop--top .spop__box {
	border-radius: 0 0 16px 16px;
	padding-top: env(safe-area-inset-top, 0px);
	box-shadow: 0 6px 24px rgba(0, 0, 0, .14);
}

.spop--bar .spop__inner {
	display: flex;
	align-items: center;
	gap: 20px;
	max-width: 1200px;
	margin: 0 auto;
	padding: 14px 24px;
}
.spop--top .spop__inner { padding-right: 64px; }

.spop--bar .spop__media { flex: 0 0 auto; }
.spop--bar .spop__media img { width: auto; height: 60px; max-width: 120px; object-fit: contain; border-radius: 4px; }
.spop--bar .spop__text { flex: 1 1 auto; min-width: 0; font-size: 19px; }

/* Bottom bar: close button is a tab sitting on top of the bar (like the reference). */
.spop--bottom .spop__close {
	top: -36px;
	right: 20px;
	width: 44px;
	height: 36px;
	border-radius: 10px 10px 0 0;
	background: var(--spop-bg);
}
.spop--top .spop__close { top: 50%; right: 12px; transform: translateY(-50%); }

/* Image-only bar */
.spop--bar.spop--image .spop__imagewrap { display: flex; justify-content: center; padding: 10px 16px; }
.spop--top.spop--image .spop__imagewrap { padding: 10px 60px; }
.spop--bar.spop--image img { width: auto; max-height: 140px; border-radius: 6px; }

/* ---------- Full popup ---------- */

.spop--full {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
	opacity: 0;
	transition: opacity .25s ease;
}
.spop--full.is-open { opacity: 1; }

.spop__overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }

.spop--full .spop__box {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 520px;
	max-height: 100%;
	overflow: hidden;
	border-radius: 18px;
	background: var(--spop-bg);
	color: var(--spop-fg);
	box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
	transform: translateY(16px) scale(.98);
	transition: transform .3s ease;
}
.spop--full.is-open .spop__box { transform: none; }

.spop--full .spop__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 52px 32px 32px;
	text-align: center;
}
.spop--full .spop__media { align-self: stretch; flex: 0 0 auto; margin: -52px -32px 0; }
.spop--full .spop__media img { width: 100%; max-height: 45vh; object-fit: cover; }
.spop--full .spop__text { font-size: 22px; }

.spop--full .spop__close { top: 10px; right: 10px; background: rgba(0, 0, 0, .4); color: #fff; }

/* Image-only full popup: the image is the popup. */
.spop--full.spop--image .spop__box { width: auto; max-width: min(720px, 100%); background: transparent; }
.spop--full.spop--image .spop__imagewrap { display: block; }
.spop--full.spop--image img {
	width: auto;
	max-width: 100%;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	border-radius: 18px;
}

html.spop-locked, html.spop-locked body { overflow: hidden !important; }

/* ---------- Tablet / phone ---------- */

@media screen and (max-width: 782px) {
	.admin-bar .spop--top { top: 46px; }
}
@media screen and (max-width: 600px) {
	.admin-bar .spop--top { top: 0; }
}

@media (max-width: 640px) {
	.spop--bar .spop__inner { flex-wrap: wrap; gap: 12px; padding: 14px 16px 16px; }
	.spop--top .spop__inner { padding-right: 56px; }
	.spop--bar .spop__media img { height: 44px; max-width: 80px; }
	.spop--bar .spop__text { flex: 1 1 0; font-size: 16px; }
	.spop--bar .spop__button { flex: 1 0 100%; padding: 12px 20px; }
	.spop--bottom .spop__close { right: 12px; }
	.spop--top .spop__close { top: 8px; transform: none; }
	.spop--bar.spop--image img { max-height: 110px; }
	.spop--top.spop--image .spop__imagewrap { padding: 8px 52px 8px 12px; }

	.spop--full .spop__inner { gap: 14px; padding: 52px 20px 22px; }
	.spop--full .spop__media { margin: -52px -20px 0; }
	.spop--full .spop__media img { max-height: 38vh; }
	.spop--full .spop__text { font-size: 19px; }
	.spop--full .spop__button { align-self: stretch; }
}

@media (prefers-reduced-motion: reduce) {
	.spop--bar, .spop--full, .spop--full .spop__box, .spop .spop__button { transition: none; }
}
