/* Happy Homes Gallery Widget — Frontend Styles */

.hhg-gallery-wrap {
	--hhg-accent: #e0a020;
	--hhg-overlay: #0f2a4a;
	font-family: 'Poppins', Arial, sans-serif;
}

/* ============================================================
   TABS — Gallery Images / Videos
   ============================================================ */

.hhg-tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin-bottom: 28px;
}

.hhg-tab {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	padding: 13px 26px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.2px;
	color: #0f2a4a;
	background: #fff;
	border: 1px solid #e6e6e6;
	border-radius: 50px;
	cursor: pointer;
	min-height: 46px;
	box-shadow: 0 2px 6px rgba(15, 42, 74, 0.06);
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease,
		transform 0.25s ease, box-shadow 0.3s ease;
	-webkit-appearance: none;
	appearance: none;
}

.hhg-tab:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 18px rgba(15, 42, 74, 0.14);
	border-color: var(--hhg-accent);
}

.hhg-tab.is-active {
	color: #fff;
	background: var(--hhg-accent);
	border-color: var(--hhg-accent);
	box-shadow: 0 8px 20px rgba(224, 160, 32, 0.32);
}

.hhg-tab:focus-visible {
	outline: 3px solid var(--hhg-overlay);
	outline-offset: 2px;
}

.hhg-tab-icon {
	display: inline-flex;
	align-items: center;
	line-height: 0;
	opacity: 0.9;
}

.hhg-tab-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	font-size: 12px;
	font-weight: 700;
	border-radius: 20px;
	background: rgba(15, 42, 74, 0.09);
	color: inherit;
	transition: background-color 0.3s ease;
}

.hhg-tab.is-active .hhg-tab-count {
	background: rgba(255, 255, 255, 0.28);
}

/* ============================================================
   PANELS
   ============================================================ */

.hhg-panel {
	display: none;
}

.hhg-panel.is-active {
	display: block;
}

/* ============================================================
   GRID
   ============================================================ */

.hhg-gallery-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

.hhg-gallery-item {
	position: relative;
	width: 100%;
	min-width: 0;
	animation: hhg-fade-up 0.5s ease both;
}

@keyframes hhg-fade-up {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.hhg-gallery-item { animation: none !important; }
	.hhg-item-inner,
	.hhg-item-inner img,
	.hhg-tab { transition: none !important; }
}

/* Aspect ratio boxes so the grid stays neat regardless of source image size */
.hhg-ratio-square .hhg-item-inner { aspect-ratio: 1 / 1; }
.hhg-ratio-landscape .hhg-item-inner { aspect-ratio: 4 / 3; }
.hhg-ratio-wide .hhg-item-inner { aspect-ratio: 16 / 9; }
.hhg-ratio-portrait .hhg-item-inner { aspect-ratio: 3 / 4; }

.hhg-item-inner {
	position: relative;
	overflow: hidden;
	border-radius: 6px;
	cursor: pointer;
	background: #eee;
	box-shadow: 0 2px 8px rgba(15, 42, 74, 0.08);
	transition: box-shadow 0.4s ease, transform 0.4s ease;
}

.hhg-item-inner img,
.hhg-item-inner video.hhg-video-thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.5s ease;
}

/* Placeholder when a video has no retrievable thumbnail */
.hhg-thumb-fallback {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, var(--hhg-overlay) 0%, #1c4470 100%);
}

/* --- Play badge on video tiles (always visible) --- */
.hhg-play-badge {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 64px;
	height: 64px;
	margin: 0;
	transform: translate(-50%, -50%);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--hhg-accent);
	color: #fff;
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
	pointer-events: none;
	z-index: 3;
	transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.3s ease;
}

.hhg-play-badge svg {
	margin-left: 3px; /* optically centres the triangle */
	width: 45%;
	height: 45%;
}

.hhg-play-badge::after {
	content: '';
	position: absolute;
	inset: -8px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.5);
	opacity: 0;
	transition: opacity 0.35s ease, transform 0.35s ease;
}

.hhg-is-video .hhg-item-inner:hover .hhg-play-badge {
	transform: translate(-50%, -50%) scale(1.12);
}

.hhg-is-video .hhg-item-inner:hover .hhg-play-badge::after {
	opacity: 1;
	transform: scale(1.06);
}

.hhg-is-video .hhg-item-inner::before {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(15, 42, 74, 0.18);
	z-index: 2;
	transition: background-color 0.35s ease;
	pointer-events: none;
}

.hhg-is-video .hhg-item-inner:hover::before {
	background: rgba(15, 42, 74, 0.34);
}

/* --- Overlay (used by fade-info + zoom-lift for the zoom icon) --- */
.hhg-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	text-align: center;
	padding: 16px;
	color: #fff;
	background: linear-gradient(180deg, rgba(15,42,74,0) 40%, rgba(15,42,74,0.75) 100%);
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.4s ease, transform 0.4s ease;
	z-index: 4;
	pointer-events: none;
}

/* On video tiles the caption sits at the bottom so it never covers the play button */
.hhg-is-video .hhg-overlay {
	justify-content: flex-end;
}

.hhg-zoom-icon {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: var(--hhg-accent);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 16px rgba(0,0,0,0.25);
	transform: scale(0.85);
	transition: transform 0.4s ease;
}

.hhg-caption {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.2px;
}

/* --- Hover effect variants --- */

/* zoom-lift (recommended default) */
.hhg-hover-zoom-lift .hhg-item-inner:hover {
	transform: translateY(-6px);
	box-shadow: 0 18px 34px rgba(15, 42, 74, 0.22);
}
.hhg-hover-zoom-lift .hhg-item-inner:hover img,
.hhg-hover-zoom-lift .hhg-item-inner:hover video.hhg-video-thumb {
	transform: scale(1.08);
}

/* zoom only */
.hhg-hover-zoom .hhg-item-inner:hover img,
.hhg-hover-zoom .hhg-item-inner:hover video.hhg-video-thumb {
	transform: scale(1.1);
}

/* fade-info: darker overlay + caption emphasis, subtle zoom */
.hhg-hover-fade-info .hhg-item-inner:hover img,
.hhg-hover-fade-info .hhg-item-inner:hover video.hhg-video-thumb {
	transform: scale(1.05);
	filter: brightness(0.85);
}
.hhg-hover-fade-info .hhg-item-inner:hover .hhg-overlay {
	opacity: 1;
	transform: translateY(0);
	background: rgba(15,42,74,0.55);
}
.hhg-hover-fade-info .hhg-is-video .hhg-item-inner:hover .hhg-overlay {
	background: linear-gradient(180deg, rgba(15,42,74,0) 45%, rgba(15,42,74,0.8) 100%);
}
.hhg-hover-fade-info .hhg-item-inner:hover .hhg-zoom-icon {
	transform: scale(1);
}

.hhg-item-inner:focus-visible {
	outline: 3px solid var(--hhg-accent);
	outline-offset: 3px;
}

/* Touch devices have no hover — show the caption permanently instead */
@media (hover: none) {
	.hhg-hover-fade-info .hhg-overlay {
		opacity: 1;
		transform: none;
	}
}

/* --- Responsive grid --- */
@media (max-width: 900px) {
	.hhg-gallery-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (max-width: 600px) {
	.hhg-gallery-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.hhg-tabs {
		gap: 8px;
	}
	.hhg-tab {
		flex: 1 1 auto;
		padding: 12px 14px;
		font-size: 14px;
		min-height: 48px;
	}
	.hhg-tab-text {
		white-space: nowrap;
	}
	.hhg-play-badge {
		width: 54px;
		height: 54px;
	}
}
@media (max-width: 380px) {
	.hhg-tab {
		font-size: 13px;
		padding: 11px 10px;
		gap: 6px;
	}
	.hhg-tab-icon {
		display: none;
	}
}

/* ============================================================
   LIGHTBOX
   ============================================================ */

body.hhg-noscroll {
	overflow: hidden;
}

.hhg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(15, 42, 74, 0.96);
	opacity: 0;
	transition: opacity 0.35s ease;
}

.hhg-lightbox.hhg-active {
	display: flex;
	opacity: 1;
}

.hhg-lightbox-stage {
	position: relative;
	max-width: 90vw;
	max-height: 86vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	transform: scale(0.96);
	opacity: 0;
	transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s ease;
}

.hhg-lightbox.hhg-active .hhg-lightbox-stage {
	transform: scale(1);
	opacity: 1;
}

/* --- Image mode --- */
.hhg-lightbox-img {
	max-width: 90vw;
	max-height: 78vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.5);
	background: #0f2a4a;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.hhg-lightbox-img.hhg-loaded {
	opacity: 1;
}

.hhg-lightbox.hhg-mode-video .hhg-lightbox-img {
	display: none;
}

/* --- Video mode --- */
.hhg-lightbox-video {
	display: none;
	position: relative;
	width: min(90vw, 1100px);
	aspect-ratio: 16 / 9;
	max-height: 78vh;
	background: #000;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}

.hhg-lightbox-video.hhg-show {
	display: block;
}

.hhg-lightbox-video iframe,
.hhg-lightbox-video video.hhg-html5-video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	background: #000;
	object-fit: contain;
}

.hhg-lightbox-loader {
	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: var(--hhg-accent, #e0a020);
	border-radius: 50%;
	animation: hhg-spin 0.8s linear infinite;
	display: none;
}

.hhg-lightbox-loader.hhg-show {
	display: block;
}

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

.hhg-lightbox-caption {
	margin-top: 14px;
	color: #fff;
	font-family: 'Poppins', Arial, sans-serif;
	font-size: 15px;
	font-weight: 500;
	text-align: center;
	max-width: 80vw;
}

.hhg-lightbox-caption:empty {
	margin-top: 0;
}

.hhg-lightbox-close,
.hhg-lightbox-prev,
.hhg-lightbox-next {
	position: absolute;
	background: rgba(255,255,255,0.1);
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	z-index: 10;
	transition: background 0.25s ease, transform 0.25s ease;
}

.hhg-lightbox-close {
	top: 24px;
	right: 24px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	font-size: 26px;
	line-height: 1;
}

.hhg-lightbox-close:hover {
	background: var(--hhg-accent, #e0a020);
	transform: rotate(90deg);
}

.hhg-lightbox-prev,
.hhg-lightbox-next {
	top: 50%;
	transform: translateY(-50%);
	width: 52px;
	height: 52px;
	border-radius: 50%;
	font-size: 18px;
}

.hhg-lightbox-prev { left: 20px; }
.hhg-lightbox-next { right: 20px; }

.hhg-lightbox-prev:hover,
.hhg-lightbox-next:hover {
	background: var(--hhg-accent, #e0a020);
	transform: translateY(-50%) scale(1.08);
}

.hhg-lightbox-close:focus-visible,
.hhg-lightbox-prev:focus-visible,
.hhg-lightbox-next:focus-visible {
	outline: 3px solid var(--hhg-accent, #e0a020);
	outline-offset: 3px;
}

@media (max-width: 900px) {
	.hhg-lightbox-video {
		width: 92vw;
	}
}

@media (max-width: 600px) {
	.hhg-lightbox {
		padding: 12px;
	}
	.hhg-lightbox-prev, .hhg-lightbox-next {
		width: 40px;
		height: 40px;
		font-size: 14px;
	}
	.hhg-lightbox-prev { left: 8px; }
	.hhg-lightbox-next { right: 8px; }
	.hhg-lightbox-close {
		top: 14px;
		right: 14px;
	}
	.hhg-lightbox-stage {
		max-width: 96vw;
	}
	.hhg-lightbox-img {
		max-width: 96vw;
		max-height: 68vh;
	}
	.hhg-lightbox-video {
		width: 96vw;
		max-height: 60vh;
	}
	.hhg-lightbox-caption {
		font-size: 14px;
		max-width: 92vw;
	}
}
