/* ABOUTME: Modern look for WordPress core's expand-on-click image viewer (.wp-lightbox-overlay):
   ABOUTME: near-black backdrop, round frosted buttons with bolder icons, a "5 of 76" counter. */

.wp-lightbox-overlay {
	--td-lb-ink: #fff;
	--td-lb-button: rgba(255, 255, 255, .12);
	--td-lb-button-hover: rgba(255, 255, 255, .22);
	--td-lb-size: 48px;
	--td-lb-edge: 24px;
}

/* Backdrop: core paints it with the theme's background color (white here), slightly see-through.
   Solid: on near-black even 4% lets a white site header read through behind the photo. */
.wp-lightbox-overlay .scrim {
	background-color: #0a0e17 !important; /* near-black leaning to NCRLA navy; neutral enough for photos */
	opacity: 1 !important;
}

.wp-lightbox-overlay .lightbox-image-container img {
	border-radius: 6px; /* same as the grid tiles */
}

/* Buttons: one round, frosted control style for close, previous and next. */
.wp-lightbox-overlay .wp-lightbox-close-button,
.wp-lightbox-overlay .wp-lightbox-navigation-button {
	width: var(--td-lb-size);
	height: var(--td-lb-size);
	min-width: 0;
	min-height: 0;
	padding: 0 !important;
	display: grid;
	place-items: center;
	border: 0 !important;
	border-radius: 999px;
	background: var(--td-lb-button) !important;
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	color: var(--td-lb-ink);
	cursor: pointer;
	transition: background-color 160ms ease, transform 160ms ease;
}

.wp-lightbox-overlay .wp-lightbox-close-button:hover,
.wp-lightbox-overlay .wp-lightbox-navigation-button:hover {
	background: var(--td-lb-button-hover) !important;
}

.wp-lightbox-overlay .wp-lightbox-close-button:active,
.wp-lightbox-overlay .wp-lightbox-navigation-button:active {
	transform: scale(.94);
}

.wp-lightbox-overlay .wp-lightbox-close-button:focus-visible,
.wp-lightbox-overlay .wp-lightbox-navigation-button:focus-visible {
	outline: 2px solid var(--td-lb-ink) !important;
	outline-offset: 3px;
}

/* Core's thin 28px glyphs give way to 2px-stroke icons drawn by the button itself. */
.wp-lightbox-overlay .wp-lightbox-close-icon,
.wp-lightbox-overlay .wp-lightbox-navigation-icon {
	display: none !important;
}

.wp-lightbox-overlay .wp-lightbox-close-button::before,
.wp-lightbox-overlay .wp-lightbox-navigation-button::before {
	content: "";
	width: 22px;
	height: 22px;
	background: currentColor;
	-webkit-mask: var(--td-lb-icon) center / contain no-repeat;
	mask: var(--td-lb-icon) center / contain no-repeat;
}

.wp-lightbox-overlay .wp-lightbox-close-button {
	--td-lb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
	position: absolute !important;
	top: calc(env(safe-area-inset-top) + var(--td-lb-edge)) !important;
	right: calc(env(safe-area-inset-right) + var(--td-lb-edge)) !important;
	left: auto !important;
}

.wp-lightbox-overlay .wp-lightbox-navigation-button-prev {
	--td-lb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E");
}

.wp-lightbox-overlay .wp-lightbox-navigation-button-next {
	--td-lb-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E");
}

.wp-lightbox-overlay .wp-lightbox-navigation-button {
	position: absolute !important;
	top: 50% !important;
	bottom: auto !important;
	margin-top: calc(var(--td-lb-size) / -2);
}

.wp-lightbox-overlay .wp-lightbox-navigation-button[hidden] {
	display: none !important;
}

.wp-lightbox-overlay .wp-lightbox-navigation-button-prev {
	left: calc(env(safe-area-inset-left) + var(--td-lb-edge)) !important;
	right: auto !important;
}

.wp-lightbox-overlay .wp-lightbox-navigation-button-next {
	right: calc(env(safe-area-inset-right) + var(--td-lb-edge)) !important;
	left: auto !important;
}

/* "5 of 76", added by lightbox.js. Same pill as the buttons, top left, opposite close. */
.td-lightbox-counter {
	position: absolute;
	z-index: 5000000;
	top: calc(env(safe-area-inset-top) + var(--td-lb-edge) + 8px);
	left: calc(env(safe-area-inset-left) + var(--td-lb-edge));
	padding: 7px 14px;
	border-radius: 999px;
	background: var(--td-lb-button);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	color: rgba(255, 255, 255, .75);
	font-size: 14px;
	line-height: 18px;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0;
	pointer-events: none;
	opacity: 0;
	transition: opacity 200ms ease;
}

.wp-lightbox-overlay.active .td-lightbox-counter:not(:empty) {
	opacity: 1;
}

/* Phones: swipe is the main way through. The arrows move to the bottom corners, out of the photo,
   with the counter centered between them; only close stays at the top. The photo runs edge to edge,
   so square corners. */
@media (max-width: 600px) {
	.wp-lightbox-overlay {
		--td-lb-size: 44px;
		--td-lb-edge: 16px;
	}

	.wp-lightbox-overlay .lightbox-image-container img {
		border-radius: 0;
	}

	.wp-lightbox-overlay .wp-lightbox-navigation-button {
		top: auto !important;
		bottom: calc(env(safe-area-inset-bottom) + var(--td-lb-edge)) !important;
		margin-top: 0;
	}

	.td-lightbox-counter {
		top: auto;
		bottom: calc(env(safe-area-inset-bottom) + var(--td-lb-edge) + 6px);
		left: 50%;
		transform: translateX(-50%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wp-lightbox-overlay .wp-lightbox-close-button,
	.wp-lightbox-overlay .wp-lightbox-navigation-button,
	.td-lightbox-counter {
		transition: none;
	}
}
