.slide:nth-child(3){
  background:#555; color:#f0f0f0; padding:20px;
  display:flex; flex-direction:column; justify-content:center; align-items:center;
}
.title{font-size:2.2em;margin-bottom:30px;text-align:center;color:#fff}

/* (opzionale) griglia classica */
.projects-grid{
  display:grid;grid-template-columns:repeat(4,1fr);gap:30px;width:90%;max-width:1200px;margin:0 auto 60px;
}

/* ------ SLIDE 3 – CAROUSEL (pulito) ------ */
.projects-carousel{
  --pc-gap: 28px;
  position: relative;
  width: min(1200px, 92vw);
  margin-inline: auto;
}
.pc-arrow{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px; height: 56px;
  border: 0; border-radius: 999px;
  background: rgba(0,0,0,.6);
  color: #fff; cursor: pointer;
  z-index: 10;
  display: grid; place-items: center;
  transition: background .2s ease, transform .2s ease;
}
.pc-arrow:hover{ background: rgba(0,0,0,.8); transform: translateY(-50%) scale(1.03); }
.pc-arrow[disabled]{ opacity:.35; cursor: not-allowed; }
.pc-prev{ left: -72px; }
.pc-next{ right: -72px; }
.pc-viewport{ width: 100%; min-width: 0; overflow: hidden; padding-inline: 0; }
.pc-track{
  display: grid;
  grid-auto-flow: column;
  gap: var(--pc-gap);
  justify-content: start;
  grid-auto-columns: calc((100% - 3*var(--pc-gap)) / 4);
  will-change: transform;
  transition: transform 320ms ease;
}
.projects-carousel .project-box{
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #111; color:#fff;
  aspect-ratio: 4 / 5;
  max-height: 440px;
  box-shadow: 0 2px 12px rgba(0,0,0,.22);
  transform: translateZ(0);
  transition: transform .25s ease, box-shadow .25s ease;
  will-change: transform;
}
.projects-carousel .project-box::before{
  content:""; position:absolute; inset:0;
  background: rgba(0,0,0,.14); opacity: 1; transition: opacity .25s ease; z-index: 1;
}
.projects-carousel .project-box:hover::before{ opacity: 0; }
.projects-carousel .project-box:hover{ transform: scale(1.02); box-shadow: 0 10px 24px rgba(0,0,0,.28); }
.projects-carousel .project-thumb{ position: absolute; inset: 0; z-index: 0;}
.projects-carousel .project-thumb img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.projects-carousel .project-meta{
  position:absolute; inset:0; display:grid; place-items:center; pointer-events:none; z-index: 2;
}
.projects-carousel .project-button{
  pointer-events:auto; padding:10px 20px; border:2px solid #fff;
  background: rgba(0,0,0,.25); color:#fff; border-radius:5px; backdrop-filter: blur(2px);
  transition: background .2s ease, border-color .2s ease, transform .15s ease, box-shadow .2s ease;
}
.projects-carousel .project-button:hover{
  background: var(--accent-color); border-color: var(--accent-color);
  box-shadow: 0 6px 16px rgba(0,0,0,.25); transform: translateY(-2px);
}
.projects-cta{display:grid;place-items:center;margin-top:16px}
.btn-see-all{display:inline-block;padding:10px 16px;border-radius:10px;background:#0ea5e9;color:#fff;text-decoration:none}
@media (max-width: 1024px){
  .projects-carousel{ --pc-gap: 24px; }
  .pc-track{ grid-auto-columns: calc((100% - var(--pc-gap)) / 2); }
  .pc-prev{ left:-32px } .pc-next{ right:-32px }
}
@media (max-width: 640px){
  .projects-carousel{ --pc-gap: 16px; }
  .pc-track{ grid-auto-columns: 100%; }
  .pc-prev{ left:6px } .pc-next{ right:6px }
}

/* ===========================
   MODAL + LIGHTBOX
   =========================== */
.modal-overlay{
  position:fixed;inset:0;display:none;justify-content:center;align-items:center;
  background:rgba(128,128,128,.8);z-index:9999;padding:20px;
}
.modal-overlay.active{display:flex}
.modal-content{
  position:relative;margin:auto;display:flex;flex-direction:row;overflow:hidden;
  width:90%;max-width:1000px;height:80%;background:#fff;border-radius:8px;box-shadow:0 4px 10px rgba(0,0,0,.5);
}
.modal-close{
  position:absolute;top:20px;right:20px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;
  border:none;border-radius:50%;cursor:pointer;background:var(--accent-color);color:#fff;font-size:1.2rem;z-index:10;transition:background-color .3s;
}
.modal-close:hover{background:var(--primary-hover)}
.modal-description-box{
  width:50%;background:#f0f7ff;display:flex;flex-direction:column;justify-content:center;align-items:center;
  padding:20px;box-sizing:border-box;border-right:1px solid #ccc;
}
.modal-description{
  background:#fff;color:#333;width:100%;height:95%;padding:20px;box-sizing:border-box;border-radius:8px;
  box-shadow:inset 0 0 10px rgba(0,0,0,.05);overflow-y:auto;
}
.modal-description h3{margin:0 0 10px;font-size:1.2em;color:var(--primary-color);border-bottom:1px solid #ccc;padding-bottom:5px}
.modal-description p{line-height:1.4;margin-bottom:8px}
.modal-description .no-description{display:flex;flex-direction:column;align-items:center;text-align:center;gap:15px}
.modal-description .no-description-logo{max-width:150px;border-radius:8px}
.modal-gallery{
  width:50%;background:#fafafa;display:flex;flex-wrap:wrap;gap:10px;padding:10px;box-sizing:border-box;overflow-y:auto;
}
.modal-gallery img{
  width:calc(50% - 10px);aspect-ratio:1/1;object-fit:cover;cursor:pointer;border:2px solid #ddd;border-radius:4px;transition:transform .2s;
}
.modal-gallery img:hover{transform:scale(1.05)}

.lightbox-overlay{
  position:fixed;inset:0;display:none;justify-content:center;align-items:center;background:rgba(0,0,0,.8);z-index:10000;
}
.lightbox-overlay.active{display:flex}
.lightbox-content{position:relative}
.lightbox-content img{
  max-width:90vw;max-height:90vh;border:2px solid #fff;box-shadow:0 4px 10px rgba(0,0,0,.8);
}
.lightbox-close{
  position:absolute;top:-20px;right:-20px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;
  border:1px solid #333;border-radius:50%;background:#fff;color:#333;font-weight:bold;cursor:pointer;
}
.lightbox-close:hover{background:#ddd}
.lightbox-arrow{
  position:absolute;top:50%;transform:translateY(-50%);z-index:10;
  color:#fff;font-size:2rem;background:rgba(0,0,0,.3);padding:10px;border-radius:50%;cursor:pointer;user-select:none;
}
.lightbox-arrow:hover{background:rgba(0,0,0,.6)}
.lightbox-arrow.left{left:-60px}
.lightbox-arrow.right{right:-60px}

/* ===========================
   MODAL (Dettagli + Thumbs)
   =========================== */
.gallery-modal{
  position: fixed; inset: 0;
  display: none; justify-content: center; align-items: center;
  background: rgba(128,128,128,.8); z-index: 10000; padding: 20px;
}
.gallery-modal.active{ display: flex; }
.gallery-modal .modal-content{
  position: relative; margin:auto; display:flex; flex-direction:row; overflow:hidden;
  width:90%; max-width:1000px; height:80%; background:#fff; border-radius:8px;
  box-shadow:0 4px 10px rgba(0,0,0,.5);
}

/* Montaggio/smontaggio con aria-hidden */
#gallery-modal[aria-hidden="true"] { display: none; }
#gallery-modal[aria-hidden="false"] { display: block; }

/* Sfondo scuro dietro alla modale */
#gallery-modal .modal-backdrop{
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9998;
}

/* Contenitore modale – tema chiaro a due colonne */
#gallery-modal .modal-content{
  position: fixed; inset: 3% 3%; background: #f7f9fb; color: #1f2937;
  border-radius: 18px; box-shadow: 0 20px 48px rgba(0,0,0,.28);
  display: grid; grid-template-rows: auto 1fr; z-index: 9999;
  overflow: auto; max-height: 94vh; max-width: 94vw;
}

/* Topbar con X */
#gallery-modal .modal-topbar{ display:flex; justify-content:flex-end; padding:8px 8px 0; }
#gallery-modal .modal-close{
  width:42px; height:42px; border:0; border-radius:50%;
  background:#2563eb; color:#fff; font-size:28px; cursor:pointer;
  box-shadow:0 6px 16px rgba(37,99,235,.35);
}
#gallery-modal .modal-close:focus-visible{ outline:2px solid #60a5fa; outline-offset:2px; }

/* Layout colonne */
#gallery-modal .modal-columns{
  display:grid; grid-template-columns:1fr 2fr; gap:1rem; padding:1rem; height:100%; min-height:0;
}
#gallery-modal .modal-left, #gallery-modal .modal-right{
  overflow:auto; min-height:0; -webkit-overflow-scrolling:touch;
}

/* Pannello sinistro (dettagli) */
#gallery-modal .modal-left{
  background:#ffffff; border:1px solid #e5e7eb; border-radius:14px;
  padding:1rem 1rem 1.25rem; box-shadow:0 10px 24px rgba(0,0,0,.06);
}
#gallery-modal .modal-title{ margin:0 0 .6rem; color:#1d4ed8; font-size:1.2rem; font-weight:700; }
#gallery-modal .field-heading{ margin:.75rem 0 .25rem; color:#1f2937; font-size:1rem; font-weight:700; }
#gallery-modal .field-value{ margin:0; font-size:.98rem; color:#111827; }
#gallery-modal .modal-left-divider{ height:2px; background:#dbeafe; border-radius:2px; margin:1rem 0 .8rem; }

/* Griglia thumbs */
#gallery-modal .thumbs-grid{
  display:grid; gap:.9rem; padding:.25rem .25rem 0;
  grid-template-columns:repeat(2, minmax(0, 1fr));
}
@media (min-width: 900px){
  #gallery-modal .thumbs-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
#gallery-modal .thumbs-grid img{
  width:100%; height:100%; object-fit:cover; aspect-ratio:4 / 3; display:block;
  border:1px solid #e5e7eb; border-radius:12px; box-shadow:0 8px 20px rgba(0,0,0,.06);
  cursor:zoom-in; transition:transform .15s ease, box-shadow .15s ease;
}
#gallery-modal .thumbs-grid img:hover{ transform:translateY(-2px); box-shadow:0 12px 26px rgba(0,0,0,.10); }

/* Responsive modale */
@media (max-width: 640px){
  #gallery-modal .modal-content{ inset: 6% 3%; }
  #gallery-modal .modal-columns{ grid-template-columns: 1fr; }
  #gallery-modal .thumbs-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* ===========================
   LIGHTBOX a schermo intero
   =========================== */
#img-lightbox{ position: fixed; inset: 0; display:none; justify-content:center; align-items:center; background: rgba(0,0,0,.8); z-index:10001; }
#img-lightbox.active{ display:flex; }
#img-lightbox[aria-hidden="true"]{ display:none; }
#img-lightbox[aria-hidden="false"]{ display:block; }
#img-lightbox .imglb-backdrop{ position:fixed; inset:0; background:rgba(0,0,0,.92); z-index:10000; }
#img-lightbox .imglb-content{
  position:fixed; inset:0; z-index:10001; display:flex; align-items:center; justify-content:center; pointer-events:none;
}
#img-lightbox .imglb-image{
  max-width:92vw; max-height:86vh; object-fit:contain; background:#000; border-radius:8px; pointer-events:auto; display:block;
}
#img-lightbox .imglb-close, #img-lightbox .imglb-nav{
  position:fixed; border:0; border-radius:50%; width:44px; height:44px; background:rgba(255,255,255,.18);
  color:#fff; font-size:28px; cursor:pointer; pointer-events:auto;
}
#img-lightbox .imglb-close{ top:14px; right:16px; }
#img-lightbox .imglb-nav{ top:50%; transform:translateY(-50%); }
#img-lightbox .imglb-nav.prev{ left:18px; }
#img-lightbox .imglb-nav.next{ right:18px; }
#img-lightbox .imglb-counter{ position:fixed; left:16px; bottom:14px; color:#fff; opacity:.9; font-size:.95rem; pointer-events:none; }

/* Motion reduce */
@media (prefers-reduced-motion: reduce){
  #gallery-modal *, #img-lightbox *{
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}