/* ---------------------------------------------------------
   Get Automating Image Fix
   1. Post body images fill the content column
   2. Dark lightbox overlay that scales up, unlike core
   --------------------------------------------------------- */

/* --- 1. Full width in the content column --- */

/* The figure itself must be a full width block, or a 100% width image
   only fills a shrink-to-fit wrapper. */
.post-body figure.wp-block-image,
.post-body .wp-block-image,
.entry-content figure.wp-block-image,
.entry-content .wp-block-image {
	display: block;
	width: 100%;
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

/* Beat any theme or block-library rule setting an explicit or auto width.
   Deliberately blunt, because the losing rule varies by theme. */
.post-body figure.wp-block-image img,
.post-body .wp-block-image img,
.post-body > img,
.post-body > p > img,
.entry-content figure.wp-block-image img,
.entry-content .wp-block-image img,
.entry-content > img,
.entry-content > p > img {
	width: 100% !important;
	height: auto !important;
	max-width: 100% !important;
	display: block;
	border-radius: 10px;
}

/* Editor resize handles set inline width and height on the img. Clear them. */
.post-body .wp-block-image.is-resized img,
.entry-content .wp-block-image.is-resized img {
	width: 100% !important;
	height: auto !important;
}

/* Escape hatch: float an image left or right and it keeps its own size. */
.post-body .alignleft img,
.post-body .alignright img,
.entry-content .alignleft img,
.entry-content .alignright img {
	width: auto !important;
	max-width: 100% !important;
}

.post-body .alignleft,
.post-body .alignright,
.entry-content .alignleft,
.entry-content .alignright {
	width: auto;
}

/* Zoom affordance */
.post-body img.ga-zoomable,
.entry-content img.ga-zoomable {
	cursor: zoom-in;
}

/* --- 2. The lightbox --- */

.ga-lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 3vh 3vw;
	background: rgba(8, 12, 22, 0.94);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.18s ease;
	cursor: zoom-out;
}

.ga-lb.is-open {
	opacity: 1;
}

.ga-lb__img {
	max-width: 94vw;
	max-height: 90vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
	transform: scale(0.985);
	transition: transform 0.18s ease;
}

/* This is the part core refuses to do: let a small image grow to fill */
.ga-lb--fill .ga-lb__img {
	width: 94vw;
	height: auto;
}

.ga-lb--fill-tall .ga-lb__img {
	height: 90vh;
	width: auto;
}

.ga-lb.is-open .ga-lb__img {
	transform: scale(1);
}

.ga-lb__close {
	position: absolute;
	top: 18px;
	right: 20px;
	width: 42px;
	height: 42px;
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.ga-lb__close:hover {
	background: rgba(255, 255, 255, 0.16);
	border-color: rgba(255, 255, 255, 0.4);
}

.ga-lb__caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 16px;
	text-align: center;
	color: rgba(255, 255, 255, 0.62);
	font-size: 13px;
	padding: 0 24px;
	pointer-events: none;
}

body.ga-lb-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.ga-lb,
	.ga-lb__img {
		transition: none;
	}
}
