/*
 * MHM Lightbox. Görünüm temadan: aşağıdaki değişkenleri tema `:root`'ta (ya da daha dar kapsamda) verir; vermezse
 * nötr koyu varsayılanlar geçer. Düzen ve davranış eklentinin, renk/yazı/köşe sitenin.
 *
 *   --mhm-lb-bg      zemin (yarı saydam olabilir)      --mhm-lb-fg     yazı ve ikon
 *   --mhm-lb-muted   ikincil yazı (açıklama, sayaç)    --mhm-lb-line   ayırıcı çizgi, düğme kenarı
 *   --mhm-lb-button  düğme zemini                      --mhm-lb-radius görsel köşesi
 *   --mhm-lb-font    yazı ailesi                       --mhm-lb-focus  odak halkası
 */
.mhm-lb {
	--_bg: var(--mhm-lb-bg, rgb(17 24 39 / 0.94));
	--_fg: var(--mhm-lb-fg, #f9fafb);
	--_muted: var(--mhm-lb-muted, #cbd5e1);
	--_line: var(--mhm-lb-line, rgb(255 255 255 / 0.18));
	--_button: var(--mhm-lb-button, rgb(255 255 255 / 0.08));

	box-sizing: border-box;
	width: 100vw;
	max-width: none;
	height: 100vh;
	height: 100dvh;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: var(--_bg);
	color: var(--_fg);
	font-family: var(--mhm-lb-font, inherit);
	overflow: hidden;
}

.mhm-lb[open] {
	display: flex;
	flex-direction: column;
}

.mhm-lb::backdrop {
	background: transparent;
}

.mhm-lb *,
.mhm-lb *::before,
.mhm-lb *::after {
	box-sizing: border-box;
}

.mhm-lb :focus-visible {
	outline: 2px solid var(--mhm-lb-focus, currentcolor);
	outline-offset: 2px;
}

html.mhm-lb-open {
	overflow: hidden;
}

.mhm-lb__bar {
	display: flex;
	flex: none;
	gap: 16px;
	align-items: center;
	justify-content: space-between;
	min-height: 72px;
	padding: 8px 16px 8px 24px;
	border-bottom: 1px solid var(--_line);
}

.mhm-lb__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.mhm-lb__title {
	font-size: 16px;
	line-height: 1.35;
}

.mhm-lb__caption {
	overflow: hidden;
	color: var(--_muted);
	font-size: 13px;
	line-height: 1.4;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Ekran okuyucu duyurusu (başlık + sayaç); görünmez. */
.mhm-lb__live {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.mhm-lb__caption:empty {
	display: none;
}

.mhm-lb__tools {
	display: flex;
	flex: none;
	gap: 12px;
	align-items: center;
}

.mhm-lb__count {
	color: var(--_muted);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}

.mhm-lb__close,
.mhm-lb__nav {
	display: inline-grid;
	flex: none;
	place-items: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--_line);
	border-radius: 999px;
	background: var(--_button);
	color: inherit;
	cursor: pointer;
}

.mhm-lb__close {
	width: 44px;
	height: 44px;
}

.mhm-lb__close:hover,
.mhm-lb__nav:hover {
	border-color: currentcolor;
}

.mhm-lb__nav[hidden] {
	display: none;
}

.mhm-lb__body {
	display: flex;
	flex: 1;
	gap: 24px;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 24px 24px 0;
}

/* Genişliğe sığdır: görsel en fazla kendi genişliğinde, uzun görsel sahnede dikey kayar. */
.mhm-lb__stage {
	align-self: stretch;
	width: min(100%, 1100px);
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
	border-radius: var(--mhm-lb-radius, 12px) var(--mhm-lb-radius, 12px) 0 0;
}

.mhm-lb__img {
	display: block;
	width: 100%;
	height: auto;
	margin-inline: auto;
}

/* Ekrana sığdır (data-mhm-lightbox-fit="contain"). */
/* Sahne esnek düzende uzatılmış (kesin boyutlu); görsel onun içinde mutlak konumla iki eksende sığar. */
.mhm-lb.is-contain .mhm-lb__stage {
	position: relative;
	overflow: hidden;
	border-radius: 0;
}

.mhm-lb.is-contain .mhm-lb__img {
	position: absolute;
	inset: 0;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 100%;
	margin: auto;
	border-radius: var(--mhm-lb-radius, 12px);
}

.mhm-lb__hint {
	flex: none;
	margin: 0;
	padding: 12px 16px;
	border-top: 1px solid var(--_line);
	color: var(--_muted);
	font-size: 13px;
	text-align: center;
}

@media (max-width: 782px) {

	.mhm-lb__bar {
		min-height: 60px;
		padding: 6px 8px 6px 16px;
	}

	.mhm-lb__body {
		position: relative;
		padding: 0;
	}

	.mhm-lb__stage {
		width: 100%;
		border-radius: 0;
		touch-action: pan-x pan-y pinch-zoom;
	}

	/* Mobilde oklar sahnenin altında, kenarlarda (kaydırma da geçer). */
	.mhm-lb__nav {
		position: absolute;
		bottom: 12px;
		z-index: 1;
		background: var(--_bg);
	}

	.mhm-lb__prev {
		left: 12px;
	}

	.mhm-lb__next {
		right: 12px;
	}

	.mhm-lb__hint {
		display: none;
	}
}

@media (forced-colors: active) {

	.mhm-lb__close,
	.mhm-lb__nav {
		border-color: ButtonText;
	}
}
