/*
 * Provider Category Grid
 * Companion styles for parts/category-grid.php
 *
 * Uses Neve FSE colour tokens (--wp--preset--color--ti-bg etc.)
 * so the grid inherits whatever palette the owner sets in the
 * Site Editor without any hardcoded colours here.
 */

/* ── Grid layout ────────────────────────────────────────────── */

.provider-category-grid__heading {
	margin-bottom: 1.5rem;
	color: inherit;
	text-align: center;
}

.provider-category-grid__list {
	--card-target-width: calc( 264px - var( --grid-cols, 5 ) * 16px );
	display: grid;
	grid-template-columns: repeat( var( --grid-cols, 5 ), minmax( 0, 1fr ) );
	justify-content: center;
	gap: 1.5rem;
	max-width: calc( var( --grid-cols, 5 ) * var( --card-target-width ) + ( var( --grid-cols, 5 ) - 1 ) * 1.5rem );
	margin: 0 auto;
	padding: 0;
	list-style: none;
}

/* ── Card ───────────────────────────────────────────────────── */

.provider-category-grid__item {
	display: flex;
	width: 100%;
	align-items: stretch;
}

.provider-category-grid__card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	padding: 1rem;
	aspect-ratio: 2 / 3;
	width: 100%;
	text-decoration: none;
	color: inherit;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
	box-sizing: border-box;
}

.provider-category-grid__card:hover,
.provider-category-grid__card:focus-visible {
	box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.1 );
	transform: translateY( -2px );
	text-decoration: none;
	color: inherit;
}

.provider-category-grid__card:focus-visible {
	outline: 2px solid var( --wp--preset--color--primary, currentColor );
	outline-offset: 2px;
}

/* ── Icon / monogram ────────────────────────────────────────── */

.provider-category-grid__icon {
	width: 72px;
	height: 72px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.provider-category-grid__icon img {
	width: 64px;
	height: 64px;
	object-fit: contain;
}

.provider-category-grid__monogram {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background-color: var( --wp--preset--color--ti-accent );
	color: var( --wp--preset--color--background, #fff );
	font-size: 1.65rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.02em;
	font-family: var( --wp--preset--font-family--heading, inherit );
}

/* ── Text ───────────────────────────────────────────────────── */

.provider-category-grid__meta {
	text-align: center;
}

.provider-category-grid__name {
	font-size: var( --wp--preset--font-size--small, 0.875rem );
	font-weight: 600;
	margin: 0 0 0.25rem;
	line-height: 1.3;
}

.provider-category-grid__count {
	font-size: var( --wp--preset--font-size--small, 0.875rem );
	color: var( --wp--preset--color--secondary, inherit );
	margin: 0;
	opacity: 0.8;
}

.provider-category-grid__subcategory-hint {
	white-space: nowrap;
}

/* ── Responsive ─────────────────────────────────────────────── */

@media ( max-width: 480px ) {
	.provider-category-grid__list {
		grid-template-columns: repeat( min( var( --grid-cols, 5 ), 2 ), minmax( 0, 1fr ) );
		justify-content: center;
		gap: 0.5rem;
	}

	.provider-category-grid__card {
		min-height: 0;
		padding: 0.75rem;
	}
}

/* ── Provider listing card image ────────────────────────────── */
@media ( max-width: 599px ) {
  .wp-block-post .wp-block-column:has( .wp-block-post-featured-image ) {
    flex-basis: 100% !important;
    width: 100%;
  }

  .wp-block-post .wp-block-post-featured-image img {
    width: 100%;
    height: auto;
  }
}
