/**
 * DICM Image Gallery for Divi 5 — Lightbox styles.
 * Port of the Divi 4 DICM_Lightbox_Helper CSS. Safari desktop tweaks are
 * applied via the .dmg-safari class (added by lightbox.js) instead of PHP UA
 * sniffing.
 */

/* ── BASE MODAL ─────────────────────────────────────────────────────────── */
#dmg-modal {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(255, 255, 255, 0.93);
	z-index: 9999999;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	box-sizing: border-box;
	transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
		visibility 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	backdrop-filter: blur(2px);
}

#dmg-modal.dmg-safari {
	transition: opacity 0.2s ease, visibility 0.2s ease;
	backdrop-filter: none;
}

#dmg-modal.active {
	display: flex !important;
	opacity: 1 !important;
	visibility: visible !important;
	pointer-events: auto;
	justify-content: center;
	align-items: center;
}

/* ── TOOLBAR ────────────────────────────────────────────────────────────── */
#dmg-modal .dmg-toolbar {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	padding: 15px;
	display: flex;
	justify-content: space-between;
	z-index: 10001;
	box-sizing: border-box;
}

#dmg-modal .dmg-left-controls,
#dmg-modal .dmg-right-controls {
	display: flex;
	align-items: center;
}

#dmg-modal .dmg-right-controls {
	gap: 30px;
}

/* ── CONTROLS (close / download / mode-toggle) ──────────────────────────── */
#dmg-modal .dmg-close,
#dmg-modal .dmg-download,
#dmg-modal .dmg-mode-toggle {
	cursor: pointer;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	padding: 8px;
	transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

#dmg-modal .dmg-close:hover,
#dmg-modal .dmg-download:hover,
#dmg-modal .dmg-mode-toggle:hover {
	transform: scale(1.1);
	opacity: 0.8;
}

/* Window-mode toolbar button bg */
#dmg-modal.dmg-window-mode .dmg-close,
#dmg-modal.dmg-window-mode .dmg-download,
#dmg-modal.dmg-window-mode .dmg-mode-toggle {
	background: rgba(0, 0, 0, 0.04);
}

#dmg-modal.dmg-window-mode .dmg-close:hover,
#dmg-modal.dmg-window-mode .dmg-download:hover,
#dmg-modal.dmg-window-mode .dmg-mode-toggle:hover {
	background: rgba(0, 0, 0, 0.12);
}

/* Fullscreen-mode toolbar button bg */
#dmg-modal.dmg-fullscreen-mode .dmg-toolbar {
	background: rgba(0, 0, 0, 0.02);
}

#dmg-modal.dmg-fullscreen-mode .dmg-close,
#dmg-modal.dmg-fullscreen-mode .dmg-download,
#dmg-modal.dmg-fullscreen-mode .dmg-mode-toggle {
	background: rgba(255, 255, 255, 0.1);
}

#dmg-modal.dmg-fullscreen-mode .dmg-close:hover,
#dmg-modal.dmg-fullscreen-mode .dmg-download:hover,
#dmg-modal.dmg-fullscreen-mode .dmg-mode-toggle:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: scale(1.05);
}

/* ── NAVIGATION ARROWS ──────────────────────────────────────────────────── */
#dmg-modal .dmg-prev,
#dmg-modal .dmg-next {
	position: absolute;
	z-index: 10001;
	top: 50%;
	transform: translateY(-50%);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
}

#dmg-modal .dmg-prev {
	left: 40px;
}

#dmg-modal .dmg-next {
	right: 40px;
}

#dmg-modal.dmg-window-mode .dmg-prev,
#dmg-modal.dmg-window-mode .dmg-next {
	width: 50px;
	height: 50px;
	background: rgba(0, 0, 0, 0.04);
}

#dmg-modal.dmg-fullscreen-mode .dmg-prev,
#dmg-modal.dmg-fullscreen-mode .dmg-next {
	width: 60px;
	height: 60px;
	background: rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(10px);
}

#dmg-modal.dmg-safari.dmg-fullscreen-mode .dmg-prev,
#dmg-modal.dmg-safari.dmg-fullscreen-mode .dmg-next {
	backdrop-filter: none;
}

#dmg-modal .dmg-prev:hover,
#dmg-modal .dmg-next:hover {
	transform: translateY(-50%) scale(1.1);
	opacity: 0.8;
}

#dmg-modal .dmg-prev:active,
#dmg-modal .dmg-next:active {
	transform: translateY(-50%) scale(0.95) !important;
}

/* ── SVG ICONS ──────────────────────────────────────────────────────────── */
#dmg-modal .dmg-close svg,
#dmg-modal .dmg-prev svg,
#dmg-modal .dmg-next svg,
#dmg-modal .dmg-download svg,
#dmg-modal .dmg-mode-toggle svg {
	color: inherit;
	display: block;
}

#dmg-modal .dmg-close svg *,
#dmg-modal .dmg-prev svg *,
#dmg-modal .dmg-next svg *,
#dmg-modal .dmg-download svg *,
#dmg-modal .dmg-mode-toggle svg * {
	fill: currentColor;
}

/* ── MODAL CONTENT ──────────────────────────────────────────────────────── */
#dmg-modal .dmg-slider-container {
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	overflow: hidden;
}

#dmg-modal .dmg-modal-image {
	display: block;
	transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#dmg-modal.dmg-safari .dmg-modal-image {
	transition: opacity 0.25s ease;
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────────────────── */
#dmg-modal .dmg-lb-title {
	display: block;
	margin: 0 0 1rem;
	font-size: 24px;
	font-weight: 700;
	color: #000000;
}

#dmg-modal .dmg-lb-desctext {
	display: block;
	margin: 0;
	word-wrap: break-word;
	font-size: 16px;
	line-height: 1.6em;
	color: #666666;
}

/* ── FULLSCREEN MODE ────────────────────────────────────────────────────── */
#dmg-modal.dmg-fullscreen-mode .dmg-desc-container {
	display: none !important;
}

#dmg-modal.dmg-fullscreen-mode .dmg-modal-content {
	width: 100vw !important;
	height: 100vh !important;
	max-width: 100vw !important;
	max-height: 100vh !important;
	margin: 0 !important;
	padding: 0 !important;
	display: flex !important;
	flex-direction: column !important;
	justify-content: center !important;
	align-items: center !important;
}

#dmg-modal.dmg-fullscreen-mode .dmg-slider-container {
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	max-height: 100% !important;
	flex: 1 !important;
}

#dmg-modal.dmg-fullscreen-mode .dmg-modal-image {
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
}

/* ── WINDOW MODE — ONE COLUMN ───────────────────────────────────────────── */
#dmg-modal.dmg-window-mode.dmg-layout-one-column .dmg-modal-content {
	width: 80%;
	max-width: 900px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
}

#dmg-modal.dmg-window-mode.dmg-layout-one-column .dmg-slider-container {
	width: 100%;
	max-width: 90%;
	height: 90vh;
	flex: none;
}

#dmg-modal.dmg-window-mode.dmg-layout-one-column .dmg-modal-image {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

#dmg-modal.dmg-window-mode.dmg-layout-one-column .dmg-desc-container.window-text {
	position: relative;
	width: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
	padding: 0 2rem;
}

/* ── WINDOW MODE — TWO COLUMNS (GRID) ───────────────────────────────────── */
#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-modal-content {
	width: 90%;
	max-width: 1400px;
	margin: 0 auto;
	padding: 1rem;
	display: grid;
	grid-template-columns: 1.5fr 0.5fr;
	align-items: center;
	gap: 1.5rem;
	position: relative;
}

#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-slider-container {
	width: 100%;
	overflow: hidden;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
}

#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-modal-image {
	max-width: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-modal-image.dmg-portrait {
	max-height: 92vh;
}

#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-modal-image.dmg-landscape {
	max-height: 80vh;
}

#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-desc-container.window-text {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	text-align: left;
	padding: 2rem;
	overflow-y: auto;
	max-height: 80vh;
}

/* ── HIDDEN ─────────────────────────────────────────────────────────────── */
.hidden,
#dmg-modal .dmg-desc-container.hidden {
	display: none !important;
}

/* ── OPEN ANIMATION ─────────────────────────────────────────────────────── */
@keyframes dmgFadeInUp {
	from {
		opacity: 0;
		transform: translateY(30px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

#dmg-modal.active .dmg-modal-content {
	animation: dmgFadeInUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#dmg-modal.dmg-safari.active .dmg-modal-content {
	animation: none;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (min-width: 1025px) and (max-width: 1400px) {
	#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-modal-content {
		grid-template-columns: 1.5fr 0.5fr;
	}

	#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-desc-container.window-text {
		padding: 1.5rem;
	}
}

@media (max-width: 1024px) {
	#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-modal-content {
		grid-template-columns: 1fr !important;
		gap: 1rem !important;
		overflow-y: auto !important;
	}

	#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-slider-container {
		width: 100% !important;
		max-height: 50vh;
	}

	#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-modal-image {
		max-height: 50vh;
	}

	#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-desc-container.window-text {
		text-align: center !important;
		align-items: center !important;
		padding: 1rem !important;
		max-height: none;
	}
}

@media (min-width: 600px) and (max-width: 1024px) {
	#dmg-modal.dmg-window-mode.dmg-layout-one-column .dmg-modal-content {
		width: 90%;
		gap: 1.5rem;
	}

	#dmg-modal.dmg-window-mode.dmg-layout-one-column .dmg-slider-container {
		height: 60vh;
	}

	#dmg-modal .dmg-prev {
		left: 30px;
	}

	#dmg-modal .dmg-next {
		right: 30px;
	}
}

@media (max-width: 599px) {
	#dmg-modal.dmg-window-mode .dmg-modal-content {
		width: 95%;
		gap: 1rem;
	}

	#dmg-modal.dmg-window-mode.dmg-layout-one-column .dmg-slider-container {
		height: 65vh;
	}

	#dmg-modal.dmg-window-mode.dmg-layout-two-columns .dmg-modal-content {
		grid-template-columns: 1fr !important;
		padding: 0.5rem;
	}

	#dmg-modal .dmg-toolbar {
		padding: 15px;
	}

	#dmg-modal .dmg-right-controls {
		gap: 20px;
	}

	#dmg-modal .dmg-prev,
	#dmg-modal .dmg-next {
		width: 50px !important;
		height: 50px !important;
	}

	#dmg-modal .dmg-prev {
		left: 20px !important;
	}

	#dmg-modal .dmg-next {
		right: 20px !important;
	}

	#dmg-modal .dmg-lb-title {
		font-size: 20px;
	}

	#dmg-modal .dmg-lb-desctext {
		font-size: 14px;
	}
}
