/* Age gate in the site's look (markup: Range Cannabis AgeGateBuilder; set up
   in src/AgeGate.php, which also sets --gm-ag-photo / --gm-ag-logo /
   --gm-ag-leaves). Storefront photo left, deep-green leaf panel right with a
   gold rule between; photo on top / panel below on phones.
   Text sits on the darkest green (#053527): gold is >= 5.6:1 there, white 13:1.
   IDs + !important beat the theme's age-gate SCSS and the option-set utility
   classes (bg-black, bg-transparent, pt-5). */

/* Range Cannabis shows the modal as display:flex and the theme centres it;
   pin to the top and fill the real screen, or on phones (100vh > 100dvh while
   the address bar shows) the content centres and a green strip shows above
   the photo. */
#ageGateModal.age-gate-modal {
	inset: 0;
	width: 100%;
	height: 100%;
	align-items: flex-start;
	justify-content: flex-start;
	padding: 0 !important;
	background: var(--bs-secondary) !important;
	overflow-y: auto;
}

#ageGateModal .age-gate-bg-overlay {
	display: none;
}

/* Layout */
#ageGateModal .age-gate-container {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(400px, 44%);
	width: 100%;
	max-width: none;
	height: 100vh;
	height: 100dvh;
}

/* Storefront photo, slightly darkened toward the panel */
#ageGateModal .age-gate-container::before {
	content: "";
	background:
		linear-gradient(90deg, rgba(var(--bs-secondary-rgb), .1) 0%, rgba(var(--bs-secondary-rgb), .45) 100%),
		var(--gm-ag-photo) 78% center / cover no-repeat;
}

/* Panel */
#ageGateModal .age-gate-content {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: stretch;
	height: 100%;
	margin: 0;
	padding: clamp(2.5rem, 6vw, 5rem) !important;
	overflow-y: auto;
	text-align: left;
	background:
		var(--gm-ag-leaves),
		linear-gradient(165deg, var(--bs-secondary) 0%, var(--bs-secondary) 60%, var(--bs-primary) 100%) !important;
	color: #fff;
}

/* Gold rule between photo and panel */
#ageGateModal .age-gate-content::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 5px;
	background: linear-gradient(180deg,
		color-mix(in srgb, var(--bs-accent) 45%, #fff) 0%,
		var(--bs-accent) 50%,
		color-mix(in srgb, var(--bs-accent) 80%, #000) 100%);
}

#ageGateModal .age-gate-content-inner {
	max-width: 30rem;
	max-height: none;
	padding: 0;
	overflow: visible;
	text-align: left;
}

/* White logo */
#ageGateModal .age-gate-content-inner::before {
	content: "";
	display: block;
	width: 112px;
	aspect-ratio: 191 / 150;
	margin-bottom: clamp(1.75rem, 5vh, 3rem);
	background: var(--gm-ag-logo) left center / contain no-repeat;
}

/* Eyebrow, title, short gold bar */
#ageGateModal .age-gate-header::before {
	content: "Welcome to Green Mart";
	display: block;
	margin-bottom: .75rem;
	color: var(--bs-accent);
	font-size: .8125rem;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
}

#ageGateModal .age-gate-title {
	margin: 0;
	color: #fff;
	font-size: clamp(2.25rem, 4vw, 3.5rem);
	font-weight: 700;
	line-height: 1.02;
}

#ageGateModal .age-gate-header::after {
	content: "";
	display: block;
	width: 3.5rem;
	height: 4px;
	margin: 1.5rem 0;
	border-radius: 2px;
	background: var(--gm-gold);
}

#ageGateModal .age-gate-main-body {
	margin-bottom: 2rem !important;
	color: rgba(255, 255, 255, .88) !important;
	font-size: 1.25rem;
}

#ageGateModal .age-gate-main-body p:last-child {
	margin-bottom: 0;
}

/* Buttons: gold pill (dark text, >= 5.6:1) + white outline pill */
#ageGateModal .age-gate-buttons {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	gap: .75rem;
}

#ageGateModal .age-gate-buttons .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	align-self: auto;
	padding: .9rem 1.75rem;
	border-radius: 999px;
	font-size: 1.0625rem;
	font-weight: 700;
	transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}

#ageGateModal .age-gate-buttons .btn::before {
	display: none;
}

#ageGateModal #ageGateYes {
	border: 0;
	background: var(--gm-gold) !important;
	color: var(--bs-dark) !important;
	box-shadow: 0 10px 24px -12px rgba(var(--bs-accent-rgb), .9);
}

#ageGateModal #ageGateYes:hover,
#ageGateModal #ageGateYes:focus-visible {
	background: var(--gm-gold-hover) !important;
	transform: translateY(-1px);
}

#ageGateModal #ageGateNo {
	border: 2px solid rgba(255, 255, 255, .4);
	background: transparent !important;
	color: #fff !important;
}

#ageGateModal #ageGateNo:hover,
#ageGateModal #ageGateNo:focus-visible {
	border-color: #fff;
	background: rgba(255, 255, 255, .08) !important;
}

#ageGateModal .age-gate-buttons .btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
	box-shadow: none;
}

/* Fine print under the buttons */
#ageGateModal .age-gate-footer::after {
	content: "Adult use: 21+ with a valid ID.\A Medical: 18+ with a valid ID and medical documentation.\A Please consume responsibly.";
	display: block;
	white-space: pre-line;
	line-height: 1.6;
	margin-top: 1.75rem;
	color: rgba(255, 255, 255, .7);
	font-size: .8125rem;
}

/* Under-21 message */
#ageGateModal .age-gate-denied-body {
	padding: 1rem 1.25rem;
	border-left: 4px solid var(--bs-accent);
	background: rgba(255, 255, 255, .08);
}

#ageGateModal .age-gate-denied-body p {
	color: #fff;
	font-size: 1.125rem;
	font-weight: 600;
}

/* Tablet: narrower photo */
@media (max-width: 991.98px) {
	#ageGateModal .age-gate-container {
		grid-template-columns: minmax(0, 1fr) minmax(0, 58%);
	}
}

/* Phones: photo band on top, panel below, whole modal scrolls */
@media (max-width: 767.98px) {
	#ageGateModal .age-gate-container {
		grid-template-columns: 1fr;
		grid-template-rows: 32vh auto;
		height: auto;
		min-height: 100%;
	}

	#ageGateModal .age-gate-container::before {
		background:
			linear-gradient(180deg, rgba(var(--bs-secondary-rgb), 0) 55%, rgba(var(--bs-secondary-rgb), .6) 100%),
			var(--gm-ag-photo) 70% center / cover no-repeat;
	}

	#ageGateModal .age-gate-content {
		justify-content: flex-start;
		min-height: 0;
		height: auto;
		padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom)) !important;
		overflow: visible;
	}

	#ageGateModal .age-gate-content::before {
		top: 0;
		right: 0;
		bottom: auto;
		width: auto;
		height: 5px;
		background: linear-gradient(90deg,
			color-mix(in srgb, var(--bs-accent) 45%, #fff) 0%,
			var(--bs-accent) 50%,
			color-mix(in srgb, var(--bs-accent) 80%, #000) 100%);
	}

	#ageGateModal .age-gate-content-inner {
		display: block;
		max-width: none;
	}

	#ageGateModal .age-gate-content-inner::before {
		width: 84px;
		margin-bottom: 1.5rem;
	}

	#ageGateModal .age-gate-buttons {
		flex-direction: column;
		align-items: stretch;
	}

	#ageGateModal .age-gate-buttons .btn {
		width: 100%;
		max-width: none;
	}
}
