/*
 * Lega dei Comuni - Enti.
 *
 * Colours and sizes come from the site's Divi Design Variables (--gcid-* colours, --gvid-* numbers);
 * each has a fallback, so the shortcode also renders correctly without them. Fonts are inherited
 * (Titillium Web on the site). No animation or transition is used.
 */

.ldc-enti {
	--ldc-enti-red: var(--gcid-primary-color, #b40000);
	--ldc-enti-navy: var(--gcid-ldc-navy, #14213d);
	--ldc-enti-muted: var(--gcid-ldc-muted, #5b6270);
	--ldc-enti-border: var(--gcid-ldc-border, #d9d5cf);
	--ldc-enti-field-border: var(--gcid-ldc-field-border, #858b96);
	--ldc-enti-grey: var(--gcid-ldc-grey, #f4f2ef);
	--ldc-enti-white: #fff;
	--ldc-enti-figure: var(--gvid-ldc-text-figure, 40px);
	--ldc-enti-label: var(--gvid-ldc-text-label, 13px);
	--ldc-enti-small: var(--gvid-ldc-text-small, 15px);
	--ldc-enti-radius: var(--gvid-ldc-radius, 4px);
	--ldc-enti-radius-pill: var(--gvid-ldc-radius-pill, 999px);
	--ldc-enti-pad: var(--gvid-ldc-card-pad, 24px);
	--ldc-enti-gap: var(--gvid-ldc-gap, 24px);
	--ldc-enti-touch: var(--gvid-ldc-touch, 44px);

	box-sizing: border-box;
	max-width: 100%;
	color: var(--ldc-enti-navy);
	font-family: inherit;
}

.ldc-enti *,
.ldc-enti *::before,
.ldc-enti *::after {
	box-sizing: inherit;
}

/* Author display rules (flex, grid) would otherwise beat the hidden attribute set by the script. */
.ldc-enti [hidden] {
	display: none !important;
}

.ldc-enti-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ldc-enti-empty,
.ldc-enti-status {
	margin: 0 0 var(--ldc-enti-gap);
	padding: 0;
	color: var(--ldc-enti-muted);
	font-size: var(--ldc-enti-small);
}

.ldc-enti-status:empty {
	display: none;
}

/* Summary: one card per region. */

/* Element + class under .ldc-enti beats Divi's `.et-l--body ul` indent. */
.ldc-enti ul.ldc-enti-cards {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--ldc-enti-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ldc-enti-card {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: var(--ldc-enti-pad);
	background: var(--ldc-enti-white);
	border: 1px solid var(--ldc-enti-border);
	border-radius: var(--ldc-enti-radius);
	list-style: none;
}

.ldc-enti-card__figure {
	order: -1;
	margin: 0;
	padding: 0;
	color: var(--ldc-enti-red);
	font-size: var(--ldc-enti-figure);
	font-weight: 700;
	line-height: 1.1;
}

.ldc-enti .ldc-enti-card__name {
	margin: 8px 0 0;
	padding: 0;
	color: var(--ldc-enti-navy);
	font-family: inherit;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
}

.ldc-enti-card__provinces {
	margin: 8px 0 0;
	padding: 0;
	color: var(--ldc-enti-muted);
	font-size: var(--ldc-enti-small);
	line-height: 1.5;
}

/* List: toolbar (mockup 18). */

.ldc-enti-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px var(--ldc-enti-gap);
	margin: 0 0 40px;
	padding: 0;
}

.ldc-enti-filters {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 16px;
	min-width: 0;
	max-width: 760px;
}

.ldc-enti-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.ldc-enti-field--search {
	flex: 2 1 280px;
}

.ldc-enti-field--province {
	flex: 1 1 200px;
	max-width: 240px;
}

.ldc-enti-label {
	color: var(--ldc-enti-muted);
	font-size: var(--ldc-enti-label);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.ldc-enti-search {
	position: relative;
	display: block;
}

.ldc-enti-search__icon {
	position: absolute;
	top: 50%;
	left: 14px;
	color: var(--ldc-enti-muted);
	transform: translateY(-50%);
	pointer-events: none;
}

.ldc-enti .ldc-enti-input,
.ldc-enti .ldc-enti-select {
	width: 100%;
	max-width: 100%;
	min-height: var(--ldc-enti-touch);
	margin: 0;
	padding: 8px 12px;
	background-color: var(--ldc-enti-white);
	border: 1px solid var(--ldc-enti-field-border);
	border-radius: var(--ldc-enti-radius);
	color: var(--ldc-enti-navy);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.4;
}

.ldc-enti .ldc-enti-input {
	padding-left: 42px;
}

.ldc-enti-download,
.ldc-enti-download:visited {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	min-height: var(--ldc-enti-touch);
	padding: 4px 0;
	color: var(--ldc-enti-red);
	text-decoration: none;
}

.ldc-enti-download__icon {
	flex: 0 0 auto;
}

.ldc-enti-download__text {
	display: flex;
	flex-direction: column;
}

.ldc-enti-download__label {
	font-size: var(--ldc-enti-small);
	font-weight: 600;
	line-height: 1.4;
}

.ldc-enti-download:hover .ldc-enti-download__label {
	text-decoration: underline;
}

.ldc-enti-download__meta {
	color: var(--ldc-enti-muted);
	font-size: var(--ldc-enti-label);
	line-height: 1.4;
}

.ldc-enti .ldc-enti-input:focus-visible,
.ldc-enti .ldc-enti-select:focus-visible,
.ldc-enti .ldc-enti-download:focus-visible {
	outline: 2px solid var(--ldc-enti-red);
	outline-offset: 2px;
}

/* List: one row per province, title on the left, chips on the right. */

.ldc-enti-provinces {
	border-top: 1px solid var(--ldc-enti-border);
}

.ldc-enti-province {
	display: grid;
	grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
	gap: 12px var(--ldc-enti-gap);
	align-items: start;
	padding: 20px 0;
	border-bottom: 1px solid var(--ldc-enti-border);
}

.ldc-enti .ldc-enti-province__title {
	margin: 0;
	padding: 4px 0 0;
	color: var(--ldc-enti-navy);
	font-family: inherit;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.4;
}

.ldc-enti ul.ldc-enti-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ldc-enti .ldc-enti-chip {
	max-width: 100%;
	margin: 0;
	padding: 6px 12px;
	background: var(--ldc-enti-white);
	border: 1px solid var(--ldc-enti-border);
	border-radius: var(--ldc-enti-radius-pill);
	color: var(--ldc-enti-navy);
	font-size: 15px;
	line-height: 1.4;
	list-style: none;
	overflow-wrap: anywhere;
}

.ldc-enti .ldc-enti-chip::before {
	content: none;
}

@media (max-width: 980px) {
	.ldc-enti ul.ldc-enti-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.ldc-enti ul.ldc-enti-cards,
	.ldc-enti-province {
		grid-template-columns: minmax(0, 1fr);
	}

	.ldc-enti .ldc-enti-province__title {
		padding-top: 0;
	}

	.ldc-enti-field--search,
	.ldc-enti-field--province,
	.ldc-enti-download {
		flex: 1 1 100%;
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ldc-enti *,
	.ldc-enti *::before,
	.ldc-enti *::after {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}
