.ifp-grid {
	display: grid;
	grid-template-columns: repeat(var(--ifp-cols, 3), 1fr);
	gap: 18px;
	margin: 20px 0;
}
.ifp-cols-1 { --ifp-cols: 1; }
.ifp-cols-2 { --ifp-cols: 2; }
.ifp-cols-3 { --ifp-cols: 3; }
.ifp-cols-4 { --ifp-cols: 4; }
.ifp-cols-5 { --ifp-cols: 5; }
.ifp-cols-6 { --ifp-cols: 6; }

.ifp-item {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	border-radius: 14px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ifp-item:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.ifp-thumb-wrap {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #fafafa;
}

/* object-fit: contain ensures the full image is always visible —
   nothing is ever cropped off the top or sides, regardless of the
   original post's aspect ratio. */
.ifp-thumb {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
	display: block;
	transition: transform 0.35s ease;
}
.ifp-item:hover .ifp-thumb {
	transform: scale(1.04);
}

.ifp-overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.ifp-badge {
	position: absolute;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	backdrop-filter: blur(2px);
}
.ifp-badge-play {
	top: 10px;
	right: 10px;
}
.ifp-badge-ig {
	bottom: 10px;
	right: 10px;
	opacity: 0;
	transition: opacity 0.2s ease;
}
.ifp-item:hover .ifp-badge-ig {
	opacity: 1;
}

.ifp-caption {
	display: block;
	padding: 10px 12px;
	font-size: 13px;
	line-height: 1.45;
	color: #333;
}

.ifp-empty {
	color: #777;
	font-style: italic;
}

.ifp-loadmore-wrap {
	text-align: center;
	margin: 20px 0;
}
.ifp-load-more {
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	padding: 11px 28px;
	border-radius: 6px;
	border: 1px solid #333;
	background: transparent;
	color: #333;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}
.ifp-load-more:hover:not(:disabled) {
	background: #333;
	color: #fff;
}
.ifp-load-more:disabled {
	opacity: 0.6;
	cursor: default;
}

@media (max-width: 700px) {
	.ifp-grid {
		grid-template-columns: repeat(min(var(--ifp-cols, 3), 2), 1fr);
		gap: 12px;
	}
}
@media (max-width: 420px) {
	.ifp-grid {
		grid-template-columns: 1fr;
	}
}
