/*
 * Reversible section hide.
 *
 * A Nexus block carrying the `nexus-hidden-section` class in its block
 * attributes (`"className":"nexus-hidden-section"`) is removed from the
 * frontend on every device and for every user while its content stays intact
 * in post_content. Reverse by deleting that one attribute from the block.
 */
.nexus-hidden-section {
	display: none !important;
}

.nexus-photo-grid-block {
	padding: clamp(84px, 8vw, 118px) 0;
	border-top: 1px solid var(--nexus-rule-soft);
	border-bottom: 1px solid var(--nexus-rule-soft);
	color: var(--nexus-green-deep);
}

.nexus-photo-grid-block__header {
	max-width: 800px;
	margin: 0 auto clamp(42px, 5vw, 68px);
	text-align: center;
}

.nexus-photo-grid-block__eyebrow {
	margin: 0 0 20px;
	color: var(--nexus-orange-deep);
	font-family: var(--nexus-font-body);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.28em;
	line-height: 1.3;
	text-transform: uppercase;
}

.nexus-photo-grid-block__title {
	margin: 0;
	color: var(--nexus-green-deep);
	font-family: var(--nexus-font-display);
	font-size: clamp(38px, 4.7vw, 60px);
	font-weight: 800;
	letter-spacing: -0.03em;
	line-height: 1.03;
}

.nexus-photo-grid-block__title em {
	display: inline;
	color: var(--nexus-green);
	font-family: var(--nexus-font-serif);
	font-size: 0.92em;
	font-style: italic;
	font-weight: 500;
	letter-spacing: 0;
}

.nexus-photo-grid-block__description {
	max-width: 700px;
	margin: 24px auto 0;
	color: var(--nexus-muted);
	font-size: 18px;
	font-weight: 500;
	line-height: 1.65;
}

.nexus-photo-grid-block__description > * {
	margin: 0;
}

.nexus-photo-grid-block__description > * + * {
	margin-top: 12px;
}

.nexus-photo-grid-block__cards {
	display: grid;
	gap: clamp(16px, 2vw, 24px);
	grid-template-columns: repeat(var(--nexus-photo-grid-columns, 3), minmax(0, 1fr));
}

.nexus-photo-grid-block__card {
	position: relative;
	overflow: hidden;
	min-height: clamp(300px, calc(1320px / var(--nexus-photo-grid-columns, 3)), 466px);
	margin: 0;
	border-radius: var(--nexus-radius-lg);
	background: var(--nexus-green-soft);
	box-shadow: 0 30px 60px -30px rgba(8, 32, 24, 0.32);
	isolation: isolate;
}

.nexus-photo-grid-block__card-inner {
	position: relative;
	display: block;
	min-height: inherit;
	color: inherit;
	text-decoration: none;
}

.nexus-photo-grid-block__card-inner::after {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 42%, rgba(15, 53, 40, 0.86) 100%);
	content: "";
	pointer-events: none;
}

.nexus-photo-grid-block__image,
.nexus-photo-grid-block__image-placeholder {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.nexus-photo-grid-block__image {
	object-fit: cover;
	transition: transform 0.6s ease;
}

.nexus-photo-grid-block__image-placeholder {
	background:
		linear-gradient(135deg, rgba(15, 53, 40, 0.1), rgba(30, 83, 64, 0.28)),
		var(--nexus-green-soft);
}

.nexus-photo-grid-block__caption {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2;
	padding: clamp(22px, 3vw, 28px);
	color: var(--nexus-white);
}

.nexus-photo-grid-block__card-kicker {
	display: block;
	margin-bottom: 8px;
	color: var(--nexus-white);
	font-family: var(--nexus-font-display);
    font-weight: 700;
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: -0.015em;
    max-width: 22ch;
}

.nexus-photo-grid-block__card-title {
	font-family: 'Mulish', sans-serif;
    font-weight: 800;
    font-size: 10.5px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--nexus-mint);
    margin-bottom: 6px;
	text-transform: uppercase;

}

.nexus-photo-grid-block__card-inner:hover .nexus-photo-grid-block__image,
.nexus-photo-grid-block__card-inner:focus-visible .nexus-photo-grid-block__image {
	transform: scale(1.04);
}

.nexus-photo-grid-block__card-inner:focus-visible {
	outline: 3px solid var(--nexus-orange);
	outline-offset: -6px;
}

@media (max-width: 960px) {
	.nexus-photo-grid-block {
		padding: 82px 0;
	}

	.nexus-photo-grid-block__cards {
		grid-template-columns: repeat(var(--nexus-photo-grid-tablet-columns, 2), minmax(0, 1fr));
	}

	.nexus-photo-grid-block__card {
		min-height: 390px;
	}
}

/* ── Photo Gallery mode — CSS columns masonry ───────────────────────────── */

.nexus-photo-grid-block__gallery {
	display: block;
	column-count: var(--nexus-gallery-columns, 3);
	column-gap: clamp(10px, 1.4vw, 16px);
}

.nexus-gallery-masonry-item {
	break-inside: avoid;
	margin-bottom: clamp(10px, 1.4vw, 16px);
	border-radius: var(--nexus-radius-lg);
	overflow: hidden;
	box-shadow: 0 18px 36px -22px rgba(8, 32, 24, 0.28);
	transition: transform 0.35s ease;
}

.nexus-gallery-masonry-item:hover {
	transform: scale(1.02);
}

.nexus-photo-grid-block__gallery-img {
	display: block;
	width: 100%;
	height: auto;
	max-height: clamp(280px, 38vw, 460px);
	object-fit: cover;
	object-position: center;
}

/* Animate mode — masonry columns (same as non-animate); flip cards use
   natural image height so varied-size layout is preserved. */
.nexus-photo-grid-block__gallery--animate {
	display: block;
	column-count: var(--nexus-gallery-columns, 3);
	column-gap: clamp(10px, 1.4vw, 16px);
}

.nexus-gallery-item {
	position: relative;
	break-inside: avoid;
	margin-bottom: clamp(10px, 1.4vw, 16px);
	border-radius: var(--nexus-radius-lg);
	overflow: hidden;
	background: var(--nexus-green-soft);
	perspective: 1000px;
	box-shadow: 0 18px 36px -22px rgba(8, 32, 24, 0.28);
}

.nexus-gallery-flip {
	position: relative;
	width: 100%;
	transform-style: preserve-3d;
	/* Keep in sync with FLIP_MS in gallery-animate.js. */
	transition: transform 0.7s ease-in-out;
}

.nexus-gallery-flip.is-flipped {
	transform: rotateY(180deg);
}

/* Front face is in normal flow — its image height drives the card height. */
.nexus-gallery-flip__front {
	position: relative;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

.nexus-gallery-flip__front img {
	display: block;
	width: 100%;
	height: auto;
	max-height: clamp(280px, 38vw, 460px);
	object-fit: cover;
	object-position: center;
}

/* Back face overlays the front absolutely so it matches the card size. */
.nexus-gallery-flip__back {
	position: absolute;
	inset: 0;
	transform: rotateY(180deg);
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

.nexus-gallery-flip__back img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

@media (max-width: 960px) {
	.nexus-photo-grid-block__gallery,
	.nexus-photo-grid-block__gallery--animate {
		column-count: 2;
	}
}

@media (max-width: 560px) {
	.nexus-photo-grid-block__gallery,
	.nexus-photo-grid-block__gallery--animate {
		column-count: 1;
	}
}

/* ─────────────────────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
	.nexus-photo-grid-block {
		padding: 72px 0;
	}

	.nexus-photo-grid-block__header {
		margin-bottom: 34px;
	}

	.nexus-photo-grid-block__title {
		font-size: 40px;
	}

	.nexus-photo-grid-block__description {
		font-size: 17px;
	}

	.nexus-photo-grid-block__cards {
		grid-template-columns: 1fr;
	}

	.nexus-photo-grid-block__card {
		min-height: 360px;
	}
}
