/**
 * Bismika Allahuma: lightbox.css (3.0.1)
 *
 * The picture viewer (assets/js/lightbox.js, inc/lightbox.php): pictures
 * that open show a zoom pointer and a soft lift; the viewer is a modal
 * dialog with the picture, its caption, a count and three round buttons.
 * Colours follow the scheme: --bm-zoom-bg is the scheme's dark colour,
 * black or the page colour (Theme Options, Articles, Pictures).
 */

/* In the article */
.bm-zoomable { cursor: zoom-in; transition: filter .2s ease, transform .2s ease; }
.bm-zoomable:hover { filter: brightness(1.04); }
.bm-zoomable:focus-visible { outline: 3px solid var(--bm-accent); outline-offset: 3px; }
.gallery-icon .bm-zoomable:hover { transform: scale(1.02); }

/* The viewer */
.bm-zoom {
	--bm-zoom-bg: var(--bm-navy);
	--bm-zoom-ink: #fff;
	--bm-zoom-soft: rgba(255, 255, 255, .72);
	--bm-zoom-line: rgba(255, 255, 255, .34);
	--bm-zoom-hover: rgba(255, 255, 255, .12);
	box-sizing: border-box;
	width: 100vw;
	max-width: none;
	height: 100vh;
	height: 100dvh;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	/* The dialog covers the screen and carries the colour itself:
	   ::backdrop cannot read the dialog's custom properties everywhere. */
	background: var(--bm-zoom-bg);
	background: color-mix(in srgb, var(--bm-zoom-bg) 96%, transparent);
	color: var(--bm-zoom-ink);
	overflow: hidden;
}
.bm-zoom--black { --bm-zoom-bg: #000; }
.bm-zoom--paper {
	--bm-zoom-bg: var(--wp--preset--color--bismika-ivory, #faf8f3);
	--bm-zoom-ink: var(--bm-ink);
	--bm-zoom-soft: var(--bm-meta);
	--bm-zoom-line: var(--bm-border);
	--bm-zoom-hover: var(--bm-light);
}
.bm-zoom[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.bm-zoom:not([open]) { display: none; }
.bm-zoom::backdrop { background: rgba(6, 10, 20, .6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
/* Browsers without showModal: the dialog draws its own backdrop. */
.bm-zoom.is-fallback[open] { position: fixed; inset: 0; z-index: 100000; background: var(--bm-zoom-bg); }
html.bm-zoom-open { overflow: hidden; }

.bm-zoom__stage {
	position: relative;
	display: grid;
	place-items: center;
	min-height: 0;
	padding: 68px 88px 12px;
}
.bm-zoom__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
	cursor: zoom-out;
	opacity: 1;
	transition: opacity .18s ease;
	-webkit-user-select: none;
	user-select: none;
}
.bm-zoom.is-loading .bm-zoom__img { opacity: .55; }
.bm-zoom--paper .bm-zoom__img { box-shadow: var(--bm-shadow-lift); }

/* Actual size: the picture scrolls inside the stage. */
.bm-zoom.is-actual .bm-zoom__stage { place-items: start center; overflow: auto; }
.bm-zoom.is-actual .bm-zoom__img { max-width: none; max-height: none; width: auto !important; height: auto !important; }

.bm-zoom__foot {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: start;
	gap: 6px 24px;
	width: min(920px, 100%);
	margin: 0 auto;
	padding: 10px 24px 22px;
	box-sizing: border-box;
}
.bm-zoom__caption {
	margin: 0;
	font: 400 17px/1.5 var(--bm-serif);
	color: var(--bm-zoom-ink);
	text-wrap: balance;
}
.bm-zoom__caption:empty { display: none; }
.bm-zoom__caption::before {
	content: "";
	display: block;
	width: 28px;
	height: 2px;
	margin-bottom: 8px;
	background: var(--bm-gold, #b8913a);
}
.bm-zoom__count {
	margin: 0;
	padding-top: 10px;
	font: 600 12px/1 var(--bm-sans);
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--bm-zoom-soft);
	white-space: nowrap;
}

.bm-zoom__btn {
	position: absolute;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--bm-zoom-line);
	border-radius: 50%;
	background: color-mix(in srgb, var(--bm-zoom-bg) 60%, transparent);
	color: var(--bm-zoom-ink);
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease;
}
.bm-zoom__btn:hover { background: var(--bm-zoom-hover); border-color: var(--bm-gold, #b8913a); }
.bm-zoom__btn:focus-visible { outline: 2px solid var(--bm-gold, #b8913a); outline-offset: 2px; }
.bm-zoom__btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bm-zoom__close { top: 14px; right: 18px; }
.bm-zoom__prev,
.bm-zoom__next { top: 50%; margin-top: -22px; }
.bm-zoom__prev { left: 20px; }
.bm-zoom__next { right: 20px; }
.bm-zoom.is-single .bm-zoom__prev,
.bm-zoom.is-single .bm-zoom__next,
.bm-zoom.is-single .bm-zoom__count { display: none; }

/* Tablet */
@media (max-width: 1099px) {
	.bm-zoom__stage { padding: 64px 72px 10px; }
}

/* Phone: the picture runs edge to edge; arrows sit at the foot. */
@media (max-width: 699px) {
	.bm-zoom__stage { padding: 60px 0 8px; }
	.bm-zoom__img { border-radius: 0; }
	.bm-zoom__foot { grid-template-columns: 1fr; padding: 8px 16px calc(84px + env(safe-area-inset-bottom)); }
	.bm-zoom__caption { font-size: 15px; }
	.bm-zoom__count { padding-top: 0; }
	.bm-zoom__close { top: 10px; right: 12px; }
	.bm-zoom__prev,
	.bm-zoom__next { top: auto; bottom: calc(18px + env(safe-area-inset-bottom)); margin-top: 0; }
	.bm-zoom__prev { left: auto; right: 72px; }
	.bm-zoom__next { right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.bm-zoomable,
	.bm-zoom__img,
	.bm-zoom__btn { transition: none; }
	.gallery-icon .bm-zoomable:hover { transform: none; }
}

@media print {
	.bm-zoom { display: none !important; }
}
