/**
 * Gallery slideshow — hover "View Slideshow" badge + full-screen lightbox.
 * Enqueued only on single `gallery` posts (see functions.php).
 */

/* ---- Hover badge on featured + in-content images ---- */
.has-slideshow-badge {
	position: relative;
}

/* Matched to live's `.slideShow`: a white block hard against the top-right of
   the image, label first and icon after, revealed on hover.

   One deliberate divergence — live parks it at `right: -3%` and slides to
   `-1%`, i.e. deliberately overhanging the image. On a 1140px container that is
   ~34px outside the box, and with no browser available to confirm it does not
   push the page into a horizontal scroll, the same slide-in is done from
   `right: 10px` to `right: 0`. Identical motion, no overflow risk. */
.viewSlideshowBadge {
	position: absolute;
	top: 0;
	right: 10px;
	z-index: 1000;
	display: inline-flex;
	align-items: center;
	margin: 0;
	padding: 10px 25px;
	border: 0;
	border-radius: 0;
	background-color: #fff;
	color: #000;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	opacity: 0;
	transition: 0.3s all ease;
	pointer-events: none;
}

.viewSlideshowBadge svg {
	width: 22px;
	height: 22px;
	margin-left: 5px;
	flex: 0 0 auto;
}

.has-slideshow-badge:hover .viewSlideshowBadge,
.has-slideshow-badge:focus-within .viewSlideshowBadge,
.viewSlideshowBadge:focus-visible {
	right: 0;
	opacity: 1;
	pointer-events: auto;
}

/* Touch screens have no hover, so live shows it unconditionally below 1024px
   and shrinks it below 767px. Same here, or the control would be unreachable. */
@media (max-width: 1024px) {
	.viewSlideshowBadge {
		right: 0;
		opacity: 1;
		pointer-events: auto;
	}
}

@media (max-width: 767px) {
	.viewSlideshowBadge {
		padding: 4px 10px;
		font-size: 10px;
	}

	.viewSlideshowBadge svg {
		width: 14px;
		height: 14px;
	}
}

/* Keyboard users: reveal the badge when it receives focus. */
.viewSlideshowBadge:focus {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

/* ---- Lightbox ---- */
body.gallery-lightbox-open {
	overflow: hidden;
}

.galleryLightbox {
	position: fixed;
	inset: 0;
	z-index: 2000;
	display: none;
}

.galleryLightbox.is-open {
	display: block;
}

.galleryLightbox-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
	cursor: zoom-out;
}

.galleryLightbox-dialog {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	width: min(1400px, 94vw);
	height: min(780px, 92vh);
	background: #fff;
	border-radius: 6px;
	overflow: hidden;
}

.galleryLightbox-header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 26px;
	border-bottom: 1px solid #e6e6e6;
}

.galleryLightbox-title {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	color: #111;
	line-height: 1.25;
}

.galleryLightbox-close {
	flex: 0 0 auto;
	border: 0;
	background: none;
	font-size: 28px;
	line-height: 1;
	color: #333;
	cursor: pointer;
	padding: 0 4px;
}

.galleryLightbox-body {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	gap: 18px;
	padding: 24px 26px;
	min-height: 0;
}

.galleryLightbox-nav {
	flex: 0 0 auto;
	border: 0;
	background: none;
	font-size: 34px;
	line-height: 1;
	color: #222;
	cursor: pointer;
	padding: 8px;
	transition: opacity 0.15s ease;
}

.galleryLightbox-nav:hover {
	opacity: 0.55;
}

.galleryLightbox-main {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 0;
	height: 100%;
}

.galleryLightbox-stage {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 0;
}

.galleryLightbox-image {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.galleryLightbox-aside {
	flex: 0 0 24%;
	align-self: flex-start;
	padding-top: 6px;
}

.galleryLightbox-caption {
	margin: 0 0 14px;
	padding-bottom: 14px;
	border-bottom: 1px solid #e6e6e6;
	font-size: 15px;
	line-height: 1.5;
	color: #333;
}

.galleryLightbox-share {
	display: flex;
	gap: 12px;
}

.galleryLightbox-share-link {
	display: inline-flex;
	width: 30px;
	height: 30px;
}

.galleryLightbox-share-link img {
	width: 100%;
	height: 100%;
}

.galleryLightbox-dots {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	padding-top: 16px;
}

.galleryLightbox-dot {
	width: 10px;
	height: 10px;
	padding: 0;
	border: 1px solid #999;
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
}

.galleryLightbox-dot.is-active {
	background: #111;
	border-color: #111;
}

/* ---- Small screens: stack caption/share under the image ---- */
@media (max-width: 767px) {
	.galleryLightbox-dialog {
		width: 96vw;
		height: 94vh;
	}

	.galleryLightbox-body {
		flex-wrap: wrap;
		padding: 16px;
		gap: 10px;
	}

	.galleryLightbox-main {
		order: 2;
		flex: 1 1 60%;
		height: auto;
	}

	.galleryLightbox-stage {
		max-height: 55vh;
	}

	.galleryLightbox-nav {
		order: 2;
		font-size: 28px;
	}

	.galleryLightbox-aside {
		order: 3;
		flex: 0 0 100%;
	}
}
