/* Elettromeccanica Salerno — stile sito pubblico */
:root {
    --blu-scuro: #0b2d4f;
    --blu-scuro-2: #0e3a66;
    --blu: #0f5c9c;
    --azzurro: #22a7e0;
    --azzurro-chiaro: #e9f5fc;
    --bianco: #ffffff;
    --grigio-chiaro: #f4f6f8;
    --grigio-bordo: #dfe6ec;
    --grigio-testo: #5c6b7a;
    --ombra: 0 10px 30px rgba(11, 45, 79, .10);
    --raggio: 14px;
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
/* Niente scorrimento/oscillazione orizzontale su mobile: nessun elemento
   deve poter allargare la pagina oltre il viewport. */
html { scroll-behavior: smooth; overflow-x: hidden; overflow-x: clip; }
body {
    margin: 0;
    overflow-x: hidden;
    overflow-x: clip;
    font-family: var(--font);
    color: var(--blu-scuro);
    background: var(--bianco);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--blu); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
.container { width: min(1180px, 92%); margin: 0 auto; }
.icon { width: 1.15em; height: 1.15em; flex: none; }
.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--blu-scuro); color: #fff; padding: .6rem 1rem; z-index: 200;
}
.skip-link:focus { left: 0; }

/* ---------- Bottoni ---------- */
.btn {
    display: inline-block; padding: .85rem 1.7rem; border-radius: 999px;
    font-weight: 700; text-decoration: none; border: 2px solid transparent;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
    cursor: pointer; font-size: 1rem;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--blu); color: #fff; }
.btn-primary:hover { background: var(--blu-scuro-2); }
.btn-accent { background: var(--azzurro); color: #fff; box-shadow: 0 8px 22px rgba(34, 167, 224, .35); }
.btn-accent:hover { background: #178fc4; }
.btn-ghost { border-color: rgba(255, 255, 255, .65); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.btn-sm { padding: .5rem 1.15rem; font-size: .92rem; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 14px rgba(11, 45, 79, .12); }
.topbar { background: var(--blu-scuro); color: #cfe3f2; font-size: .85rem; }
.topbar-inner { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; }
.topbar-right { display: flex; gap: 1.4rem; }
.topbar-item { display: inline-flex; align-items: center; gap: .45rem; color: inherit; text-decoration: none; }
.topbar-item span { overflow-wrap: anywhere; }
.topbar-item .icon { color: var(--azzurro); }
a.topbar-item:hover { color: #fff; }
.navbar { background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); }
.navbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--blu-scuro); }
.brand-mark { height: 44px; width: auto; max-width: 230px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: .82rem; letter-spacing: .22em; font-weight: 700; color: var(--grigio-testo); }
.brand-text em { font-style: normal; font-size: 1.35rem; font-weight: 800; color: var(--blu-scuro); letter-spacing: .06em; }
.brand-light .brand-text strong { color: #9fc4de; }
.brand-light .brand-text em { color: #fff; }
.nav { display: flex; align-items: center; gap: 1.6rem; }
.nav > a:not(.btn) {
    text-decoration: none; color: var(--blu-scuro); font-weight: 600; font-size: .98rem;
    padding: .35rem 0; border-bottom: 3px solid transparent;
}
.nav > a:not(.btn):hover, .nav > a.active { color: var(--blu); border-bottom-color: var(--azzurro); }
.nav-cta { margin-left: .4rem; }
.nav-toggle {
    display: none; flex-direction: column; gap: 5px; background: none; border: 0;
    padding: .6rem .4rem; cursor: pointer;
}
.nav-toggle span { width: 26px; height: 3px; border-radius: 2px; background: var(--blu-scuro); transition: .2s; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: min(88vh, 860px); display: flex; align-items: center; color: #fff; overflow: hidden; }
.hero-bg {
    position: absolute; inset: 0; background-size: cover; background-position: center;
    transform: scale(1.02);
}
.hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(100deg, rgba(11, 45, 79, .93) 0%, rgba(11, 45, 79, .78) 45%, rgba(15, 92, 156, .38) 100%);
}
.hero-inner { position: relative; padding: 6.5rem 0 5rem; max-width: 820px; margin: 0 auto; width: 92%; }
.hero-sub { font-size: clamp(1.02rem, 1.6vw, 1.22rem); color: #dcebf6; max-width: 640px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; margin: 1.8rem 0 0; }
.hero-stats {
    list-style: none; display: flex; flex-wrap: wrap; gap: 2.6rem;
    margin: 3rem 0 0; padding: 1.6rem 0 0; border-top: 1px solid rgba(255, 255, 255, .28);
}
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 2rem; font-weight: 800; color: var(--azzurro); }
.hero-stats span { font-size: .9rem; color: #cfe3f2; }

/* ---------- Sezioni ---------- */
.kicker {
    display: inline-block; text-transform: uppercase; letter-spacing: .2em;
    font-size: .78rem; font-weight: 800; color: var(--azzurro); margin: 0 0 .8rem;
}
.kicker-light { color: #8fd4f5; }
.section { padding: 5.5rem 0; scroll-margin-top: 92px; }
.section-alt { background: var(--grigio-chiaro); }
.section-head { max-width: 720px; margin: 0 auto 3rem; text-align: center; }
.section-intro { color: var(--grigio-testo); font-size: 1.06rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.grid-2.text-image-left .about-media { order: -1; }
.about-media { position: relative; }
.about-media img { border-radius: var(--raggio); box-shadow: var(--ombra); width: 100%; object-fit: cover; aspect-ratio: 4 / 3.4; }
.about-frame {
    position: absolute; inset: 1.4rem -1.2rem -1.2rem 1.4rem; border: 3px solid var(--azzurro);
    border-radius: var(--raggio); z-index: -1;
}
.about-body .check-list { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; gap: .7rem; }
.check-list li { display: flex; gap: .7rem; align-items: flex-start; font-weight: 600; }
.check-list .icon { color: var(--azzurro); margin-top: .25rem; }

/* ---------- Card servizi ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 1.8rem; }
.card {
    background: #fff; border-radius: var(--raggio); overflow: hidden;
    box-shadow: var(--ombra); border: 1px solid var(--grigio-bordo);
    display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(11, 45, 79, .16); }
.card-media { aspect-ratio: 16 / 10; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.05); }
.card-body { padding: 1.6rem 1.6rem 1.9rem; }
.card-icon {
    display: inline-flex; width: 52px; height: 52px; border-radius: 12px;
    background: var(--azzurro-chiaro); color: var(--blu); align-items: center; justify-content: center;
    margin-bottom: 1rem;
}
.card-icon .icon { width: 26px; height: 26px; }
.card-body p { color: var(--grigio-testo); margin: 0; font-size: .97rem; }

/* ---------- Galleria ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 1.2rem; }
.gallery figure { margin: 0; }
.gallery-link { display: block; position: relative; border-radius: var(--raggio); overflow: hidden; box-shadow: var(--ombra); }
.gallery-link img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .35s ease; }
.gallery-link:hover img { transform: scale(1.06); }
.gallery figcaption {
    position: absolute; inset: auto 0 0 0; padding: 1.6rem .9rem .7rem; color: #fff; font-size: .88rem;
    background: linear-gradient(transparent, rgba(11, 45, 79, .88));
}

/* ---------- Contatti ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 1.4rem; margin-bottom: 2.6rem; }
.contact-card {
    background: var(--grigio-chiaro); border: 1px solid var(--grigio-bordo); border-radius: var(--raggio);
    padding: 1.8rem 1.5rem; text-align: center; min-width: 0;
}
.contact-icon {
    display: inline-flex; width: 54px; height: 54px; border-radius: 50%;
    background: var(--blu-scuro); color: var(--azzurro); align-items: center; justify-content: center;
    margin-bottom: .9rem;
}
.contact-icon .icon { width: 24px; height: 24px; }
.contact-card h3 { margin-bottom: .35rem; }
.contact-card p { margin: 0; font-weight: 600; }
.contact-card a { color: var(--blu-scuro); text-decoration: none; }
.contact-card a:hover { color: var(--blu); text-decoration: underline; }
/* Email/URL lunghi restano dentro la card invece di uscire o allargare la pagina. */
.contact-card p, .contact-card a { overflow-wrap: anywhere; }
.contact-sub { font-size: .88rem; color: var(--grigio-testo); font-weight: 500 !important; margin-top: .3rem !important; }
.map-wrap { border-radius: var(--raggio); overflow: hidden; box-shadow: var(--ombra); border: 1px solid var(--grigio-bordo); }
.map-wrap iframe { width: 100%; height: 420px; border: 0; display: block; }
.contact-note { text-align: center; color: var(--grigio-testo); margin: 1.6rem auto 0; max-width: 640px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--blu-scuro); color: #c6d9e8; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 3rem; padding: 4rem 0 3rem; }
.footer-col { min-width: 0; }
.footer-col h3 { color: #fff; font-size: 1rem; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 1.1rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.footer-col a { color: #c6d9e8; text-decoration: none; }
.footer-col a:hover { color: var(--azzurro); }
.footer-brand p { margin-top: 1rem; font-size: .95rem; }
.footer-contacts li { display: flex; gap: .6rem; align-items: flex-start; }
.footer-contacts .icon { color: var(--azzurro); margin-top: .28rem; }
.footer-contacts li > a, .footer-contacts li > span { min-width: 0; overflow-wrap: anywhere; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .14); font-size: .88rem; }
.footer-bottom-inner { display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; flex-wrap: wrap; }
.footer-bottom a { color: #9fc4de; }

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed; inset: 0; z-index: 300; background: rgba(8, 24, 40, .92);
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(1100px, 92vw); max-height: 78vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lightbox-caption { color: #dcebf6; margin-top: 1rem; font-size: .95rem; }
.lightbox-close {
    position: absolute; top: 1.2rem; right: 1.4rem; background: none; border: 0; color: #fff;
    font-size: 2.4rem; line-height: 1; cursor: pointer;
}

/* ---------- Animazioni ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .grid-2 { grid-template-columns: 1fr; gap: 2.6rem; }
    .grid-2.text-image-left .about-media { order: 0; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .topbar-inner { justify-content: center; }
    .topbar-item:first-child { display: none; }
}
@media (max-width: 760px) {
    .nav-toggle { display: flex; }
    .nav {
        position: absolute; top: 100%; left: 0; right: 0; background: #fff;
        flex-direction: column; align-items: stretch; gap: 0; padding: .6rem 4% 1.2rem;
        box-shadow: 0 18px 30px rgba(11, 45, 79, .16); display: none;
    }
    .nav.open { display: flex; }
    .nav > a:not(.btn) { padding: .8rem .2rem; border-bottom: 1px solid var(--grigio-chiaro); }
    .nav-cta { margin: .9rem 0 0; text-align: center; }
    .topbar-right { gap: .9rem; }
    .topbar-item span { display: none; }
    .topbar-item .icon { width: 1.3em; height: 1.3em; }
    .footer-grid { grid-template-columns: 1fr; gap: 2.2rem; padding: 3rem 0 2rem; }
    .hero-stats { gap: 1.6rem; }
    .section { padding: 4rem 0; }
}
@media (max-width: 560px) {
    /* La cornice decorativa resta dentro i margini del viewport: su schermi
       stretti l'eccedenza negativa causava lo scorrimento orizzontale. */
    .about-frame { inset: 1.2rem -.5rem -.5rem 1.2rem; }
}
