/**
 * GG Donation Pop-up
 *
 * Scoped to .ggdp / .ggdp__* so it never touches theme styles. The pop-up root
 * is moved to be a direct child of <body> by the script, which is what makes
 * this fixed overlay cover the viewport inside transformed theme wrappers.
 */

.ggdp {
	--ggdp-navy: #1e3a5f;
	--ggdp-teal: #00727a;
	--ggdp-light: #eef1f5;
	--ggdp-ink: #333;
	--ggdp-muted: #6b7280;
	--ggdp-border: #c9d1dc;

	font-family: inherit;
	color: var(--ggdp-ink);
	box-sizing: border-box;
}

.ggdp *,
.ggdp *::before,
.ggdp *::after {
	box-sizing: border-box;
}

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

/* Pop-up shell: viewport-fixed, above the theme header (z-index 9999). */
.ggdp--popup {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100vh;
	height: 100dvh;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	overscroll-behavior: contain;
}

.ggdp__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.ggdp__card {
	position: relative;
	background: #fff;
	width: min(520px, 92vw);
	max-height: 92vh;
	max-height: 92dvh;
	overflow: auto;
	overscroll-behavior: contain;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	display: grid;
	gap: 8px;
}

.ggdp--inline {
	display: block;
}

.ggdp--inline .ggdp__card {
	width: 100%;
	max-width: var(--ggdp-max, 560px);
	margin: 0 auto;
	box-shadow: none;
	border: 1px solid var(--ggdp-border);
}

.ggdp__bar {
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 12px;
	min-height: 64px;
	background: var(--ggdp-teal);
	color: #fff;
	padding: 8px 52px;
	border-radius: 8px 8px 0 0;
}

.ggdp__brand {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	letter-spacing: 0.03em;
	line-height: 1;
	text-align: center;
}

.ggdp__logo {
	display: block;
	max-height: var(--ggdp-logo-h, 44px);
	max-width: 220px;
	width: auto;
}

/* The theme lockup is a JPEG, so it sits on a white plate on the teal bar. */
.ggdp__logo--plate {
	max-height: calc(var(--ggdp-logo-h, 44px) + 10px);
	padding: 5px 12px;
	background: #fff;
	border-radius: 4px;
}

.ggdp__x {
	background: none;
	border: 0;
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	line-height: 1;
	padding: 4px;
	font-family: inherit;
}

.ggdp__bar .ggdp__x {
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	padding: 8px;
}

.ggdp__x--float {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--ggdp-navy);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.ggdp__body {
	padding: 6px 18px 2px;
}

.ggdp__h {
	color: var(--ggdp-navy);
	font-size: 1.4rem;
	line-height: 1.25;
	margin: 0 0 6px;
}

.ggdp__p {
	margin: 0;
	color: var(--ggdp-ink);
}

.ggdp__freq,
.ggdp__amts {
	display: grid;
	gap: 6px;
	padding: 0 14px;
}

.ggdp__freq {
	grid-template-columns: 1fr 1fr;
}

.ggdp__amts {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ggdp__btn {
	appearance: none;
	background: var(--ggdp-light);
	color: var(--ggdp-navy);
	border: 0;
	border-radius: 4px;
	padding: 12px 6px;
	min-height: 44px;
	font-family: inherit;
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.2;
	cursor: pointer;
}

.ggdp__btn.is-on {
	background: var(--ggdp-navy);
	color: #fff;
}

.ggdp__other {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 14px;
	background: var(--ggdp-light);
	border-radius: 4px;
	padding: 0 12px;
}

.ggdp__other input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	padding: 12px 0;
	font-family: inherit;
	font-size: 1rem;
	color: var(--ggdp-navy);
}

.ggdp__fees {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 14px;
	font-size: 0.9rem;
	color: var(--ggdp-ink);
	cursor: pointer;
}

.ggdp__donate {
	appearance: none;
	margin: 4px 14px 14px;
	background: var(--ggdp-teal);
	color: #fff;
	border: 0;
	border-radius: 4px;
	padding: 15px;
	min-height: 48px;
	font-family: inherit;
	font-size: 1.15rem;
	font-weight: 700;
	cursor: pointer;
}

.ggdp__foot {
	margin: 8px 0 0;
	padding: 12px 16px;
	text-align: center;
	background: var(--ggdp-teal);
	color: #fff;
	font-size: 0.8rem;
	border-radius: 0 0 8px 8px;
}

.ggdp__later {
	background: none;
	border: 0;
	color: #fff;
	text-decoration: underline;
	cursor: pointer;
	font-family: inherit;
	font-size: inherit;
	padding: 0;
}

.ggdp__h,
.ggdp__p,
.ggdp__fees,
.ggdp__foot,
.ggdp__later {
	font-weight: 700;
}

.ggdp :focus-visible {
	outline: 3px solid #f5a623;
	outline-offset: 2px;
}

/* Scroll lock while the pop-up is open. */
html.ggdp-lock,
html.ggdp-lock body {
	overflow: hidden;
}

@media (max-width: 600px) {
	.ggdp--popup {
		align-items: flex-end;
	}

	.ggdp--popup[data-mobile="sheet"] .ggdp__card {
		width: 100%;
		max-width: none;
		max-height: 88vh;
		max-height: 88dvh;
		border-radius: 12px 12px 0 0;
	}

	.ggdp--popup[data-mobile="sheet"] .ggdp__bar {
		border-radius: 12px 12px 0 0;
	}

	.ggdp--popup[data-mobile="full"] {
		align-items: stretch;
	}

	.ggdp--popup[data-mobile="full"] .ggdp__card {
		width: 100%;
		max-width: none;
		height: 100vh;
		height: 100dvh;
		max-height: none;
		border-radius: 0;
	}

	.ggdp--popup[data-mobile="full"] .ggdp__bar {
		border-radius: 0;
	}

	.ggdp--popup[data-mobile="sheet"] .ggdp__foot,
	.ggdp--popup[data-mobile="full"] .ggdp__foot {
		border-radius: 0;
	}

	.ggdp--popup[data-mobile="hide"] {
		display: none !important;
	}

	/* The immediate test URL always opens it, even on a phone. The
	   live-settings URL follows the mobile setting like a normal visit. */
	.ggdp--popup[data-test-mode="instant"][data-mobile="hide"] {
		display: flex !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ggdp,
	.ggdp * {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}
