/* ====== Base tipografia & reset ====== */
*{box-sizing:border-box}
html,body{height:100%}
html{font-size:15px}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial,"Noto Sans",sans-serif;
  line-height:1.6;
  color:var(--fg,#fff);
  background:#0c1a22;
}

/* ====== Tema ====== */
:root{
  --fg:#0e1b22;
  --fg-invert:#fff;
  --bg:#0b1520;
  --overlay-start:rgba(0,0,0,.28);
  --overlay-end:rgba(0,0,0,.55);
}
[data-theme="dark"]{
  --fg:#e7eef3;
}

/* ====== Layout header / nav ====== */
.header {
  position: fixed;                /* era sticky → causa dello sfarfallio */
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  backdrop-filter: saturate(120%) blur(6px);
  background: rgba(10,20,28,.35);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  overflow: hidden;
  height: var(--header-h);
  transition: transform 0.3s ease, background 0.3s ease;
}

/* ===== HEADER SHRINK FIX (versione 50%) ===== */
:root {
  --header-h: 90px; /* altezza originale */
}

/* Header principale con distribuzione migliorata */
.header {
  height: var(--header-h);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;  /* logo sinistra, resto destra */
  padding: 0 40px;
  max-width: 1400px;
  margin: 0 auto;
  transition: padding 0.25s ease;
}

/* Stato ridotto */
.header.shrink {
  --header-h: 60px;
}
.header.shrink .container {
  padding: 0 30px;
}

/* Logo sinistra */
.logo {
  flex: 0 0 auto;
  margin-right: 40px;
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 10px;
}
.logo img {
  height: 102px;
  width: auto;
  display: block;
  padding: 6px 0;
  transition: height 0.25s ease;
}
.header.shrink .logo img {
  height: 51px;
}

/* Menu centrato */
.nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  gap: 38px;
  align-items: center;
}
.nav a {
  color: #fff;
  text-decoration: none;
  opacity: .95;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: none;
  transition: opacity .2s ease, transform .2s ease;
}
.nav a:hover,
.nav a.active {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: .25em;
  transform: scale(1.05);
}

/* Bandiere a destra */
.lang-switch {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}
.lang-switch img {
  width: 26px;
  height: 17px;
  border-radius: 3px;
  transition: transform 0.2s ease;
}
.lang-switch img:hover {
  transform: scale(1.15);
}

/* Spacer invisibile per allineamento */
#header-spacer {
  height: var(--header-h);
  transition: height 0.25s ease;
}





.container{
  max-width:1100px;
  margin:0 auto;
  padding:14px 18px;
  display:flex;
  align-items:center;
  gap:18px;
}

.logo{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
}
.logo img{
  height:102px;
  width:auto;
  display:block;
  padding: 6px 0; /* <— aggiungi questa riga */
}

/* ====== NAV ====== */
.nav{
  margin-left:auto;
  display:flex;
  gap:26px;
  align-items:center;
  font-size:1rem;
  line-height:1.4;
}
.nav a{
  color:#fff;
  text-decoration:none;
  opacity:.95;
  font-size:1.10rem;
  font-weight:600;
  letter-spacing:0.5px;
  text-transform:none; /* normale: iniziale maiuscola e resto minuscolo */
  transition:opacity .2s ease, transform .2s ease;
}
.nav a:hover,
.nav a.active{
  opacity:1;
  text-decoration:underline;
  text-underline-offset:.25em;
  transform:scale(1.05);
}

.lang-select{
  background:rgba(255,255,255,.1);
  color:#fff;
  border:1px solid rgba(255,255,255,.2);
  padding:6px 10px;
  border-radius:8px;
}

/* ====== Hero spacing generic ====== */
.main{
  min-height:calc(100dvh - 140px);
  padding:60px 18px 100px;
}
.main .container{
  display:block;
}

/* ====== Pulsanti ====== */
.btn{
  display:inline-block;
  padding:10px 16px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.2);
  background:rgba(0,0,0,.15);
  color:#fff;
}
.btn:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 24px rgba(0,0,0,.25);
  transition:.2s;
}

/* ====== Sfondi di pagina ====== */
body::before{
  content:"";
  position:fixed;
  top:0;
  left:0;
  width:100vw;
  height:100vh;
  z-index:-2;
  background-position:center center;
  background-size:cover;
  background-repeat:no-repeat;
  background-attachment:fixed;   /* 🟩 sfondo fisso: non scorre mai */
}

/* ====== Sfondo fisso solo per la pagina ATTIVITÀ ====== */
body[data-page="attivita"]::before {
  background-image: url("images/Attivita1.png");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Disattiva il rotatore solo in questa pagina */
body[data-page="attivita"] #bg-rotator {
  display: none !important;
}


body::after{
  content:"";
  position:fixed;
  inset:0;
  z-index:-1;
  background:linear-gradient(to bottom,var(--overlay-start),var(--overlay-end));
  pointer-events:none;
}

/* ====== Sfondo fisso solo per la pagina QUALITÀ ====== */
body[data-page="qualita"]::before {
  background-image: url("images/Qualita1.png");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Disattiva il rotatore solo in questa pagina */
body[data-page="qualita"] #bg-rotator {
  display: none !important;
}


/* ====== Rotatore per slideshow ====== */
#bg-rotator{
  position:fixed;
  top:0;
  left:0;
  width:100vw;
  height:100vh;
  z-index:-2;
  background-size:cover;
  background-position:center center;
  background-repeat:no-repeat;
  background-attachment:fixed;     /* 🟩 fa restare l'immagine fissa durante lo scroll */
  transition:opacity 1.5s ease-in-out;
  opacity:1;
  overflow:hidden;
}


/* ====== Tipografia ====== */
h1{
  font-size: clamp(34px, 4vw, 52px);
  margin: 0 0 14px;
  color: #fff;
  text-align: left;
  text-shadow: 0 2px 6px rgba(0,0,0,.8);
  letter-spacing: 0.5px;
  line-height: 1.1;
}
h2{
  font-size:clamp(26px,4vw,35px);
  color:#fff;
  margin:28px 0 14px;
  text-shadow:0 2px 4px rgba(0,0,0,.8);
}
h3{
  font-size:clamp(20px,3vw,30px);
  color:#fff;
  margin:20px 0 10px;
  text-shadow:0 2px 4px rgba(0,0,0,.8);
}
p{
  color: #d8e2ea;
  max-width: 75ch;
  text-shadow: 0 2px 4px rgba(0,0,0,.8);
  font-size: 1.00rem;
  line-height: 1.6;
}

/* ====== Footer ====== */
.footer{
  padding:20px 18px;
  text-align:center;
  color:#a9bac7;
  border-top:1px solid rgba(255,255,255,.08);
  background:rgba(10,20,28,.35);
  font-size:.75rem;
}

/* =========================
   SEZIONE CLIENTI (2×6 loghi)
   ========================= */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 6 colonne per riga */
  gap: 40px;
  justify-items: center;
  align-items: center;
  margin-top: 50px;
  margin-bottom: 60px;
}

.logo-grid img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  image-rendering: auto;
  background: #fff; /* sfondo bianco del box */
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
  padding: 12px;
  transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
  filter: brightness(.96) contrast(1.08);
}
.logo-grid img:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 28px rgba(0,0,0,.5);
  filter: brightness(1) contrast(1.12);
}

/* Responsività */
@media (max-width: 1100px) {
  .logo-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 800px) {
  .logo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 520px) {
  .logo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.logo-grid img{
  width:150px;
  height:150px;
  object-fit:contain;
  image-rendering:auto;
  transition:transform .25s ease, box-shadow .25s ease, filter .25s ease;
  filter:brightness(.96) contrast(1.08);
}
.logo-grid img:hover{
  transform:scale(1.06);
  box-shadow:0 0 14px rgba(255,255,255,.22);
  filter:brightness(1) contrast(1.12);
}
@media (max-width: 700px){
  .logo-grid{ grid-template-columns:repeat(2, 1fr); gap:28px; }
}
@media (max-width: 420px){
  .logo-grid{ grid-template-columns:1fr; gap:22px; }
}

/* =========================
   PROGETTI NEL MONDO (card)
   ========================= */
.projects { margin-top: 22px; }
.projects-title {
  margin: 10px 0 4px;
  font-size: clamp(22px, 3vw, 32px);
  color: #fff;
  letter-spacing: .3px;
}
.projects-intro {
  margin: 0 0 26px;
  color: #d8e2ea;
}
.project-grid{
  list-style:none;
  padding:0;
  margin:0;
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:18px;
}
.project-card{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid rgba(255,255,255,.14);
  border-radius:14px;
  padding:14px 16px 16px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.project-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0,0,0,.28);
  border-color: rgba(255,255,255,.22);
}
.pc-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:8px;
}
.pc-country{
  font-size:.8rem;
  font-weight:700;
  letter-spacing:.3px;
  padding:4px 8px;
  border-radius:999px;
  color:#0a1520;
  background:#a9e5ff;
}
.pc-year{
  font-size:.82rem;
  color:#cfe6f3;
  opacity:.9;
}
.pc-client{
  margin:6px 0 4px;
  color:#fff;
  font-size:1.02rem;
}
.pc-desc{
  margin:0;
  color:#d8e2ea;
  opacity:.95;
  font-size:.95rem;
}
@media (max-width: 980px){
  .project-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 540px){
  .project-grid{ grid-template-columns: 1fr; }
}

/* =========================
   CARD ATTIVITÀ
   ========================= */
.works{
  display:flex;
  flex-direction:column;
  gap:24px;
  margin-top:12px;
  max-width:1000px;
  width:100%;
  margin-left:auto;
  margin-right:auto;
}
.work{
  width:100%;
  max-width:1000px;
  background:rgba(0,0,0,.45);
  border:1px solid rgba(255,255,255,.2);
  border-radius:10px;
  padding:12px 14px 16px;
  box-shadow:0 20px 40px rgba(0,0,0,.8);
  backdrop-filter:blur(6px) saturate(120%);
  color:#fff;
}
.work-header{
  display:flex;
  align-items:flex-start;
  flex-wrap:nowrap;
  gap:16px;
}
.work-thumb{
  flex:0 0 auto;
  width:200px;
  height:auto;
  border-radius:6px;
  box-shadow:0 10px 30px rgba(0,0,0,.8);
  border:1px solid rgba(255,255,255,.2);
  background:#000;
  object-fit:cover;
}
.work-info{
  flex:1 1 auto;
  min-width:0;
  font-size:.8rem;
  line-height:1.4;
}
.work-title{
  margin:0 0 6px;
  font-size:1.10rem;
  font-weight:600;
  color:#fff;
  letter-spacing:0.3px;
  text-transform:uppercase;
  text-shadow:0 2px 6px rgba(0,0,0,.8);
}
.work-meta{
  font-size:0.9rem;
  font-weight:400;
  color:#e2eef7;
  margin-bottom:8px;
  letter-spacing:0.3px;
  text-shadow:0 1px 4px rgba(0,0,0,.8);
}
.work-excerpt{
  margin:0 0 10px;
  color:#f4f8fb;
  font-size:1.00rem;
  line-height:1.6;
  font-weight:400;
  text-shadow:0 2px 5px rgba(0,0,0,.8);
}
.work-toggle{
  appearance:none;
  border:0;
  border-radius:6px;
  background:rgba(255,255,255,.18);
  color:#fff;
  font-size:.7rem;
  font-weight:500;
  padding:6px 8px;
  cursor:pointer;
  width:100%;
  text-align:center;
  box-shadow:0 10px 20px rgba(0,0,0,.8);
}
.work-toggle:hover{
  background:rgba(255,255,255,.28);
}
.work-more {
  overflow:hidden;
  max-height:0;
  transition:max-height .3s ease;
  margin-top:12px;
  border-top:1px solid rgba(255,255,255,.2);
  padding-top:12px;
  font-size:1rem;
  line-height:1.6;
  color:#f0f5fa;
  text-shadow:0 2px 4px rgba(0,0,0,.7);
  width:100%;
  text-align:left;
}
.work-more[hidden]{display:none}
.work-more p{
  max-width:none!important;
  width:100%;
  margin:0 0 14px;
}

/* =========================
   GALLERIA IMMAGINI ATTIVITÀ
   ========================= */
.work-gallery{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
  gap:14px;
  margin-top:16px;
}
.work-gallery:has(.work-photo:nth-of-type(1):last-of-type){
  grid-template-columns:1fr;
  max-width:600px;
  margin-left:auto;
  margin-right:auto;
}
.work-photo{
  position:relative;
  border-radius:6px;
  background:#000;
  border:1px solid rgba(255,255,255,.2);
  box-shadow:0 10px 30px rgba(0,0,0,.8);
  margin:0;
  cursor:pointer;
  overflow:hidden;
  aspect-ratio:4/3;
  display:flex;
  align-items:center;
  justify-content:center;
}
.work-photo img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  border-radius:6px;
  transition:transform .25s ease;
  box-shadow:0 8px 24px rgba(0,0,0,.35);
}
.work-photo:hover img{transform:scale(1.03)}
@media(max-width:600px){
  .works,.work{max-width:100%}
  .work-header{
    flex-direction:column;
    align-items:center;
    text-align:center;
  }
  .work-thumb{
    width:100%;
    max-width:260px;
  }
}

/* =========================
   LIGHTBOX FULLSCREEN
   ========================= */
.lightbox-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.8);
  backdrop-filter:saturate(140%) blur(4px);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
  padding:20px;
  opacity:0;
  transition:opacity .2s ease;
}
.lightbox-overlay.active{
  display:flex;
  opacity:1;
}
.lightbox-frame{
  position:relative;
  max-width:90vw;
  max-height:90vh;
  display:flex;
  align-items:center;
  justify-content:center;
}
.lightbox-img{
  max-width:100%;
  max-height:100%;
  border-radius:10px;
  box-shadow:0 30px 60px rgba(0,0,0,.9);
  border:1px solid rgba(255,255,255,.4);
  background:#000;
  object-fit:contain;
}
.lightbox-close{
  position:absolute;
  top:-40px;
  right:0;
  background:rgba(0,0,0,.6);
  color:#fff;
  border:1px solid rgba(255,255,255,.4);
  border-radius:6px;
  padding:6px 10px;
  font-size:.8rem;
  cursor:pointer;
  box-shadow:0 10px 30px rgba(0,0,0,.8);
}
.lightbox-prev,
.lightbox-next{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  background:rgba(0,0,0,.6);
  color:#fff;
  border:1px solid rgba(255,255,255,.4);
  border-radius:6px;
  padding:8px 10px;
  font-size:.8rem;
  cursor:pointer;
  box-shadow:0 10px 30px rgba(0,0,0,.8);
  user-select:none;
}
.lightbox-prev{left:-50px}
.lightbox-next{right:-50px}
@media(max-width:600px){
  .lightbox-prev{left:10px}
  .lightbox-next{right:10px}
  .lightbox-close{top:-50px;right:10px}
}

/* ====== Lingue (bandiere) ====== */
.lang-switch{
  display:flex;
  gap:0.6rem;
  align-items:center;
}
.lang-switch img{
  width:24px;
  height:16px;
  border-radius:2px;
  transition:transform .2s ease;
}
.lang-switch img:hover{
  transform:scale(1.1);
}

/* ====== Sezioni Home con immagini affiancate ====== */
.home-block{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:30px;
  margin:60px 0;
  flex-wrap:wrap;
}
.home-text{flex:1 1 55%}
.home-image{flex:1 1 40%;text-align:right}
.home-image img{
  width:100%;
  max-width:360px;
  border-radius:10px;
  box-shadow:0 10px 30px rgba(0,0,0,.6);
  border:1px solid rgba(255,255,255,.2);
}
@media(max-width:800px){
  .home-block{flex-direction:column;text-align:center}
  .home-image img{max-width:100%}
}

/* ====== BLOCCO IMMAGINE ISO FISSA COME NEL PROFILO ====== */
.qualita-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

/* Testo a sinistra */
.qualita-text {
  flex: 1 1 600px;
  min-width: 300px;
}

.qualita-img-fixed {
  flex: 0 1 350px;
  position: fixed;
  top: 400px;
  right: 15%;                  /* 🔹 prima 12%, spostato più verso il bordo */
  z-index: 10;
  text-align: right;
  transform: translateX(0);   /* 🔹 eliminato lo spostamento verso sinistra */
}


.qualita-img-fixed img {
  width: 480px;            /* 🔹 Aumentato da 350px → 480px */
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.7);
  filter: brightness(1) contrast(1.1);
  transition: transform .3s ease, filter .3s ease;
}
.qualita-img-fixed img:hover {
  transform: scale(1.04);
  filter: brightness(1.1) contrast(1.15);
}


.qualita-img-fixed img:hover {
  transform: scale(1.03);
  filter: brightness(1) contrast(1.1);
}

/* Mobile: l’immagine si toglie dal fisso e torna normale */
@media (max-width: 780px) {
  .qualita-img-fixed {
    position: static;
    transform: none;
    text-align: center;
    margin-top: 20px;
  }
}

/* ====== BOX CONTATTI ====== */
.contact-box {
  position: absolute;
  top: 50%;                   /* posiziona verticalmente nella zona visibile */
  left: 58%;                  /* spostato verso destra per lasciare visibile il logo */
  transform: translate(-50%, -50%);
  background: rgba(12, 26, 34, 0.85);  /* semi-trasparente per vedere il logo dietro */
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
  border-radius: 14px;
  padding: 36px 44px;
  max-width: 420px;
  color: #d8e2ea;
  backdrop-filter: blur(10px) saturate(140%);
  text-align: left;
  line-height: 1.6;
}

.contact-box h1 {
  font-size: 2rem;
  color: #fff;
  margin-bottom: 10px;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}

.contact-box a {
  color: #a9e5ff;
  text-decoration: none;
}

.contact-box a:hover {
  text-decoration: underline;
}

@media (max-width: 700px) {
  .contact-box {
    left: 50%;
    top: 55%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    padding: 28px;
    text-align: center;
  }


}

/* === FIX: ripristina visibilità degli sfondi === */
body:not([data-page="attivita"]):not([data-page="qualita"])::before {
  display: none !important;
}

/* ================================
   BLOCCO CERTIFICAZIONI RESPONSIVE
   ================================ */
.certificazioni {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 40px;
  margin-top: 40px;
}

.certificazioni-text {
  flex: 1 1 60%;
  min-width: 300px;
}

.certificazioni-iso {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 0 1 35%;
  gap: 14px;
}

.certificazioni-iso img {
  width: auto;
  height: 130px;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.6);
  filter: brightness(1) contrast(1.05);
  transition: transform .3s ease, filter .3s ease;
}

.certificazioni-iso img:hover {
  transform: scale(1.05);
  filter: brightness(1.1) contrast(1.1);
}

/* ====== VERSIONE MOBILE ====== */
@media (max-width: 850px) {
  .certificazioni {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .certificazioni-iso {
    margin-top: 25px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .certificazioni-iso img {
    height: 90px;
  }
}

/* ================================
   BLOCCO PROFILO RESPONSIVE LOGHI
   ================================ */
.profilo-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  flex-wrap: nowrap;
  margin: 30px 0;
}

.profilo-logos img {
  height: 120px;
  width: auto;
  border-radius: 10px;
  filter: brightness(1) contrast(1.1);
  transition: transform .3s ease, filter .3s ease;
}

.profilo-logos img:hover {
  transform: scale(1.05);
  filter: brightness(1.1) contrast(1.15);
}

/* ===== MOBILE / TABLET ===== */
@media (max-width: 850px) {
  .profilo-logos {
    flex-direction: column;         /* 🔹 loghi in colonna */
    gap: 25px;
    margin-top: 20px;
  }

  .profilo-logos img {
    height: 100px;
  }
}
