/* De Vito & Consales – foglio di stile del sito
   Contrasti verificati per WCAG 2.1 AA (testo >= 4.5:1, elementi grafici >= 3:1). */

:root {
    --green-800: #145220;   /* hover */
    --green-700: #1b6b2a;   /* colore principale: 6.6:1 su bianco */
    --green-100: #e6f2e7;
    --accent:    #00b81f;   /* verde del logo, solo decorativo */
    --ink:       #1a1d1b;   /* testo: 16:1 */
    --muted:     #4a514c;   /* testo secondario: 8:1 */
    --line:      #d5dbd6;
    --bg:        #ffffff;
    --bg-alt:    #f3f6f3;
    --dark:      #151916;
    --focus:     #0b57d0;

    --radius: 10px;
    --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .06);
    --container: 1160px;
    --header-h: 76px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 12px);
}
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.4rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); font-weight: 800; letter-spacing: -.01em; }
h3 { font-size: 1.2rem; font-weight: 700; }
p  { margin: 0 0 1em; }
p, li, address { text-wrap: pretty; }   /* niente parola sola sull'ultima riga */

a { color: var(--green-700); text-underline-offset: .18em; }
a:hover { color: var(--green-800); }

::selection { background: var(--green-700); color: #fff; }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    border-radius: 4px;
}

address { font-style: normal; }

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 20px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 12px; top: -100px;
    z-index: 100;
    padding: 12px 18px;
    background: var(--ink);
    color: #fff;
    font-weight: 700;
    border-radius: 0 0 var(--radius) var(--radius);
}
.skip-link:focus { top: 0; color: #fff; }
.skip-link:hover { color: #fff; }

main:focus { outline: none; }

/* ---------- Pulsanti ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    min-height: 44px;
    padding: .6em 1.2em;
    border: 2px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.btn-lg { min-height: 52px; padding: .75em 1.5em; font-size: 1.05rem; }
.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-800); color: #fff; }
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { background: var(--green-100); color: var(--ink); }
.btn-outline { border-color: var(--green-700); color: var(--green-700); background: transparent; }
.btn-outline:hover { background: var(--green-700); color: #fff; }

.icon { width: 1.1em; height: 1.1em; fill: currentColor; flex: none; }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgb(255 255 255 / .97);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--header-h);
}
.brand img { width: 200px; height: auto; }

.site-nav ul {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0; padding: 0;
    list-style: none;
}
.site-nav a:not(.btn) {
    display: block;
    padding: 10px 14px;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
}
.site-nav a:not(.btn):hover { background: var(--bg-alt); color: var(--green-700); }
.nav-cta { margin-left: 8px; }

.nav-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 14px;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
}
.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
    display: block;
    width: 20px; height: 2px;
    background: currentColor;
    border-radius: 2px;
    position: relative;
}
.nav-toggle-icon::before,
.nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
.nav-toggle-icon::before { top: -6px; }
.nav-toggle-icon::after  { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after  { top: 0; transform: rotate(-45deg); }

/* Pulsante "Chiama" nell'header: solo su mobile */
.header-call { display: none; }
@media (max-width: 420px) {
    .header-call span { display: none; }      /* solo icona; il nome accessibile resta nell'aria-label */
    .header-call { padding-inline: .8em; }
    .header-inner { gap: 10px; }
}

@media (max-width: 920px) {
    :root { --header-h: 68px; }
    .brand img { width: 160px; }
    .js .nav-toggle { display: inline-flex; }
    .js .site-nav {
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: #fff;
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow);
        display: none;
    }
    .js .site-nav.is-open { display: block; }
    .site-nav ul { flex-direction: column; align-items: stretch; padding: 8px 20px 20px; }
    .site-nav a:not(.btn) { padding: 14px 12px; border-bottom: 1px solid var(--bg-alt); }
    .nav-cta { margin: 12px 0 0; }
    .nav-cta .btn { width: 100%; }
    .header-call { display: inline-flex; margin-left: auto; padding-inline: 1em; }
    /* Senza JavaScript il menu resta visibile sotto il logo */
    html:not(.js) .header-inner { flex-wrap: wrap; padding-block: 10px; }
    html:not(.js) .site-nav { width: 100%; }
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    min-height: min(78vh, 680px);
    padding-block: 72px;
    color: #fff;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: 65% center;
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, rgb(10 14 11 / .88) 0%, rgb(10 14 11 / .7) 50%, rgb(10 14 11 / .35) 100%);
}
.hero-content { max-width: var(--container); }
.hero h1 { max-width: 20ch; margin-bottom: .4em; }
.hero-lead { max-width: 52ch; font-size: clamp(1.05rem, 1rem + .4vw, 1.25rem); color: #eef2ee; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- Sezioni ---------- */
.section { padding-block: clamp(56px, 8vw, 104px); }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 680px; margin-bottom: 40px; }
.section-head p:last-child { color: var(--muted); font-size: 1.1rem; }

/* Servizi */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 0; padding: 0;
    list-style: none;
}
.card {
    padding: 28px 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-top: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card p { color: var(--muted); }
.card-icon {
    width: 44px; height: 44px;
    margin-bottom: 16px;
    padding: 9px;
    border-radius: 10px;
    background: var(--green-100);
    stroke: var(--green-700);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}
.checklist { margin: 0; padding: 0; list-style: none; }
.checklist li {
    position: relative;
    padding: 6px 0 6px 28px;
    border-top: 1px solid var(--bg-alt);
    font-weight: 500;
}
.checklist li::before {
    content: "";
    position: absolute;
    left: 2px; top: .8em;
    width: 12px; height: 7px;
    border-left: 3px solid var(--green-700);
    border-bottom: 3px solid var(--green-700);
    transform: rotate(-45deg);
}

/* Blocchi testo + immagine */
.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: clamp(28px, 5vw, 64px);
}
.split-reverse .split-media { order: 2; }
.split-media img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: calc(var(--radius) * 1.5);
    box-shadow: var(--shadow);
}
@media (max-width: 800px) {
    .split { grid-template-columns: 1fr; }
    .split-reverse .split-media { order: 0; }
    .split-media img { aspect-ratio: 4 / 3; }
}

.facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 28px 0 0; padding: 0;
    list-style: none;
}
.facts li {
    padding: 16px;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}
.facts strong { display: block; font-size: 1.6rem; line-height: 1.1; color: var(--green-700); }
.facts span { font-size: .95rem; color: var(--muted); }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr; } }

/* Fascia call-to-action */
.cta-band { background: var(--dark); color: #fff; }
.cta-band p { color: #d9dfda; font-size: 1.1rem; }
.cta-band a:not(.btn) { color: #fff; font-weight: 700; }
.cta-band a:not(.btn):hover { color: #9be3a5; }
.cta-band .cta-note { margin-top: 20px; font-size: 1rem; overflow-wrap: break-word; }
.cta-band .btn-outline { border-color: #fff; color: #fff; }
.cta-band .btn-outline:hover { background: #fff; color: var(--ink); }
.cta-band .btn-primary { background: #267d35; }   /* 5.2:1 con testo bianco, 3.4:1 sullo sfondo */

/* Sulle sezioni scure il contorno del focus diventa bianco (blu: solo 2.8:1) */
.hero :focus-visible,
.cta-band :focus-visible,
.site-footer :focus-visible { outline-color: #fff; }
.cta-band .btn-primary:hover { background: var(--green-700); }

/* Galleria */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin: 0; padding: 0;
    list-style: none;
}
.js .gallery-grid .is-extra { display: none; }
.gallery-grid a {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    background: var(--line);
}
.gallery-grid img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform .25s;
}
@media (prefers-reduced-motion: no-preference) {
    .gallery-grid a:hover img { transform: scale(1.05); }
}
.gallery-more {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
}
.gallery-count { color: var(--muted); }

/* Contatti */
.contact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin: 0; padding: 0;
    list-style: none;
}
.contact-card {
    padding: 28px 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.contact-card h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.contact-card p { margin-bottom: .4em; }
.contact-link { font-size: 1.2rem; font-weight: 700; overflow-wrap: break-word; }
.map-link { display: inline-block; padding-block: 10px; }   /* area di tocco >= 44px */
.contact-person + .contact-person { margin-top: 14px; }
.contact-name { display: block; color: var(--muted); font-size: .95rem; }

/* ---------- Pagine di testo (privacy, note legali) ---------- */
.page-head { padding-block: 56px 24px; background: var(--bg-alt); }
.prose { padding-block: 40px 80px; }
.prose > * { max-width: 60ch; }   /* righe di lettura comode */
.prose h2 { font-size: 1.4rem; margin-top: 2em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }

/* ---------- Footer ---------- */
.site-footer { background: var(--dark); color: #d9dfda; padding-top: 56px; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: #9be3a5; }
.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 32px;
    padding-bottom: 40px;
}
.footer-brand { font-size: 1.3rem; font-weight: 800; color: #fff; margin-bottom: .3em; }
.footer-title { font-size: .9rem; text-transform: uppercase; letter-spacing: .1em; color: #fff; }
.footer-links { margin: 0; padding: 0; list-style: none; }
.footer-links li { margin-bottom: .4em; }
.footer-bottom { padding-block: 20px; border-top: 1px solid #2c322e; font-size: .9rem; }
.footer-bottom p { margin: 0; }
.stats { position: absolute; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Lightbox ---------- */
.lightbox {
    width: 100vw; height: 100vh;
    max-width: none; max-height: none;
    margin: 0; padding: 0;
    border: 0;
    background: rgb(8 10 9 / .94);
    color: #fff;
}
.lightbox::backdrop { background: rgb(0 0 0 / .6); }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox-figure { margin: 0; padding: 64px 72px 24px; text-align: center; }
.lightbox-img {
    max-width: min(1200px, calc(100vw - 144px));
    max-height: calc(100vh - 140px);
    width: auto; height: auto;
    margin-inline: auto;
    border-radius: 6px;
}
.lightbox-caption { margin-top: 12px; font-weight: 600; }
.lightbox-btn {
    position: absolute;
    display: grid;
    place-items: center;
    width: 52px; height: 52px;
    border: 2px solid rgb(255 255 255 / .5);
    border-radius: 50%;
    background: rgb(0 0 0 / .5);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}
.lightbox-btn:hover { background: rgb(255 255 255 / .2); }
.lightbox-btn:focus-visible { outline-color: #fff; }
.lightbox-prev  { left: 12px;  top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-close { right: 12px; top: 12px; }
@media (max-width: 600px) {
    .lightbox-figure { padding: 72px 8px 88px; }
    .lightbox-img { max-width: calc(100vw - 16px); max-height: calc(100vh - 180px); }
    .lightbox-prev, .lightbox-next { top: auto; bottom: 16px; transform: none; }
    .lightbox-prev { left: calc(50% - 64px); }
    .lightbox-next { right: calc(50% - 64px); }
}

/* ---------- Preferenze utente ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
    .btn, .card, .contact-card { border: 2px solid ButtonText; }
}
@media print {
    .site-header, .hero-bg, .gallery-grid, .gallery-more, .stats, .lightbox { display: none !important; }
    .hero, .cta-band, .site-footer { color: #000; background: none; }
    .hero::before { display: none; }
}
