/* Card_Categories: one card per category, 3 per row from 1024 px, one per row below. Values from docs/design-system.md → Card_Categories. */
.pln-category-cards .wp-block-term-template {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The flow layout of the Term Template adds a top margin to each item: the grid gap replaces it. */
.pln-category-cards .wp-block-term-template > .wp-block-term {
	margin: 0;
}

@media (min-width: 1024px) {
	.pln-category-cards .wp-block-term-template {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 24px;
	}
}

.pln-card-category {
	position: relative;
	height: 100%;
	min-height: 112px;
	box-sizing: border-box;
	padding-left: 16px;
	border-radius: 12px;
	background: var(--pln-color-white);
	box-shadow: var(--pln-elevation-1);
	overflow: hidden;
	transition: box-shadow 0.15s ease;
}

/* Bar in the category color at the bottom of the card (--pln-category-color from the Fields plugin). */
.pln-card-category::before {
	content: "";
	position: absolute;
	inset: auto 0 0;
	z-index: 2;
	height: 4px;
	background: var(--pln-category-color);
	pointer-events: none;
}

/* Without an image the text keeps a margin on the right too. */
.pln-card-category:not(:has(.pln-card-category__image)) {
	padding-right: 16px;
}

.pln-card-category__text {
	flex: 1 1 auto;
	min-width: 0;
	justify-content: space-between;
	padding-block: 12px;
}

/* Title: the category name, 20/28 semibold, at most 2 lines. Its link covers the whole card. */
.pln-card-category__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	margin: 0;
	overflow: hidden;
	color: var(--pln-color-text);
	font-size: 20px;
	font-weight: 600;
	line-height: 28px;
}

.pln-card-category__title a {
	color: inherit;
	text-decoration: none;
}

.pln-card-category__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.pln-card-category__title a:focus-visible {
	outline: none;
}

.pln-card-category:has(a:focus-visible) {
	outline: 2px solid var(--pln-color-text);
	outline-offset: 4px;
}

/* «Leggi di più»: Other/Text-Link. Plain text, the card link is the title. */
.pln-card-category__more {
	margin: 0;
	color: var(--pln-color-text);
	font-size: 16px;
	font-weight: 600;
	line-height: 24px;
	text-decoration: underline;
}

/* Hover: Elevation 2 and underlined text. */
.pln-card-category:hover {
	box-shadow: var(--pln-elevation-2);
}

.pln-card-category:hover .pln-card-category__title a {
	text-decoration: underline;
}

/* Image: 100 px wide, as tall as the card (the text sets the height), radius 8 px. */
.pln-card-category .pln-card-category__image {
	position: relative;
	flex: none;
	width: 100px;
	margin: 0;
}

.pln-card-category .pln-card-category__image img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 8px;
}

@media (min-width: 1024px) {
	.pln-card-category {
		min-height: 120px;
	}

	.pln-card-category__text {
		justify-content: flex-start;
		padding-block: 16px;
	}
}

/* Chips_Filter: subcategories of the category archive, links to their archives. Values from docs/design-system.md → Filtri.
   Centered; when the chips do not fit, the row scrolls sideways. Below 1024 px it starts on the left and its right edge fades. */
.pln-chips .wp-block-term-template {
	display: flex;
	gap: 24px;
	justify-content: safe center;
	margin: 0;
	padding: 4px 0;
	list-style: none;
	overflow-x: auto;
	scrollbar-width: none;
}

.pln-chips .wp-block-term-template::-webkit-scrollbar {
	display: none;
}

.pln-chips .wp-block-term-template > .wp-block-term {
	flex: none;
	margin: 0;
}

@media (max-width: 1023px) {
	.pln-chips .wp-block-term-template {
		justify-content: flex-start;
		mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
	}
}

.pln-chip {
	margin: 0;
	font-size: 12px;
	font-weight: 700;
	line-height: 16px;
	text-transform: uppercase;
}

.pln-chip a {
	display: block;
	padding: 8px 16px;
	border-radius: 24px;
	background: var(--pln-color-bg-friendly-beige);
	color: var(--pln-color-text);
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease;
}

.pln-chip a:hover {
	background: var(--pln-color-hover);
	text-decoration: underline;
}
