.pg-projects-section {
	--pg-accent: #1fa87e;
	max-width: 1200px;
	margin: 0 auto;
	padding: 40px 20px;
	text-align: center;
	font-family: inherit;
}

/* ===== Category page (the auto-created "View All" Page) ===== */
.pg-category-page {
	padding-top: 10px;
	padding-bottom: 40px;
}

/* ===== Groups (one per tab, only one visible at a time) ===== */
.pg-projects-group { width: 100%; }

.pg-view-all-wrap {
	text-align: center;
	margin-top: 30px;
}

.pg-view-all-btn {
	display: inline-block;
	background: var(--pg-viewall-color, var(--pg-accent));
	color: #fff;
	font-weight: 700;
	font-size: 14px;
	letter-spacing: .5px;
	text-decoration: none;
	padding: 12px 34px;
	border-radius: 30px;
	transition: opacity .2s ease, transform .2s ease;
}

.pg-view-all-btn:hover {
	opacity: .9;
	transform: translateY(-2px);
	color: #fff;
}

/* ===== Filter Tabs ===== */
.pg-filter-tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	width: 100%;
	max-width: 100%;
	overflow: visible;
	gap: 30px;
	margin-bottom: 40px;
	border-bottom: 1px solid #e5e5e5;
	padding-bottom: 10px;
	box-sizing: border-box;
}

.pg-tab {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 17px;
	font-weight: 600;
	color: #666;
	padding: 6px 4px;
	position: relative;
	transition: color .2s ease;
	flex: 0 0 auto;
	white-space: nowrap;
}

.pg-tab:hover { color: var(--pg-accent); }
.pg-tab.active { color: var(--pg-accent); }

.pg-tab.active::after {
	content: '';
	position: absolute;
	bottom: -11px;
	left: 0;
	right: 0;
	height: 2px;
	background: var(--pg-accent);
	border-radius: 2px;
}

/* ===== Masonry Grid (2 columns, variable height, JS assigns row-span) ===== */
.pg-projects-grid {
	display: grid;
	grid-template-columns: repeat(var(--pg-columns, 2), 1fr);
	grid-auto-rows: 8px;
	gap: 20px;
	text-align: right;
	opacity: 0;
	transition: opacity .25s ease;
}

/* JS adds this once row-spans are actually computed (images loaded), so
   the grid only appears in its final "professional" layout — no flash of
   unsized/overlapping cards, and this looks identical whether it's the
   initial "All" tab or a group just revealed by clicking a filter. */
.pg-projects-grid.pg-ready {
	opacity: 1;
}

@media (max-width: 600px) {
	.pg-projects-grid { grid-template-columns: 1fr; }

	.pg-filter-tabs {
		gap: 14px 20px;
		margin-bottom: 26px;
	}

	.pg-tab {
		font-size: 15px;
		padding: 4px 2px;
	}
}

/* ===== Card ===== */
.pg-project-card {
	border-radius: 14px;
	overflow: hidden;
	cursor: pointer;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0,0,0,.08);
	transition: transform .25s ease, box-shadow .25s ease;
	align-self: start;
}

.pg-project-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 26px rgba(0,0,0,.16);
}

.pg-project-thumb {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #ececec;
	line-height: 0;
}

/* Blurred backdrop made from the same image, so there is never an empty
   grey bar — while the real photo on top is never cropped. */
.pg-project-thumb::before {
	content: '';
	position: absolute;
	inset: -12%;
	background-image: var(--pg-thumb-bg);
	background-size: cover;
	background-position: center;
	filter: blur(22px) brightness(0.85);
	transform: scale(1.1);
	z-index: 0;
}

/* Fixed rhythm: within every block of 8 cards, the 1st and 8th are the
   "small" box (548x450), the 6 in between are the "large" box (548x600).
   This repeats automatically for as many cards as there are (e.g. on a
   category's full "View All" page). */
.pg-projects-grid .pg-project-card .pg-project-thumb { aspect-ratio: 548 / 600; }

.pg-projects-grid .pg-project-card:nth-child(8n+1) .pg-project-thumb,
.pg-projects-grid .pg-project-card:nth-child(8n) .pg-project-thumb {
	aspect-ratio: 548 / 450;
}

.pg-project-thumb img {
	position: relative;
	z-index: 1;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform .35s ease;
}

.pg-project-card:hover .pg-project-thumb img {
	transform: scale(1.03);
}

/* Solid color label bar under the image */
.pg-project-label {
	background: var(--pg-label-color, var(--pg-accent));
	color: #fff;
	font-weight: 700;
	font-size: 15px;
	text-align: center;
	padding: 14px 10px;
	letter-spacing: .3px;
}

/* Play icon (shown when the album has video/youtube content) */
.pg-play-icon {
	position: absolute;
	top: 12px;
	left: 12px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(0,0,0,.55);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	backdrop-filter: blur(2px);
}

/* Media count badge */
.pg-count-badge {
	position: absolute;
	top: 12px;
	right: 12px;
	background: rgba(0,0,0,.6);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	min-width: 22px;
	height: 22px;
	border-radius: 11px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 6px;
}

/* ===== Lightbox Modal ===== */
.pg-modal {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.92);
	z-index: 99999;
	align-items: center;
	justify-content: center;
}

.pg-modal.open { display: flex; }

.pg-modal-content {
	max-width: 88vw;
	max-height: 88vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pg-modal-content img,
.pg-modal-content video {
	max-width: 88vw;
	max-height: 88vh;
	border-radius: 8px;
}

.pg-modal-content iframe {
	width: min(88vw, 960px);
	height: min(60vw, 540px);
	border: 0;
	border-radius: 8px;
}

.pg-modal-empty {
	color: #fff;
	font-size: 16px;
}

.pg-modal-close {
	position: absolute;
	top: 20px;
	right: 30px;
	font-size: 34px;
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	line-height: 1;
	z-index: 2;
}

.pg-modal-prev,
.pg-modal-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255,255,255,.15);
	border: none;
	color: #fff;
	font-size: 20px;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	cursor: pointer;
	z-index: 2;
}

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

/* ===== Admin Gallery Manager thumbnails ===== */
.pg-thumb-icon {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: #f0f0f1;
	color: #666;
	font-size: 12px;
}

.pg-thumb-icon .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
	margin-bottom: 4px;
}
