/*
 * Hydro Shield — homepage Work Gallery section. NEW (split from the old
 * combined Customer Proof section, see gallery.php's header comment).
 * Grey-dark background — a tonal break from Why Hydro Shield's own
 * grey-dark right above it is not needed here since Why already uses
 * grey-dark; this section instead uses graphite so the rhythm reads
 * graphite(Hero)/graphite(Reviews)/graphite(Products)/grey-dark(Why)/
 * graphite(Gallery)/grey-dark(Contact) — alternating at every step.
 */

.hs-gallery {
	background: var(--hs-color-bg);
	padding-top: var(--hs-space-6);
	padding-bottom: var(--hs-space-6);
}

.hs-gallery__inner {
	max-width: 1360px;
	margin: 0 auto;
	padding: 0 var(--hs-space-4);
}

.hs-gallery__top {
	max-width: 640px;
	margin: 0 0 var(--hs-space-5);
}

.hs-gallery__heading {
	margin: 0 0 var(--hs-space-3);
	font-size: clamp(1.9rem, 3.4vw, 2.6rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.005em;
	text-transform: uppercase;
	color: var(--hs-color-text);
}

.hs-gallery__note {
	margin: 0;
	font-size: 0.86rem;
	line-height: 1.55;
	font-style: italic;
	color: var(--hs-color-grey-mid);
}

/* Controlled asymmetric bento grid — 2 large anchor tiles + many small
   ones, deliberately denser than a 5-tile grid ("lots of small photos"
   direct request) but still not a uniform square dump. 7-column base grid
   (direct follow-up: an 8-column grid doesn't divide evenly against this
   item mix — every row is large(span 3) + small(span 2) + small(span 2) =
   7, so the leftover 8th column sat empty as a tall dead gap down the
   right edge. 7 columns lets that exact pattern fill the row completely). */

.hs-gallery__grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	grid-auto-rows: 90px;
	grid-auto-flow: dense;
	gap: var(--hs-space-2);
}

.hs-gallery__item {
	margin: 0;
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	background: var(--hs-color-surface);
	/* Tiles are real <button>s now (2026-09-22, lightbox rework) — reset
	   the native button chrome so they still read as plain photo tiles. */
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	cursor: pointer;
	appearance: none;
	font: inherit;
}

.hs-gallery__item:focus-visible {
	outline: 2px solid var(--hs-color-accent);
	outline-offset: 2px;
}

/* Play-icon badge for video tiles — small, bottom-left, so it reads as
   "this one plays" without covering the poster frame's own content. */
.hs-gallery__play {
	position: absolute;
	left: 8px;
	bottom: 8px;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(15, 15, 17, 0.72);
	color: var(--hs-color-off-white);
	backdrop-filter: blur(4px);
	pointer-events: none;
}

.hs-gallery__play svg {
	margin-left: 2px; /* optically center the play triangle */
}

.hs-gallery__item img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s var(--hs-ease-standard);
}

.hs-gallery__item:hover img,
.hs-gallery__item:focus-within img {
	transform: scale(1.06);
}

.hs-gallery__item--large {
	grid-column: span 3;
	grid-row: span 3;
}

.hs-gallery__item--small {
	grid-column: span 2;
	grid-row: span 2;
}

/* ================= Responsive ================= */

@media (max-width: 899.98px) {
	.hs-gallery {
		padding-top: var(--hs-space-5);
		padding-bottom: var(--hs-space-5);
	}

	.hs-gallery__grid {
		grid-template-columns: repeat(4, 1fr);
		grid-auto-rows: 80px;
	}

	.hs-gallery__item--large {
		grid-column: span 4;
		grid-row: span 3;
	}

	.hs-gallery__item--small {
		grid-column: span 2;
		grid-row: span 2;
	}
}

@media (max-width: 639.98px) {
	.hs-gallery__grid {
		grid-template-columns: repeat(2, 1fr);
		grid-auto-rows: 100px;
	}

	.hs-gallery__item--large {
		grid-column: span 2;
		grid-row: span 2;
	}

	.hs-gallery__item--small {
		grid-column: span 1;
		grid-row: span 1;
	}
}

/* ================= Lightbox ================= */
/* Fullscreen viewer (2026-09-22, direct request — "click karnay par
   specific section ko wo bara ho jaye, okay as screen") — hidden by
   default, [data-hs-gallery-lightbox].is-open (gallery.js) fades it in.
   Plain opacity/display toggle, no GSAP — this is a utility overlay, not
   a decorative animation. */

.hs-gallery__lightbox {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--hs-duration-base) var(--hs-ease-standard);
}

.hs-gallery__lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.hs-gallery__lightbox-scrim {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 11, 0.94);
}

.hs-gallery__lightbox-media {
	position: relative;
	z-index: 1;
	max-width: min(92vw, 1100px);
	max-height: 78vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hs-gallery__lightbox-media img,
.hs-gallery__lightbox-media video {
	max-width: 100%;
	max-height: 78vh;
	width: auto;
	height: auto;
	border-radius: 4px;
	box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
}

.hs-gallery__lightbox-caption {
	position: relative;
	z-index: 1;
	max-width: 720px;
	margin: var(--hs-space-3) var(--hs-space-4) 0;
	padding: 0;
	text-align: center;
	font-size: 0.82rem;
	color: rgba(240, 240, 232, 0.7);
}

.hs-gallery__lightbox-close,
.hs-gallery__lightbox-nav {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	appearance: none;
	border: 1px solid rgba(240, 240, 232, 0.3);
	border-radius: 50%;
	background: rgba(26, 26, 29, 0.6);
	color: var(--hs-color-off-white);
	cursor: pointer;
	transition: background var(--hs-duration-fast) var(--hs-ease-standard), border-color var(--hs-duration-fast) var(--hs-ease-standard);
}

.hs-gallery__lightbox-close:hover,
.hs-gallery__lightbox-close:focus-visible,
.hs-gallery__lightbox-nav:hover,
.hs-gallery__lightbox-nav:focus-visible {
	background: rgba(26, 26, 29, 0.9);
	border-color: var(--hs-color-off-white);
}

.hs-gallery__lightbox-close:focus-visible,
.hs-gallery__lightbox-nav:focus-visible {
	outline: 2px solid var(--hs-color-accent);
	outline-offset: 2px;
}

.hs-gallery__lightbox-close {
	top: var(--hs-space-4);
	right: var(--hs-space-4);
	width: 42px;
	height: 42px;
}

.hs-gallery__lightbox-nav {
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
}

.hs-gallery__lightbox-nav--prev {
	left: var(--hs-space-4);
}

.hs-gallery__lightbox-nav--next {
	right: var(--hs-space-4);
}

@media (max-width: 639.98px) {
	.hs-gallery__lightbox-close {
		top: var(--hs-space-3);
		right: var(--hs-space-3);
		width: 38px;
		height: 38px;
	}

	.hs-gallery__lightbox-nav {
		width: 40px;
		height: 40px;
	}

	.hs-gallery__lightbox-nav--prev {
		left: var(--hs-space-2);
	}

	.hs-gallery__lightbox-nav--next {
		right: var(--hs-space-2);
	}

	.hs-gallery__lightbox-caption {
		font-size: 0.76rem;
		margin-left: var(--hs-space-3);
		margin-right: var(--hs-space-3);
	}
}

/* ================= Reduced motion ================= */

@media (prefers-reduced-motion: reduce) {
	.hs-gallery__item img {
		transition: none;
	}

	.hs-gallery__lightbox {
		transition: none;
	}
}
