/* Fox House Gallery — frontend */
.fhg {
	--fhg-brown: #733714;
	--fhg-navy: #024272;
	--fhg-gap: 14px;
	--fhg-radius: 14px;
	width: 100%;
	max-width: 1240px;
	margin-inline: auto;
	padding-inline: 16px;
	box-sizing: border-box;
	font-family: "Tajawal", sans-serif;
}
.fhg *, .fhg *::before, .fhg *::after { box-sizing: border-box; }

.fhg-grid { display: grid; gap: var(--fhg-gap); }
.fhg-item { position: relative; margin: 0; min-width: 0; }
.fhg-link {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: var(--fhg-radius);
	background: #efe9e4;
	box-shadow: 0 2px 10px rgba(17, 17, 17, .06);
	isolation: isolate;
	-webkit-tap-highlight-color: transparent;
}
.fhg-link:focus-visible { outline: 3px solid var(--fhg-brown); outline-offset: 3px; }
.fhg .fhg-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border-radius: 0;
	transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}
.fhg-overlay {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: #fff;
	background: linear-gradient(180deg, rgba(2, 66, 114, 0) 40%, rgba(115, 55, 20, .55));
	opacity: 0;
	transition: opacity .35s ease;
}
.fhg-overlay svg {
	padding: 11px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	border: 1px solid rgba(255, 255, 255, .45);
	transform: scale(.8);
	transition: transform .35s ease;
}
@media (hover: hover) {
	.fhg-link:hover .fhg-img { transform: scale(1.06); }
	.fhg-link:hover .fhg-overlay { opacity: 1; }
	.fhg-link:hover .fhg-overlay svg { transform: scale(1); }
}

/* Uniform grid (homepage) ----------------------------------------------- */
.fhg--grid .fhg-grid { grid-template-columns: repeat(var(--fhg-cols-d, 5), minmax(0, 1fr)); }
@media (min-width: 1025px) { .fhg--grid .fhg-hide-d { display: none; } }
.fhg--grid .fhg-item { aspect-ratio: 4 / 3; }

/* Masonry (gallery page) ------------------------------------------------- */
.fhg--masonry .fhg-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fhg--masonry .fhg-item { aspect-ratio: var(--fhg-ratio, 4 / 3); }
/* JS upgrade: row spans from each image's real ratio, no cropping, no gaps. */
.fhg--masonry.is-laid-out .fhg-grid { grid-auto-rows: 2px; row-gap: 0; }
.fhg--masonry.is-laid-out .fhg-item { aspect-ratio: auto; padding-bottom: var(--fhg-gap); }

/* Entrance */
.fhg.is-ready .fhg-item, .fhg .fhg-item.fhg-new { animation: fhg-in .6s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes fhg-in { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
	.fhg.is-ready .fhg-item { animation: none; }
	.fhg .fhg-img { transition: none; }
}

/* Button ------------------------------------------------------------------ */
.fhg-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.fhg-button {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 13px 28px;
	border-radius: 5px;
	background: var(--fhg-brown);
	color: #fff !important;
	font-family: "Tajawal", sans-serif;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none !important;
	box-shadow: 0 8px 20px rgba(115, 55, 20, .22);
	transition: background-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
button.fhg-button { border: 0; cursor: pointer; }
.fhg-button--outline {
	background: transparent;
	color: var(--fhg-brown) !important;
	border: 1.5px solid var(--fhg-brown) !important;
	box-shadow: none;
}
.fhg-button--outline .fhg-button-count { background: rgba(115, 55, 20, .12); }
.fhg-button--outline:hover, .fhg-button--outline:focus-visible { color: #fff !important; background: var(--fhg-brown); border-color: var(--fhg-brown) !important; box-shadow: 0 8px 20px rgba(115, 55, 20, .22); }
.fhg-button--outline:hover .fhg-button-count { background: rgba(255, 255, 255, .2); }
.fhg-more.is-loading { opacity: .7; pointer-events: none; }
.fhg-more.is-loading .fhg-more-icon { animation: fhg-spin .8s linear infinite; }
.fhg-button:not(.fhg-button--outline):hover, .fhg-button:not(.fhg-button--outline):focus-visible { background: var(--fhg-navy); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(2, 66, 114, .25); }
.fhg-button-count { padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, .2); font-size: 13px; }
.fhg-button-arrow { transition: transform .25s ease; }
[dir="rtl"] .fhg-button-arrow { transform: scaleX(-1); }
.fhg-button:hover .fhg-button-arrow { transform: translateX(4px); }
[dir="rtl"] .fhg-button:hover .fhg-button-arrow { transform: scaleX(-1) translateX(4px); }

.fhg-empty { text-align: center; color: #666; padding: 24px; border: 1px dashed #ccc; border-radius: 12px; }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1024px) {
	.fhg { --fhg-gap: 12px; --fhg-radius: 12px; }
	.fhg--grid .fhg-grid { grid-template-columns: repeat(var(--fhg-cols-t, 4), minmax(0, 1fr)); }
	.fhg--grid .fhg-hide-t { display: none; }
	.fhg--masonry .fhg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
	.fhg { --fhg-gap: 8px; --fhg-radius: 10px; padding-inline: 12px; }
	.fhg--grid .fhg-grid { grid-template-columns: repeat(var(--fhg-cols-m, 2), minmax(0, 1fr)); }
	.fhg--grid .fhg-item { aspect-ratio: 1 / 1; }
	.fhg--grid .fhg-hide-t { display: block; }
	.fhg--grid .fhg-hide-m { display: none; }
	.fhg--masonry .fhg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.fhg-overlay { display: none; }
	.fhg-actions { margin-top: 22px; gap: 10px; }
	.fhg-button { flex: 1 1 100%; max-width: 420px; justify-content: center; padding: 14px 20px; }
}

/* Lightbox ---------------------------------------------------------------- */
.fhg-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	background: rgba(10, 12, 16, .96);
	color: #fff;
	font-family: "Tajawal", sans-serif;
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s ease, visibility 0s linear .3s;
	touch-action: pan-y pinch-zoom;
	-webkit-user-select: none;
	user-select: none;
}
.fhg-lb.is-open { opacity: 1; visibility: visible; transition: opacity .3s ease; }
.fhg-lb-top {
	position: relative;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	padding-top: max(14px, env(safe-area-inset-top));
}
.fhg-lb-counter { font-size: 15px; letter-spacing: .5px; opacity: .85; direction: ltr; }
.fhg-lb-stage {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 76px;
	overflow: hidden;
}
.fhg-lb-track { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; transition: transform .3s cubic-bezier(.2, .7, .2, 1), opacity .3s ease; }
.fhg-lb-track.is-dragging { transition: none; }
.fhg-lb-img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
	opacity: 0;
	transition: opacity .25s ease;
}
.fhg-lb-img.is-loaded { opacity: 1; }
.fhg-lb-spinner {
	position: absolute;
	width: 38px;
	height: 38px;
	border: 3px solid rgba(255, 255, 255, .2);
	border-top-color: #fff;
	border-radius: 50%;
	animation: fhg-spin .8s linear infinite;
}
.fhg-lb.is-loaded .fhg-lb-spinner { display: none; }
@keyframes fhg-spin { to { transform: rotate(360deg); } }
.fhg-lb-caption {
	min-height: 54px;
	padding: 12px 20px;
	padding-bottom: max(14px, env(safe-area-inset-bottom));
	text-align: center;
	font-size: 16px;
	line-height: 1.5;
	opacity: .9;
}
.fhg-lb button {
	display: grid;
	place-items: center;
	padding: 0;
	margin: 0;
	border: 1px solid rgba(255, 255, 255, .2);
	border-radius: 50%;
	background: rgba(255, 255, 255, .1);
	color: #fff;
	cursor: pointer;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transition: background-color .2s ease, transform .2s ease;
}
.fhg-lb button:hover, .fhg-lb button:focus-visible { background: var(--fhg-brown, #733714); border-color: transparent; outline: none; }
.fhg-lb-close { width: 44px; height: 44px; }
.fhg-lb-nav { position: absolute; top: 50%; z-index: 2; width: 54px; height: 54px; transform: translateY(-50%); }
.fhg-lb-nav:active { transform: translateY(-50%) scale(.94); }
.fhg-lb-prev { inset-inline-start: 14px; }
.fhg-lb-next { inset-inline-end: 14px; }
[dir="rtl"] .fhg-lb-nav svg { transform: scaleX(-1); }
.fhg-lb[data-single] .fhg-lb-nav { display: none; }
html.fhg-lb-lock, html.fhg-lb-lock body { overflow: hidden !important; }

@media (max-width: 767px) {
	.fhg-lb-stage { padding: 0 8px; }
	.fhg-lb-nav { top: auto; bottom: 10px; transform: none; width: 46px; height: 46px; }
	.fhg-lb-nav:active { transform: scale(.94); }
	.fhg-lb-stage { padding-bottom: 66px; }
	.fhg-lb-prev { inset-inline-start: calc(50% - 56px); }
	.fhg-lb-next { inset-inline-end: calc(50% - 56px); }
	.fhg-lb-img { border-radius: 4px; }
	.fhg-lb-caption { font-size: 15px; min-height: 40px; }
}
