/* ==========================================================================
	 1. LIGHTBOX MODAL & BACKDROP OVERLAY
	 ========================================================================== */

.tsdv-wrapper {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	background-color: rgba(15, 23, 42, 0.9) !important; /* Deep dark slate backdrop */
	z-index: 999999 !important; /* Floats over theme headers and menus cleanly */
	display: flex !important;
	justify-content: center !important;
	align-items: center !important;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
	box-sizing: border-box;
}

/* Toggle state class controlled by JavaScript */
.tsdv-wrapper.tsdv-lightbox-open {
	opacity: 1 !important;
	pointer-events: auto !important;
}

/* Temporary testing launcher button styling */
.tsdv-launcher-btn {
	background-color: #2563eb !important;
	color: #ffffff !important;
	border: none !important;
	padding: 12px 24px !important;
	font-size: 0.95rem !important;
	font-weight: 600 !important;
	border-radius: 6px !important;
	cursor: pointer !important;
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2) !important;
	transition: background-color 0.2s ease !important;
}

.tsdv-launcher-btn:hover {
	background-color: #1d4ed8 !important;
}

/* ==========================================================================
	 2. INTERIOR STAGE & CANVAS CONTAINMENT
	 ========================================================================== */

.tsdv-container {
	width: 90%;
	
	/* The Fix: 133vh dynamically chokes down the width on short, wide viewports 
	   so the 16:9 box height can never overflow the top/bottom edges of the screen. */
	max-width: min(1000px, 133vh) !important;
	
	background: rgba(0, 0, 0, 0.5);
	border-radius: 12px;
	padding: 12px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
	position: relative;
	box-sizing: border-box;
}

.tsdv-stage-outer {
	position: relative;
	width: 100%;
	padding-top: 56.25%; /* 16:9 Aspect Ratio Boundary lock */
	background-color: #1a1a1a;
	border-radius: 8px;
	overflow: hidden;
}

.tsdv-canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: block;
	cursor: grab;
	touch-action: none; 
	opacity: 0;
	transition: opacity 0.4s ease;
	z-index: 5;
}

.tsdv-canvas:active { cursor: grabbing; }
.tsdv-canvas.tsdv-is-zoomed { cursor: move; }

/* ==========================================================================
	 3. LIGHTBOX INTERFACE BUTTONS & OVERRIDES
	 ========================================================================== */

/* Main Lightbox Dismiss/Close Action Button */
.tsdv-lightbox-close {
	position: fixed !important;
	top: 20px !important;
	right: 20px !important;
	left: auto !important;
	transform: none !important;
	
	background-color: #2563eb !important;
	border: 1px solid #2563eb !important;
	border-radius: 50% !important;
	width: 40px !important;
	height: 40px !important;
	color: #ffffff !important;
	cursor: pointer !important;
	padding: 0 !important;
	margin: 0 !important;
	opacity: 0.8 !important;
	z-index: 9999999 !important;
	transition: opacity 0.2s, transform 0.2s, background-color 0.2s !important;

	/* The Fix: Flex alignment guarantees mathematical cross-axis centering */
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
}

.tsdv-lightbox-close:hover,
.tsdv-lightbox-close:focus-visible {
	opacity: 1 !important;
	background-color: #1d4ed8 !important;
	border-color: #1d4ed8 !important;
	transform: scale(1.05) !important;
}

/* Explicit scaling rules for the internal close path icon */
.tsdv-lightbox-close svg {
	width: 20px !important;
	height: 20px !important;
	stroke: currentColor !important;
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* Floating Info Toggle Icon Button */
.tsdv-help-toggle {
	position: absolute !important;
	top: 14px !important;
	right: 14px !important;
	z-index: 10 !important;
	background: rgba(15, 23, 42, 0.6) !important;
	border: 1px solid rgba(255, 255, 255, 0.1) !important;
	border-radius: 50% !important;
	width: 38px !important;
	height: 38px !important;
	padding: 0 !important;
	margin: 0 !important;
	display: flex !important;
	justify-content: center !important;
	align-items: center !important;
	cursor: pointer !important;
	color: #ffffff !important;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2) !important;
	transition: background-color 0.2s ease, transform 0.2s ease !important;
}

.tsdv-help-toggle:hover {
	background: #2563eb !important;
	border-color: #2563eb !important;
}

.tsdv-help-toggle svg {
	width: 22px !important;
	height: 22px !important;
	fill: currentColor !important;
	display: block !important;
}

/* Start Trigger Button inside Lightbox Viewport */
.tsdv-start-btn {
	position: relative !important;
	z-index: 2 !important;
	background-color: #2563eb !important;
	color: #ffffff !important;
	border: none !important;
	padding: 14px 32px !important;
	font-size: 1rem !important;
	font-weight: 600 !important;
	border-radius: 30px !important;
	cursor: pointer !important;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
	display: inline-block !important;
	height: auto !important;
	width: auto !important;
	margin: 0 !important;
	transition: transform 0.2s ease, background-color 0.2s ease !important;
}

.tsdv-start-btn:hover {
	background-color: #1d4ed8 !important;
	transform: scale(1.05) !important;
}

/* ==========================================================================
	 4. SCREEN OVERLAYS & TEXT INFRASTRUCTURE
	 ========================================================================== */

.tsdv-preview-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-size: cover;
	background-position: center;
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 8;
	transition: opacity 0.4s ease;
}

.tsdv-preview-overlay::before {
	content: "";
	position: absolute;
	top: 0; left: 0; width: 100%; height: 100%;
	background: rgba(0, 0, 0, 0.35);
	z-index: 1;
}

.tsdv-loading-overlay {
	position: absolute;
	top: 0; left: 0; width: 100%; height: 100%;
	background: #ffffff;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 9;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.tsdv-loading-overlay.tsdv-active {
	opacity: 1;
	pointer-events: auto;
}

.tsdv-spinner {
	width: 44px;
	height: 44px;
	border: 4px solid #eaeaea;
	border-top: 4px solid #2563eb;
	border-radius: 50%;
	animation: tsdv-spin 1s linear infinite;
}

.tsdv-loading-text {
	margin-top: 16px;
	font-weight: 600;
	color: #1f2937;
}

@keyframes tsdv-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* ==========================================================================
	 5. INTERACTIVE INSTRUCTION DRAWER SYSTEM
	 ========================================================================== */

.tsdv-help-overlay {
	position: absolute;
	top: 0; left: 0; width: 100%; height: 100%;
	background: rgba(15, 23, 42, 0.95);
	color: #ffffff;
	z-index: 11;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	overflow-y: auto;
	padding: 30px 24px;
	box-sizing: border-box;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.tsdv-help-overlay.tsdv-active {
	opacity: 1;
	pointer-events: auto;
}

.tsdv-help-content {
	max-width: 480px;
	width: 100%;
	margin: auto 0;
}

.tsdv-help-title {
	font-size: 1.3rem;
	margin-top: 0;
	margin-bottom: 16px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.15);
	padding-bottom: 8px;
	font-weight: 600;
}

.tsdv-help-section {
	margin-bottom: 16px;
	font-size: 0.95rem;
	line-height: 1.6;
}

.tsdv-help-section strong {
	color: #38bdf8;
	margin-bottom: 4px;
}

.tsdv-help-section p {
	margin: 3px 0;
	color: #e2e8f0;
}

.tsdv-close-help-btn {
	background-color: #2563eb !important;
	color: #ffffff !important;
	border: none !important;
	padding: 12px 24px !important;
	font-size: 0.95rem !important;
	font-weight: 600 !important;
	border-radius: 24px !important;
	cursor: pointer !important;
	margin-top: 12px !important;
	width: 100% !important;
	display: block !important;
}

.tsdv-close-help-btn:hover {
	background-color: #1d4ed8 !important;
}

/* Focus Rings */
.tsdv-start-btn:focus-visible,
.tsdv-help-toggle:focus-visible,
.tsdv-close-help-btn:focus-visible,
.tsdv-lightbox-close:focus-visible {
	outline: 3px solid #db2777 !important;
	outline-offset: 2px !important;
}

/* ==========================================================================
	 6. GALLERY CAROUSEL THUMBNAIL INTEGRATION MATRIX
	 ========================================================================== */

.tsdv-thumbnail-launcher {
	position: relative !important;
	top: 0 !important;
	left: 0 !important;
	
	/* Layout Configuration: Matches your exact .cic-carousel-item track standards */
	height: 100px !important;
	width: 140px !important; /* Establishes clean standard horizontal thumbnail footing */
	flex-shrink: 0 !important;
	border-radius: 12px !important;
	border: 3px solid #2563eb !important;
	outline: none !important;
	
	background-size: cover !important;
	background-position: center !important;
	background-repeat: no-repeat !important;
	cursor: pointer !important;
	padding: 0 !important;
	margin: 0 !important;
	overflow: hidden !important;
	box-shadow: none !important;
	transform: none !important;
	display: inline-block !important;
	transition: none !important; /* Kills any lingering animation timings */
	
	color: initial !important;
}

/* BULLETPROOF HOVER RESET BLOCK
	Forces the button to remain completely flat and look identical on hover/click states, 
	neutralizing all background, color, and border overrides from the theme.
*/
.tsdv-thumbnail-launcher:hover,
.tsdv-thumbnail-launcher:focus,
.tsdv-thumbnail-launcher:active {
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	transform: none !important;
	background-color: transparent !important;
}

/* Semi-Transparent Dark Mask Covering the Background Frame */
.tsdv-thumbnail-overlay {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	background-color: rgba(15, 23, 42, 0.65) !important; /* Sleek dark slate mask tint */
	color: #ffffff !important;
	
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 6px !important;
	box-sizing: border-box !important;
	padding: 8px !important;
	transition: none !important; /* Kills any hover color fading effects */
}

/* Explicitly locks the overlay contents so they never shift colors on hover */
.tsdv-thumbnail-launcher:hover .tsdv-thumbnail-overlay,
.tsdv-thumbnail-launcher:focus .tsdv-thumbnail-overlay,
.tsdv-thumbnail-launcher:active .tsdv-thumbnail-overlay {
	background-color: rgba(15, 23, 42, 0.65) !important;
	color: #ffffff !important;
}

/* Typography lock for the overlay display string text */
.tsdv-thumbnail-overlay span {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
	font-size: 11px !important;
	font-weight: 700 !important;
	text-transform: uppercase !important;
	letter-spacing: 0.5px !important;
	line-height: 1.2 !important;
	text-align: center !important;
}

.tsdv-thumbnail-overlay svg {
	stroke: currentColor !important;
	display: block !important;
	flex-shrink: 0 !important;
}

/* Accessible ring identifier wrapper - retains high contrast usability for keyboard nav */
.tsdv-thumbnail-launcher:focus-visible {
	outline: 3px solid #db2777 !important;
	outline-offset: 2px !important;
}