/**
 * Site Directory block: cards with the site's picture, name, description and
 * address. The whole card is the link (the name's link covers it).
 * Colors come from the theme's palette, with fallbacks for other themes.
 */

.ivo-sites__intro {
	max-width: 42rem;
	margin: 0 0 2rem;
	color: var(--wp--preset--color--muted, #475569);
}

.ivo-sites__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
	gap: 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ivo-sites__card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--border, #d8dee8);
	border-radius: 0.5rem;
	background: var(--wp--preset--color--base, #fff);
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.ivo-sites__card:hover,
.ivo-sites__card:focus-within {
	border-color: var(--wp--preset--color--primary, #1d4ed8);
	box-shadow: 0 0.5rem 1.5rem rgb(15 23 42 / 0.12);
	transform: translateY(-2px);
}

.ivo-sites__picture {
	display: grid;
	place-items: center;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-bottom: 1px solid var(--wp--preset--color--border, #d8dee8);
	background: var(--wp--preset--color--surface, #f1f5f9);
}

.ivo-sites__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
}

.ivo-sites__icon {
	width: 38%;
	height: auto;
	aspect-ratio: 1;
	object-fit: contain;
}

.ivo-sites__initials {
	display: grid;
	place-items: center;
	width: 6rem;
	aspect-ratio: 1;
	border-radius: 50%;
	background: var(--wp--preset--color--primary, #1d4ed8);
	color: #fff;
	font-family: var(--wp--preset--font-family--heading, inherit);
	font-size: 2rem;
	font-weight: 700;
	letter-spacing: 0.04em;
}

.ivo-sites__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1.25rem;
}

.ivo-sites__name {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading, inherit);
	font-size: var(--wp--preset--font-size--medium, 1.0625rem);
	line-height: 1.3;
}

.ivo-sites__name a {
	color: var(--wp--preset--color--contrast, #1e293b);
	text-decoration: none;
}

/* The name's link covers the whole card. */
.ivo-sites__name a::after {
	position: absolute;
	inset: 0;
	content: "";
}

.ivo-sites__name a:focus-visible {
	outline: none;
}

.ivo-sites__card:has(a:focus-visible) {
	outline: 3px solid var(--wp--preset--color--primary, #1d4ed8);
	outline-offset: 2px;
}

.ivo-sites__card:hover .ivo-sites__name a {
	color: var(--wp--preset--color--primary, #1d4ed8);
	text-decoration: underline;
}

.ivo-sites__description {
	margin: 0;
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	line-height: 1.5;
}

.ivo-sites__host {
	margin: auto 0 0;
	padding-top: 0.5rem;
	color: var(--wp--preset--color--primary, #1d4ed8);
	font-family: var(--wp--preset--font-family--monospace, ui-monospace, monospace);
	font-size: 0.8125rem;
	overflow-wrap: anywhere;
}

.ivo-sites__all {
	margin: 1.5rem 0 0;
	font-weight: 700;
	text-align: end;
}

@media (prefers-reduced-motion: reduce) {
	.ivo-sites__card {
		transition: none;
	}

	.ivo-sites__card:hover,
	.ivo-sites__card:focus-within {
		transform: none;
	}
}
