/**
 * Casa Laner – ritocchi sopra il bridge Design Comuni.
 */

/* Testo pagina su tutta la colonna centrata, allineato a breadcrumb e titolo */
body .apsp-comuni-page .entry-content,
body .apsp-comuni-page .page-content-wrapper {
	max-width: none;
}

/* Header con immagine a tutto schermo (contenuti nati con Astra) */
main {
	overflow-x: clip;
}

/* Il titolo è già dentro l'immagine: niente titolo doppio sopra */
.apsp-comuni-page-column:has(.entry-content > .hero-section:first-child) > .cmp-hero {
	display: none;
}

.apsp-comuni-page-column:has(.entry-content > .hero-section:first-child) > .cmp-breadcrumbs {
	margin-bottom: 1rem;
}

body .apsp-comuni-page .hero-section {
	position: relative;
	box-sizing: border-box;
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	margin-bottom: 1.5rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: clamp(300px, 34vw, 520px);
	padding: 3rem 1.5rem !important;
	background-size: cover;
	background-position: 50% 50% !important;
	background-repeat: no-repeat;
	text-align: center;
}

/* Inquadratura per foto: il soggetto resta visibile nella fascia */
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-118."] { background-position: 60% 50% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-18."]  { background-position: 50% 62% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-104."] { background-position: 50% 55% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-16."]  { background-position: 50% 45% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-68."]  { background-position: 50% 40% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-43."]  { background-position: 50% 45% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-108."] { background-position: 50% 58% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-41."]  { background-position: 50% 62% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-10."]  { background-position: 50% 40% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-47."]  { background-position: 50% 58% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-102."] { background-position: 50% 45% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-25."]  { background-position: 50% 55% !important; }
.apsp-comuni-page .hero-section[style*="APSPCasaLaner-32."]  { background-position: 50% 60% !important; }

.apsp-comuni-page .hero-section::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.45) 100%);
}

.apsp-comuni-page .hero-section > * {
	position: relative;
	z-index: 1;
}

.apsp-comuni-page .hero-section h1 {
	line-height: 1.2;
}

@media (max-width: 767.98px) {
	body .apsp-comuni-page .hero-section {
		min-height: 260px;
		padding: 2.5rem 1rem !important;
	}

	.apsp-comuni-page .hero-section h1 {
		font-size: 1.6rem !important;
	}
}

/* Albo: tutti gli atti sono dell'ente, la colonna Ente toglie solo spazio */
body.apsp-albo-page .albo-table .albo-col-ente {
	display: none;
}

body.apsp-albo-page .albo-table .albo-col-categoria {
	white-space: normal;
	min-width: 9rem;
	max-width: 12rem;
}

body.apsp-albo-page .albo-table .albo-col-categoria .albo-categoria-badge {
	white-space: normal;
	display: inline-block;
	max-width: 100%;
}

/* Homepage: «I nostri servizi» su due righe da tre, «Iniziative» su una riga da quattro. */
body .apsp-homepage .page-content.homepage .homepage-section--servizi > .homepage-cards {
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.5rem;
}

body .apsp-homepage .page-content.homepage .homepage-section--iniziative > .homepage-cards {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 991.98px) {
	body .apsp-homepage .page-content.homepage .homepage-section--servizi > .homepage-cards,
	body .apsp-homepage .page-content.homepage .homepage-section--iniziative > .homepage-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 575.98px) {
	body .apsp-homepage .page-content.homepage .homepage-section--servizi > .homepage-cards,
	body .apsp-homepage .page-content.homepage .homepage-section--iniziative > .homepage-cards {
		grid-template-columns: 1fr;
	}
}

body .apsp-homepage .page-content.homepage .homepage-section--servizi .homepage-card {
	position: relative;
	border-top: 4px solid var(--apsp-home-accent, #0066cc);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

body .apsp-homepage .page-content.homepage .homepage-section--servizi .homepage-card:hover,
body .apsp-homepage .page-content.homepage .homepage-section--servizi .homepage-card:focus-within {
	box-shadow: 0 0.5rem 1.5rem rgba(0, 38, 77, 0.12);
	transform: translateY(-2px);
}

body .apsp-homepage .page-content.homepage .homepage-section--servizi .homepage-card__body {
	padding: 1.5rem 1.5rem 1.6rem;
}

body .apsp-homepage .page-content.homepage .homepage-card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3.5rem;
	height: 3.5rem;
	margin-bottom: 1rem;
	border-radius: 50%;
	background: #e6f0fa;
	color: var(--apsp-home-accent, #0066cc);
	flex: none;
}

body .apsp-homepage .page-content.homepage .homepage-card__icon svg {
	width: 2rem;
	height: 2rem;
}

body .apsp-homepage .page-content.homepage .homepage-section--servizi .homepage-card__title {
	min-height: 0;
}

body .apsp-homepage .page-content.homepage .homepage-section--servizi .homepage-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
}

body .apsp-homepage .page-content.homepage .homepage-section--servizi .homepage-card__excerpt {
	min-height: 0;
}

/* Notizie senza immagine in evidenza: riquadro istituzionale al posto del grigio vuoto. */
body .apsp-homepage .page-content.homepage .homepage-card__image--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 9;
	min-height: 0;
	background-color: var(--apsp-home-accent, #0066cc);
	background-image:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h13v13a2 2 0 0 0 2 2H6a2 2 0 0 1-2-2z'/%3E%3Cpath d='M17 9h3v9a2 2 0 0 1-4 0'/%3E%3Cpath d='M7 8.5h7M7 12h7M7 15.5h4'/%3E%3C/svg%3E"),
		linear-gradient(135deg, #0066cc 0%, #004080 100%);
	background-repeat: no-repeat;
	background-position: center, center;
	background-size: 4.5rem 4.5rem, cover;
}

/* Notizie in homepage: sottotitolo sempre su tre righe, schede allineate. */
body .apsp-homepage .page-content.homepage .homepage-card:has(.homepage-card__image) .homepage-card__excerpt {
	min-height: calc(1.5em * 3);
	-webkit-line-clamp: 3;
	line-clamp: 3;
}

/* Testo delle pagine: stessa interlinea per elenchi puntati e numerati, immagini nel flusso del testo. */
body .apsp-comuni-page .entry-content li {
	line-height: 1.55;
	margin-bottom: 0.35rem;
}

body .apsp-comuni-page .entry-content .apsp-figure {
	margin: 1rem 0 1.5rem;
}

body .apsp-comuni-page .entry-content .apsp-figure img {
	max-width: 100%;
	height: auto;
	border: 1px solid #e6e9f2;
	border-radius: 4px;
}

/* Bootstrap Italia azzera i marcatori di tutti gli elenchi: li ripristino negli elenchi semplici del testo. */
body .apsp-comuni-page .entry-content ul:not([class]),
body .apsp-comuni-page .entry-content ol:not([class]) {
	padding-left: 1.5rem;
	margin-bottom: 1rem;
}

body .apsp-comuni-page .entry-content ul:not([class]) {
	list-style: disc;
}

body .apsp-comuni-page .entry-content ol:not([class]) {
	list-style: decimal;
}

body .apsp-comuni-page .entry-content ul:not([class]) > li::marker,
body .apsp-comuni-page .entry-content ol:not([class]) > li::marker {
	color: var(--apsp-home-accent, #0066cc);
	font-weight: 600;
}

/* Testo allineato al titolo della pagina. */
body.wp-theme-design-comuni-wordpress-theme main .apsp-comuni-page .row.apsp-comuni-page__body-row > .entry-content {
	padding-left: 0;
	padding-right: 0;
}

/*
 * Testi incollati dal vecchio sito o da Word: dimensioni, font, colori e allineamenti scritti a mano
 * riportati allo stile del tema (titoli e testo AGID). Header con foto e misure delle tabelle esclusi.
 */
body .apsp-comuni-page .entry-content :is(span, strong, b, em, i, u, a, p, li, ul, ol, font, div, section, blockquote, h1, h2, h3, h4, h5, h6)[style*="font-size"]:not(.hero-section, .hero-section *) {
	font-size: inherit !important;
}

body .apsp-comuni-page .entry-content [style*="font-family"]:not(.hero-section *),
body .apsp-comuni-page .entry-content font {
	font-family: inherit !important;
}

body .apsp-comuni-page .entry-content :is(span, strong, b, em, i, u, p, li, ul, ol, font, div, section, blockquote, h1, h2, h3, h4, h5, h6)[style*="color"]:not([style*="#ff0000"]):not([style*="#f00"]):not([style*="red"]):not(.hero-section *) {
	color: inherit !important;
}

body .apsp-comuni-page .entry-content a[style*="color"]:not(.hero-section *) {
	color: #0066cc !important;
}

body .apsp-comuni-page .entry-content :is(span, a, strong, p, li)[style*="background-color"]:not(.hero-section *) {
	background-color: transparent !important;
}

body .apsp-comuni-page .entry-content [style*="justify"],
body .apsp-comuni-page .entry-content :is(p, li, h1, h2, h3, h4, h5, h6)[style*="text-align: center"]:not(:has(img)):not(.hero-section *) {
	text-align: left !important;
}

body .apsp-comuni-page .entry-content :is(h1, h2, h3, h4, h5, h6) :is(strong, b) {
	font-weight: inherit;
}

body .apsp-comuni-page .entry-content center {
	text-align: left;
}

/* Titoli dentro il testo: scala unica, sempre più piccola del titolo della pagina (h1). */
body .apsp-comuni-page .entry-content :is(h1, h2, h3, h4, h5, h6):not(.hero-section *, .apsp-section-index *, .callout *, [class*="card"] *, .apsp-at-index *) {
	font-weight: 700;
	line-height: 1.3;
	margin-top: 2rem;
	margin-bottom: 0.75rem;
	text-transform: none;
	letter-spacing: normal;
}

body .apsp-comuni-page .entry-content :is(h1, h2):not(.hero-section *, .apsp-section-index *, .callout *, [class*="card"] *, .apsp-at-index *) { font-size: 1.75rem; }
body .apsp-comuni-page .entry-content h3:not(.hero-section *, .apsp-section-index *, .callout *, [class*="card"] *, .apsp-at-index *) { font-size: 1.5rem; }
body .apsp-comuni-page .entry-content h4:not(.hero-section *, .apsp-section-index *, .callout *, [class*="card"] *, .apsp-at-index *) { font-size: 1.375rem; }
body .apsp-comuni-page .entry-content h5:not(.hero-section *, .apsp-section-index *, .callout *, [class*="card"] *, .apsp-at-index *) { font-size: 1.25rem; }
body .apsp-comuni-page .entry-content h6:not(.hero-section *, .apsp-section-index *, .callout *, [class*="card"] *, .apsp-at-index *) { font-size: 1.125rem; }

body .apsp-comuni-page .entry-content > :is(h1, h2, h3, h4, h5, h6):first-child,
body .apsp-comuni-page .entry-content > section:first-child > :is(h1, h2, h3, h4, h5, h6):first-child {
	margin-top: 0;
}

@media (max-width: 767.98px) {
	body .apsp-comuni-page .entry-content :is(h1, h2):not(.hero-section *, .apsp-section-index *, .callout *, [class*="card"] *, .apsp-at-index *) { font-size: 1.5rem; }
	body .apsp-comuni-page .entry-content h3:not(.hero-section *, .apsp-section-index *, .callout *, [class*="card"] *, .apsp-at-index *) { font-size: 1.3rem; }
}

/* Testo scritto direttamente dentro riquadri (div/section) senza paragrafo: stesso corpo dei paragrafi. */
body .apsp-comuni-page .entry-content {
	font-size: 1.125rem;
	line-height: 1.555;
}

body .apsp-comuni-page .entry-content :is(section, div, blockquote):not(.hero-section, .hero-section *, .callout, .callout *)[style*="line-height"] {
	line-height: 1.555 !important;
}

/*
 * Riquadri «section.section» copiati dai siti Comuni: in Bootstrap Italia sono fasce da homepage
 * con 48–96px di spazio interno; dentro una pagina diventano blocchi di testo normali.
 */
body .apsp-comuni-page .entry-content section.section:not(.hero-section) {
	padding: 0;
	margin: 0 0 1rem;
	background: none;
}

body .apsp-comuni-page .entry-content p:empty {
	display: none;
}

/* Amministrazione trasparente su schermi stretti (indice sopra il testo): testo allineato a titolo e date. */
@media (max-width: 991.98px) {
	body.wp-theme-design-comuni-wordpress-theme main .apsp-at-page-row > .apsp-at-layout__main {
		padding-left: 0;
		padding-right: 0;
	}
}

/* Albo Avvisi e Albo Gare: colonna «Stato» abbastanza larga per ATTIVO / SCADUTO su una riga. */
body .albo-frontend .albo-table :is(th, td):nth-child(5),
body .albo-gare-table :is(th, td):nth-child(5) {
	width: 7.5rem;
	min-width: 7.5rem;
	white-space: nowrap;
	text-align: center;
}

body .albo-frontend .albo-table :is(th, td),
body .albo-gare-table :is(th, td) {
	word-break: normal;
	overflow-wrap: normal;
	hyphens: manual;
}

body .albo-frontend .albo-table :is(th, td):first-child {
	min-width: 8.5rem;
}

/*
 * Il CSS dell'Albo on-line nasconde ogni «.albo-table» sotto 768px (lì usa le schede): la tabella
 * Avvisi ha la stessa classe e su telefono spariva. Resta visibile, scorrevole in orizzontale.
 */
@media (max-width: 768px) {
	body .albo-frontend .albo-table {
		display: table !important;
		visibility: visible !important;
		min-width: 860px;
	}

	body .albo-frontend > div:has(> .albo-table) {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
}

/* Ricerca (pagina risultati e finestra in testata): Blu Italia al posto del verde del tema Comuni. */
body #search-form .btn-primary,
body .search-modal .btn-primary,
body #modal-categories .btn-primary {
	background-color: #0066cc !important;
	border-color: #0066cc !important;
	color: #fff !important;
}
body #search-form .btn-primary:hover,
body #search-form .btn-primary:focus,
body .search-modal .btn-primary:hover,
body .search-modal .btn-primary:focus,
body #modal-categories .btn-primary:hover,
body #modal-categories .btn-primary:focus {
	background-color: #0052a3 !important;
	border-color: #0052a3 !important;
}
body #search-form .input-group-text svg,
body .search-modal .form-group .input-group-prepend svg,
body .search-modal .form-group .autocomplete-icon .icon,
body .search-modal .modal-title .search-link svg,
body #search-form .rounded-icon svg {
	fill: #0066cc !important;
}
body #search-form .form-check [type=checkbox]:checked + label::after,
body #modal-categories .form-check [type=checkbox]:checked + label::after {
	border-color: #0066cc !important;
	background-color: #0066cc !important;
}
body #search-form .form-check [type=checkbox]:focus + label::after,
body #modal-categories .form-check [type=checkbox]:focus + label::after {
	border-color: #0066cc !important;
}
body #search-form .form-control:focus,
body .search-modal .form-control:focus {
	border-color: #0066cc !important;
	box-shadow: 0 1px 0 #0066cc !important;
}
body #search-form a.title-xsmall-semi-bold,
body #search-form .t-primary {
	color: #0066cc !important;
}
