/**
 * Gatekeeper Frontend Stylesheet
 * Version: 1.3.0
 * Author: The Web Wolves
 */

/* ==========================================================================
   1. Document & Scroll Lock (Prevents Background Scrolling Behind Modal)
   ========================================================================== */

html.gk-locked,
body.gk-locked {
	overflow: hidden !important;
	height: 100% !important;
	touch-action: none !important;
	-webkit-overflow-scrolling: auto !important;
}

/* ==========================================================================
   2. Base Modal & Overlay Layout
   ========================================================================== */

#gk-gatekeeper-modal,
#gk-gatekeeper-modal *,
#gk-gatekeeper-modal *::before,
#gk-gatekeeper-modal *::after {
	box-sizing: border-box;
}

#gk-gatekeeper-modal.gk-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	height: 100vh;
	height: 100dvh;
	background: var(--gk-overlay-bg, rgba(0, 0, 0, 0.88));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	z-index: 99999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: env(safe-area-inset-top, 16px) env(safe-area-inset-right, 16px) env(safe-area-inset-bottom, 16px) env(safe-area-inset-left, 16px);
	box-sizing: border-box;
	font-family: inherit;
	color: var(--gk-text-color, #e2e8f0);
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--gk-anim-duration, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
	            visibility var(--gk-anim-duration, 300ms) cubic-bezier(0.16, 1, 0.3, 1);
	overflow: hidden;
}

#gk-gatekeeper-modal.gk-visible {
	opacity: 1 !important;
	visibility: visible !important;
}

#gk-gatekeeper-modal .gk-modal-container {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	overflow: hidden;
}

/* Modal Box */
#gk-gatekeeper-modal .gk-modal-box {
	background: var(--gk-modal-bg, #0b0d13);
	width: 100%;
	max-width: var(--gk-modal-width, 800px);
	height: auto;
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	border: var(--gk-modal-border-width, 1px) solid var(--gk-modal-border-color, #d4af37);
	border-radius: var(--gk-modal-border-radius, 8px);
	box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85),
	            0 0 35px -5px rgba(212, 175, 55, 0.2),
	            inset 0 1px 0 rgba(255, 255, 255, 0.05);
	display: flex;
	flex-direction: column;
	position: relative;
	box-sizing: border-box;
	overflow: hidden;
	outline: none;
	transform: translateZ(0);
	margin: auto;
}

/* Modal Gate View (Flex Container for Header, Body, and Persistent Footer) */
#gk-gatekeeper-modal .gk-gate-view {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	max-height: 100%;
	min-height: 0;
	flex: 1 1 auto;
	overflow: hidden;
	box-sizing: border-box;
}

/* ==========================================================================
   3. Header Section & Legal Organization Branding
   ========================================================================== */

#gk-gatekeeper-modal .gk-modal-header {
	padding: 34px 36px 16px;
	text-align: center;
	flex-shrink: 0;
	background: linear-gradient(180deg, rgba(212, 175, 55, 0.05) 0%, transparent 100%);
	position: relative;
	z-index: 2;
	box-sizing: border-box;
	width: 100%;
}

#gk-gatekeeper-modal .gk-modal-header:not(:has(.gk-modal-icon-wrap)):not(:has(.gk-org-logo-wrap)):not(:has(.gk-org-name)) {
	padding-top: 38px;
}

#gk-gatekeeper-modal .gk-org-logo-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 12px;
}

#gk-gatekeeper-modal .gk-org-logo {
	height: auto;
	max-height: 72px;
	width: auto;
	object-fit: contain;
	display: block;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

#gk-gatekeeper-modal .gk-org-name {
	font-size: 0.95rem;
	font-weight: 700;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: var(--gk-accent-color, #d4af37);
	margin: 0 0 6px 0;
	line-height: 1.3;
}

#gk-gatekeeper-modal .gk-modal-icon-wrap {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 12px;
	color: var(--gk-accent-color, #d4af37);
	filter: drop-shadow(0 2px 8px rgba(212, 175, 55, 0.3));
}

#gk-gatekeeper-modal .gk-modal-icon-wrap svg {
	width: 44px;
	height: 44px;
	fill: currentColor;
}

#gk-gatekeeper-modal .gk-custom-icon {
	max-width: 64px;
	max-height: 64px;
	height: auto;
	object-fit: contain;
}

#gk-gatekeeper-modal .gk-modal-heading {
	font-size: 1.35rem;
	font-weight: 700;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--gk-heading-color, #d4af37);
	margin: 0 0 8px 0;
	padding: 0;
	line-height: 1.35;
	box-sizing: border-box;
	display: block;
}

#gk-gatekeeper-modal .gk-modal-subtitle {
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--gk-text-color, #e2e8f0);
	opacity: 0.88;
	margin: 0;
	padding: 0;
	line-height: 1.4;
	box-sizing: border-box;
}

#gk-gatekeeper-modal .gk-gold-divider {
	height: 1px;
	width: 80%;
	max-width: 320px;
	margin: 16px auto 0;
	background: linear-gradient(90deg, transparent 0%, var(--gk-modal-border-color, #d4af37) 50%, transparent 100%);
	opacity: 0.7;
}

/* ==========================================================================
   4. Scrollable Content Body
   ========================================================================== */

#gk-gatekeeper-modal .gk-modal-body {
	padding: 16px 32px 20px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	touch-action: pan-y;
	flex: 1 1 auto;
	min-height: 0; /* Crucial: enables flex-shrink & scrolling */
	font-size: var(--gk-font-size, 15px);
	line-height: 1.65;
	color: var(--gk-text-color, #e2e8f0);
	scrollbar-width: thin;
	scrollbar-color: var(--gk-modal-border-color, #d4af37) rgba(0, 0, 0, 0.2);
}

#gk-gatekeeper-modal .gk-modal-body::-webkit-scrollbar {
	width: 6px;
}

#gk-gatekeeper-modal .gk-modal-body::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.2);
}

#gk-gatekeeper-modal .gk-modal-body::-webkit-scrollbar-thumb {
	background-color: var(--gk-modal-border-color, #d4af37);
	border-radius: 3px;
}

#gk-gatekeeper-modal .gk-intro-text {
	margin-bottom: 20px;
	font-weight: 500;
	color: var(--gk-text-color, #e2e8f0);
	opacity: 0.95;
	border-left: 3px solid var(--gk-accent-color, #d4af37);
	padding-left: 14px;
	font-size: 0.95rem;
	line-height: 1.6;
}

#gk-gatekeeper-modal .gk-sections-list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

#gk-gatekeeper-modal .gk-section-item {
	background: rgba(255, 255, 255, 0.02);
	border: 1px solid rgba(212, 175, 55, 0.15);
	border-radius: 6px;
	padding: 14px 18px;
}

#gk-gatekeeper-modal .gk-section-title {
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--gk-accent-color, #d4af37);
	margin: 0 0 6px 0;
	letter-spacing: 0.3px;
}

#gk-gatekeeper-modal .gk-section-content {
	font-size: 0.88rem;
	line-height: 1.6;
	opacity: 0.9;
}

#gk-gatekeeper-modal .gk-section-content p:last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   5. Persistent Footer & Action Buttons
   ========================================================================== */

#gk-gatekeeper-modal .gk-modal-footer {
	padding: 16px 32px 20px;
	flex-shrink: 0;
	border-top: 1px solid rgba(212, 175, 55, 0.18);
	background: #0b0d13;
	background: linear-gradient(180deg, rgba(11, 13, 19, 0.95) 0%, rgba(7, 9, 14, 0.98) 100%);
	text-align: center;
	position: relative;
	z-index: 2;
	box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}

#gk-gatekeeper-modal .gk-button-group {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin-bottom: 10px;
}

#gk-gatekeeper-modal .gk-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: var(--gk-btn-padding, 12px 24px);
	font-size: var(--gk-btn-font-size, 14px);
	font-weight: 600;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	border-radius: 6px;
	cursor: pointer;
	text-decoration: none;
	transition: all 0.2s ease-in-out;
	box-sizing: border-box;
	min-width: 180px;
	min-height: 44px; /* WCAG 2.5.5 Touch Target Compliance */
	outline: none;
}

#gk-gatekeeper-modal .gk-btn:focus-visible {
	outline: 2px solid var(--gk-accent-color, #d4af37);
	outline-offset: 3px;
}

/* Agree Button (Primary) */
#gk-gatekeeper-modal .gk-btn-agree {
	background: var(--gk-agree-bg, #1e293b);
	color: var(--gk-agree-text, #ffffff);
	border: 1px solid var(--gk-agree-border, #3b82f6);
	box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

#gk-gatekeeper-modal .gk-btn-agree:hover {
	background: var(--gk-agree-hover-bg, #2563eb);
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

#gk-gatekeeper-modal .gk-btn-agree:active {
	transform: translateY(0);
}

#gk-gatekeeper-modal .gk-btn-arrow {
	transition: transform 0.2s ease;
}

#gk-gatekeeper-modal .gk-btn-agree:hover .gk-btn-arrow {
	transform: translateX(3px);
}

/* Decline Button (Secondary) */
#gk-gatekeeper-modal .gk-btn-decline {
	background: var(--gk-decline-bg, transparent);
	color: var(--gk-decline-text, #d4af37);
	border: 1px solid var(--gk-decline-border, #d4af37);
}

#gk-gatekeeper-modal .gk-btn-decline:hover {
	background: var(--gk-decline-hover-bg, rgba(212, 175, 55, 0.12));
	transform: translateY(-1px);
}

#gk-gatekeeper-modal .gk-btn-decline:active {
	transform: translateY(0);
}

#gk-gatekeeper-modal .gk-footer-note {
	font-size: 0.75rem;
	color: var(--gk-text-color, #e2e8f0);
	opacity: 0.65;
	margin: 0;
	line-height: 1.4;
}

/* ==========================================================================
   6. Decline Fallback View
   ========================================================================== */

#gk-gatekeeper-modal .gk-decline-notice {
	padding: 40px 32px;
	text-align: center;
	margin: auto 0;
}

#gk-gatekeeper-modal .gk-decline-icon {
	font-size: 48px;
	margin-bottom: 16px;
}

#gk-gatekeeper-modal .gk-decline-title {
	font-size: 1.4rem;
	font-weight: 700;
	color: #ef4444;
	margin: 0 0 12px 0;
}

#gk-gatekeeper-modal .gk-decline-body {
	font-size: 0.95rem;
	line-height: 1.6;
	margin-bottom: 24px;
	opacity: 0.9;
}

#gk-gatekeeper-modal .gk-decline-actions {
	display: flex;
	justify-content: center;
}

#gk-gatekeeper-modal .gk-hidden {
	display: none !important;
}

/* ==========================================================================
   7. Animations
   ========================================================================== */

/* Fade Zoom Animation (Default) */
#gk-gatekeeper-modal.gk-anim-fade_zoom .gk-modal-box {
	opacity: 0;
	transform: scale(0.96) translateY(10px);
	transition: opacity var(--gk-anim-duration, 300ms) cubic-bezier(0.16, 1, 0.3, 1),
	            transform var(--gk-anim-duration, 300ms) cubic-bezier(0.16, 1, 0.3, 1);
}

#gk-gatekeeper-modal.gk-visible.gk-anim-fade_zoom .gk-modal-box {
	opacity: 1;
	transform: scale(1) translateY(0);
}

/* Simple Fade */
#gk-gatekeeper-modal.gk-anim-fade .gk-modal-box {
	opacity: 0;
	transition: opacity var(--gk-anim-duration, 300ms) ease;
}

#gk-gatekeeper-modal.gk-visible.gk-anim-fade .gk-modal-box {
	opacity: 1;
}

/* Slide Down */
#gk-gatekeeper-modal.gk-anim-slide_down .gk-modal-box {
	opacity: 0;
	transform: translateY(-40px);
	transition: opacity var(--gk-anim-duration, 300ms) ease,
	            transform var(--gk-anim-duration, 300ms) cubic-bezier(0.16, 1, 0.3, 1);
}

#gk-gatekeeper-modal.gk-visible.gk-anim-slide_down .gk-modal-box {
	opacity: 1;
	transform: translateY(0);
}

/* No animation */
#gk-gatekeeper-modal.gk-anim-none .gk-modal-box {
	transition: none !important;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
	#gk-gatekeeper-modal,
	#gk-gatekeeper-modal .gk-modal-box,
	#gk-gatekeeper-modal .gk-btn,
	#gk-gatekeeper-modal .gk-btn-arrow {
		transition: none !important;
		animation: none !important;
		transform: none !important;
	}
}

/* ==========================================================================
   8. Responsive Viewport Adaptations
   ========================================================================== */

/* Short Viewport Heights (e.g. 1366x768 Laptops, Landscape Mobile) */
@media (max-height: 720px) and (min-width: 768px) {
	#gk-gatekeeper-modal .gk-modal-box {
		max-height: calc(100vh - 32px);
		max-height: calc(100dvh - 32px);
	}
	#gk-gatekeeper-modal .gk-modal-header {
		padding: 22px 28px 12px;
	}
	#gk-gatekeeper-modal .gk-modal-header:not(:has(.gk-modal-icon-wrap)):not(:has(.gk-org-logo-wrap)):not(:has(.gk-org-name)) {
		padding-top: 24px;
	}
	#gk-gatekeeper-modal .gk-org-logo {
		max-height: 48px;
	}
	#gk-gatekeeper-modal .gk-org-name {
		font-size: 0.85rem;
		margin-bottom: 4px;
	}
	#gk-gatekeeper-modal .gk-modal-heading {
		font-size: 1.15rem;
		margin-bottom: 4px;
		line-height: 1.3;
	}
	#gk-gatekeeper-modal .gk-modal-subtitle {
		font-size: 0.75rem;
	}
	#gk-gatekeeper-modal .gk-modal-icon-wrap {
		margin-bottom: 8px;
	}
	#gk-gatekeeper-modal .gk-modal-icon-wrap svg {
		width: 32px;
		height: 32px;
	}
	#gk-gatekeeper-modal .gk-gold-divider {
		margin: 10px auto 0;
	}
	#gk-gatekeeper-modal .gk-modal-body {
		padding: 12px 28px 16px;
	}
	#gk-gatekeeper-modal .gk-modal-footer {
		padding: 12px 28px 14px;
	}
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
	#gk-gatekeeper-modal .gk-modal-box {
		max-width: 720px;
		max-height: calc(100vh - 48px);
		max-height: calc(100dvh - 48px);
	}
	#gk-gatekeeper-modal .gk-modal-header {
		padding: 28px 28px 14px;
	}
	#gk-gatekeeper-modal .gk-modal-header:not(:has(.gk-modal-icon-wrap)):not(:has(.gk-org-logo-wrap)):not(:has(.gk-org-name)) {
		padding-top: 32px;
	}
	#gk-gatekeeper-modal .gk-modal-body {
		padding: 14px 24px 18px;
	}
	#gk-gatekeeper-modal .gk-modal-footer {
		padding: 14px 24px 18px;
	}
}

/* Mobile Devices (767px and below) */
@media (max-width: 767px) {
	#gk-gatekeeper-modal.gk-overlay {
		padding: 0;
		align-items: stretch;
		justify-content: stretch;
	}

	#gk-gatekeeper-modal .gk-modal-container {
		width: 100%;
		height: 100%;
		height: 100vh;
		height: 100dvh;
	}

	#gk-gatekeeper-modal .gk-modal-box {
		width: 100%;
		max-width: 100%;
		height: 100%;
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		border-radius: 0;
		border: none;
		border-top: 2px solid var(--gk-modal-border-color, #d4af37);
		margin: 0;
	}

	#gk-gatekeeper-modal .gk-modal-header {
		padding: max(16px, env(safe-area-inset-top, 16px)) 16px 12px;
	}

	#gk-gatekeeper-modal .gk-org-logo {
		max-height: 52px;
	}

	#gk-gatekeeper-modal .gk-org-name {
		font-size: 0.85rem;
		letter-spacing: 1.5px;
	}

	#gk-gatekeeper-modal .gk-modal-heading {
		font-size: 1.15rem;
		letter-spacing: 1px;
	}

	#gk-gatekeeper-modal .gk-modal-subtitle {
		font-size: 0.75rem;
		letter-spacing: 0.8px;
	}

	#gk-gatekeeper-modal .gk-modal-body {
		padding: 12px 16px 16px;
		font-size: 14px;
	}

	#gk-gatekeeper-modal .gk-intro-text {
		padding-left: 12px;
		margin-bottom: 14px;
	}

	#gk-gatekeeper-modal .gk-sections-list {
		gap: 12px;
	}

	#gk-gatekeeper-modal .gk-section-item {
		padding: 12px 14px;
	}

	#gk-gatekeeper-modal .gk-section-title {
		font-size: 0.9rem;
	}

	#gk-gatekeeper-modal .gk-section-content {
		font-size: 0.84rem;
	}

	#gk-gatekeeper-modal .gk-modal-footer {
		padding: 12px 16px max(14px, env(safe-area-inset-bottom, 14px));
	}

	#gk-gatekeeper-modal .gk-button-group {
		flex-direction: column;
		width: 100%;
		gap: 10px;
		margin-bottom: 8px;
	}

	#gk-gatekeeper-modal .gk-btn {
		width: 100%;
		min-width: 100%;
		min-height: 44px; /* WCAG 2.5.5 Touch Target Compliance */
		padding: 12px 16px;
		font-size: 13.5px;
	}

	#gk-gatekeeper-modal .gk-footer-note {
		font-size: 0.7rem;
	}
}

/* Extra Small Mobile Viewports (e.g. 320px x 568px iPhone SE 1st gen) */
@media (max-width: 360px) {
	#gk-gatekeeper-modal .gk-modal-header {
		padding: max(12px, env(safe-area-inset-top, 12px)) 12px 8px;
	}
	#gk-gatekeeper-modal .gk-org-name {
		font-size: 0.78rem;
		letter-spacing: 1px;
	}
	#gk-gatekeeper-modal .gk-modal-heading {
		font-size: 1rem;
		letter-spacing: 0.5px;
	}
	#gk-gatekeeper-modal .gk-modal-body {
		padding: 8px 12px 12px;
		font-size: 13px;
	}
	#gk-gatekeeper-modal .gk-section-item {
		padding: 10px 12px;
	}
	#gk-gatekeeper-modal .gk-modal-footer {
		padding: 10px 12px max(10px, env(safe-area-inset-bottom, 10px));
	}
	#gk-gatekeeper-modal .gk-btn {
		min-height: 44px;
		padding: 10px 14px;
		font-size: 13px;
	}
}

/* Desktop & Large Laptops (1024px+) */
@media (min-width: 1024px) {
	#gk-gatekeeper-modal .gk-modal-box {
		max-width: var(--gk-modal-width, 800px);
		max-height: min(calc(100vh - 60px), 820px);
		max-height: min(calc(100dvh - 60px), 820px);
	}
	#gk-gatekeeper-modal .gk-modal-header {
		padding: 36px 40px 18px;
	}
	#gk-gatekeeper-modal .gk-modal-header:not(:has(.gk-modal-icon-wrap)):not(:has(.gk-org-logo-wrap)):not(:has(.gk-org-name)) {
		padding-top: 40px;
	}
}
