/* ==========================================================
	 STILE EDITORIALE UNIFICATO
	 Supporta:
	 - .box.box-content
	 - .editor-content
	 - classi TinyMCE generate da pulisci_html_tinymce()
	 ========================================================== */

/* ======= container box ======= */
.box {
	max-width: 1200px;
	margin: 0 auto;
	padding: 48px 56px;
	background: #ffffff;
	border-radius: 20px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* ======= scope editoriale condiviso ======= */
.box.box-content,
.editor-content {
	font-family: "Poppins", sans-serif;
	color: #4f5b52;
	font-size: 1.65rem;
	line-height: 1.9;
	letter-spacing: 0;
	word-break: break-word;
	overflow-wrap: break-word;
}

/* Reset margini primo/ultimo elemento */
.box.box-content>*:first-child,
.editor-content>*:first-child {
	margin-top: 0 !important;
}

.box.box-content>*:last-child,
.editor-content>*:last-child {
	margin-bottom: 0 !important;
}

/* ======= blocchi base ======= */
.box.box-content p,
.box.box-content ul,
.box.box-content ol,
.box.box-content blockquote,
.box.box-content pre,
.box.box-content table,
.box.box-content figure,
.box.box-content hr,
.editor-content p,
.editor-content .contenuto-paragrafo,
.editor-content ul,
.editor-content ol,
.editor-content .contenuto-lista,
.editor-content blockquote,
.editor-content .contenuto-citazione,
.editor-content pre,
.editor-content table,
.editor-content .tabella-contenuto,
.editor-content figure,
.editor-content hr {
	margin: 0 0 2rem;
}

/* ======= paragrafi ======= */
.box.box-content p,
.editor-content p,
.editor-content .contenuto-paragrafo {
	font-size: 1.65rem;
	line-height: 1.9;
	color: #4f5b52;
}

/* ======= titoli ======= */
.box.box-content h1,
.box.box-content h2,
.box.box-content h3,
.box.box-content h4,
.box.box-content h5,
.box.box-content h6,
.editor-content h1,
.editor-content h2,
.editor-content h3,
.editor-content h4,
.editor-content h5,
.editor-content h6,
.editor-content .contenuto-titolo {
	font-family: "Poppins", sans-serif;
	color: #2f4034;
	font-weight: 600;
	letter-spacing: -0.025em;
	line-height: 1.3;
	margin-top: 3.6rem;
	margin-bottom: 1.4rem;
}

/* H1 */
.box.box-content h1,
.editor-content h1 {
	font-size: 3.4rem;
	margin-top: 0;
	padding-bottom: 1rem;
	position: relative;
}

/* H2 */
.box.box-content h2,
.editor-content h2,
.editor-content h2.contenuto-titolo {
	font-size: 3.1rem;
	margin-top: 4.2rem;
	padding-bottom: 1rem;
	position: relative;
}

/* H3 */
.box.box-content h3,
.editor-content h3,
.editor-content h3.contenuto-titolo {
	font-size: 2.5rem;
	color: #37503d;
}

/* H4 */
.box.box-content h4,
.editor-content h4,
.editor-content h4.contenuto-titolo {
	font-size: 2rem;
	color: #3e5a45;
}

/* H5 */
.box.box-content h5,
.editor-content h5,
.editor-content h5.contenuto-titolo {
	font-size: 1.75rem;
	color: #45634d;
}

/* H6 */
.box.box-content h6,
.editor-content h6,
.editor-content h6.contenuto-titolo {
	font-size: 1.45rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--secondary);
}

/* Riga decorativa sotto h1 e h2 */
.box.box-content h1::after,
.box.box-content h2::after,
.editor-content h1::after,
.editor-content h2::after,
.editor-content h2.contenuto-titolo::after {
	content: "";
	display: block;
	width: 7rem;
	height: 0.3rem;
	margin-top: 1rem;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
}

/* ======= link ======= */
.box.box-content a,
.editor-content a,
.editor-content .contenuto-link {
	color: var(--secondary);
	font-weight: 500;
	text-decoration: none;
	border-bottom: 0.1rem solid rgba(65, 123, 73, 0.25);
	padding-bottom: 0.1rem;
	transition: color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

.box.box-content a:hover,
.box.box-content a:focus,
.editor-content a:hover,
.editor-content a:focus,
.editor-content .contenuto-link:hover,
.editor-content .contenuto-link:focus {
	color: var(--primary);
	border-bottom-color: var(--primary);
	text-decoration: none;
	outline: none;
}

.box.box-content a:active,
.editor-content a:active,
.editor-content .contenuto-link:active {
	opacity: 0.85;
}

/* ======= enfasi ======= */
.box.box-content strong,
.editor-content strong {
	color: #2f4034;
	font-weight: 600;
}

.box.box-content em,
.editor-content em {
	color: #5c6a61;
	font-style: italic;
}

/* ======= liste ======= */
.box.box-content ul,
.box.box-content ol,
.editor-content ul,
.editor-content ol,
.editor-content .contenuto-lista {
	padding-left: 0;
	color: #4f5b52;
}

/* Liste unordered */
.box.box-content ul,
.editor-content ul,
.editor-content ul.contenuto-lista {
	list-style: none;
}

.box.box-content ul li,
.editor-content ul li,
.editor-content ul.contenuto-lista li {
	position: relative;
	padding-left: 2.4rem;
	margin-bottom: 1rem;
	line-height: 1.8;
}

.box.box-content ul li::before,
.editor-content ul li::before,
.editor-content ul.contenuto-lista li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.95rem;
	width: 0.8rem;
	height: 0.8rem;
	border-radius: 50%;
	background: var(--primary);
	box-shadow: 0 0 0 0.35rem rgba(76, 145, 86, 0.12);
}

/* Liste ordered */
.box.box-content ol,
.editor-content ol,
.editor-content ol.contenuto-lista {
	list-style: none;
}

.box.box-content ol {
	counter-reset: box-counter;
}

.editor-content ol,
.editor-content ol.contenuto-lista {
	counter-reset: editor-counter;
}

.box.box-content ol li,
.editor-content ol li,
.editor-content ol.contenuto-lista li {
	position: relative;
	padding-left: 3.8rem;
	margin-bottom: 1rem;
	line-height: 1.8;
}

.box.box-content ol li {
	counter-increment: box-counter;
}

.editor-content ol li,
.editor-content ol.contenuto-lista li {
	counter-increment: editor-counter;
}

.box.box-content ol li::before,
.editor-content ol li::before,
.editor-content ol.contenuto-lista li::before {
	position: absolute;
	left: 0;
	top: 0.1rem;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--secondary);
	background: var(--primary-soft);
	border: 0.1rem solid rgba(76, 145, 86, 0.18);
}

.box.box-content ol li::before {
	content: counter(box-counter);
}

.editor-content ol li::before,
.editor-content ol.contenuto-lista li::before {
	content: counter(editor-counter);
}

/* Liste annidate */
.box.box-content ul ul,
.box.box-content ul ol,
.box.box-content ol ul,
.box.box-content ol ol,
.editor-content ul ul,
.editor-content ul ol,
.editor-content ol ul,
.editor-content ol ol {
	margin-top: 1rem;
	margin-bottom: 0.6rem;
}

/* ======= blockquote ======= */
.box.box-content blockquote,
.editor-content blockquote,
.editor-content .contenuto-citazione {
	position: relative;
	margin: 3rem 0;
	padding: 2.6rem 2.6rem 2.4rem 3rem;
	background: linear-gradient(180deg, #fbfdfb 0%, #f3f8f4 100%);
	border-left: 0.35rem solid var(--primary);
	border-radius: 0.6rem;
	color: #4a574f;
	font-size: 1.75rem;
	line-height: 1.85;
	font-weight: 300;
}

.box.box-content blockquote::before,
.editor-content blockquote::before,
.editor-content .contenuto-citazione::before {
	content: "“";
	position: absolute;
	left: 1.2rem;
	top: 0.2rem;
	font-size: 5rem;
	line-height: 1;
	color: rgba(76, 145, 86, 0.14);
	font-weight: 700;
}

.box.box-content blockquote p:last-child,
.editor-content blockquote p:last-child,
.editor-content .contenuto-citazione p:last-child {
	margin-bottom: 0;
}

/* ======= codice ======= */
.box.box-content code,
.editor-content code {
	padding: 0.2rem 0.6rem;
	border-radius: 0.8rem;
	background: rgba(0, 0, 0, 0.04);
	font-size: 0.92em;
}

.box.box-content pre,
.editor-content pre {
	padding: 1.6rem;
	border-radius: 1.2rem;
	background: rgba(0, 0, 0, 0.035);
	overflow-x: auto;
}

.box.box-content pre code,
.editor-content pre code {
	padding: 0;
	background: transparent;
	border-radius: 0;
}

/* ======= immagini ======= */
.box.box-content figure,
.editor-content figure {
	margin: 3rem 0 2.2rem;
}

.box.box-content img,
.editor-content img,
.editor-content .contenuto-immagine {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0 auto;
	border-radius: 0.4rem;
	background: #ffffff;
	box-shadow: 0 10px 28px rgba(25, 40, 29, 0.08);
}

.box.box-content figcaption,
.editor-content figcaption {
	margin-top: 1rem;
	font-size: 1.3rem;
	line-height: 1.6;
	text-align: center;
	color: #7a867d;
	font-style: italic;
}

/* ======= tabelle ======= */
.box.box-content table,
.editor-content table,
.editor-content .tabella-contenuto {
	width: 100%;
	margin: 3rem 0;
	border-collapse: collapse;
	background: #ffffff;
	border-radius: 0.4rem;
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.box.box-content table th,
.box.box-content table td,
.editor-content table th,
.editor-content table td,
.editor-content .tabella-contenuto th,
.editor-content .tabella-contenuto td {
	padding: 1.3rem 1.5rem;
	text-align: left;
	vertical-align: top;
	font-size: 1.45rem;
	line-height: 1.65;
	border-bottom: 0.1rem solid #edf2ee;
}

.box.box-content table thead th,
.editor-content table thead th,
.editor-content .tabella-contenuto thead th {
	background: linear-gradient(180deg, #f3f8f4 0%, #ebf4ed 100%);
	color: var(--secondary);
	font-weight: 600;
	border-bottom: 0.1rem solid rgba(76, 145, 86, 0.2);
}

.box.box-content table tbody tr:nth-child(even),
.editor-content table tbody tr:nth-child(even),
.editor-content .tabella-contenuto tbody tr:nth-child(even) {
	background: #fcfdfc;
}

.box.box-content table tbody tr:hover,
.editor-content table tbody tr:hover,
.editor-content .tabella-contenuto tbody tr:hover {
	background: #f6faf7;
}

.box.box-content table tbody tr:last-child td,
.editor-content table tbody tr:last-child td,
.editor-content .tabella-contenuto tbody tr:last-child td {
	border-bottom: 0;
}

/* ======= separatore ======= */
.box.box-content hr,
.editor-content hr {
	border: 0;
	height: 0.1rem;
	margin: 3.2rem 0;
	background: linear-gradient(90deg,
			rgba(76, 145, 86, 0) 0%,
			rgba(76, 145, 86, 0.28) 50%,
			rgba(76, 145, 86, 0) 100%);
}

/* ======= spaziature intelligenti ======= */
.box.box-content h1+p,
.box.box-content h2+p,
.box.box-content h3+p,
.box.box-content h4+p,
.box.box-content h5+p,
.box.box-content h6+p,
.editor-content h1+p,
.editor-content h2+p,
.editor-content h3+p,
.editor-content h4+p,
.editor-content h5+p,
.editor-content h6+p,
.editor-content h1+.contenuto-paragrafo,
.editor-content h2+.contenuto-paragrafo,
.editor-content h3+.contenuto-paragrafo,
.editor-content h4+.contenuto-paragrafo,
.editor-content h5+.contenuto-paragrafo,
.editor-content h6+.contenuto-paragrafo,
.editor-content .contenuto-titolo+.contenuto-paragrafo {
	margin-top: 0.2rem;
}

.box.box-content p+ul,
.box.box-content p+ol,
.editor-content p+ul,
.editor-content p+ol,
.editor-content .contenuto-paragrafo+.contenuto-lista {
	margin-top: -0.5rem;
}

/* ======= responsive ======= */
@media screen and (max-width: 767px) {
	.box {
		padding: 28px 22px;
		border-radius: 16px;
	}

	.box.box-content,
	.editor-content {
		font-size: 1.5rem;
		line-height: 1.8;
	}

	.box.box-content p,
	.editor-content p,
	.editor-content .contenuto-paragrafo {
		font-size: 1.5rem;
		line-height: 1.8;
		margin-bottom: 1.7rem;
	}

	.box.box-content h1,
	.editor-content h1 {
		font-size: 2.8rem;
	}

	.box.box-content h2,
	.editor-content h2,
	.editor-content h2.contenuto-titolo {
		font-size: 2.5rem;
		margin-top: 3.4rem;
	}

	.box.box-content h3,
	.editor-content h3,
	.editor-content h3.contenuto-titolo {
		font-size: 2.1rem;
	}

	.box.box-content h4,
	.editor-content h4,
	.editor-content h4.contenuto-titolo {
		font-size: 1.8rem;
	}

	.box.box-content blockquote,
	.editor-content blockquote,
	.editor-content .contenuto-citazione {
		padding: 2.2rem 1.8rem 2rem 2.4rem;
		font-size: 1.55rem;
		line-height: 1.75;
	}

	.box.box-content table,
	.editor-content table,
	.editor-content .tabella-contenuto {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		white-space: nowrap;
	}
}