/* Divi Social Grid */

/* The wrapper class raises specificity above Divi's own list styles. */
.dsg-wrap .dsg-grid {
	display: grid;
	grid-template-columns: repeat(var(--dsg-cols, 4), minmax(0, var(--dsg-tile, 1fr)));
	gap: var(--dsg-gap, 12px);
	justify-content: center;
	align-items: start;
	margin: 0;
	padding: 0;
	list-style: none;
}
@media (max-width: 980px) {
	.dsg-wrap .dsg-grid {
		grid-template-columns: repeat(var(--dsg-cols-t, 3), minmax(0, var(--dsg-tile-t, var(--dsg-tile, 1fr))));
		gap: var(--dsg-gap-t, var(--dsg-gap, 12px));
	}
}
@media (max-width: 767px) {
	.dsg-wrap .dsg-grid {
		grid-template-columns: repeat(var(--dsg-cols-p, 2), minmax(0, var(--dsg-tile-p, var(--dsg-tile-t, var(--dsg-tile, 1fr)))));
		gap: var(--dsg-gap-p, var(--dsg-gap-t, var(--dsg-gap, 12px)));
	}
}

.dsg-wrap .dsg-item {
	margin: 0;
	padding: 0;
	list-style: none;
}
.dsg-wrap .dsg-item::before { content: none; }

.dsg-wrap .dsg-link {
	position: relative;
	display: block;
	aspect-ratio: var(--dsg-ratio, 1 / 1);
	overflow: hidden;
	border-radius: var(--dsg-radius, 0);
	background: #e9e9e9;
	color: #fff;
	text-decoration: none;
}
.dsg-wrap .dsg-link:focus-visible {
	outline: 3px solid #1a73e8;
	outline-offset: 2px;
}

.dsg-wrap .dsg-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 0.4s ease;
}
.dsg-wrap .dsg-link:hover .dsg-img { transform: scale(1.04); }

/* "Original" shape: natural image heights */
.dsg-wrap.dsg-natural .dsg-link { aspect-ratio: auto; }
.dsg-wrap.dsg-natural .dsg-img { height: auto; }
.dsg-wrap.dsg-natural .dsg-item--text .dsg-link { aspect-ratio: 1 / 1; }

/* Text-only posts */
.dsg-wrap .dsg-textpost {
	display: -webkit-box;
	height: 100%;
	padding: 16px 16px 40px; /* room for the date line */
	box-sizing: border-box;
	overflow: hidden;
	background: #f1f1f1;
	color: #222;
	font-size: 15px;
	line-height: 1.5;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 8;
}

/* Video / multi-photo badge */
.dsg-wrap .dsg-badge {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
}

/* Caption and details */
.dsg-wrap .dsg-meta {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 32px 12px 12px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.78));
	font-size: 14px;
	line-height: 1.4;
	transition: opacity 0.25s ease, transform 0.25s ease;
}
.dsg-wrap .dsg-caption {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}
.dsg-wrap .dsg-details {
	font-size: 12px;
	opacity: 0.85;
}
.dsg-wrap .dsg-item--text .dsg-meta { background: none; color: #555; }

/* Hover mode: hidden until hover or keyboard focus */
.dsg-caption--hover .dsg-meta {
	opacity: 0;
	transform: translateY(8px);
}
.dsg-caption--hover .dsg-link:hover .dsg-meta,
.dsg-caption--hover .dsg-link:focus-visible .dsg-meta {
	opacity: 1;
	transform: none;
}
/* Touch screens can't hover, so keep the text-only tile details visible there */
@media (hover: none) {
	.dsg-caption--hover .dsg-item--text .dsg-meta { opacity: 1; transform: none; }
}

@media (max-width: 767px) {
	.dsg-wrap .dsg-meta { padding: 24px 8px 8px; font-size: 13px; }
	.dsg-wrap .dsg-caption { -webkit-line-clamp: 2; }
}

@media (prefers-reduced-motion: reduce) {
	.dsg-wrap .dsg-img,
	.dsg-wrap .dsg-meta { transition: none; }
	.dsg-wrap .dsg-link:hover .dsg-img { transform: none; }
}

/* Message shown to editors when there's nothing to display */
.dsg-empty {
	padding: 40px 20px;
	border: 2px dashed #c4c4c4;
	color: #666;
	text-align: center;
}
