/* Certificate Gallery — lightweight, no dependencies */

.certg-gallery {
	--certg-cols: 3;
	--certg-gap: 20px;
	--certg-radius: 12px;
	--certg-aspect: 3 / 4;
	--certg-accent: #2563eb;
	display: grid;
	grid-template-columns: repeat(var(--certg-cols), minmax(0, 1fr));
	gap: var(--certg-gap);
	margin: 0;
	padding: 0;
}

/* Item — works as <button> or <a> */
.certg-item {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	text-align: left;
	cursor: pointer;
	color: inherit;
	font: inherit;
	text-decoration: none;
	-webkit-appearance: none;
	appearance: none;
}

.certg-thumb {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: var(--certg-aspect);
	overflow: hidden;
	border-radius: var(--certg-radius);
	background: #fff;
	box-shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
	transition: box-shadow .2s ease, transform .2s ease;
}

.certg-thumb img {
	width: 100%;
	height: 100%;
	/* contain = whole certificate stays visible, nothing gets cropped */
	object-fit: contain;
	object-position: center;
	display: block;
	transition: transform .35s ease;
}

.certg-item:hover .certg-thumb,
.certg-item:focus-visible .certg-thumb {
	box-shadow: 0 12px 28px rgba(16, 24, 40, .18);
	transform: translateY(-3px);
}
.certg-item:hover .certg-thumb img {
	transform: scale(1.04);
}
.certg-item:focus-visible {
	outline: none;
}
.certg-item:focus-visible .certg-thumb {
	outline: 3px solid var(--certg-accent);
	outline-offset: 2px;
}

/* Fallback tile for PDFs with no generated thumbnail */
.certg-fallback {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	color: #b0392b;
	background: repeating-linear-gradient(45deg, #f7f8fa, #f7f8fa 12px, #f1f3f6 12px, #f1f3f6 24px);
}
.certg-fallback em {
	font-style: normal;
	font-weight: 700;
	letter-spacing: 1px;
	font-size: 13px;
}

.certg-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	background: #c0392b;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .5px;
	padding: 3px 7px;
	border-radius: 5px;
	line-height: 1;
}

.certg-zoom {
	position: absolute;
	right: 8px;
	bottom: 8px;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	background: var(--certg-accent);
	border-radius: 50%;
	opacity: 0;
	transform: scale(.8);
	transition: opacity .2s ease, transform .2s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.certg-item:hover .certg-zoom,
.certg-item:focus-visible .certg-zoom {
	opacity: 1;
	transform: scale(1);
}

.certg-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.certg-name {
	font-weight: 600;
	font-size: 15px;
	line-height: 1.3;
}
.certg-issuer {
	font-size: 13px;
	opacity: .7;
}

/* Responsive: shrink columns on smaller screens */
@media (max-width: 900px) {
	.certg-gallery { grid-template-columns: repeat(min(var(--certg-cols), 3), minmax(0, 1fr)); }
}
@media (max-width: 620px) {
	.certg-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 400px) {
	.certg-gallery { grid-template-columns: 1fr; }
}

/* ── Lightbox ─────────────────────────────────────────────── */
.certg-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	background: rgba(12, 15, 22, .9);
	opacity: 0;
	visibility: hidden;
	transition: opacity .22s ease, visibility .22s ease;
	backdrop-filter: blur(2px);
}
.certg-lb.is-open {
	opacity: 1;
	visibility: visible;
}

.certg-lb-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	color: #fff;
	flex: 0 0 auto;
}
.certg-lb-title {
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 1 1 auto;
}
.certg-lb-btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	border: 0;
	border-radius: 8px;
	padding: 8px 12px;
	font: inherit;
	font-size: 14px;
	cursor: pointer;
	text-decoration: none;
	transition: background .15s ease;
}
.certg-lb-btn:hover {
	background: rgba(255, 255, 255, .24);
}
.certg-lb-close {
	width: 40px;
	height: 40px;
	padding: 0;
	justify-content: center;
	font-size: 22px;
	line-height: 1;
}

.certg-lb-stage {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 12px 12px;
	min-height: 0;
	position: relative;
}
.certg-lb-content {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}
.certg-lb-stage img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
	background: #fff;
}
.certg-lb-stage iframe {
	width: min(1200px, 96%);
	height: 100%;
	border: 0;
	border-radius: 6px;
	background: #fff;
}

/* Prev / next arrows */
.certg-lb-nav {
	position: absolute;
	z-index: 2;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	font-size: 26px;
	transition: background .15s ease;
}
.certg-lb-nav:hover {
	background: rgba(255, 255, 255, .28);
}
.certg-lb-prev { left: 18px; }
.certg-lb-next { right: 18px; }
.certg-lb-nav[hidden] { display: none; }

body.certg-lb-lock {
	overflow: hidden;
}

@media (max-width: 600px) {
	.certg-lb-nav { width: 40px; height: 40px; font-size: 22px; }
	.certg-lb-prev { left: 8px; }
	.certg-lb-next { right: 8px; }
	.certg-lb-btn span { display: none; }
}
