/* ==========================================================================
   MPconsulting - foglio di stile unico (mobile first)
   ========================================================================== */

:root {
	--c-primary: #0b3a66;		/* blu istituzionale (ex #003665) */
	--c-primary-dark: #072845;
	--c-accent: #0a8fd0;		/* azzurro link (ex #059BD8) */
	--c-accent-dark: #076fa3;
	--c-warm: #e8930c;			/* arancio moduli (ex #efa118) */
	--c-text: #1f2933;
	--c-muted: #5b6875;
	--c-border: #dde3ea;
	--c-bg: #f3f5f8;
	--c-surface: #ffffff;
	--c-dark: #1d232b;
	--radius: 12px;
	--radius-sm: 8px;
	--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
	--shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
	--wrap: 1120px;
	--gutter: clamp(16px, 4vw, 32px);
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset essenziale ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { transition: none !important; animation: none !important; }
}
body {
	margin: 0;
	font: 16px/1.6 var(--font);
	color: var(--c-text);
	background: var(--c-bg);
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
}
main { flex: 1; }
img, svg { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--c-primary); margin: 0 0 .5em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.85rem); letter-spacing: -.01em; }
h3 { font-size: 1.125rem; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
a { color: var(--c-accent-dark); text-underline-offset: 2px; }
a:hover { color: var(--c-primary); }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; border-radius: 4px; }
address { font-style: normal; }
.visually-hidden {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 200; background: var(--c-primary); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; color: #fff; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header e navigazione ---------- */
.site-header {
	position: sticky; top: 0; z-index: 100;
	background: rgba(255, 255, 255, .92);
	-webkit-backdrop-filter: saturate(180%) blur(10px);
	backdrop-filter: saturate(180%) blur(10px);
	border-bottom: 1px solid var(--c-border);
}
.header-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 44px; height: 44px; }
.brand-name { font-size: 1.35rem; font-weight: 700; color: var(--c-primary); letter-spacing: -.02em; }
.brand-name span { color: var(--c-accent); font-weight: 600; }

.nav-toggle {
	display: inline-flex; align-items: center; justify-content: center;
	width: 44px; height: 44px; padding: 0;
	border: 1px solid var(--c-border); border-radius: var(--radius-sm);
	background: var(--c-surface); color: var(--c-primary); cursor: pointer;
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
	display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px;
	position: relative; transition: transform .2s, background-color .2s;
}
.nav-toggle-bar::before, .nav-toggle-bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }
.nav-open .nav-toggle-bar { background: transparent; }
.nav-open .nav-toggle-bar::before { transform: translateY(6px) rotate(45deg); }
.nav-open .nav-toggle-bar::after { transform: translateY(-6px) rotate(-45deg); }

.site-nav { display: none; flex-basis: 100%; }
.nav-open .site-nav { display: block; max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); overflow-y: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a {
	display: block; padding: 12px 4px; text-decoration: none;
	color: var(--c-text); font-weight: 600;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--c-accent-dark); }
.nav-list { padding: 4px 0 16px; border-top: 1px solid var(--c-border); }
.nav-list > li + li { border-top: 1px solid var(--c-border); }
.submenu { padding-left: 16px !important; padding-bottom: 8px !important; }
.submenu a { font-weight: 500; padding: 8px 4px; color: var(--c-muted); }
.nav-cta a { color: var(--c-accent-dark); }

@media (min-width: 900px) {
	.nav-toggle { display: none; }
	.site-nav, .nav-open .site-nav { display: block; flex-basis: auto; max-height: none; overflow: visible; }
	.nav-list { display: flex; align-items: center; gap: 4px; padding: 0; border: 0; }
	.nav-list > li { position: relative; }
	.nav-list > li + li { border: 0; }
	.nav-list > li > a { padding: 8px 12px; border-radius: var(--radius-sm); }
	.nav-list > li > a:hover { background: var(--c-bg); }
	.has-sub > a::after {
		content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 3px 8px;
		border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
	}
	.submenu {
		position: absolute; top: 100%; left: 0; min-width: 220px;
		padding: 8px !important; background: var(--c-surface);
		border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
		opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .15s, transform .15s, visibility .15s;
	}
	.has-sub:hover > .submenu, .has-sub:focus-within > .submenu { opacity: 1; visibility: visible; transform: none; }
	.submenu a { padding: 8px 12px; border-radius: 6px; color: var(--c-text); }
	.submenu a:hover { background: var(--c-bg); }
	.nav-cta a { background: var(--c-accent); color: #fff !important; margin-left: 8px; }
	.nav-cta a:hover { background: var(--c-accent-dark) !important; }
}

/* ---------- Bottoni ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 46px; padding: 10px 22px;
	font: 600 1rem/1.2 var(--font); text-decoration: none; text-align: center;
	color: #fff; background: var(--c-accent); border: 2px solid var(--c-accent); border-radius: 999px;
	cursor: pointer; transition: background-color .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover { background: var(--c-accent-dark); border-color: var(--c-accent-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .6); }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.btn-outline { background: transparent; color: var(--c-accent-dark); border-color: var(--c-accent); }
.btn-outline:hover { background: var(--c-accent); color: #fff; }
.btn-sm { min-height: 38px; padding: 6px 16px; font-size: .9rem; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Sezioni ---------- */
.hero {
	color: #fff;
	background:
		radial-gradient(1200px 400px at 85% -10%, rgba(10, 143, 208, .55), transparent 60%),
		linear-gradient(135deg, var(--c-primary-dark), var(--c-primary) 55%, #0f5a92);
	padding: clamp(48px, 8vw, 96px) 0;
}
.hero h1 { color: #fff; max-width: 20ch; }
.hero p { font-size: clamp(1.05rem, 1rem + .4vw, 1.25rem); color: rgba(255, 255, 255, .88); max-width: 60ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #9fd8f5; margin-bottom: 12px; }

.page-head { background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding: clamp(28px, 5vw, 48px) 0; }
.page-head h1 { margin-bottom: .25em; }
.page-head p { color: var(--c-muted); max-width: 70ch; font-size: 1.075rem; }

.section { padding: clamp(36px, 6vw, 72px) 0; }
.section + .section { padding-top: 0; }
.section-title { margin-bottom: 1.25em; }
.section-title p { color: var(--c-muted); }
.lead { font-size: 1.1rem; color: var(--c-muted); }
.highlight { color: #c0262d; font-weight: 700; }

/* ---------- Griglie e card ---------- */
.grid { display: grid; gap: clamp(16px, 2.5vw, 24px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }

.card {
	background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
	padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow);
	display: flex; flex-direction: column;
}
.card h3 { margin-bottom: .4em; }
.card p { color: var(--c-muted); }
.card .card-foot { margin-top: auto; padding-top: 16px; }
.card-icon { width: 56px; height: 56px; object-fit: contain; margin-bottom: 14px; }
.card-num { font-size: .8rem; font-weight: 700; color: var(--c-accent); letter-spacing: .08em; }

.feature { display: flex; gap: 16px; align-items: flex-start; }
.feature img { flex: 0 0 48px; width: 48px; height: 48px; object-fit: contain; }
.feature h3 { margin-bottom: .25em; }
.feature p { color: var(--c-muted); margin: 0; }

.panel { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: clamp(20px, 4vw, 36px); box-shadow: var(--shadow); }
.prose { max-width: 75ch; }
.prose h2 { margin-top: 1.6em; }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.25em; }
.prose li { margin-bottom: .35em; }

.callout {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
	background: linear-gradient(135deg, #e9f6fd, #f3f9fd); border: 1px solid #cfe9f7;
	border-radius: var(--radius); padding: clamp(20px, 4vw, 32px);
}
.callout h2 { margin: 0 0 .2em; font-size: 1.35rem; }
.callout p { margin: 0; color: var(--c-muted); }

.creds { display: inline-grid; grid-template-columns: auto auto; gap: 2px 12px; background: var(--c-bg); border-radius: var(--radius-sm); padding: 10px 14px; margin: 4px 0 12px; font-size: .95rem; }
.creds dt { color: var(--c-muted); }
.creds dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 600; }

.tech-list { list-style: none; padding: 0; margin: 0; }
.tech-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--c-border); }
.tech-list li span:first-child { color: var(--c-muted); }
.tech-list li span:last-child { font-weight: 600; text-align: right; }

/* ---------- Download ---------- */
.file-list { list-style: none; padding: 0; margin: 12px 0 0; }
.file-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--c-border); }
.file-list .file-info { flex: 1; min-width: 0; }
.file-list .file-name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.file-list .file-meta { display: block; font-size: .85rem; color: var(--c-muted); }
.file-list .btn { flex: 0 0 auto; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #e3f4e8; color: #17663a; }

details { border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-bg); margin-top: 14px; }
details summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--c-primary); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--c-accent); }
details[open] summary::after { content: "\2212"; }
details .details-body { padding: 0 16px 16px; font-size: .95rem; }
details .details-body ol, details .details-body ul { padding-left: 1.25em; margin: 0 0 1em; }
details .details-body li { margin-bottom: .3em; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; background: rgba(11, 58, 102, .07); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }

/* ---------- Galleria screenshot ---------- */
.gallery-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.gallery { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); margin: 16px 0 8px; }
.shot { margin: 0; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.shot a { display: block; text-decoration: none; color: inherit; }
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top left; transition: transform .3s; background: var(--c-bg); }
.shot a:hover img { transform: scale(1.03); }
.shot figcaption { padding: 12px 14px; font-size: .9rem; color: var(--c-muted); }
.shot figcaption strong { display: block; color: var(--c-text); font-size: 1rem; }
.gallery-group { scroll-margin-top: 80px; }
.gallery-group + .gallery-group { margin-top: clamp(32px, 5vw, 56px); }

.lightbox {
	width: min(96vw, 1240px); max-height: 94vh; padding: 0; border: 0; border-radius: var(--radius);
	background: #0d1117; color: #e6edf3; box-shadow: var(--shadow-lg); overflow: hidden;
}
.lightbox::backdrop { background: rgba(5, 10, 18, .82); }
.lightbox-media { max-height: calc(94vh - 64px); overflow: auto; overscroll-behavior: contain; background: #0d1117; }
.lightbox img { display: block; width: 100%; max-height: calc(94vh - 64px); object-fit: contain; background: #0d1117; }
/* su smartphone la schermata resta leggibile: larga 960px e si scorre col dito */
@media (max-width: 700px) {
	.lightbox-media img { width: 960px; max-width: none; max-height: none; }
}
.lightbox-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.lightbox-caption { flex: 1; font-size: .9rem; min-width: 0; }
.lightbox-caption strong { margin-right: 8px; }
.lightbox-btn {
	width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25);
	background: transparent; color: #fff; font-size: 1.2rem; cursor: pointer;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, .12); }

/* ---------- Contatti e modulo ---------- */
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.contact-list li { display: flex; gap: 14px; align-items: flex-start; }
.contact-list .ico {
	flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%;
	display: grid; place-items: center; background: #e6f3fb; color: var(--c-accent-dark);
}
.contact-list .ico svg { width: 22px; height: 22px; }
.contact-list strong { display: block; color: var(--c-primary); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }

.form { display: grid; gap: 8px; }
.form-row { display: grid; gap: 8px 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.field label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 6px; }
.field .req { color: #c0262d; }
.field input, .field textarea {
	width: 100%; font: inherit; font-size: 16px; /* 16px evita lo zoom automatico su iOS */
	padding: 12px 14px; color: var(--c-text); background: var(--c-surface);
	border: 1px solid #c4ccd6; border-radius: var(--radius-sm);
	transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 4px rgba(10, 143, 208, .18); }
.field.invalid input, .field.invalid textarea { border-color: #c0262d; }
.field-error { display: block; min-height: 1.2em; font-size: .85rem; color: #c0262d; margin-top: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--c-accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 600; }
.form-status:empty { display: none; }
.form-status.ok { background: #e3f4e8; color: #17663a; }
.form-status.ko { background: #fde8e8; color: #9b1c1c; }


/* ---------- Footer ---------- */
.site-footer { background: var(--c-dark); color: #b7c0ca; font-size: .95rem; padding: 40px 0 24px; margin-top: clamp(32px, 6vw, 72px); }
.site-footer a { color: #e6edf3; }
.site-footer a:hover { color: #9fd8f5; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.site-footer h2 { color: #fff; font-size: 1rem; margin-bottom: .75em; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer ul a { display: inline-block; padding: 4px 0; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 32px; padding-top: 18px; font-size: .85rem; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ---------- Banner cookie ---------- */
.cookie-banner {
	position: fixed; z-index: 300; left: 12px; right: 12px; bottom: 12px;
	max-width: 760px; margin: 0 auto; padding: 18px 20px;
	background: var(--c-surface); color: var(--c-text);
	border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
	display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { flex: 1 1 320px; margin: 0; font-size: .92rem; }
.cookie-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Stampa ---------- */
@media print {
	.site-header, .site-footer, .cookie-banner, .hero-actions, .nav-toggle { display: none !important; }
	body { background: #fff; }
	.card, .panel { box-shadow: none; }
}

/* ---------- Utilità ---------- */
.h3 { font-size: 1.125rem; }
.mt { margin-top: 12px; }
.callout .hero-actions { margin: 0; }
