/*!
 * Local Hero SEO Gallery - front end
 * Everything is scoped under .lhg / .lhg-lb so nothing leaks into a theme.
 * No element selectors, no resets, no !important except the two visually
 * hidden helpers that must win.
 */

.lhg {
	--lhg-cols: 3;
	--lhg-cols-t: 2;
	--lhg-cols-m: 1;
	--lhg-gap: 12px;
	--lhg-radius: 10px;
	--lhg-accent: #1e4192;
	--lhg-cap-color: inherit;
	--lhg-cap-size: 0.875em;
	--lhg-dur: 0.28s;

	display: block;
	box-sizing: border-box;
	margin: 0 0 1.5rem;
	max-width: 100%;
}

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

.lhg__head {
	margin: 0 0 1rem;
}

.lhg__title {
	margin: 0 0 0.35rem;
	line-height: 1.2;
}

.lhg__desc {
	margin: 0;
	opacity: 0.85;
	max-width: 70ch;
}

/* ------------------------------------------------------------------ Filters */

.lhg__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 1rem;
}

.lhg__filter {
	appearance: none;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 999px;
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-size: 0.85em;
	line-height: 1;
	opacity: 0.62;
	padding: 0.55em 1.05em;
	transition: opacity var(--lhg-dur) ease, background-color var(--lhg-dur) ease, color var(--lhg-dur) ease;
}

.lhg__filter:hover,
.lhg__filter:focus-visible {
	opacity: 1;
}

.lhg__filter.is-active {
	background: var(--lhg-accent);
	border-color: var(--lhg-accent);
	color: #fff;
	opacity: 1;
}

/* --------------------------------------------------------------------- Grid */

.lhg__grid {
	display: grid;
	grid-template-columns: repeat(var(--lhg-cols), minmax(0, 1fr));
	gap: var(--lhg-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.lhg__item {
	position: relative;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.lhg__item.is-hidden {
	display: none;
}

.lhg__link {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--lhg-radius);
	line-height: 0;
	text-decoration: none;
	box-shadow: none;
	background: rgba(0, 0, 0, 0.04);
}

.lhg__link:focus-visible {
	outline: 3px solid var(--lhg-accent);
	outline-offset: 3px;
}

.lhg__img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	border: 0;
	border-radius: inherit;
	transition: transform var(--lhg-dur) ease, filter var(--lhg-dur) ease, opacity var(--lhg-dur) ease;
}

.lhg__cap {
	margin: 0.5rem 0 0;
	font-size: var(--lhg-cap-size);
	line-height: 1.45;
	color: var(--lhg-cap-color);
	opacity: 0.8;
}

/* ------------------------------------------------------------- Crop ratios */

.lhg--ratio-1-1 .lhg__img { aspect-ratio: 1 / 1; object-fit: cover; }
.lhg--ratio-4-3 .lhg__img { aspect-ratio: 4 / 3; object-fit: cover; }
.lhg--ratio-3-2 .lhg__img { aspect-ratio: 3 / 2; object-fit: cover; }
.lhg--ratio-16-9 .lhg__img { aspect-ratio: 16 / 9; object-fit: cover; }
.lhg--ratio-3-4 .lhg__img { aspect-ratio: 3 / 4; object-fit: cover; }

/* Fallback for browsers with no aspect-ratio support. */
@supports not (aspect-ratio: 1 / 1) {
	.lhg--ratio-1-1 .lhg__link,
	.lhg--ratio-4-3 .lhg__link,
	.lhg--ratio-3-2 .lhg__link,
	.lhg--ratio-16-9 .lhg__link,
	.lhg--ratio-3-4 .lhg__link {
		height: 0;
	}
	.lhg--ratio-1-1 .lhg__link { padding-bottom: 100%; }
	.lhg--ratio-4-3 .lhg__link { padding-bottom: 75%; }
	.lhg--ratio-3-2 .lhg__link { padding-bottom: 66.6667%; }
	.lhg--ratio-16-9 .lhg__link { padding-bottom: 56.25%; }
	.lhg--ratio-3-4 .lhg__link { padding-bottom: 133.3333%; }

	.lhg--ratio-1-1 .lhg__img,
	.lhg--ratio-4-3 .lhg__img,
	.lhg--ratio-3-2 .lhg__img,
	.lhg--ratio-16-9 .lhg__img,
	.lhg--ratio-3-4 .lhg__img {
		position: absolute;
		inset: 0;
		height: 100%;
		object-fit: cover;
	}
}

/* ----------------------------------------------------------- Hover effects */

.lhg--hover-zoom .lhg__link:hover .lhg__img,
.lhg--hover-zoom .lhg__link:focus-visible .lhg__img {
	transform: scale(1.06);
}

.lhg--hover-lift .lhg__link {
	transition: transform var(--lhg-dur) ease, box-shadow var(--lhg-dur) ease;
}

.lhg--hover-lift .lhg__link:hover,
.lhg--hover-lift .lhg__link:focus-visible {
	transform: translateY(-4px);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.lhg--hover-fade .lhg__link::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--lhg-accent);
	opacity: 0;
	transition: opacity var(--lhg-dur) ease;
	pointer-events: none;
}

.lhg--hover-fade .lhg__link:hover::after,
.lhg--hover-fade .lhg__link:focus-visible::after {
	opacity: 0.28;
}

.lhg--hover-grayscale .lhg__img {
	filter: grayscale(1);
}

.lhg--hover-grayscale .lhg__link:hover .lhg__img,
.lhg--hover-grayscale .lhg__link:focus-visible .lhg__img {
	filter: grayscale(0);
}

/* --------------------------------------------------------- Overlay caption */

.lhg__overlay {
	position: absolute;
	inset: auto 0 0 0;
	display: flex;
	align-items: flex-end;
	padding: 1.4em 1em 0.9em;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
	color: #fff;
	line-height: 1.4;
	font-size: var(--lhg-cap-size);
	opacity: 1;
	transform: none;
	transition: opacity var(--lhg-dur) ease, transform var(--lhg-dur) ease;
}

.lhg--hover-reveal .lhg__overlay {
	opacity: 0;
	transform: translateY(12px);
}

.lhg--hover-reveal .lhg__link:hover .lhg__overlay,
.lhg--hover-reveal .lhg__link:focus-visible .lhg__overlay {
	opacity: 1;
	transform: none;
}

.lhg__overlay-text {
	display: block;
}

/* ------------------------------------------------------------------ Masonry */

.lhg--masonry .lhg__grid {
	grid-auto-rows: 4px;
	align-items: start;
}

.lhg--masonry .lhg__item {
	grid-row-end: span 60;
}

/* Before the script measures, keep it readable. */
.lhg--masonry:not(.is-ready) .lhg__grid {
	grid-auto-rows: auto;
}

.lhg--masonry:not(.is-ready) .lhg__item {
	grid-row-end: auto;
}

/* ---------------------------------------------------------------- Justified */

.lhg--justified .lhg__grid {
	display: flex;
	flex-wrap: wrap;
	gap: var(--lhg-gap);
}

.lhg--justified .lhg__item {
	flex: 1 1 240px;
}

.lhg--justified.is-ready .lhg__item {
	flex: 0 0 auto;
}

.lhg--justified .lhg__img {
	height: 100%;
	object-fit: cover;
}

/* ------------------------------------------------------------------- Mosaic */

.lhg--mosaic .lhg__grid {
	grid-auto-flow: dense;
}

.lhg--mosaic .lhg__item:nth-child(5n + 1) {
	grid-column: span 2;
	grid-row: span 2;
}

@media (max-width: 600px) {
	.lhg--mosaic .lhg__item:nth-child(5n + 1) {
		grid-column: span 1;
		grid-row: span 1;
	}
}

/* ----------------------------------------------------------------- Carousel */

.lhg__carousel {
	position: relative;
}

.lhg__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - (var(--lhg-cols) - 1) * var(--lhg-gap)) / var(--lhg-cols));
	gap: var(--lhg-gap);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding-bottom: 4px;
	scrollbar-width: thin;
}

.lhg__track::-webkit-scrollbar {
	height: 6px;
}

.lhg__track::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.25);
	border-radius: 999px;
}

.lhg__track .lhg__item {
	scroll-snap-align: start;
}

.lhg__track:focus-visible {
	outline: 3px solid var(--lhg-accent);
	outline-offset: 4px;
}

.lhg__nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	margin-top: -21px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.94);
	color: #111;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	cursor: pointer;
	transition: opacity var(--lhg-dur) ease, transform var(--lhg-dur) ease;
}

.lhg__nav:hover {
	transform: scale(1.06);
}

.lhg__nav--prev { left: -10px; }
.lhg__nav--next { right: -10px; }

.lhg__nav[disabled] {
	opacity: 0.3;
	cursor: default;
	transform: none;
}

.lhg__dots {
	display: flex;
	justify-content: center;
	gap: 7px;
	margin-top: 0.85rem;
}

.lhg__dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.28;
	cursor: pointer;
	transition: opacity var(--lhg-dur) ease, width var(--lhg-dur) ease;
}

.lhg__dot.is-active {
	width: 22px;
	border-radius: 999px;
	opacity: 1;
	background: var(--lhg-accent);
}

/* ---------------------------------------------------------------- Spotlight */

.lhg__stage {
	position: relative;
	display: grid;
	border-radius: var(--lhg-radius);
	overflow: hidden;
}

.lhg__stage .lhg__stage-item {
	grid-area: 1 / 1;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease;
}

.lhg__stage .lhg__stage-item.is-active {
	opacity: 1;
	visibility: visible;
}

.lhg__strip {
	display: flex;
	gap: 8px;
	margin-top: 10px;
	overflow-x: auto;
	padding-bottom: 4px;
}

.lhg__thumb {
	position: relative;
	flex: 0 0 auto;
	width: 84px;
	padding: 0;
	border: 0;
	border-radius: calc(var(--lhg-radius) / 1.6);
	overflow: hidden;
	background: none;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity var(--lhg-dur) ease, box-shadow var(--lhg-dur) ease;
}

.lhg__thumb img {
	display: block;
	width: 100%;
	height: 60px;
	object-fit: cover;
}

.lhg__thumb.is-active,
.lhg__thumb:hover,
.lhg__thumb:focus-visible {
	opacity: 1;
	box-shadow: 0 0 0 2px var(--lhg-accent);
}

/* ------------------------------------------------------------ Before/after */

.lhg__grid--ba {
	grid-template-columns: repeat(var(--lhg-cols), minmax(0, 1fr));
}

.lhg__ba {
	position: relative;
}

.lhg__ba-figure {
	position: relative;
	margin: 0;
	overflow: hidden;
	border-radius: var(--lhg-radius);
	line-height: 0;
	touch-action: pan-y;
}

.lhg__ba-img {
	display: block;
	width: 100%;
	height: auto;
}

.lhg__ba-clip {
	position: absolute;
	inset: 0;
	width: 50%;
	overflow: hidden;
}

.lhg__ba-clip .lhg__ba-img {
	position: absolute;
	top: 0;
	left: 0;
	width: auto;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.lhg__ba-tag {
	position: absolute;
	top: 10px;
	z-index: 3;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.68);
	color: #fff;
	font-size: 0.72em;
	line-height: 1.5;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	pointer-events: none;
}

.lhg__ba-tag--before { left: 10px; }
.lhg__ba-tag--after { right: 10px; }

.lhg__ba-range {
	position: absolute;
	inset: 0;
	z-index: 4;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: ew-resize;
	appearance: none;
	background: transparent;
}

.lhg__ba-range::-webkit-slider-thumb {
	appearance: none;
	width: 44px;
	height: 100%;
}

.lhg__ba-range:focus-visible + .lhg__ba-handle {
	box-shadow: 0 0 0 3px var(--lhg-accent);
}

.lhg__ba-handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	z-index: 3;
	width: 3px;
	margin-left: -1.5px;
	background: #fff;
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
	pointer-events: none;
}

.lhg__ba-handle::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 38px;
	height: 38px;
	margin: -19px 0 0 -19px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* --------------------------------------------------------------- Load more */

.lhg__more-wrap {
	display: flex;
	justify-content: center;
	margin-top: 1.25rem;
}

.lhg__more {
	appearance: none;
	border: 1px solid var(--lhg-accent);
	border-radius: 999px;
	background: var(--lhg-accent);
	color: #fff;
	cursor: pointer;
	font: inherit;
	font-size: 0.9em;
	padding: 0.7em 1.7em;
	transition: filter var(--lhg-dur) ease;
}

.lhg__more:hover {
	filter: brightness(1.1);
}

/* ------------------------------------------------------------- Responsive */

@media (max-width: 900px) {
	.lhg__grid,
	.lhg__grid--ba {
		grid-template-columns: repeat(var(--lhg-cols-t), minmax(0, 1fr));
	}
	.lhg__track {
		grid-auto-columns: calc((100% - (var(--lhg-cols-t) - 1) * var(--lhg-gap)) / var(--lhg-cols-t));
	}
}

@media (max-width: 600px) {
	.lhg__grid,
	.lhg__grid--ba {
		grid-template-columns: repeat(var(--lhg-cols-m), minmax(0, 1fr));
	}
	.lhg__track {
		grid-auto-columns: calc((100% - (var(--lhg-cols-m) - 1) * var(--lhg-gap)) / var(--lhg-cols-m));
	}
	.lhg__nav--prev { left: 2px; }
	.lhg__nav--next { right: 2px; }
}

@media (prefers-reduced-motion: reduce) {
	.lhg *,
	.lhg-lb * {
		transition-duration: 0.001ms !important;
		animation-duration: 0.001ms !important;
	}
	.lhg__track {
		scroll-behavior: auto;
	}
}

/* ------------------------------------------------------------- Editor note */

.lhg-notice {
	margin: 1rem 0;
	padding: 0.85rem 1rem;
	border-left: 4px solid #ff1c1c;
	background: #fff5f5;
	color: #5b1111;
	font-size: 0.9em;
	border-radius: 4px;
}

/* ================================================================ Lightbox */

.lhg-lb {
	position: fixed;
	inset: 0;
	z-index: 999990;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.22s ease, visibility 0.22s ease;
	font-family: inherit;
	-webkit-font-smoothing: antialiased;
}

.lhg-lb.is-open {
	opacity: 1;
	visibility: visible;
}

.lhg-lb__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(8, 10, 16, 0.94);
}

.lhg-lb--light .lhg-lb__backdrop {
	background: rgba(248, 249, 251, 0.97);
}

.lhg-lb--blur .lhg-lb__backdrop {
	background: rgba(10, 14, 24, 0.62);
	backdrop-filter: blur(18px) saturate(1.2);
	-webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.lhg-lb__stage {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 56px 64px 76px;
}

.lhg-lb__figure {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.lhg-lb__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 150px);
	width: auto;
	height: auto;
	border-radius: 6px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
	transition: transform 0.25s ease, opacity 0.2s ease;
	cursor: zoom-in;
	touch-action: pan-y;
}

.lhg-lb.is-zoomed .lhg-lb__img {
	transform: scale(2);
	cursor: zoom-out;
	max-height: none;
}

.lhg-lb.is-loading .lhg-lb__img {
	opacity: 0.25;
}

.lhg-lb__caption {
	max-width: 68ch;
	margin: 14px auto 0;
	color: #f2f4f8;
	font-size: 0.92rem;
	line-height: 1.5;
	text-align: center;
}

.lhg-lb--light .lhg-lb__caption {
	color: #1a1d23;
}

.lhg-lb__caption strong {
	display: block;
	margin-bottom: 2px;
	font-weight: 600;
}

.lhg-lb__btn {
	position: absolute;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.lhg-lb--light .lhg-lb__btn {
	background: rgba(0, 0, 0, 0.06);
	color: #14161b;
}

.lhg-lb__btn:hover {
	background: rgba(255, 255, 255, 0.22);
	transform: scale(1.06);
}

.lhg-lb--light .lhg-lb__btn:hover {
	background: rgba(0, 0, 0, 0.12);
}

.lhg-lb__btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.lhg-lb__btn[hidden] {
	display: none;
}

.lhg-lb__close { top: 14px; right: 16px; }
.lhg-lb__prev { top: 50%; left: 14px; margin-top: -23px; }
.lhg-lb__next { top: 50%; right: 14px; margin-top: -23px; }

.lhg-lb__counter {
	position: absolute;
	top: 22px;
	left: 24px;
	z-index: 3;
	color: rgba(255, 255, 255, 0.75);
	font-size: 0.82rem;
	letter-spacing: 0.06em;
}

.lhg-lb--light .lhg-lb__counter {
	color: rgba(0, 0, 0, 0.6);
}

.lhg-lb__spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	border-radius: 50%;
	opacity: 0;
	animation: lhg-spin 0.8s linear infinite;
	pointer-events: none;
}

.lhg-lb.is-loading .lhg-lb__spinner {
	opacity: 1;
}

@keyframes lhg-spin {
	to { transform: rotate(360deg); }
}

@media (max-width: 700px) {
	.lhg-lb__stage {
		padding: 52px 12px 68px;
	}
	.lhg-lb__prev { left: 6px; }
	.lhg-lb__next { right: 6px; }
	.lhg-lb__btn {
		width: 40px;
		height: 40px;
	}
}

.lhg-lb-lock {
	overflow: hidden !important;
}

/* Screen reader helper, only defined if the theme has not. */
.lhg .screen-reader-text,
.lhg-lb .screen-reader-text {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}
