.ifs-grid {
	display: grid;
	grid-template-columns: repeat(var(--ifs-columns, 3), 1fr);
	gap: 8px;
	max-width: 100%;
	margin: 1em 0;
}

.ifs-item {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 6px;
	/* Rasio 1080:1440 (3:4 potret) mengikuti safe area desain thumbnail */
	aspect-ratio: 1080 / 1440;
	background: #f0f0f0;
	cursor: pointer;
}

.ifs-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.25s ease;
}

.ifs-item:hover img {
	transform: scale(1.05);
}

.ifs-badge {
	position: absolute;
	top: 8px;
	right: 8px;
	color: #fff;
	font-size: 14px;
	text-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
	line-height: 1;
}

.ifs-admin-notice {
	padding: 10px 14px;
	background: #fff8e5;
	border-left: 4px solid #dba617;
	font-size: 13px;
}

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

@media (max-width: 480px) {
	.ifs-grid {
		grid-template-columns: repeat(min(var(--ifs-columns, 3), 2), 1fr);
		gap: 6px;
	}
}

/* ------------------------------------------------------------------
 * Modal / lightbox preview
 * ------------------------------------------------------------------ */
.ifs-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.85);
	padding: 24px;
}

.ifs-modal.is-open {
	display: flex;
}

.ifs-modal-dialog {
	position: relative;
	display: flex;
	background: #000;
	width: 100%;
	max-width: 900px;
	max-height: 90vh;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.ifs-modal-media {
	position: relative;
	flex: 1 1 auto;
	background: #000;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1080 / 1440;
	max-height: 90vh;
}

.ifs-modal-media img,
.ifs-modal-media video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}

.ifs-modal-badge-video {
	position: absolute;
	top: 12px;
	left: 12px;
	color: #fff;
	background: rgba(0, 0, 0, 0.5);
	border-radius: 4px;
	padding: 3px 8px;
	font-size: 12px;
}

.ifs-modal-fallback-msg {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	margin: 0;
	padding: 10px 14px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 13px;
	text-align: center;
}

.ifs-modal-sidebar {
	flex: 0 0 300px;
	background: #fff;
	padding: 18px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.ifs-modal-caption {
	font-size: 14px;
	line-height: 1.5;
	color: #262626;
	white-space: pre-wrap;
	word-break: break-word;
}

.ifs-modal-timestamp {
	font-size: 12px;
	color: #8e8e8e;
}

.ifs-modal-link {
	margin-top: auto;
	display: inline-block;
	text-align: center;
	padding: 8px 14px;
	border-radius: 6px;
	background: #0095f6;
	color: #fff !important;
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
}

.ifs-modal-close,
.ifs-modal-prev,
.ifs-modal-next {
	position: absolute;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.ifs-modal-close {
	top: 12px;
	right: 12px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	font-size: 18px;
	z-index: 2;
}

.ifs-modal-prev,
.ifs-modal-next {
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	font-size: 20px;
	z-index: 2;
}

.ifs-modal-prev {
	left: 12px;
}

.ifs-modal-next {
	right: 12px;
}

.ifs-modal-prev:disabled,
.ifs-modal-next:disabled {
	opacity: 0.3;
	cursor: default;
}

.ifs-modal-counter {
	position: absolute;
	bottom: 12px;
	left: 50%;
	transform: translateX(-50%);
	color: #fff;
	background: rgba(0, 0, 0, 0.5);
	border-radius: 12px;
	padding: 2px 10px;
	font-size: 12px;
	z-index: 2;
}

@media (max-width: 700px) {
	.ifs-modal {
		padding: 0;
	}
	.ifs-modal-dialog {
		flex-direction: column;
		max-height: 100vh;
		max-width: 100vw;
		height: 100%;
		border-radius: 0;
	}
	.ifs-modal-media {
		aspect-ratio: auto;
		flex: 1 1 auto;
		max-height: 62vh;
	}
	.ifs-modal-sidebar {
		flex: 0 0 auto;
		max-height: 38vh;
	}
}
