/* ==========================================================================
   Portfolio Grid — front-end styles
   ========================================================================== */

/* Always-on outer container: 80% width, centered, 10% margin each side.
   Hardcoded with !important so no theme rule or stale cached CSS can
   override it — applies to the grid AND to status/error messages. */
.pg-container {
	width: 80% !important;
	max-width: 80% !important;
	margin-left: auto !important;
	margin-right: auto !important;
	box-sizing: border-box !important;
}

.pg-grid-wrap {
	--pg-columns: 3;
	--pg-gap: 16px;
	--pg-hover-zoom: 1;
	position: relative;
	box-sizing: border-box;
}

.pg-grid {
	display: grid;
	grid-template-columns: repeat(var(--pg-columns), 1fr);
	gap: var(--pg-gap);
	width: 100%;
}

.pg-grid-item {
	position: relative;
	overflow: hidden;
	border-radius: 6px;
	aspect-ratio: 1 / 1;
	background: #111;
	cursor: pointer;
	outline: none;
}

.pg-grid-item .pg-thumb-image,
.pg-grid-item .pg-thumb-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.pg-grid-wrap[style*="--pg-hover-zoom: 1"] .pg-grid-item:hover .pg-thumb-image,
.pg-grid-wrap[style*="--pg-hover-zoom: 1"] .pg-grid-item:hover .pg-thumb-video {
	transform: scale(1.06);
}

.pg-grid-item.pg-type-video .pg-play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 54px;
	height: 54px;
	margin: -27px 0 0 -27px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	pointer-events: none;
}

.pg-grid-item.pg-type-video .pg-play-icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 55%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 10px 0 10px 16px;
	border-color: transparent transparent transparent #fff;
}

/* Lightbox */
.pg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(0, 0, 0, 0.9);
	display: none;
	align-items: center;
	justify-content: center;
	padding: 40px;
}

.pg-lightbox.is-open {
	display: flex;
}

.pg-lightbox-content {
	max-width: 90vw;
	max-height: 85vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pg-lightbox-content img,
.pg-lightbox-content video {
	max-width: 90vw;
	max-height: 85vh;
	border-radius: 4px;
}

.pg-lightbox-close,
.pg-lightbox-prev,
.pg-lightbox-next {
	position: absolute;
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	font-size: 28px;
	line-height: 1;
	padding: 12px;
}

.pg-lightbox-close {
	top: 16px;
	right: 16px;
	font-size: 34px;
}

.pg-lightbox-prev {
	left: 8px;
	top: 50%;
	transform: translateY(-50%);
}

.pg-lightbox-next {
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
}

.pg-error {
	padding: 12px 16px;
	background: #fff3cd;
	border: 1px solid #ffe69c;
	border-radius: 4px;
	color: #664d03;
}

@media (max-width: 782px) {
	.pg-grid {
		grid-template-columns: repeat(min(var(--pg-columns), 2), 1fr);
	}
}

/* ==========================================================================
   Admin (meta box) styles
   ========================================================================== */

.pg-admin-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 12px;
	margin: 14px 0;
	min-height: 10px;
}

.pg-admin-item {
	position: relative;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 6px;
	background: #fff;
	cursor: move;
	text-align: center;
}

.pg-admin-item.pg-sorting-placeholder {
	border: 2px dashed #8c8f94;
	background: #f6f7f7;
}

.pg-admin-thumb {
	width: 100%;
	height: 90px;
	object-fit: cover;
	border-radius: 3px;
	display: block;
	background: #f0f0f1;
}

.pg-admin-thumb-video {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #1d2327;
}

.pg-admin-thumb-video .dashicons {
	color: #fff;
	font-size: 30px;
	width: 30px;
	height: 30px;
}

.pg-admin-filename {
	display: block;
	font-size: 11px;
	color: #50575e;
	margin-top: 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pg-admin-remove {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #b32d2e;
	color: #fff;
	border: 2px solid #fff;
	cursor: pointer;
	line-height: 1;
	font-size: 14px;
	padding: 0;
}

.pg-admin-remove:hover {
	background: #8a2222;
}
