/*
 * Gallery section on the home and About pages — template-parts/gallery-section.php.
 * Two rows of photos drifting in opposite directions. Plain CSS: the theme
 * ships without node_modules, so Tailwind classes missing from the compiled
 * build would not render.
 */

.home-gallery {
	padding: 5rem 0;
	overflow: hidden;
}

@media (min-width: 768px) {
	.home-gallery {
		padding: 6rem 0;
	}
}

.home-gallery__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1.5rem;
	margin-bottom: 2.75rem;
}

.home-gallery__tag {
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
	color: #0891B2;
	font-size: 0.75rem;
	font-weight: 800;
	letter-spacing: 0.25em;
	text-transform: uppercase;
}

.home-gallery__tag::before {
	content: '';
	width: 2rem;
	height: 2px;
	border-radius: 2px;
	background: linear-gradient(90deg, #4F46E5, #06B6D4);
}

.home-gallery__title {
	margin: 0.9rem 0 0;
	color: #0F172A;
	font-size: 1.9rem;
	font-weight: 800;
	line-height: 1.15;
}

@media (min-width: 768px) {
	.home-gallery__title {
		font-size: 2.5rem;
	}
}

.home-gallery__desc {
	max-width: 34rem;
	margin: 0.9rem 0 0;
	color: #64748B;
	font-size: 1rem;
	line-height: 1.7;
}

.home-gallery__side {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.9rem;
}

.home-gallery__count {
	display: inline-flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.45rem 1rem 0.45rem 0.45rem;
	border: 1px solid #E2E8F0;
	border-radius: 9999px;
	background: #FFFFFF;
	color: #475569;
	font-size: 0.88rem;
}

.home-gallery__count .material-symbols-outlined {
	display: flex;
	width: 2.1rem;
	height: 2.1rem;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	background: linear-gradient(135deg, #4F46E5, #06B6D4);
	color: #FFFFFF;
	font-size: 1.1rem;
}

.home-gallery__count strong {
	color: #0F172A;
	font-weight: 800;
}

/* ----- Drifting rows ----- */

.home-gallery__rows {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	-webkit-mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
	mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
}

.home-gallery__row {
	overflow: hidden;
}

/*
 * The track holds its set three times; moving it by a third brings the second
 * copy exactly where the first began. Spacing is a margin on each item rather
 * than a flex gap, so that third is a whole number of items and gaps.
 */
.home-gallery__track {
	display: flex;
	width: max-content;
	animation: home-gallery-drift var(--dur, 45s) linear infinite;
}

.home-gallery__row--rev .home-gallery__track {
	animation-direction: reverse;
}

.home-gallery__rows:hover .home-gallery__track,
.home-gallery__rows:focus-within .home-gallery__track {
	animation-play-state: paused;
}

@keyframes home-gallery-drift {
	to {
		transform: translateX(calc(-100% / 3));
	}
}

.home-gallery__item {
	position: relative;
	display: block;
	height: 11rem;
	flex-shrink: 0;
	margin-right: 1rem;
	overflow: hidden;
	border-radius: 1.1rem;
	background: #E2E8F0;
	box-shadow: 0 16px 30px -22px rgb(15 23 42 / 0.5);
}

@media (min-width: 768px) {
	.home-gallery__item {
		height: 14rem;
		margin-right: 1.25rem;
	}
}

@media (min-width: 1280px) {
	.home-gallery__item {
		height: 16rem;
	}
}

.home-gallery__item img {
	display: block;
	width: auto;
	height: 100%;
	max-width: none;
	transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}

.home-gallery__item::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgb(15 23 42 / 0.55), rgb(15 23 42 / 0) 55%);
	opacity: 0;
	transition: opacity .35s ease;
}

.home-gallery__item:hover img,
.home-gallery__item:focus-visible img {
	transform: scale(1.07);
}

.home-gallery__item:hover::after,
.home-gallery__item:focus-visible::after {
	opacity: 1;
}

.home-gallery__zoom {
	position: absolute;
	right: 0.8rem;
	bottom: 0.8rem;
	z-index: 1;
	display: flex;
	width: 2.5rem;
	height: 2.5rem;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	background: #FFFFFF;
	color: #4F46E5;
	font-size: 1.35rem;
	opacity: 0;
	transform: scale(0.6) rotate(-45deg);
	transition: opacity .3s ease, transform .35s cubic-bezier(.3, 1.4, .5, 1);
}

.home-gallery__item:hover .home-gallery__zoom,
.home-gallery__item:focus-visible .home-gallery__zoom {
	opacity: 1;
	transform: none;
}

/* Reduced motion: no drift; each row scrolls by hand and shows its set once. */
@media (prefers-reduced-motion: reduce) {
	.home-gallery__track {
		animation: none;
	}

	.home-gallery__row {
		overflow-x: auto;
	}

	.home-gallery__item[aria-hidden="true"] {
		display: none;
	}

	.home-gallery__item img,
	.home-gallery__zoom {
		transition: none;
	}
}
