/**
 * Standards FM — "Our Projects" page.
 *
 * Loaded only on the page using the Projects template. The inner hero itself
 * is styled by page-hero.css; this file owns the filter bar and the projects
 * grid that sit below it.
 */

.filter-wrap,
.projects-section {
	--pp-green: var(--sfm-green, #01a44c);
	--pp-green-dark: #008f43;
	--pp-navy: var(--sfm-navy, #001357);
	--pp-active-navy: #3e5683;
	--pp-ink: var(--sfm-ink, #1c1c1e);
	--pp-muted: var(--sfm-muted, #6b7191);
}

/* Filter bar — seven tabs that overlap the bottom of the hero. */
.filter-wrap {
	width: min(var(--sfm-container), 100% - 48px);
	margin: -74px auto 0;
	position: relative;
	z-index: 3;
}

.project-filters {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 9px;
	align-items: stretch;
}

.filter-btn {
	min-height: 74px;
	border: 0;
	border-radius: 10px 10px 0 0;
	padding: 15px 12px;
	background: var(--pp-green);
	color: #fff;
	font-family: inherit;
	font-size: var(--sfm-text-sm);
	line-height: 1.35;
	font-weight: var(--sfm-weight-bold);
	cursor: pointer;
	transition: background 0.22s ease, box-shadow 0.22s ease;
}

.filter-btn:hover {
	background: var(--pp-green-dark);
}

.filter-btn__label {
	display: inline-block;
	transition: transform 0.18s ease;
}

.filter-btn:hover .filter-btn__label,
.filter-btn:focus-visible .filter-btn__label {
	transform: scale(1.06);
}

.filter-btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: -6px;
}

.filter-btn[aria-pressed="true"] {
	background: var(--pp-active-navy);
	box-shadow: none;
}

/* Mobile filter dropdown trigger — hidden on desktop and tablet. */
.filter-trigger {
	display: none;
}

/* Projects grid */
.projects-section {
	padding: 74px 24px 100px;
	background: #fff;
	min-height: 420px;
}

.projects-inner {
	width: min(var(--sfm-container), 100%);
	margin: 0 auto;
}

.section-heading {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 28px;
}

.section-heading h2 {
	margin: 0;
	color: var(--pp-ink);
	font-size: clamp(24px, 2.4vw, 34px);
	font-weight: var(--sfm-weight-bold);
	letter-spacing: -0.025em;
}

.section-heading p {
	margin: 8px 0 0;
	color: var(--pp-muted);
	font-size: var(--sfm-text-sm);
}

.project-count {
	color: var(--pp-muted);
	font-size: 13px;
	white-space: nowrap;
}

.project-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px;
}

.project-card {
	overflow: hidden;
	background: #fff;
	border-radius: 9px;
	border: 1px solid #edf0f3;
	box-shadow: 0 5px 20px rgba(16, 24, 40, 0.055);
	transition: transform 0.3s ease, border-color 0.3s ease;
	animation: sfm-card-in 0.35s ease both;
}

.project-card[hidden] {
	display: none;
}

.project-card:hover {
	transform: translateY(-4px);
	border-color: rgba(1, 164, 76, 0.5);
}

.project-image {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	aspect-ratio: 1.22 / 1;
	overflow: hidden;
	background: linear-gradient(135deg, #eef2f7, #e2e8f0);
	cursor: pointer;
}

.project-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.project-card:hover .project-image img {
	transform: scale(1.055);
}

.project-zoom {
	position: absolute;
	top: 50%;
	left: 50%;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	color: #fff;
	background: rgba(1, 164, 76, 0.92);
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.8);
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.project-zoom svg {
	width: 22px;
	height: 22px;
}

.project-card:hover .project-zoom {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

.project-photos {
	position: absolute;
	top: 12px;
	right: 12px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 9px;
	border-radius: 999px;
	color: #fff;
	background: rgba(6, 10, 24, 0.6);
	font-size: 11px;
	font-weight: var(--sfm-weight-bold);
	line-height: 1;
}

.project-photos svg {
	width: 14px;
	height: 14px;
}

.project-image:focus-visible {
	outline: 3px solid var(--pp-green);
	outline-offset: -3px;
}

.project-info {
	padding: 17px 17px 19px;
}

.project-info h3 {
	position: relative;
	margin: 0 0 7px;
	font-size: 17px;
	font-weight: var(--sfm-weight-bold);
	color: var(--pp-ink);
	transition: color 0.3s ease;
}

.project-info h3::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -3px;
	width: 0;
	height: 2px;
	border-radius: 2px;
	background: var(--pp-green);
	transition: width 0.3s ease;
}

.project-card:hover .project-info h3 {
	color: var(--pp-green-dark);
}

.project-card:hover .project-info h3::after {
	width: 34px;
}

.project-year {
	display: block;
	margin: 2px 0 10px;
	color: var(--pp-muted);
	font-size: 12px;
	line-height: 1.3;
	font-weight: var(--sfm-weight-medium);
}

.project-info p {
	margin: 0;
	font-size: 13px;
	line-height: 1.6;
	color: #747d8d;
}

.project-link {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-top: 16px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--pp-green-dark);
	font-family: inherit;
	font-size: var(--sfm-text-xs);
	font-weight: var(--sfm-weight-bold);
	text-decoration: none;
	cursor: pointer;
}

.project-link span {
	transition: transform 0.2s ease;
}

.project-link:hover span {
	transform: translateX(4px);
}

.empty-state {
	text-align: center;
	padding: 70px 20px;
	color: var(--pp-muted);
	border: 1px dashed #d9dee6;
	border-radius: 10px;
}

.empty-state[hidden] {
	display: none;
}

.empty-state strong {
	display: block;
	color: var(--pp-ink);
	font-size: var(--sfm-text-lg);
	margin-bottom: 8px;
}

@keyframes sfm-card-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Medium band (721–1199): keep all seven tabs on a single row and shrink the
   type so they fit — instead of wrapping the bar onto extra rows (which hung
   below the hero) or scrolling it. */
@media (min-width: 721px) and (max-width: 1199px) {
	.project-filters {
		gap: 8px;
	}

	.filter-btn {
		padding: 12px 6px;
		font-size: clamp(10px, 1.25vw, 14px);
		line-height: 1.3;
	}
}

@media (max-width: 1050px) {
	.project-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 720px) {
	.filter-wrap {
		width: calc(100% - 28px);
		margin-top: -28px;
	}

	.filter-trigger {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		width: 100%;
		border: 0;
		border-radius: 12px;
		padding: 11px 15px;
		background: var(--pp-green);
		color: #fff;
		font-family: inherit;
		text-align: left;
		cursor: pointer;
		box-shadow: 0 10px 24px rgba(7, 40, 24, 0.24);
		transition: background 0.22s ease;
	}

	.filter-trigger:hover {
		background: var(--pp-green-dark);
	}

	.filter-trigger:focus-visible {
		outline: 3px solid #fff;
		outline-offset: -4px;
	}

	.filter-trigger__meta {
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	.filter-trigger__cap {
		font-size: 10px;
		font-weight: var(--sfm-weight-bold);
		letter-spacing: 0.12em;
		text-transform: uppercase;
		opacity: 0.8;
	}

	.filter-trigger__current {
		font-size: var(--sfm-text-sm);
		font-weight: var(--sfm-weight-bold);
		line-height: 1.25;
	}

	.filter-trigger__chev {
		flex: 0 0 auto;
		width: 0;
		height: 0;
		border-left: 5px solid transparent;
		border-right: 5px solid transparent;
		border-top: 6px solid currentColor;
		transition: transform 0.18s ease;
	}

	.filter-trigger[aria-expanded="true"] .filter-trigger__chev {
		transform: rotate(180deg);
	}

	.project-filters {
		position: absolute;
		top: calc(100% + 10px);
		left: 0;
		right: 0;
		display: none;
		background: #fff;
		border-radius: 14px;
		overflow: hidden;
		box-shadow: 0 20px 46px rgba(6, 16, 50, 0.26);
		z-index: 6;
	}

	.project-filters.is-open {
		display: block;
	}

	.filter-btn {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		width: 100%;
		min-height: 0;
		border-radius: 0;
		padding: 13px 16px;
		background: #fff;
		color: var(--pp-ink);
		font-size: 13px;
		font-weight: var(--sfm-weight-bold);
		line-height: 1.35;
		text-align: left;
		box-shadow: none;
		border-top: 1px solid #eef1f6;
	}

	.filter-btn:first-child {
		border-top: 0;
	}

	.filter-btn:hover {
		background: #f5faf7;
	}

	.filter-btn[aria-pressed="true"] {
		background: var(--pp-active-navy);
		color: #fff;
		box-shadow: none;
	}

	.filter-btn[aria-pressed="true"]::after {
		content: "\2713";
		color: #fff;
		font-weight: var(--sfm-weight-bold);
	}

	.filter-btn__label br {
		display: none;
	}

	.projects-section {
		padding: 30px 18px 50px;
	}

	.section-heading {
		align-items: flex-start;
		flex-direction: column;
		gap: 10px;
	}

	.project-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 14px;
	}

	.project-info {
		padding: 13px;
	}

	.project-info h3 {
		font-size: var(--sfm-text-sm);
	}

	.project-info p {
		font-size: var(--sfm-text-xs);
	}

}

@media (max-width: 420px) {
	.project-grid {
		grid-template-columns: 1fr;
	}

	.project-image {
		aspect-ratio: 1.5 / 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.project-card,
	.filter-btn,
	.filter-btn__label,
	.project-image img,
	.project-zoom,
	.project-link span,
	.project-info h3,
	.project-info h3::after,
	.sfm-lightbox,
	.sfm-lightbox__figure {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}

	.filter-btn:hover .filter-btn__label,
	.filter-btn:focus-visible .filter-btn__label {
		transform: none;
	}
}

/* Image lightbox */
.sfm-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(8px, 3vw, 40px);
	padding: 5vh 4vw;
	background: rgba(6, 10, 24, 0.92);
	opacity: 0;
	transition: opacity 0.22s ease;
}

.sfm-lightbox[hidden] {
	display: none;
}

.sfm-lightbox.is-open {
	opacity: 1;
}

.sfm-lightbox__figure {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	max-width: min(1100px, 100%);
	max-height: 100%;
	margin: 0;
	transform: scale(0.97);
	transition: transform 0.22s ease;
}

.sfm-lightbox__figure.is-loading::after {
	position: absolute;
	top: calc(50% - 22px);
	left: calc(50% - 22px);
	width: 44px;
	height: 44px;
	border: 3px solid rgba(255, 255, 255, 0.28);
	border-top-color: #fff;
	border-radius: 50%;
	content: "";
	animation: sfm-lightbox-spin 0.8s linear infinite;
	pointer-events: none;
}

.sfm-lightbox__img.is-loading {
	visibility: hidden;
}

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

.sfm-lightbox.is-open .sfm-lightbox__figure {
	transform: scale(1);
}

.sfm-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: 78vh;
	border-radius: 8px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.sfm-lightbox__caption {
	color: #fff;
	font-size: var(--sfm-text-md);
	font-weight: var(--sfm-weight-bold);
	letter-spacing: 0.01em;
	text-align: center;
}

.sfm-lightbox__caption[hidden] {
	display: none;
}

.sfm-lightbox__nav,
.sfm-lightbox__close {
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	flex: 0 0 auto;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease;
}

.sfm-lightbox__nav:hover,
.sfm-lightbox__close:hover {
	background: var(--pp-green);
}

.sfm-lightbox__nav:focus-visible,
.sfm-lightbox__close:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.sfm-lightbox__nav svg,
.sfm-lightbox__close svg {
	width: 24px;
	height: 24px;
}

.sfm-lightbox__nav[hidden] {
	display: none;
}

.sfm-lightbox__close {
	position: absolute;
	top: clamp(12px, 3vw, 26px);
	right: clamp(12px, 3vw, 26px);
}

.sfm-lightbox__counter {
	position: absolute;
	bottom: clamp(12px, 3vh, 26px);
	left: 50%;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, 0.75);
	font-size: 13px;
	letter-spacing: 0.06em;
}

.sfm-lightbox__counter[hidden] {
	display: none;
}

body.sfm-lightbox-open {
	overflow: hidden;
}

@media (max-width: 560px) {
	.sfm-lightbox {
		gap: 0;
		padding: 4vh 12px;
	}

	.sfm-lightbox__nav {
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
		width: 40px;
		height: 40px;
		background: rgba(6, 10, 24, 0.6);
	}

	.sfm-lightbox__nav--prev {
		left: 8px;
	}

	.sfm-lightbox__nav--next {
		right: 8px;
	}

	.sfm-lightbox__img {
		max-height: 72vh;
	}
}
