/**
 * Roshan Gallery - Modern Accessible Image Carousel & Lightbox CSS
 * Loaded conditionally only when a gallery with lightbox/carousel is rendered.
 */

:root {
	--roshan-trans-speed: 450ms;
	--roshan-thumb-size: 74px;
	--roshan-thumb-height: 54px;
	--roshan-thumb-gap: 8px;
}

.roshan-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background-color: rgba(10, 15, 26, 0.95);
	backdrop-filter: blur(8px);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-between;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	user-select: none;
	touch-action: pan-y;
	box-sizing: border-box;
	color: #ffffff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	padding: 12px 16px;
}

.roshan-lightbox *,
.roshan-lightbox *::before,
.roshan-lightbox *::after {
	box-sizing: border-box;
}

.roshan-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

/* Progress Indicator Bar */
.roshan-lightbox__progress {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: rgba(255, 255, 255, 0.15);
	z-index: 30;
}

.roshan-lightbox__progress-bar {
	height: 100%;
	width: 0%;
	background: #0073e6;
	transition: width 0.3s ease;
}

/* Lightbox Header */
.roshan-lightbox__header {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 12px;
	z-index: 20;
}

.roshan-lightbox__counter {
	font-size: 13px;
	font-weight: 500;
	color: #94a3b8;
	letter-spacing: 0.5px;
}

.roshan-lightbox__header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Buttons */
.roshan-lightbox__btn {
	background: rgba(30, 41, 59, 0.7);
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: #ffffff;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
	outline: none;
	user-select: none;
}

.roshan-lightbox__btn:hover {
	background: rgba(51, 65, 85, 0.95);
	transform: scale(1.08);
	border-color: rgba(255, 255, 255, 0.3);
}

.roshan-lightbox__btn:focus-visible {
	outline: 2px solid #38bdf8;
	outline-offset: 2px;
}

.roshan-lightbox__btn--close {
	width: 38px;
	height: 38px;
	font-size: 22px;
	line-height: 1;
}

.roshan-lightbox__btn--fs {
	width: 36px;
	height: 36px;
	font-size: 16px;
}

/* Main Area: Navigation Arrows + Stage */
.roshan-lightbox__main-area {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	flex: 1;
	position: relative;
	min-height: 0;
	overflow: hidden;
}

.roshan-lightbox__btn--prev,
.roshan-lightbox__btn--next {
	width: 48px;
	height: 48px;
	font-size: 22px;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 15;
}

.roshan-lightbox__btn--prev {
	left: 12px;
}

.roshan-lightbox__btn--next {
	right: 12px;
}

/* Stage & Slide Track */
.roshan-lightbox__stage {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	cursor: grab;
}

.roshan-lightbox__stage.is-dragging {
	cursor: grabbing;
}

.roshan-lightbox__track {
	display: flex;
	align-items: center;
	height: 100%;
	width: 100%;
	transition: transform var(--roshan-trans-speed, 450ms) cubic-bezier(0.25, 1, 0.5, 1);
	will-change: transform;
}

/* Individual Slides */
.roshan-lightbox__slide {
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px;
	position: relative;
	opacity: 0.4;
	transform: scale(0.92);
	transition: opacity var(--roshan-trans-speed, 450ms) ease, transform var(--roshan-trans-speed, 450ms) ease;
}

.roshan-lightbox__slide.is-active {
	opacity: 1;
	transform: scale(1);
	z-index: 5;
}

.roshan-lightbox__img {
	max-width: 90vw;
	max-height: 72vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
	pointer-events: none;
}

/* ==========================================================================
   CAROUSEL STYLES
   ========================================================================== */

/* 1. Fullscreen Slider */
.roshan-lightbox.roshan-style-fullscreen {
	padding: 0;
	background-color: #000000;
}

.roshan-lightbox.roshan-style-fullscreen .roshan-lightbox__img {
	max-width: 100vw;
	max-height: 84vh;
	border-radius: 0;
}

/* 2. Centered Slider (Active slide centered, adjacent slides peek) */
.roshan-lightbox.roshan-style-centered .roshan-lightbox__slide {
	flex: 0 0 75%;
	opacity: 0.35;
	transform: scale(0.85);
}

.roshan-lightbox.roshan-style-centered .roshan-lightbox__slide.is-active {
	opacity: 1;
	transform: scale(1);
}

/* 3. Coverflow 3D Slider */
.roshan-lightbox.roshan-style-coverflow .roshan-lightbox__stage {
	perspective: 1200px;
}

.roshan-lightbox.roshan-style-coverflow .roshan-lightbox__slide {
	flex: 0 0 65%;
	transition: transform var(--roshan-trans-speed, 450ms) cubic-bezier(0.2, 0.8, 0.2, 1), opacity var(--roshan-trans-speed, 450ms) ease;
}

.roshan-lightbox.roshan-style-coverflow .roshan-lightbox__slide.is-prev {
	transform: rotateY(38deg) scale(0.82) translateZ(-80px);
	opacity: 0.45;
}

.roshan-lightbox.roshan-style-coverflow .roshan-lightbox__slide.is-next {
	transform: rotateY(-38deg) scale(0.82) translateZ(-80px);
	opacity: 0.45;
}

.roshan-lightbox.roshan-style-coverflow .roshan-lightbox__slide.is-active {
	transform: rotateY(0deg) scale(1) translateZ(0);
	opacity: 1;
}

/* 4. Fade Slider */
.roshan-lightbox.roshan-style-fade .roshan-lightbox__track {
	display: block;
	position: relative;
	transform: none !important;
}

.roshan-lightbox.roshan-style-fade .roshan-lightbox__slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	transform: none;
	transition: opacity var(--roshan-trans-speed, 450ms) ease-in-out;
	pointer-events: none;
}

.roshan-lightbox.roshan-style-fade .roshan-lightbox__slide.is-active {
	opacity: 1;
	pointer-events: auto;
}

/* 5. Minimal Slider */
.roshan-lightbox.roshan-style-minimal {
	background-color: rgba(10, 10, 12, 0.98);
}

.roshan-lightbox.roshan-style-minimal .roshan-lightbox__btn {
	background: transparent;
	border: none;
	opacity: 0.6;
}

.roshan-lightbox.roshan-style-minimal .roshan-lightbox__btn:hover {
	opacity: 1;
	transform: none;
}

/* 6. Modern Card Slider */
.roshan-lightbox.roshan-style-modern-card .roshan-lightbox__slide.is-active .roshan-lightbox__img {
	border-radius: 14px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   DOTS & NUMBER PAGINATION
   ========================================================================== */

.roshan-lightbox__dots {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 6px 0;
	z-index: 10;
}

.roshan-lightbox__dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.3);
	border: none;
	cursor: pointer;
	padding: 0;
	transition: all 0.2s ease;
}

.roshan-lightbox__dot:hover {
	background: rgba(255, 255, 255, 0.6);
	transform: scale(1.25);
}

.roshan-lightbox__dot.is-active {
	background: #38bdf8;
	width: 24px;
	border-radius: 12px;
}

/* Number Pagination */
.roshan-lightbox__num-pag {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 6px 0;
	z-index: 10;
}

.roshan-lightbox__num-pill {
	background: rgba(30, 41, 59, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: #94a3b8;
	font-size: 12px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.15s ease;
}

.roshan-lightbox__num-pill:hover {
	background: rgba(51, 65, 85, 0.85);
	color: #ffffff;
}

.roshan-lightbox__num-pill.is-active {
	background: #0284c7;
	color: #ffffff;
	border-color: #38bdf8;
}

/* Footer / Caption */
.roshan-lightbox__footer {
	text-align: center;
	padding: 4px 16px;
	max-width: 800px;
	z-index: 10;
}

.roshan-lightbox__caption {
	font-size: 14px;
	font-weight: 500;
	color: #e2e8f0;
	line-height: 1.4;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   THUMBNAILS SLIDER FILMSTRIP
   ========================================================================== */

.roshan-lightbox__thumb-container {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 900px;
	padding: 6px 8px;
	position: relative;
	z-index: 15;
}

.roshan-lightbox__thumb-viewport {
	overflow: hidden;
	display: flex;
	scroll-behavior: smooth;
	max-width: 100%;
}

.roshan-lightbox__thumb-track {
	display: flex;
	gap: var(--roshan-thumb-gap, 8px);
	padding: 4px;
}

.roshan-lightbox__thumb-item {
	width: var(--roshan-thumb-size, 74px);
	height: var(--roshan-thumb-height, 54px);
	flex: 0 0 var(--roshan-thumb-size, 74px);
	border: 2px solid transparent;
	border-radius: 4px;
	overflow: hidden;
	padding: 0;
	background: #0f172a;
	cursor: pointer;
	opacity: 0.5;
	transition: all 0.2s ease;
}

.roshan-lightbox__thumb-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
}

.roshan-lightbox__thumb-item:hover {
	opacity: 0.85;
	transform: translateY(-2px);
}

/* Thumbnail Active Styles */
.roshan-lightbox.roshan-thumb-style-border .roshan-lightbox__thumb-item.is-active {
	opacity: 1;
	border-color: #38bdf8;
}

.roshan-lightbox.roshan-thumb-style-glow .roshan-lightbox__thumb-item.is-active {
	opacity: 1;
	border-color: #38bdf8;
	box-shadow: 0 0 12px #38bdf8;
}

.roshan-lightbox.roshan-thumb-style-opacity .roshan-lightbox__thumb-item.is-active {
	opacity: 1;
	border-color: rgba(255, 255, 255, 0.4);
}

.roshan-lightbox.roshan-thumb-style-scale .roshan-lightbox__thumb-item.is-active {
	opacity: 1;
	border-color: #38bdf8;
	transform: scale(1.1);
}

/* Thumbnail Arrows */
.roshan-lightbox__thumb-arrow {
	background: rgba(30, 41, 59, 0.7);
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: #ffffff;
	cursor: pointer;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	flex-shrink: 0;
	margin: 0 6px;
	transition: all 0.15s ease;
}

.roshan-lightbox__thumb-arrow:hover {
	background: rgba(51, 65, 85, 0.95);
	color: #38bdf8;
}

/* Thumbnail Position: Above */
.roshan-lightbox.roshan-thumb-pos-above {
	flex-direction: column;
}

.roshan-lightbox.roshan-thumb-pos-above .roshan-lightbox__thumb-container {
	order: 1;
}

.roshan-lightbox.roshan-thumb-pos-above .roshan-lightbox__main-area {
	order: 2;
}

.roshan-lightbox.roshan-thumb-pos-above .roshan-lightbox__footer {
	order: 3;
}

/* Thumbnail Position: Left / Right (Desktop) */
@media (min-width: 769px) {
	.roshan-lightbox.roshan-thumb-pos-left .roshan-lightbox__main-area,
	.roshan-lightbox.roshan-thumb-pos-right .roshan-lightbox__main-area {
		display: grid;
		grid-template-columns: 1fr;
		width: 100%;
	}

	.roshan-lightbox.roshan-thumb-pos-left,
	.roshan-lightbox.roshan-thumb-pos-right {
		display: grid;
		grid-template-areas:
			"header header"
			"sidebar main"
			"footer footer";
		grid-template-columns: auto 1fr;
		grid-template-rows: auto 1fr auto;
	}

	.roshan-lightbox.roshan-thumb-pos-right {
		grid-template-areas:
			"header header"
			"main sidebar"
			"footer footer";
		grid-template-columns: 1fr auto;
	}

	.roshan-lightbox.roshan-thumb-pos-left .roshan-lightbox__header,
	.roshan-lightbox.roshan-thumb-pos-right .roshan-lightbox__header {
		grid-area: header;
	}

	.roshan-lightbox.roshan-thumb-pos-left .roshan-lightbox__main-area,
	.roshan-lightbox.roshan-thumb-pos-right .roshan-lightbox__main-area {
		grid-area: main;
	}

	.roshan-lightbox.roshan-thumb-pos-left .roshan-lightbox__footer,
	.roshan-lightbox.roshan-thumb-pos-right .roshan-lightbox__footer {
		grid-area: footer;
	}

	.roshan-lightbox.roshan-thumb-pos-left .roshan-lightbox__thumb-container,
	.roshan-lightbox.roshan-thumb-pos-right .roshan-lightbox__thumb-container {
		grid-area: sidebar;
		flex-direction: column;
		width: calc(var(--roshan-thumb-size, 74px) + 24px);
		max-height: 70vh;
	}

	.roshan-lightbox.roshan-thumb-pos-left .roshan-lightbox__thumb-viewport,
	.roshan-lightbox.roshan-thumb-pos-right .roshan-lightbox__thumb-viewport {
		flex-direction: column;
		max-height: 100%;
	}

	.roshan-lightbox.roshan-thumb-pos-left .roshan-lightbox__thumb-track,
	.roshan-lightbox.roshan-thumb-pos-right .roshan-lightbox__thumb-track {
		flex-direction: column;
	}
}

/* Mobile Responsiveness for Lightbox */
@media (max-width: 768px) {
	.roshan-lightbox {
		padding: 8px;
	}

	.roshan-lightbox__btn--prev {
		left: 4px;
		width: 38px;
		height: 38px;
	}

	.roshan-lightbox__btn--next {
		right: 4px;
		width: 38px;
		height: 38px;
	}

	.roshan-lightbox__img {
		max-height: 60vh;
	}

	.roshan-lightbox__thumb-item {
		width: 58px;
		height: 44px;
		flex: 0 0 58px;
	}

	/* On mobile, automatically adapt thumbnails to horizontal touch strip */
	.roshan-lightbox__thumb-container {
		display: flex !important;
		flex-direction: row !important;
		max-width: 100% !important;
	}

	.roshan-lightbox__thumb-viewport {
		flex-direction: row !important;
	}

	.roshan-lightbox__thumb-track {
		flex-direction: row !important;
	}
}

body.roshan-lightbox-open {
	overflow: hidden !important;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	.roshan-lightbox,
	.roshan-lightbox__track,
	.roshan-lightbox__slide,
	.roshan-lightbox__btn,
	.roshan-lightbox__dot,
	.roshan-lightbox__thumb-item {
		transition: none !important;
		transform: none !important;
	}
}
