/**
 * THD Wholesale – age verification popup (21+)
 * Printed by inc/features/age-gate.php. Colours fall back to the brand tokens
 * defined in style.css (:root --thdw-*); override the --ag-* values here to
 * restyle the popup only.
 */

#thd-age-gate {
	--ag-teal:   var(--thdw-teal, #025960);
	--ag-orange: var(--thdw-orange, #fc9e01);
	--ag-mint:   var(--thdw-mint, #bed5cf);
	--ag-cream:  #f7f1e3;
	--ag-white:  #ffffff;

	position: fixed;
	inset: 0;
	z-index: 2147483000; /* above everything, including the cookie banner */
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(20, 20, 20, 0.40);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	font-family: inherit;
	text-align: center;
}

/* The html class is set by the inline check in age-gate.php and removed by age-gate.js. */
html.thd-age-gate-open #thd-age-gate { display: flex; }
html.thd-age-gate-open body { overflow: hidden; height: 100vh; }

#thd-age-gate *,
#thd-age-gate *::before,
#thd-age-gate *::after { box-sizing: border-box; }

.thd-age-gate .ag-modal {
	background: var(--ag-teal);
	color: var(--ag-cream);
	width: 100%;
	max-width: 620px;
	max-height: 92vh;
	overflow-y: auto;
	border-radius: 22px;
	padding: 40px 28px 44px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
	animation: agFadeUp .35s ease;
}
@keyframes agFadeUp {
	from { opacity: 0; transform: translateY(18px); }
	to   { opacity: 1; transform: translateY(0); }
}

.thd-age-gate .ag-logo {
	width: 92px;
	height: 92px;
	margin: 0 auto 22px;
	border-radius: 50%;
	background: var(--ag-mint);
	color: var(--ag-teal);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.thd-age-gate .ag-logo img,
.thd-age-gate .ag-logo svg {
	width: 62px;
	height: 62px;
	object-fit: contain;
	display: block;
}
.thd-age-gate .ag-logo [hidden] { display: none; }

.thd-age-gate .ag-eyebrow {
	color: var(--ag-orange);
	font-size: clamp(24px, 5vw, 34px);
	font-weight: 600;
	line-height: 1.2;
	margin: 0 0 6px;
}
.thd-age-gate .ag-title {
	color: var(--ag-cream);
	font-size: clamp(30px, 6.5vw, 52px);
	font-weight: 500;
	letter-spacing: 2px;
	line-height: 1.1;
	text-transform: uppercase;
	margin: 0 0 28px;
}

.thd-age-gate .ag-buttons {
	display: flex;
	gap: 14px;
	justify-content: center;
	flex-wrap: wrap;
	margin-bottom: 26px;
}
.thd-age-gate .ag-btn {
	font-family: inherit;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
	min-width: 150px;
	min-height: 0;
	padding: 13px 34px;
	border-radius: 999px;
	border: 2px solid var(--ag-cream);
	background: var(--ag-cream);
	color: var(--ag-teal);
	box-shadow: none;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease;
}
.thd-age-gate .ag-btn--yes { border-color: var(--ag-orange); }
.thd-age-gate .ag-btn--no  { background: transparent; color: var(--ag-cream); }
.thd-age-gate .ag-btn:hover,
.thd-age-gate .ag-btn:focus-visible {
	background: var(--ag-cream);
	color: var(--ag-teal);
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
.thd-age-gate .ag-btn:focus-visible { outline: 3px solid var(--ag-white); outline-offset: 2px; }

.thd-age-gate .ag-note {
	color: var(--ag-orange);
	font-size: clamp(14px, 3.5vw, 16px);
	font-weight: 600;
	margin: 0 0 22px;
}
.thd-age-gate .ag-legal {
	color: var(--ag-cream);
	font-size: clamp(13px, 3.4vw, 15px);
	font-weight: 500;
	line-height: 1.6;
	max-width: 520px;
	margin: 0 auto;
}

@media (max-width: 480px) {
	.thd-age-gate .ag-modal { padding: 32px 18px 34px; border-radius: 18px; }
	.thd-age-gate .ag-buttons { gap: 10px; }
	.thd-age-gate .ag-btn { min-width: 130px; padding: 12px 26px; font-size: 16px; }
	.thd-age-gate .ag-logo { width: 76px; height: 76px; margin-bottom: 16px; }
	.thd-age-gate .ag-logo img,
	.thd-age-gate .ag-logo svg { width: 50px; height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
	.thd-age-gate .ag-modal { animation: none; }
	.thd-age-gate .ag-btn { transition: none; }
	.thd-age-gate .ag-btn:hover,
	.thd-age-gate .ag-btn:focus-visible { transform: none; }
}
