/**
 * Document Gallery — storefront styles for [dg] shortcode.
 *
 * Uses the same class names as the original Document Gallery plugin
 * for backward compatibility with existing content.
 *
 * @package WPAIC
 */

/* === Gallery Container === */

.document-gallery {
	margin: 16px 0;
	padding: 0;
}

/* === Row === */

.document-icon-row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 12px;
}

.document-icon-row:last-child {
	margin-bottom: 0;
}

/* === Single Document Icon === */

.document-icon {
	width: var(--dg-icon-width, 25%);
	flex: 0 0 var(--dg-icon-width, 25%);
	max-width: var(--dg-icon-width, 25%);
	box-sizing: border-box;
	text-align: center;
	padding: 8px;
}

/* Account for gap in flex layout */
.document-icon-row {
	--dg-gap: 12px;
}

.document-icon {
	width: calc(var(--dg-icon-width, 25%) - var(--dg-gap));
	flex: 0 0 calc(var(--dg-icon-width, 25%) - var(--dg-gap));
	max-width: calc(var(--dg-icon-width, 25%) - var(--dg-gap));
}

.document-icon a {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-decoration: none;
	color: inherit;
	transition: opacity 0.2s;
}

.document-icon a:hover {
	opacity: 0.8;
}

/* === Icon / Thumbnail === */

.document-icon img {
	max-width: 100%;
	height: auto;
	max-height: 120px;
	object-fit: contain;
	margin-bottom: 6px;
	border-radius: 4px;
}

/* === Title === */

.document-icon .title {
	display: block;
	font-size: 13px;
	line-height: 1.4;
	color: #1e1e1e;
	word-break: break-word;
	max-width: 100%;
}

.document-icon a:hover .title {
	color: #2563eb;
	text-decoration: underline;
}

/* === Description (optional) === */

.document-icon .document-description {
	font-size: 12px;
	line-height: 1.4;
	color: #6b7280;
	margin-top: 4px;
	text-align: left;
}

/* === Responsive === */

@media (max-width: 768px) {
	.document-icon-row {
		gap: 8px;
	}

	.document-icon {
		--dg-gap: 8px;
	}

	.document-icon img {
		max-height: 80px;
	}

	.document-icon .title {
		font-size: 12px;
	}
}

@media (max-width: 480px) {
	/* Force 2 columns on very small screens */
	.document-gallery .document-icon {
		width: calc(50% - 4px) !important;
		flex: 0 0 calc(50% - 4px) !important;
		max-width: calc(50% - 4px) !important;
	}
}
