/*
 * Alberto Patti - cio' che theme.json non sa esprimere.
 *
 * Sezioni:
 *   1. Icone (font mfn-icons ereditato da BeTheme, classi ap-icona-*)
 *   2. Header laterale (>= 1240px) e barra mobile (< 1240px)
 *   3. Contenuti: titoli nelle fasce scure, fascia titolo, separatore corto
 *   4. Stili di blocco: invito, link con linea, contatore, box contatti, riga foto
 *   5. Progetti: barra precedente/successivo, filtri, griglia, paginazione
 *   6. Modulo contatti (Contact Form 7)
 *   7. Footer e 404
 *
 * Le soglie ricalcano BeTheme: header laterale largo 250px, menu mobile sotto i 1240px.
 */

/* 1. Icone -------------------------------------------------------------- */

@font-face {
	font-family: 'mfn-icons';
	src: url(../fonts/mfn-icons.woff) format('woff');
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

.ap-icona::before {
	font-family: 'mfn-icons';
	font-style: normal;
	font-weight: 400;
	speak: never;
	display: inline-block;
	width: 1em;
	margin-right: .5em;
	text-align: center;
	line-height: 1;
}

/* Si aggiunge "ap-icona ap-icona-<nome>" in Avanzate > Classi CSS aggiuntive. */
.ap-icona-picture::before      { content: '\e8f6'; }
.ap-icona-users::before        { content: '\e94e'; }
.ap-icona-location::before     { content: '\e8c6'; }
.ap-icona-phone::before        { content: '\e8f4'; }
.ap-icona-layout::before       { content: '\e8b1'; }
.ap-icona-vcard::before        { content: '\e94f'; }
.ap-icona-back-in-time::before { content: '\e812'; }
.ap-icona-window::before       { content: '\e95a'; }
.ap-icona-doc-text::before     { content: '\e85d'; }
.ap-icona-cancel::before       { content: '\e82a'; }
.ap-icona-link::before         { content: '\e8c2'; }
.ap-icona-mail::before         { content: '\e8d0'; }
.ap-icona-traffic-cone::before { content: '\e93b'; }

/* 2. Header ------------------------------------------------------------- */

.ap-header-laterale {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 100;
	box-sizing: border-box;
	width: 250px;
	height: 100vh;
	padding: 65px 20px 30px;
	gap: 0 !important;
	background: #fff;
	box-shadow: 2px 0 4px 2px rgba(0, 0, 0, .15);
	overflow-y: auto;
}

.admin-bar .ap-header-laterale {
	top: 32px;
	height: calc(100vh - 32px);
}

.ap-header-laterale .ap-logo {
	margin: 0 0 70px;
}

.ap-menu-laterale .wp-block-navigation__container {
	gap: 19px;
	text-align: center;
}

.ap-header-laterale .ap-social {
	margin-top: auto;
	padding-top: 30px;
}

.ap-header-laterale .current-menu-item > a,
.ap-header-mobile .current-menu-item > a,
.ap-menu-laterale a:hover {
	color: #afafaf;
}

/* Larghezza del contenuto come in BeTheme: 1220px solo se accanto all'header
   ne restano almeno 1240 (finestra da 1490px), altrimenti 940px. Misurato
   sull'originale: 940px a 1400px di finestra, ~1176px a 1920. */
@media (max-width: 1489px) {
	:root {
		--wp--style--global--content-size: 940px;
		--wp--style--global--wide-size: 940px;
	}
}

/* Il contenuto e il footer si spostano a destra dell'header, come in BeTheme. */
@media (min-width: 1240px) {
	body {
		padding-left: 250px;
	}

	.ap-header-mobile {
		display: none !important;
	}
}

@media (max-width: 1239px) {
	.ap-header-laterale {
		display: none !important;
	}

	.ap-header-mobile {
		position: relative;
		justify-content: center !important;
		padding: 10px 20px;
		background: #fff;
	}

	/* Niente transform qui: un transform su un antenato fa da riferimento agli
	   elementi position:fixed, e l'overlay del menu (che deve coprire lo schermo)
	   si apriva schiacciato dentro i 24px del pulsante. */
	/* Solo il <nav>, figlio diretto: WordPress copia la classe ap-menu-mobile
	   anche sulla <ul> delle voci, e una regola generica la rendeva absolute. */
	.ap-header-mobile > nav.ap-menu-mobile {
		position: absolute;
		top: 0;
		bottom: 0;
		right: 20px;
		display: flex;
		align-items: center;
	}

	/* Menu aperto: voci in colonna, centrate, sotto la X di chiusura. */
	nav.ap-menu-mobile .wp-block-navigation__responsive-container.is-menu-open {
		background: #fff !important;
	}

	nav.ap-menu-mobile .is-menu-open .wp-block-navigation__responsive-container-content {
		align-items: center !important;
		padding-top: 70px !important;
	}

	nav.ap-menu-mobile .is-menu-open ul.wp-block-navigation__container {
		position: static !important;
		flex-direction: column !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
		gap: 24px !important;
	}

	nav.ap-menu-mobile .is-menu-open .wp-block-navigation-item__content {
		font-size: 18px;
		padding: 4px 0;
	}
}

/* 3. Contenuti ---------------------------------------------------------- */

/* Nelle fasce con testo chiaro i titoli seguono il colore del testo:
   in theme.json i titoli sono neri e resterebbero neri sul grigio scuro. */
.has-text-color :is(h1, h2, h3, h4, h5, h6):not(.has-text-color),
.has-text-color :is(h1, h2, h3, h4, h5, h6):not(.has-text-color) a {
	color: inherit;
}

.has-text-color .wp-block-social-links {
	color: inherit;
}

/* Il paragrafo "grande" di BeTheme (p.big): 16/28. */
.has-grande-font-size {
	line-height: 28px;
}

/* Le fasce a tutta larghezza si toccano, come le sezioni di BeTheme: niente
   spazio fra header, contenuto e footer ne' attorno ai blocchi "alignfull".
   Il resto dei blocchi e' distanziato di 40px, il margine sotto le colonne BeTheme. */
.wp-site-blocks > * + *,
.ap-principale > .wp-block-post-content > .alignfull,
.ap-principale > .wp-block-post-content > .alignfull + * {
	margin-block-start: 0;
}

.ap-principale > .wp-block-post-content > * + *:not(.alignfull) {
	margin-block-start: 40px;
}

.wp-block-column > * + * {
	margin-block-start: 15px;
}

.wp-block-columns {
	gap: 2em 40px;
}

.ap-fascia-titolo h1 {
	margin-bottom: 0;
}

.ap-fascia-titolo h5 {
	letter-spacing: 3px;
}

.wp-block-separator.is-style-corto {
	width: 7%;
	min-width: 40px;
	margin: 30px auto;
	border: 0;
	border-top: 1px solid currentColor;
	opacity: .3;
}

/* Media e testo dei servizi: il lato immagine non scende sotto i 400px. */
.wp-block-media-text.ap-servizio .wp-block-media-text__media {
	min-height: 400px;
}

.wp-block-media-text.ap-servizio .wp-block-media-text__content {
	padding: 50px 6% 10px;
}

/* Didascalie sotto l'immagine, grigie e centrate come in BeTheme (WordPress
   nelle gallerie le sovrappone alla foto con una sfumatura). */
.wp-block-image figcaption,
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
	position: static;
	margin: 0;
	padding: 6px 0;
	background: none;
	color: #a8a8a8;
	text-align: center;
	text-shadow: none;
	font-size: 13px;
	max-height: none;
	overflow: visible;
}

.wp-block-gallery.has-nested-images figure.wp-block-image:has(figcaption)::before {
	display: none;
}

.wp-block-gallery.has-nested-images figure.wp-block-image {
	flex-direction: column;
	background: #f7f7f7;
}

/* Spazio prima del footer dove il contenuto non finisce con una fascia piena. */
.single-portfolio .ap-principale,
.ap-archivio {
	padding-bottom: 60px;
}

/* Titoli ridotti sui telefoni, come faceva BeTheme ("font-size-responsive"). */
@media (max-width: 767px) {
	:root h1 {
		font-size: 40px;
		line-height: 44px;
		letter-spacing: 2px;
	}

	:root h2,
	:root .has-titolo-sezione-font-size {
		font-size: 30px !important;
		line-height: 1.15 !important;
	}

	:root h3 {
		font-size: 24px;
		line-height: 28px;
	}
}

/* 4. Stili di blocco ---------------------------------------------------- */

/* Invito: tutta la fascia e' cliccabile e schiarisce al passaggio. */
.is-style-invito {
	position: relative;
	transition: background-color .3s;
}

.is-style-invito a {
	color: inherit;
}

.is-style-invito a::after {
	content: '';
	position: absolute;
	inset: 0;
}

.is-style-invito:hover {
	background-color: var(--wp--preset--color--medio) !important;
}

/* Link con linea (fancy_link di BeTheme). */
.wp-block-button.is-style-linea .wp-block-button__link {
	position: relative;
	padding: 0 5px 12px;
	background: none;
	color: var(--wp--preset--color--nero);
	font-weight: 700;
	text-transform: uppercase;
}

.wp-block-button.is-style-linea .wp-block-button__link::after {
	content: '';
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 2px;
	background: currentColor;
	opacity: .3;
	transition: opacity .3s;
}

.wp-block-button.is-style-linea .wp-block-button__link:hover::after {
	opacity: .8;
}

/* Contatore: icona grande sopra il numero. */
.is-style-contatore {
	text-align: center;
}

.is-style-contatore.ap-icona::before {
	display: block;
	width: auto;
	margin: 0 auto 10px;
	font-size: 48px;
}

.is-style-contatore .ap-contatore__numero {
	margin: 0;
	font-family: var(--wp--preset--font-family--tinos);
	font-size: 48px;
	line-height: 1.1;
}

/* Box contatti (get_in_touch di BeTheme). */
.is-style-box-contatti {
	padding: 25px 20px 25px 30px;
}

.is-style-box-contatti p {
	position: relative;
	margin: 0;
	padding: 13px 0 13px 50px;
}

/* La linea divisoria sta su ::after: ::before e' gia' dell'icona. */
.is-style-box-contatti p + p::after {
	content: '';
	position: absolute;
	top: 0;
	left: -30px;
	width: 70px;
	border-top: 1px solid rgba(255, 255, 255, .2);
}

.is-style-box-contatti p.ap-icona::before {
	position: absolute;
	left: 0;
	top: 50%;
	margin: -12px 0 0;
	width: 30px;
	color: rgba(0, 0, 0, .7);
	font-size: 23px;
}

/* Riga foto della home: immagine a tutta larghezza, riquadro bianco al centro. */
.is-style-riga-foto {
	position: relative;
}

.is-style-riga-foto .wp-block-post-featured-image {
	margin: 0;
}

.is-style-riga-foto .wp-block-post-featured-image img {
	width: 100%;
	height: auto;
	display: block;
}

.is-style-riga-foto .ap-riga-foto__box {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	box-sizing: border-box;
	width: 240px;
	padding: 40px 30px;
	margin: 0 !important;
	text-align: center;
}

.is-style-riga-foto .ap-riga-foto__box .wp-block-post-title {
	margin: 0 0 12px;
	padding-bottom: 14px;
	border-bottom: 1px solid rgba(0, 0, 0, .08);
	font-size: 21px;
	line-height: 1.2;
}

.is-style-riga-foto .ap-riga-foto__box .wp-block-post-title a {
	color: var(--wp--preset--color--nero);
}

.is-style-riga-foto .ap-riga-foto__box .wp-block-post-terms {
	font-size: 10px;
	color: #a8a8a8;
}

.is-style-riga-foto .ap-riga-foto__box .wp-block-post-terms a {
	color: inherit;
}

/* Sui telefoni la foto e' bassa: la si alza e il riquadro si stringe. */
@media (max-width: 767px) {
	.is-style-riga-foto .wp-block-post-featured-image img {
		height: 280px;
		object-fit: cover;
	}

	.is-style-riga-foto .ap-riga-foto__box {
		width: 70%;
		padding: 20px 15px;
	}

	.is-style-riga-foto .ap-riga-foto__box .wp-block-post-title {
		font-size: 17px;
	}
}

.ap-righe-progetti .wp-block-post-template,
.ap-griglia .wp-block-post-template {
	gap: 0;
}

.ap-righe-progetti .wp-block-post-template > li {
	margin-block-start: 0;
}

/* Icone social dentro i contenuti (icon_bar di BeTheme): riquadri bianchi. */
.ap-icon-bar .wp-social-link {
	width: 44px;
	height: 44px;
	justify-content: center;
	border-radius: 0 !important;
	background: #fff !important;
	color: #444 !important;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}

.ap-icon-bar .wp-social-link:hover {
	background: #444 !important;
	color: #fff !important;
	transform: none;
}

/* 5. Progetti ----------------------------------------------------------- */

.ap-barra-progetto,
.ap-filtri {
	margin-top: 30px !important;
	margin-bottom: 60px !important;
	padding: 10px 15px;
	align-items: center;
	background-image: repeating-linear-gradient(-45deg, rgba(0, 0, 0, .025) 0 1px, transparent 1px 6px);
}

.ap-barra-progetto p,
.ap-filtri p {
	margin: 0;
	font-size: 12px;
}

.ap-frecce {
	gap: 6px;
}

.ap-frecce .post-navigation-link-previous a,
.ap-frecce .post-navigation-link-next a {
	display: block;
	width: 40px;
	height: 40px;
	line-height: 38px;
	text-align: center;
	background: #f7f7f7;
	border: 1px solid #e2e2e2;
	border-radius: 5px;
	color: #747474;
	font-size: 16px;
}

.ap-filtri__etichetta {
	color: #a8a8a8;
}

.ap-filtri__elenco {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ap-filtri__elenco li a {
	display: block;
	padding: 5px 10px;
	background: #fff;
	border: 1px solid #f7f7f7;
	color: #858585;
	font-size: 12px;
}

.ap-filtri__elenco li.current-cat a {
	background: #8b8b8b;
	color: #fff;
}

.ap-griglia .wp-block-post-template {
	gap: 0;
}

.ap-card {
	position: relative;
	overflow: hidden;
}

.ap-card .wp-block-post-featured-image {
	margin: 0;
}

.ap-card .wp-block-post-featured-image img {
	display: block;
	transition: transform .4s;
}

/* Il titolo compare al passaggio del mouse, sopra la foto. */
.ap-card .ap-card__titolo {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	margin: 0;
	padding: 15px 20px;
	background: rgba(255, 255, 255, .92);
	font-size: 15px;
	transform: translateY(100%);
	transition: transform .3s;
}

.ap-card:hover .ap-card__titolo,
.ap-card:focus-within .ap-card__titolo {
	transform: none;
}

.ap-card:hover .wp-block-post-featured-image img {
	transform: scale(1.03);
}

.ap-griglia .wp-block-query-pagination {
	margin-top: 25px;
	font-size: 13px;
}

.ap-griglia .wp-block-query-pagination-numbers .page-numbers {
	display: inline-block;
	min-width: 34px;
	padding: 7px 0;
	text-align: center;
	background: #f7f7f7;
	color: #a8a8a8;
}

.ap-griglia .wp-block-query-pagination-numbers .page-numbers.current {
	background: #808080;
	color: #fff;
	border-radius: 3px;
}

/* 6. Modulo contatti ---------------------------------------------------- */

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 10px;
	border: 1px solid #fff;
	background: #fff;
	color: #626262;
	font: inherit;
	font-size: 15px;
	transition: border-color .2s;
}

.wpcf7 textarea {
	min-height: 220px;
}

.wpcf7 ::placeholder {
	color: #929292;
}

.wpcf7 input:focus,
.wpcf7 textarea:focus {
	outline: none;
	border-color: #1982c2;
	color: #1982c2;
}

.wpcf7 input[type="submit"] {
	padding: 10px 20px;
	border: 0;
	border-radius: 3px;
	background: #808080;
	color: #fff;
	font: inherit;
	cursor: pointer;
}

.wpcf7 input[type="submit"]:hover {
	background: #6a6a6a;
}

.wpcf7 .wpcf7-acceptance {
	font-size: 12px;
}

.wpcf7 .wpcf7-not-valid-tip {
	font-size: 12px;
	color: #dc3232;
}

/* 7. Footer e 404 ------------------------------------------------------- */

.ap-footer a {
	color: #fff;
}

.ap-footer p {
	margin: 0;
}

.ap-social .wp-social-link {
	color: #bbb !important;
	background: none !important;
}

.ap-footer .ap-social .wp-social-link {
	color: #65666c !important;
}

.ap-social .wp-social-link:hover {
	color: #444 !important;
}

.ap-footer .ap-social .wp-social-link:hover {
	color: #fff !important;
}

.ap-iubenda {
	text-align: center;
}

.ap-errore__icona::before {
	font-size: 110px;
	width: auto;
	margin: 0;
	color: #808080;
}
