/* GHRO Media Gallery — defaults match the widget control defaults, so the
   gallery looks right even before any style is customised in Elementor. */

.ghro-gallery {
	--ghro-lb-bg: rgba(0, 0, 0, 0.92);
	--ghro-lb-ui: #ffffff;
	--ghro-lb-caption: #ffffff;
	--ghro-row-gap: 16px;
	--ghro-col-gap: 16px;
	--ghro-row-h: 240px;
	--ghro-video-ratio: 16 / 9;
	width: 100%;
	box-sizing: border-box;
}
.ghro-gallery *,
.ghro-gallery *::before,
.ghro-gallery *::after {
	box-sizing: border-box;
}

/* ---------- Toolbar: filters + sort ---------- */
.ghro-gallery__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 24px;
}
.ghro-gallery__filters {
	display: flex;
	flex-wrap: wrap;
	flex: 1 1 auto;
	justify-content: center;
	gap: 8px;
}
.ghro-gallery__filter {
	appearance: none;
	cursor: pointer;
	border: 0;
	border-radius: 999px;
	padding: 8px 18px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: #0F2A4A;
	background-color: #EEF2F6;
	transition: background-color 0.2s ease, color 0.2s ease;
}
.ghro-gallery__filter:hover {
	background-color: #dde5ee;
}
.ghro-gallery__filter.is-active,
.ghro-gallery__filter.is-active:hover {
	color: #ffffff;
	background-color: #0E7C6B;
}
.ghro-gallery__filter:focus-visible,
.ghro-gallery__more-btn:focus-visible,
.ghro-gallery__link:focus-visible {
	outline: 3px solid #0E7C6B;
	outline-offset: 2px;
}
.ghro-gallery__sort-select {
	font-size: 14px;
	padding: 8px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	background-color: #ffffff;
}

/* ---------- Grid ---------- */
.ghro-gallery__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	column-gap: 16px;
	row-gap: 16px;
}
.ghro-gallery__item {
	display: flex;
	margin: 0;
	min-width: 0;
}
.ghro-gallery__item[hidden],
.ghro-gallery__more[hidden],
.ghro-gallery__empty[hidden] {
	display: none !important;
}

/* The media box */
.ghro-gallery__link {
	position: relative;
	display: block;
	width: 100%;
	height: 240px;
	max-width: 100%;
	overflow: hidden;
	border-radius: 8px;
	background-color: #e5e7eb;
	text-decoration: none;
	cursor: pointer;
}
/* Auto height (Grid layout) and Masonry: images keep their natural proportions,
   video tiles take the chosen aspect ratio (per-video value wins over the widget value). */
.ghro-height-auto .ghro-gallery__link,
.ghro-gallery--masonry .ghro-gallery__link {
	height: auto;
}
.ghro-height-auto .ghro-gallery__item[data-type="image"] .ghro-gallery__thumb,
.ghro-height-auto .ghro-gallery__item[data-type="image"] .ghro-gallery__thumb img,
.ghro-gallery--masonry .ghro-gallery__item[data-type="image"] .ghro-gallery__thumb,
.ghro-gallery--masonry .ghro-gallery__item[data-type="image"] .ghro-gallery__thumb img {
	height: auto;
}
.ghro-height-auto .ghro-gallery__item[data-type="video"] .ghro-gallery__link,
.ghro-gallery--masonry .ghro-gallery__item[data-type="video"] .ghro-gallery__link {
	aspect-ratio: var(--ghro-item-ratio, var(--ghro-video-ratio, 16 / 9));
}

/* ---------- Masonry ----------
   CSS grid with 2px implicit rows; the script gives every tile a row-span that
   matches its height, so auto-placement drops each tile into the shortest column.
   Row gap is applied by the script (via --ghro-row-gap) instead of by the grid. */
.ghro-gallery--masonry .ghro-gallery__grid {
	grid-auto-rows: 2px;
	row-gap: 0 !important;
}
.ghro-gallery--masonry .ghro-gallery__item {
	align-self: start;
}
.ghro-gallery--masonry .ghro-gallery__thumb img {
	width: 100%;
}

.ghro-gallery__thumb {
	display: block;
	width: 100%;
	height: 100%;
}
.ghro-gallery__thumb img,
.ghro-gallery__thumb video {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center center;
	transition-property: transform;
	transition-duration: 0.4s;
	transition-timing-function: ease;
}
.ghro-gallery__no-thumb {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 120px;
	background: linear-gradient(135deg, #0F2A4A, #0E7C6B);
}

/* Overlay + title */
.ghro-gallery__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-end;
	padding: 14px 16px;
	background-color: rgba(15, 42, 74, 0.55);
	pointer-events: none;
	transition-property: opacity;
	transition-duration: 0.4s;
}
.ghro-gallery__title {
	display: block;
	width: 100%;
	color: #ffffff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
	text-align: left;
}
.ghro-gallery--title-hover .ghro-gallery__overlay {
	opacity: 0;
}
.ghro-gallery--title-hover .ghro-gallery__link:hover .ghro-gallery__overlay,
.ghro-gallery--title-hover .ghro-gallery__link:focus-visible .ghro-gallery__overlay {
	opacity: 1;
}
.ghro-gallery--title-always .ghro-gallery__overlay {
	opacity: 1;
}
.ghro-gallery--title-none .ghro-gallery__overlay {
	opacity: 0;
}

/* Zoom on hover */
.ghro-gallery--zoom .ghro-gallery__link:hover .ghro-gallery__thumb img,
.ghro-gallery--zoom .ghro-gallery__link:hover .ghro-gallery__thumb video {
	transform: scale(1.06);
}

/* Play button on video tiles */
.ghro-gallery__play {
	position: absolute;
	top: 50%;
	left: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background-color: rgba(0, 0, 0, 0.6);
	transform: translate(-50%, -50%);
	pointer-events: none;
	transition: transform 0.2s ease;
}
.ghro-gallery__play svg {
	width: 50%;
	height: 50%;
	margin-left: 6%;
	fill: #ffffff;
}
.ghro-gallery__link:hover .ghro-gallery__play {
	transform: translate(-50%, -50%) scale(1.1);
}

/* ---------- Justified ----------
   Flex rows. Every tile's flex-basis is (aspect ratio x row height) and its grow factor is
   proportional to the aspect ratio, so when a row stretches to the full width every picture
   scales by the same factor: equal heights, each keeping its own proportions, no cropping.
   The ::after filler soaks up the free space so the LAST row is not stretched. */
.ghro-gallery--justified .ghro-gallery__grid {
	display: flex;
	flex-wrap: wrap;
}
.ghro-gallery--justified .ghro-gallery__grid::after {
	content: "";
	flex-grow: 1000000;
	flex-shrink: 1;
	flex-basis: 0;
	margin-left: calc(var(--ghro-col-gap, 16px) * -1); /* cancel the column gap so a full last row doesn't wrap */
}
.ghro-gallery--justified .ghro-gallery__item {
	display: block;
	min-width: 0;
	flex-grow: calc(var(--ghro-ar, 1.5) * 100);
	flex-shrink: 1;
	flex-basis: calc(var(--ghro-ar, 1.5) * var(--ghro-row-h, 240px));
}
.ghro-gallery--justified .ghro-gallery__link {
	height: auto;
	aspect-ratio: var(--ghro-ar, 1.5);
}
.ghro-gallery--justified .ghro-gallery__thumb {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.ghro-gallery--justified .ghro-gallery__thumb img,
.ghro-gallery--justified .ghro-gallery__thumb video {
	height: 100%;
}

/* ---------- Load More / empty ---------- */
.ghro-gallery__more {
	margin-top: 28px;
	text-align: center;
}
.ghro-gallery__more-btn {
	appearance: none;
	cursor: pointer;
	border: 0;
	border-radius: 6px;
	padding: 12px 32px;
	font-size: 15px;
	font-weight: 600;
	color: #ffffff;
	background-color: #0E7C6B;
	transition: background-color 0.2s ease;
}
.ghro-gallery__more-btn:hover {
	background-color: #0F2A4A;
}
.ghro-gallery__empty {
	text-align: center;
	color: #6b7280;
	padding: 32px 0;
}
.ghro-gallery__editor-note {
	padding: 24px;
	text-align: center;
	color: #6b7280;
	background: #f3f4f6;
	border: 1px dashed #cbd5e1;
	border-radius: 6px;
}

/* ---------- Lightbox (appended to <body>) ---------- */
.ghro-lightbox {
	box-sizing: border-box;
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 56px 64px;
	background-color: var(--ghro-lb-bg, rgba(0, 0, 0, 0.92));
	color: var(--ghro-lb-ui, #ffffff);
}
.ghro-lightbox[hidden] {
	display: none !important;
}
.ghro-lightbox__content {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 100%;
	max-height: 100%;
}
.ghro-lightbox__stage {
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 100%;
}
.ghro-lightbox__stage > * { animation: ghro-fade 0.25s ease; }
@keyframes ghro-fade { from { opacity: 0; } to { opacity: 1; } }
.ghro-lightbox__stage img,
.ghro-lightbox__stage video {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 160px);
	border-radius: 4px;
}
.ghro-lightbox__ratio {
	position: relative;
	width: min(90vw, calc((100vh - 160px) * 16 / 9));
	aspect-ratio: 16 / 9;
}
.ghro-lightbox__ratio iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: 4px;
	background: #000;
}
/* Loading indicator while the image / player arrives */
.ghro-lightbox__spinner {
	display: none;
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 2;
	width: 46px;
	height: 46px;
	margin: -23px 0 0 -23px;
	border: 4px solid rgba(255, 255, 255, 0.25);
	border-top-color: var(--ghro-lb-ui, #ffffff);
	border-radius: 50%;
	animation: ghro-spin 0.8s linear infinite;
	pointer-events: none;
}
.ghro-lightbox.is-loading .ghro-lightbox__spinner {
	display: block;
}
@keyframes ghro-spin {
	to { transform: rotate(360deg); }
}

.ghro-lightbox__caption {
	margin-top: 14px;
	max-width: 80ch;
	text-align: center;
	font-size: 15px;
	color: var(--ghro-lb-caption, #ffffff);
}
.ghro-lightbox__caption:empty {
	display: none;
}
.ghro-lightbox__counter {
	position: absolute;
	z-index: 5;
	top: 18px;
	left: 24px;
	font-size: 14px;
	opacity: 0.85;
}
.ghro-lightbox .ghro-lightbox__btn {
	position: absolute !important;
	z-index: 5 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 46px !important;
	height: 46px !important;
	min-width: 0 !important;
	margin: 0;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: rgba(0, 0, 0, 0.55) !important;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
	color: var(--ghro-lb-ui, #ffffff) !important;
	opacity: 1 !important;
	visibility: visible !important;
	line-height: 1;
	cursor: pointer;
	text-transform: none;
	transition: background-color 0.2s ease;
}
.ghro-lightbox .ghro-lightbox__btn svg {
	width: 22px;
	height: 22px;
	display: block;
	pointer-events: none;
}
.ghro-lightbox .ghro-lightbox__btn:hover,
.ghro-lightbox .ghro-lightbox__btn:focus {
	background: rgba(255, 255, 255, 0.28) !important;
	color: var(--ghro-lb-ui, #ffffff) !important;
}
.ghro-lightbox__btn:focus-visible {
	outline: 3px solid #ffffff;
	outline-offset: 2px;
}
.ghro-lightbox__close { top: 14px; right: 18px; }
.ghro-lightbox__prev  { left: 14px; top: 50%; transform: translateY(-50%); }
.ghro-lightbox__next  { right: 14px; top: 50%; transform: translateY(-50%); }
.ghro-lightbox .ghro-lightbox__btn[hidden] { display: none !important; }
body.ghro-lightbox-open { overflow: hidden; }

/* ---------- Small screens (layout defaults; columns/gaps are Elementor controls) ---------- */
@media (max-width: 1024px) {
	.ghro-gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
	.ghro-gallery__grid { grid-template-columns: repeat(1, minmax(0, 1fr)); }
	.ghro-lightbox { padding: 56px 12px; }
	.ghro-lightbox__prev { left: 6px; }
	.ghro-lightbox__next { right: 6px; }
	.ghro-gallery__toolbar { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
	.ghro-gallery *,
	.ghro-lightbox * {
		transition: none !important;
	}
	.ghro-lightbox__spinner {
		animation-duration: 2.4s;
	}
}
