/* Costruire Digitale – versione per smartphone (sotto gli 820 px).
   Per i blocchi di struttura diversa esistono due versioni nel codice, una per computer e una per smartphone:
   la classe .cd-only-mobile si vede solo sul telefono, .cd-only-desktop solo sul computer. Le altre parti si adattano con le regole qui sotto. */

/* ---------- utilità: mostra/nascondi in base al dispositivo ---------- */
@media (min-width: 821px) { .cd-only-mobile { display: none !important; } }
@media (max-width: 820px) { .cd-only-desktop { display: none !important; } }
.elementor-editor-active .cd-only-mobile, .elementor-editor-active .cd-only-desktop { display: flex !important; outline: 2px dashed var(--cd-primary); outline-offset: 4px; }

/* parti per smartphone: nascoste su computer */
.cd-mhead, .cd-mmenu, .cd-mbar, .cd-mfooter { display: none; }

@media (max-width: 820px) {
	html { scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
	html.cd-mmenu-open, html.cd-mmenu-open body { overflow: hidden; }
	body { font-size: 17px; line-height: 1.65; padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); overflow-wrap: break-word; }

	/* ======== intestazione ======== */
	.site-header, .cd-burger { display: none !important; }
	.cd-mhead { display: flex; position: fixed; z-index: 85; top: 0; left: 0; right: 0; height: calc(64px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 12px 0 14px; box-sizing: border-box; align-items: center; justify-content: space-between; gap: 10px;
		background: rgba(6, 6, 12, .9); -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3); border-bottom: 1px solid rgba(199, 196, 240, .22);
		transition: transform .35s var(--cd-ease), background .3s; }
	.cd-mhead.cd-hide { transform: translateY(-100%); }
	.cd-mhead.cd-scrolled { box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
	.cd-mhead-brand { display: block; line-height: 0; }
	.cd-mhead-brand img { height: 40px; width: auto; display: block; filter: drop-shadow(0 0 10px rgba(138, 145, 226, .45)); }
	.cd-mhead-actions { display: flex; align-items: center; gap: 10px; }
	.cd-mhead-cta { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--cd-primary); color: #000 !important; font-weight: 700; font-size: .95rem; text-decoration: none; }
	.cd-mtoggle { position: relative; width: 48px; height: 48px; padding: 0; border-radius: 50%; border: 1px solid rgba(199, 196, 240, .45); background: rgba(255, 255, 255, .08); cursor: pointer; -webkit-tap-highlight-color: transparent; }
	.cd-mtoggle span { position: absolute; left: 14px; right: 14px; height: 2px; border-radius: 2px; background: #fff; transition: transform .3s var(--cd-ease), opacity .2s; }
	.cd-mtoggle span:nth-child(1) { top: 17px; } .cd-mtoggle span:nth-child(2) { top: 23px; } .cd-mtoggle span:nth-child(3) { top: 29px; }
	html.cd-mmenu-open .cd-mtoggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
	html.cd-mmenu-open .cd-mtoggle span:nth-child(2) { opacity: 0; }
	html.cd-mmenu-open .cd-mtoggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

	/* ======== menu a schermo intero ======== */
	.cd-mmenu { display: flex; flex-direction: column; position: fixed; z-index: 95; inset: 0; box-sizing: border-box; overflow-y: auto; -webkit-overflow-scrolling: touch;
		padding: calc(10px + env(safe-area-inset-top, 0px)) 22px calc(20px + env(safe-area-inset-bottom, 0px)); color: #fff;
		background: radial-gradient(90% 55% at 100% 0%, rgba(138, 145, 226, .38), transparent 65%), linear-gradient(rgba(199, 196, 240, .05) 1px, transparent 1px) 0 0 / 100% 48px, #05050b;
		visibility: hidden; opacity: 0; transform: translateY(-14px); transition: opacity .3s ease, transform .4s var(--cd-ease), visibility 0s linear .4s; }
	html.cd-mmenu-open .cd-mmenu { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
	.cd-mmenu-top { display: flex; align-items: center; justify-content: space-between; height: 54px; flex: none; }
	.cd-mclose { position: relative; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(199, 196, 240, .45); background: rgba(255, 255, 255, .08); cursor: pointer; }
	.cd-mclose span { position: absolute; left: 14px; right: 14px; top: 23px; height: 2px; background: #fff; border-radius: 2px; }
	.cd-mclose span:nth-child(1) { transform: rotate(45deg); } .cd-mclose span:nth-child(2) { transform: rotate(-45deg); }
	.cd-mnav { flex: 1 0 auto; padding: 18px 0 10px; }
	.cd-mnav ul { list-style: none; margin: 0; padding: 0; }
	.cd-mnav > ul > li { border-bottom: 1px solid rgba(199, 196, 240, .16); opacity: 0; translate: 0 16px; transition: opacity .4s ease, translate .5s var(--cd-ease); transition-delay: 0s; }
	html.cd-mmenu-open .cd-mnav > ul > li { opacity: 1; translate: none; transition-delay: calc(80ms + var(--i, 0) * 55ms); }
	.cd-mlink { display: flex; align-items: center; justify-content: space-between; width: 100%; box-sizing: border-box; min-height: 64px; padding: 12px 2px; background: none; border: 0; color: #fff !important; font: 700 1.55rem/1.2 var(--cd-font); letter-spacing: -.01em; text-align: left; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
	.cd-mlink[aria-current="page"] { color: var(--cd-primary) !important; }
	.cd-msub-toggle i { width: 12px; height: 12px; border: solid currentColor; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-3px, -3px); transition: transform .3s var(--cd-ease); margin-right: 6px; }
	.cd-msub.cd-open .cd-msub-toggle i { transform: rotate(-135deg) translate(-3px, -3px); }
	.cd-msub-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--cd-ease); }
	.cd-msub.cd-open .cd-msub-wrap { grid-template-rows: 1fr; }
	.cd-msub-list { overflow: hidden; padding-left: 14px !important; border-left: 2px solid var(--cd-primary); margin: 0 0 0 2px !important; }
	.cd-msub.cd-open .cd-msub-list { margin-bottom: 14px !important; }
	.cd-mlink-sub { min-height: 52px; font-size: 1.2rem; font-weight: 500; color: var(--cd-secondary) !important; }
	.cd-mlink-sub[aria-current="page"] { color: #fff !important; }
	.cd-mmenu-foot { flex: none; display: grid; gap: 12px; padding-top: 10px; }
	.cd-mcta { display: flex; align-items: center; justify-content: space-between; min-height: 60px; padding: 0 24px; border-radius: 999px; background: var(--cd-primary); color: #000 !important; font-weight: 700; font-size: 1.05rem; text-decoration: none; }
	.cd-mquick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
	.cd-mquick a { display: flex; align-items: center; justify-content: center; min-height: 54px; border-radius: 999px; border: 1px solid rgba(199, 196, 240, .5); color: #fff !important; font-weight: 600; font-size: 1rem; text-decoration: none; }

	/* ======== barra d'azione in basso ======== */
	.cd-mbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; z-index: 84; left: 0; right: 0; bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); background: rgba(6, 6, 12, .94);
		-webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid rgba(199, 196, 240, .25); box-shadow: 0 -10px 30px rgba(0, 0, 0, .35); }
	.cd-mbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 62px; color: #fff !important; font-size: .82rem; font-weight: 500; text-decoration: none; -webkit-tap-highlight-color: transparent; }
	.cd-mbar a:active { background: rgba(138, 145, 226, .25); }
	.cd-mbar svg { width: 22px; height: 22px; fill: var(--cd-secondary); }
	html.cd-mmenu-open .cd-mbar, html.cd-modal-open .cd-mbar, html.cd-kbd .cd-mbar, html.cd-splash-lock .cd-mbar { display: none; }
	.cd-tray { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); max-width: calc(100% - 24px); }

	/* ======== piè di pagina a fisarmoniche ======== */
	.cd-footer { display: none !important; }
	.cd-mfooter { display: block; position: relative; padding: 32px 20px 26px; background: #000; color: #fff; border-top: 1px solid var(--cd-line); }
	.cd-mf-id { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
	.cd-mf-id strong { color: var(--cd-primary); font-size: 1.05rem; line-height: 1.25; }
	.cd-mf-id .cd-footer-logo { height: 48px; width: 48px; flex: none; display: block; }
	.cd-mf-id .cd-footer-iqua { height: 56px; width: 56px; flex: none; margin-left: auto; border-radius: 12px; display: block; }
	.cd-mf-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
	.cd-mf-quick a { display: flex; align-items: center; justify-content: center; min-height: 54px; border-radius: 14px; border: 1px solid var(--cd-primary); color: #fff !important; font-weight: 600; text-decoration: none; }
	.cd-mf-acc { border-bottom: 1px solid var(--cd-line); }
	.cd-mf-acc summary { display: flex; align-items: center; justify-content: space-between; min-height: 58px; font-weight: 600; font-size: 1.05rem; cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
	.cd-mf-acc summary::-webkit-details-marker { display: none; }
	.cd-mf-acc summary::after { content: ''; width: 10px; height: 10px; border: solid var(--cd-secondary); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .25s var(--cd-ease); margin-right: 4px; }
	.cd-mf-acc[open] summary::after { transform: rotate(-135deg); }
	.cd-mf-body { padding: 0 0 18px; }
	.cd-mf-body p { margin: 0 0 .9em; font-size: .98rem; line-height: 1.7; color: #d9d7f2; }
	.cd-mf-body a { display: inline-block; min-height: 44px; padding: 10px 0; color: #fff; }
	.cd-mf-legal { padding-top: 18px; font-size: .9rem; color: #bdbbe0; }
	.cd-mf-legal p { margin: 0; }
	.cd-mf-legal a { display: inline-block; padding: 12px 4px; min-height: 44px; box-sizing: border-box; color: #fff; }

	/* ======== pagine ======== */
	.cd-band { padding: 52px 20px; }
	.cd-band.cd-hero { padding-top: calc(104px + env(safe-area-inset-top, 0px)); padding-bottom: 48px; min-height: 0; }
	.cd-hero h1, .cd-home-hero h1 { font-size: clamp(2.1rem, 10.5vw, 2.9rem); line-height: 1.08; hyphens: auto; -webkit-hyphens: auto; }
	.cd-band h2 { font-size: clamp(1.55rem, 7vw, 1.95rem); line-height: 1.15; }
	.cd-band h3 { font-size: 1.25rem; }
	.cd-lead, .cd-lead p { font-size: 1.08rem; line-height: 1.6; }
	.cd-band .elementor-widget-text-editor p, .cd-band .elementor-widget-text-editor li { max-width: none; font-size: 1rem; line-height: 1.7; }
	.elementor-widget-text-editor img, .elementor-widget-image img, .cd-band img { max-width: 100%; height: auto; }
	.elementor-widget-button { width: 100%; }
	.elementor-button { min-height: 54px; padding: 14px 22px; font-size: 1rem; justify-content: center; width: 100%; box-sizing: border-box; }
	.cd-contact-buttons { flex-direction: column !important; align-items: stretch; gap: 12px; }
	.cd-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
	.cd-stats .elementor-counter-title { font-size: .82rem; line-height: 1.35; }
	.cd-stats .elementor-counter-number-wrapper { font-size: 2.4rem; }
	.cd-marquee p { font-size: .8rem; }
	.cd-grid { grid-template-columns: 1fr !important; gap: 16px; }
	.cd-card { padding: 22px; }
	.elementor-widget-google_maps iframe, .cd-map { width: 100%; min-height: 280px; border-radius: 16px; }
	.elementor-tabs .elementor-tab-title { min-height: 48px; font-size: 1rem; }
	.cd-countdown-date { font-size: .9rem !important; }
	.cd-countdown-grid div { font-size: .85rem; }

	/* moduli: campi grandi, testo da 16 px (niente zoom automatico su iPhone), bersagli da 48 px */
	.cd-field label, .cd-field legend { font-size: 1rem; }
	.cd-field input[type=text], .cd-field input[type=email], .cd-field input[type=tel], .cd-field select, .cd-field textarea { font-size: 16px; min-height: 54px; padding: 14px 16px; border-radius: 14px; }
	.cd-chip-opt span { min-height: 48px; display: inline-flex; align-items: center; font-size: 1rem; }
	.cd-inline { align-items: center; gap: 14px; padding: 8px 0; }
	.cd-inline a { display: inline-block; padding: 10px 4px; margin: -10px -4px; }
	.cd-band a[href^="mailto:"]:not(.elementor-button), .cd-band a[href^="tel:"]:not(.elementor-button), .cd-band .elementor-widget-text-editor a[href^="http"]:not(.elementor-button) { display: inline-block; padding: 7px 0; }
	.cd-inline input, .cd-field input[type=checkbox], .cd-field input[type=radio] { width: 26px; height: 26px; }
	.cd-nav button, .cd-submit, .cd-next, .cd-back { min-height: 54px; font-size: 1rem; }
	.cd-st { font-size: .82rem; }
	.cd-hint, .cd-error, .cd-group-title { font-size: .9rem; }
	.cd-modal-close { width: 48px; height: 48px; }
}

/* telefoni molto stretti */
@media (max-width: 360px) {
	.cd-mhead-cta { display: none; }
	.cd-mlink { font-size: 1.4rem; }
	.cd-band { padding-left: 16px; padding-right: 16px; }
}

/* telefono in orizzontale: barra in basso più bassa, menu a due colonne di spazio */
@media (max-width: 820px) and (orientation: landscape) and (max-height: 480px) {
	.cd-mbar a { min-height: 48px; flex-direction: row; gap: 8px; }
	.cd-mlink { min-height: 52px; font-size: 1.25rem; }
	.cd-band.cd-hero { padding-top: 90px; }
}

@media (prefers-reduced-motion: reduce) {
	.cd-mhead, .cd-mmenu, .cd-mmenu *, .cd-mtoggle span, .cd-msub-wrap { transition: none !important; }
}
