/* ==========================================================================
   STG Labs 21+ age gate. The overlay geometry, backdrop and scroll lock are
   printed inline in <head> (src/AgeGate/Head.php); this file styles the panel.
   Tokens come from the theme's theme.json presets, with fallbacks.
   ========================================================================== */

.stg-age {
	--stg-age-void: var(--wp--preset--color--void, #050505);
	--stg-age-ink: var(--wp--preset--color--ink, #0b0b0d);
	--stg-age-raised: var(--wp--preset--color--raised, #1c1c20);
	--stg-age-bone: var(--wp--preset--color--bone, #f3efe6);
	--stg-age-muted: var(--wp--preset--color--muted, #a09e99);
	--stg-age-gold: var(--wp--preset--color--gold, #c9a24a);
	--stg-age-gold-light: var(--wp--preset--color--gold-light, #e9d08a);
	--stg-age-display: var(--wp--preset--font-family--display, "Cormorant Garamond", Georgia, serif);
	--stg-age-sans: var(--wp--preset--font-family--sans, Manrope, "Helvetica Neue", Arial, sans-serif);
	--stg-age-ease: var(--wp--custom--ease--out, cubic-bezier(0.16, 1, 0.3, 1));
	color-scheme: dark;
	font-family: var(--stg-age-sans);
	-webkit-font-smoothing: antialiased;
}

/* Same selector as the critical CSS so this richer backdrop replaces it once loaded. */
html.stg-age-pending .stg-age {
	background:
		radial-gradient(60rem 32rem at 50% -10%, rgba(201, 162, 74, 0.14), transparent 62%),
		rgba(5, 5, 5, 0.9);
	-webkit-backdrop-filter: blur(18px) saturate(120%);
	backdrop-filter: blur(18px) saturate(120%);
}

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

/* Panel: margin:auto centres it and still lets a tall panel scroll on short screens. */
.stg-age__panel {
	position: relative;
	width: 100%;
	max-width: 30rem;
	margin: auto;
	padding: clamp(1.75rem, 1.25rem + 2.5vw, 2.75rem) clamp(1.25rem, 0.75rem + 2.5vw, 2.5rem);
	text-align: center;
	color: var(--stg-age-bone);
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 40%),
		linear-gradient(180deg, var(--stg-age-raised) 0%, var(--stg-age-ink) 100%);
	border: 1px solid rgba(201, 162, 74, 0.26);
	border-radius: var(--wp--custom--radius--l, 20px);
	box-shadow:
		0 40px 120px rgba(0, 0, 0, 0.65),
		inset 0 1px 0 rgba(255, 255, 255, 0.07);
	animation: stg-age-in 0.6s var(--stg-age-ease) both;
}

.stg-age__panel::before {
	content: "";
	position: absolute;
	top: -1px;
	left: 18%;
	right: 18%;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--stg-age-gold-light), transparent);
	opacity: 0.8;
	pointer-events: none;
}

/*
 * The panel and the refusal take focus only programmatically (tabindex -1). The radius is
 * restated because the theme's global :focus-visible rule sets border-radius: 2px.
 */
.stg-age__panel:focus,
.stg-age__panel:focus-visible {
	outline: none;
	border-radius: var(--wp--custom--radius--l, 20px);
}

.stg-age__title--denied:focus,
.stg-age__title--denied:focus-visible {
	outline: none;
}

/* Brand lockup, as in the site header */
.stg-age__brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem;
	margin: 0 0 1.5rem;
	line-height: 1;
}

.stg-age__mark {
	display: block;
	width: 54px;
	height: auto;
	margin: 0 0 0.35rem;
	filter: drop-shadow(0 0 14px rgba(201, 162, 74, 0.3));
}

.stg-age__brand-name {
	font-family: var(--stg-age-display);
	font-size: 1.25rem;
	font-weight: 500;
	letter-spacing: 0.02em;
}

.stg-age__brand-labs {
	font-size: 0.62rem;
	font-weight: 600;
	letter-spacing: 0.34em;
	text-transform: uppercase;
	color: var(--stg-age-gold);
}

/* Copy */
.stg-age__title {
	margin: 0 0 0.75rem;
	font-family: var(--stg-age-display);
	font-size: clamp(1.875rem, 1.45rem + 1.8vw, 2.5rem);
	font-weight: 500;
	font-style: normal;
	line-height: 1.1;
	letter-spacing: -0.01em;
	text-transform: none;
	color: var(--stg-age-bone);
	text-wrap: balance;
}

.stg-age__body {
	max-width: 38ch;
	margin: 0 auto 1.75rem;
	font-size: 1rem;
	line-height: 1.6;
	color: rgba(243, 239, 230, 0.8);
	text-wrap: pretty;
}

/* Buttons: stacked on phones, side by side from about 544px */
.stg-age__actions {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

@media (min-width: 34em) {
	.stg-age__actions {
		flex-direction: row;
	}

	.stg-age__actions .stg-age__btn {
		flex: 1 1 0;
	}
}

.stg-age__btn {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 0.95rem 1.25rem;
	font-family: var(--stg-age-sans);
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.08em;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	border: 1px solid transparent;
	border-radius: 999px;
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.stg-age__btn--primary,
.stg-age__btn--primary:visited {
	color: var(--stg-age-void);
	background: var(--stg-age-gold);
	box-shadow: 0 12px 32px -12px rgba(201, 162, 74, 0.6);
}

.stg-age__btn--primary:hover {
	color: var(--stg-age-void);
	background: var(--stg-age-gold-light);
}

.stg-age__btn--ghost {
	color: var(--stg-age-bone);
	background: transparent;
	border-color: rgba(243, 239, 230, 0.24);
}

.stg-age__btn--ghost:hover {
	color: var(--stg-age-bone);
	border-color: var(--stg-age-bone);
}

.stg-age__btn:focus-visible {
	outline: 2px solid var(--stg-age-gold-light);
	outline-offset: 3px;
	border-radius: 999px;
}

.stg-age__fine a:focus-visible {
	outline: 2px solid var(--stg-age-gold-light);
	outline-offset: 3px;
}

/* Small print */
.stg-age__fine {
	margin: 1.5rem 0 0;
	padding-top: 1.25rem;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	font-size: 0.8125rem;
	line-height: 1.55;
	color: var(--stg-age-muted);
}

.stg-age__fine a {
	color: var(--stg-age-gold-light);
	text-decoration: underline;
	text-decoration-color: rgba(233, 208, 138, 0.45);
	text-underline-offset: 3px;
	border-radius: 2px;
}

.stg-age__fine a:hover {
	color: var(--stg-age-bone);
	text-decoration-color: currentColor;
}

/* Refusal. [hidden] keeps it out until "I am under 21". */
.stg-age__denied:not([hidden]) {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.5rem;
}

.stg-age__denied .stg-age__title {
	margin: 0;
}

.stg-age__denied .stg-age__btn {
	width: auto;
	min-width: 12rem;
}

@keyframes stg-age-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.98);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.stg-age__panel {
		animation: none;
	}

	.stg-age__btn {
		transition: none;
	}
}

@media (forced-colors: active) {
	.stg-age__panel {
		border: 1px solid CanvasText;
	}

	.stg-age__btn {
		border: 1px solid ButtonText;
	}
}
