/* [itx_resource_file_preview]: a resource file thumbnail, shown at the Preview Image's own proportions. */

.itx-resource-file-preview {
	display: block;
	position: relative;
	width: 100%;
	overflow: hidden;
	background: var(--color-content-bg-alt, #f5f5f5);
	border: 1px solid var(--color-content-border, #e0e0e0);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	color: var(--color-content-faded, #888);
	transition: box-shadow 0.2s, transform 0.2s;
}

a.itx-resource-file-preview:hover,
a.itx-resource-file-preview:focus-visible {
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
	transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
	a.itx-resource-file-preview:hover,
	a.itx-resource-file-preview:focus-visible {
		transform: none;
	}
}

/* The image's width and height attributes reserve its space, so nothing shifts as it loads. */
.itx-resource-file-preview__image {
	display: block;
	width: 100%;
	height: auto;
}

/*
 * Download panel (Resource Single #2945 sidebar): a Vertical Wrapper card holding this preview,
 * an h5, a line of text and a button. Stacked, the preview filled the column and pushed the
 * button far down, so it becomes a thumbnail beside the heading and text, with the button full
 * width below. Keyed to the preview being there, so the template needs no class, and a resource
 * with no Preview Image keeps the stacked layout.
 */
.w-vwrapper:has(> .wpb_text_column .itx-resource-file-preview) {
	display: grid;
	grid-template-columns: 5.5rem minmax(0, 1fr);
	grid-template-rows: 1fr auto auto 1fr auto;
	column-gap: 1.25rem;
	align-items: start;
}

.w-vwrapper:has(> .wpb_text_column .itx-resource-file-preview) > * {
	grid-column: 2;
	margin: 0;
}

/* The thumbnail spans the text rows; the 1fr rows either side centre the text against it. */
.w-vwrapper:has(> .wpb_text_column .itx-resource-file-preview) > .wpb_text_column {
	grid-column: 1;
	grid-row: 1 / 5;
}

.w-vwrapper:has(> .wpb_text_column .itx-resource-file-preview) > h5 {
	grid-row: 2;
	margin-bottom: 0.25rem;
}

.w-vwrapper:has(> .wpb_text_column .itx-resource-file-preview) > p {
	grid-row: 3;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.w-vwrapper:has(> .wpb_text_column .itx-resource-file-preview) > .w-btn-wrapper {
	grid-column: 1 / -1;
	grid-row: 5;
	margin-top: 1.5rem;
}

.w-vwrapper:has(> .wpb_text_column .itx-resource-file-preview) > .w-btn-wrapper .w-btn {
	width: 100%;
	justify-content: center;
}
