.c2smi-instagram-feed {
	display: grid;
	grid-template-columns: repeat(var(--c2smi-columns, 3), 1fr);
	gap: 8px;
}

.c2smi-instagram-item {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

.c2smi-instagram-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.c2smi-instagram-item:hover img {
	transform: scale(1.05);
}

.c2smi-instagram-item .c2smi-caption {
	position: absolute;
	inset: auto 0 0 0;
	padding: 8px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
	color: #fff;
	font-size: 0.8em;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.c2smi-instagram-item:hover .c2smi-caption {
	opacity: 1;
}

.c2smi-facebook-posts {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.c2smi-facebook-post {
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
}

.c2smi-facebook-post img {
	width: 100%;
	height: auto;
	display: block;
}

.c2smi-facebook-post-content {
	padding: 16px;
}

.c2smi-facebook-post-content time {
	display: block;
	font-size: 0.85em;
	color: #777;
	margin-bottom: 8px;
}

.c2smi-facebook-post-content p {
	margin: 0 0 8px;
}

.c2smi-facebook-link {
	display: inline-flex;
	align-items: center;
	margin-top: 8px;
	font-weight: 600;
}

/* ── Unified Social Feed Carousel ─────────────────────────────────────── */

.c2smi-social-feed {
	position: relative;
}

.c2smi-carousel-outer {
	display: flex;
	align-items: stretch;
	gap: 8px;
}

.c2smi-carousel-viewport {
	flex: 1;
	overflow: hidden;
}

.c2smi-carousel-track {
	display: flex;
	transition: transform 0.35s ease;
	will-change: transform;
}

.c2smi-carousel-item {
	flex: 0 0 calc(100% / var(--c2smi-visible, 4));
	min-width: 0;
	padding: 0 8px;
	box-sizing: border-box;
}

.c2smi-carousel-btn {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	padding: 0;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 4px;
	transition: opacity 0.2s;
}

.c2smi-carousel-btn:disabled {
	opacity: 0.25;
	cursor: default;
}

/* ── Slide card ────────────────────────────────────────────────────────── */

.c2smi-post {
	height: 100%;
	display: flex;
	flex-direction: column;
	cursor: pointer;
	user-select: none;
}

.c2smi-post:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.c2smi-post-image {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

.c2smi-post-image > img:first-child {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.c2smi-post:hover .c2smi-post-image > img:first-child {
	transform: scale(1.04);
}

/* Source logo badge — top-right of image */
.c2smi-post-badge {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 22px;
	height: 22px;
	object-fit: contain;
	pointer-events: none;
	filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}

.c2smi-post-body {
	padding: 8px 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
}

.c2smi-post-body time {
	font-size: 0.8em;
	opacity: 0.65;
}

.c2smi-post-caption {
	margin: 0;
	font-size: 0.875em;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ── Lightbox ───────────────────────────────────────────────────────────── */

.c2smi-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;
}

.c2smi-lightbox[hidden] {
	display: none;
}

/* Constrained block layouts set a max-width on every child; the fixed overlay must span the viewport. */
body .c2smi-lightbox {
	max-width: none;
	width: auto;
}

body.c2smi-lightbox-open {
	overflow: hidden;
}

.c2smi-lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
	cursor: pointer;
}

.c2smi-lightbox-dialog {
	position: relative;
	display: flex;
	width: 100%;
	max-width: 960px;
	max-height: calc(100dvh - 32px);
	background: #fff;
	border-radius: 4px;
	overflow: hidden;
}

.c2smi-lightbox-image {
	flex: 0 0 50%;
	background: #111;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.c2smi-lightbox-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	max-height: calc(100dvh - 32px);
}

.c2smi-lightbox-panel {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 20px 20px 20px 24px;
	overflow-y: auto;
	min-width: 0;
}

/* Source logo + date row */
.c2smi-lightbox-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding-bottom: 14px;
	margin-bottom: 14px;
	border-bottom: 1px solid #e8e8e8;
	flex-shrink: 0;
}

.c2smi-lightbox-logo {
	width: 22px;
	height: 22px;
	object-fit: contain;
	flex-shrink: 0;
}

#c2smi-lightbox-date {
	font-size: 0.85em;
	opacity: 0.65;
}

#c2smi-lightbox-caption {
	flex: 1;
	margin: 0 0 20px;
	white-space: pre-wrap;
	word-break: break-word;
	line-height: 1.6;
	font-size: 0.9em;
	overflow-y: auto;
}

/* Original-post link — plain left-aligned text link with external-link icon */
.c2smi-lightbox-link {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	text-align: left;
	margin-top: auto;
	font-weight: 600;
	font-size: 0.875em;
	flex-shrink: 0;
}

.c2smi-lightbox-link[hidden] {
	display: none;
}

.c2smi-lightbox-link::after,
.c2smi-facebook-link::after {
	content: "";
	display: inline-block;
	flex: 0 0 0.75em;
	width: 0.75em;
	height: 0.75em;
	margin-left: 0.3em;
	background-color: currentColor;
	-webkit-mask: url("../images/external-link.svg") center / contain no-repeat;
	mask: url("../images/external-link.svg") center / contain no-repeat;
}

/* Local video in the detail view */
.c2smi-lightbox-image img[hidden],
.c2smi-lightbox-video[hidden] {
	display: none;
}

.c2smi-lightbox-video {
	width: 100%;
	height: 100%;
	max-height: calc(100dvh - 32px);
	object-fit: contain;
	display: block;
	background: #000;
}

/* Local placeholder when an image could not be stored */
.c2smi-post-image > img.c2smi-placeholder,
.c2smi-instagram-item img.c2smi-placeholder,
.c2smi-facebook-post img.c2smi-placeholder {
	object-fit: contain;
	background: #e3ebf0;
}

.c2smi-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Close button — top-right of dialog */
.c2smi-lightbox-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 1;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255,255,255,0.9);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	font-size: 1rem;
	line-height: 1;
	color: #333;
}

@media (max-width: 600px) {
	.c2smi-lightbox-dialog {
		flex-direction: column;
		max-height: calc(100dvh - 32px);
	}

	.c2smi-lightbox-image {
		flex: 0 0 auto;
		max-height: 50dvh;
	}

	.c2smi-lightbox-panel {
		padding: 16px;
	}
}

/* ────────────────────────────────────────────────────────────────────────── */

.c2smi-notice {
	padding: 12px;
	background: #fff3cd;
	border: 1px solid #ffe69c;
	border-radius: 4px;
	color: #664d03;
}
