/* Projects gallery: filterable cards + full-screen project viewer (projects.html) */
:root {
	--pg-accent: #F18A3A;
	--pg-accent-dark: #d9711f;
	--pg-ink: #263a4e;
	--pg-muted: #6b7380;
	--pg-line: #e7e9ee;
	--pg-bg: #f7f8fb;
	--pg-radius: 14px;
}

/* ---------- Section ---------- */
.pg-section {
	background: var(--pg-bg);
	padding: 90px 0 100px;
}

.pg-head {
	text-align: center;
	max-width: 640px;
	margin: 0 auto 36px;
}

.pg-eyebrow {
	font-family: "Roboto Condensed", sans-serif;
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--pg-accent);
	margin-bottom: 10px;
}

.pg-heading {
	font-size: clamp(28px, 4vw, 40px);
	margin-bottom: 14px;
}

.pg-sub {
	color: var(--pg-muted);
	margin: 0;
}

/* ---------- Filters ---------- */
.pg-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin-bottom: 36px;
}

.pg-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 18px;
	border: 1px solid var(--pg-line);
	border-radius: 999px;
	background: #fff;
	color: var(--pg-ink);
	font: 500 15px "Roboto", sans-serif;
	cursor: pointer;
	transition: border-color .2s, background-color .2s, color .2s, box-shadow .2s;
	white-space: nowrap;
}

.pg-chip:hover { border-color: var(--pg-accent); }

.pg-chip__n {
	display: inline-grid;
	place-items: center;
	min-width: 24px;
	height: 24px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--pg-bg);
	color: var(--pg-muted);
	font-size: 12px;
	font-weight: 700;
}

.pg-chip.is-active {
	background: var(--pg-accent);
	border-color: var(--pg-accent);
	color: #fff;
	box-shadow: 0 6px 16px rgba(241, 138, 58, .28);
}

.pg-chip.is-active .pg-chip__n {
	background: rgba(255, 255, 255, .25);
	color: #fff;
}

.pg-chip:focus-visible,
.pg-card__link:focus-visible,
.pg-btn:focus-visible {
	outline: 3px solid var(--pg-ink);
	outline-offset: 3px;
}

/* ---------- Grid & cards ---------- */
.pg-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 28px;
}

.pg-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: var(--pg-radius);
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(38, 58, 78, .06), 0 8px 24px rgba(38, 58, 78, .06);
	transition: transform .3s ease, box-shadow .3s ease;
}

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

.pg-card.is-entering { animation: pg-rise .45s ease both; }

@keyframes pg-rise {
	from { opacity: 0; transform: translateY(14px); }
}

.pg-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 2px 4px rgba(38, 58, 78, .06), 0 18px 40px rgba(38, 58, 78, .14);
}

/* The whole card is clickable via the media link */
.pg-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
}

.pg-card__media {
	position: relative;
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--pg-line);
}

.pg-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}

.pg-card:hover .pg-card__media img { transform: scale(1.05); }

.pg-card__badge,
.pg-card__cat {
	position: absolute;
	top: 14px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 28px;
	padding: 0 12px;
	border-radius: 999px;
	font: 700 12px "Roboto", sans-serif;
	letter-spacing: .02em;
}

.pg-card__badge {
	right: 14px;
	background: rgba(20, 28, 38, .65);
	color: #fff;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.pg-card__cat {
	left: 14px;
	background: #fff;
	color: var(--pg-ink);
}

.pg-card__body {
	padding: 20px 22px 24px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.pg-card__title {
	font-size: 21px;
	line-height: 1.2;
	transition: color .2s;
}

.pg-card:hover .pg-card__title { color: var(--pg-accent-dark); }

.pg-card__meta {
	margin: 0;
	color: var(--pg-muted);
	font-size: 14px;
	line-height: 1.4;
}

.pg-card__meta .fa { color: var(--pg-accent); margin-right: 4px; }

.pg-card__desc {
	margin: 0;
	color: #4a5260;
	font-size: 15px;
	line-height: 1.55;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pg-empty {
	text-align: center;
	color: var(--pg-muted);
	padding: 40px 0;
}

.pg-more {
	text-align: center;
	margin-top: 44px;
}

.pg-more__btn {
	background: #fff;
	min-height: 48px;
}

.pg-more__btn:hover { background: var(--pg-accent); color: #fff; }

/* Showcase images open the viewer too */
[data-pg-item] .showcase-image { cursor: zoom-in; }

/* ---------- Viewer (native <dialog>) ---------- */
html.pg-lock,
html.pg-lock body { overflow: hidden; }

.pg-viewer {
	width: 100vw;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: #10161d;
	color: #fff;
	font-family: "Roboto", sans-serif;
}

.pg-viewer::backdrop { background: rgba(16, 22, 29, .9); }

.pg-viewer[open] {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 360px;
	grid-template-rows: minmax(0, 1fr) auto;
	animation: pg-fade .25s ease;
}

@keyframes pg-fade { from { opacity: 0; } }

.pg-stage {
	position: relative;
	grid-row: 1;
	grid-column: 1;
	display: grid;
	place-items: center;
	padding: 24px 84px;
	min-height: 0;
	touch-action: pan-y;
	user-select: none;
	outline: none;
}

.pg-stage__img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 8px;
	transition: opacity .25s ease, transform .25s ease;
	-webkit-user-drag: none;
}

.pg-stage__img.is-loading { opacity: .15; transform: scale(.99); }

.pg-spinner {
	position: absolute;
	width: 38px;
	height: 38px;
	border: 3px solid rgba(255, 255, 255, .2);
	border-top-color: var(--pg-accent);
	border-radius: 50%;
	animation: pg-spin .8s linear infinite;
	opacity: 0;
	transition: opacity .2s;
	pointer-events: none;
}

.pg-stage.is-loading .pg-spinner { opacity: 1; }

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

.pg-btn {
	display: inline-grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .1);
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	transition: background-color .2s, transform .2s;
}

.pg-btn:hover { background: var(--pg-accent); }

.pg-btn:active { transform: scale(.94); }

.pg-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
}

.pg-nav:active { transform: translateY(-50%) scale(.94); }

.pg-nav--prev { left: 20px; }
.pg-nav--next { right: 20px; }

.pg-counter {
	position: absolute;
	left: 50%;
	bottom: 6px;
	transform: translateX(-50%);
	padding: 4px 12px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .45);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

/* Info panel */
.pg-panel {
	grid-row: 1 / span 2;
	grid-column: 2;
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 28px 28px 24px;
	background: #fff;
	color: var(--pg-ink);
	overflow-y: auto;
}

.pg-panel__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.pg-panel__pos {
	color: var(--pg-muted);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

.pg-close {
	background: var(--pg-bg);
	color: var(--pg-ink);
}

.pg-close:hover { color: #fff; }

.pg-panel__cat {
	align-self: flex-start;
	padding: 5px 12px;
	border-radius: 999px;
	background: rgba(241, 138, 58, .12);
	color: var(--pg-accent-dark);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .03em;
	text-transform: uppercase;
}

.pg-panel__title {
	font-size: 30px;
	line-height: 1.15;
	color: var(--pg-ink);
}

.pg-panel__facts {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 8px 14px;
	margin: 0;
	font-size: 15px;
}

.pg-panel__facts dt { color: var(--pg-muted); font-weight: 400; }
.pg-panel__facts dd { margin: 0; font-weight: 500; }

.pg-panel__desc {
	margin: 0;
	color: #4a5260;
	line-height: 1.6;
}

.pg-cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 50px;
	margin-top: auto;
	border-radius: 10px;
	background: #25D366;
	color: #fff !important;
	font-weight: 700;
	transition: background-color .2s;
}

.pg-cta:hover { background: #1ebe5a; }

.pg-cta .fa { font-size: 20px; }

.pg-projnav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.pg-projnav button {
	min-height: 44px;
	border: 1px solid var(--pg-line);
	border-radius: 10px;
	background: #fff;
	color: var(--pg-ink);
	font: 500 14px "Roboto", sans-serif;
	cursor: pointer;
	transition: border-color .2s, color .2s;
}

.pg-projnav button:hover { border-color: var(--pg-accent); color: var(--pg-accent-dark); }

/* Thumbnails */
.pg-thumbs {
	grid-row: 2;
	grid-column: 1;
	display: flex;
	gap: 8px;
	padding: 12px 20px 18px;
	overflow-x: auto;
	scrollbar-width: none;
	justify-content: safe center;
}

.pg-thumbs::-webkit-scrollbar { display: none; }

.pg-thumbs button {
	flex: 0 0 auto;
	width: 76px;
	height: 56px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 8px;
	overflow: hidden;
	background: none;
	cursor: pointer;
	opacity: .5;
	transition: opacity .2s, border-color .2s;
}

.pg-thumbs button:hover { opacity: .85; }

.pg-thumbs button[aria-current="true"] {
	opacity: 1;
	border-color: var(--pg-accent);
}

.pg-thumbs img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pg-viewer.is-single .pg-nav,
.pg-viewer.is-single .pg-counter,
.pg-viewer.is-single .pg-thumbs { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
	.pg-viewer[open] {
		grid-template-columns: 1fr;
		grid-template-rows: minmax(0, 1fr) auto auto;
	}

	.pg-stage { padding: 56px 12px 12px; }
	.pg-thumbs { grid-row: 2; padding: 4px 12px 12px; }

	.pg-panel {
		grid-row: 3;
		grid-column: 1;
		max-height: 42dvh;
		padding: 18px 18px 20px;
		gap: 12px;
		border-radius: 18px 18px 0 0;
	}

	.pg-panel__top {
		position: fixed;
		top: 10px;
		left: 12px;
		right: 12px;
		z-index: 3;
	}

	.pg-panel__pos {
		padding: 4px 12px;
		border-radius: 999px;
		background: rgba(0, 0, 0, .45);
		color: #fff;
	}

	.pg-close { background: rgba(255, 255, 255, .14); color: #fff; }

	.pg-panel__title { font-size: 22px; }
	.pg-nav { display: none; }
	.pg-cta { margin-top: 4px; }
}

@media (max-width: 575px) {
	.pg-section { padding: 60px 0 70px; }
	.pg-filters {
		flex-wrap: nowrap;
		justify-content: flex-start;
		overflow-x: auto;
		margin: 0 -15px 28px;
		padding: 2px 15px 6px;
		scrollbar-width: none;
	}
	.pg-filters::-webkit-scrollbar { display: none; }
	.pg-grid { grid-template-columns: 1fr; gap: 20px; }
	.pg-thumbs button { width: 60px; height: 46px; }
	.pg-panel__facts { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
	.pg-card,
	.pg-card__media img,
	.pg-stage__img { transition: none; }
	.pg-card.is-entering,
	.pg-viewer[open] { animation: none; }
}
