/**
 * Minimal CSS to render the Age Verification modal as a centered lightbox.
 * Keeps styles intentionally small and self-contained.
 */

/* Background page must not scroll while the gate is open. */
html.avm-modal-open,
html.avm-modal-open body {
	overflow: hidden;
	touch-action: none;
}

.avm-modal {
	position: fixed;
	inset: 0;
	display: none;
	z-index: 99999;
	pointer-events: none;
}

.avm-modal.avm-open {
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: auto;
	box-sizing: border-box;
	padding: 16px;
	/* Respect notches and rounded corners on phones. */
	padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
		max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.avm-modal .avm-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	-webkit-backdrop-filter: blur(0);
	backdrop-filter: blur(0);
}

/*
 * Without border-box the configurable padding is added on top of the width,
 * which pushed the dialog off the right edge of every phone screen and cut
 * the submit button in half.
 */
.avm-modal .avm-dialog,
.avm-modal .avm-dialog *,
.avm-modal .avm-dialog *::before,
.avm-modal .avm-dialog *::after {
	box-sizing: border-box;
}

.avm-modal .avm-dialog {
	position: relative;
	width: 100%;
	max-width: 520px;
	margin: auto;
	background: #ffffff;
	color: #111827;
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
	padding: 20px;
	font-family: inherit;
	font-size: 16px;
	line-height: 1.5;
	z-index: 1;
	/* Long legal text, or a phone held in landscape, must stay reachable. */
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.avm-modal .avm-close {
	position: absolute;
	top: 4px;
	right: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	/* 44px is the smallest reliable touch target. */
	width: 44px;
	height: 44px;
	background: transparent;
	border: 0;
	font-size: 24px;
	color: #111827;
	cursor: pointer;
	line-height: 1;
}

.avm-modal .avm-body {
	outline: none;
}

.avm-modal .avm-methods {
	margin-bottom: 12px;
}

.avm-modal .avm-methods label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	margin-right: 12px;
	font-weight: 500;
	cursor: pointer;
}

.avm-modal input[type="checkbox"],
.avm-modal input[type="radio"] {
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
	margin: 0;
	accent-color: #2563eb;
}

.avm-modal .avm-dob label {
	display: block;
	margin-bottom: 6px;
	font-weight: 500;
}

.avm-modal input[type="date"],
.avm-modal input[type="text"] {
	width: 100%;
	box-sizing: border-box;
	min-height: 44px;
	padding: 10px 12px;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	font-size: inherit;
	margin-bottom: 10px;
}

.avm-modal .avm-actions {
	margin-top: 8px;
	text-align: right;
}

.avm-modal .avm-actions .avm-submit {
	background: #2563eb;
	color: #fff;
	border: 0;
	min-height: 44px;
	padding: 12px 18px;
	border-radius: 4px;
	cursor: pointer;
	font-weight: 600;
}

.avm-modal .avm-actions .avm-cancel {
	background: #f3f4f6;
	color: #374151;
	border: 0;
	min-height: 44px;
	padding: 12px 18px;
	border-radius: 4px;
	cursor: pointer;
	font-weight: 600;
	transition: background 0.2s;
	margin-right: 10px;
}

.avm-modal .avm-actions .avm-cancel:hover,
.avm-modal .avm-actions .avm-cancel:focus {
	background: #e5e7eb;
	color: #111827;
}

.avm-modal .avm-error {
	color: #b91c1c;
	margin-top: 10px;
	min-height: 18px;
}

/* Accessibility tweaks */
.avm-modal [tabindex] { outline: none; }
.avm-modal:focus { outline: none; }

/* RTL support */
html[dir="rtl"] .avm-modal .avm-dialog { direction: rtl; }
html[dir="rtl"] .avm-modal .avm-close { left: 10px; right: auto; }

/* Small screens */
@media (max-width: 600px) {
	.avm-modal .avm-dialog {
		max-width: none;
	}

	/* Stacked, full width, primary action on top and cancel underneath. */
	.avm-modal .avm-actions {
		display: flex;
		flex-direction: column-reverse;
		gap: 10px;
		text-align: initial;
	}

	.avm-modal .avm-actions .avm-submit,
	.avm-modal .avm-actions .avm-cancel {
		width: 100%;
		margin: 0;
	}

	/* One method per line: side by side they are impossible to tap apart. */
	.avm-modal .avm-methods label {
		display: flex;
		margin-right: 0;
	}

	/*
	 * iOS zooms the whole page when a focused field is under 16px, and the
	 * font size is merchant configurable, so clamp it here.
	 */
	.avm-modal input[type="date"],
	.avm-modal input[type="text"] {
		font-size: 16px;
	}
}
