.projects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: 6.5vw;
  row-gap: 7.8vw;
  width: 100%;
}

.project-item {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.46;
  overflow: hidden;
  position: relative;
}

.project-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.projects-grid .project-item:nth-child(6n+1) { grid-column: 1; }
.projects-grid .project-item:nth-child(6n+2) { grid-column: 2; }
.projects-grid .project-item:nth-child(6n+3) { grid-column: 4; }
.projects-grid .project-item:nth-child(6n+4) { grid-column: 2; }
.projects-grid .project-item:nth-child(6n+5) { grid-column: 3; }
.projects-grid .project-item:nth-child(6n+6) { grid-column: 4; }

.project-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  background: #F8F8F8;
  padding: 18px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s linear;
}

.project-cursor-grid {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 12px;
  align-items: start;
}

.project-cursor p {
  margin: 0;
  line-height: 1.35;
  font-size: 13px;
  font-family: 'STK Bureau Sans' !important;
}

.pc-left { white-space: nowrap; }

.pc-right p + p { margin-top: 2px; }

.project-info {
  display: none;
  margin-top: 10px;
}

.pi-left {
  font-size: 15px;
  margin-bottom: 4px;
}

.pi-name,
.pi-client,
.pi-area {
  margin: 0;
  line-height: 1.3;
  font-size: 17px;
}

.pi-right p + p { margin-top: 2px; }

/* TABLET */
@media (max-width: 1024px) {
  .project-item {
    aspect-ratio: auto !important;
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 5vw;
  }

  .projects-grid .project-item {
    grid-column: auto !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .project-item a {
    width: 100%;
    display: block;
    /* Asegura el MISMO ratio del desktop solo para la caja de imagen */
    aspect-ratio: 1 / 1.46;
  }

  .project-item img {
    width: 100%;
    height: 100%; /* <— antes estaba en auto; esto hacía que no llenara el alto */
    object-fit: cover;
  }

  .project-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding-top: 10px;
  }

  .pi-left {
    font-size: 13px;
    margin: 0;
    font-family: 'STK Bureau Sans' !important; 
  }

  .pi-right {
    text-align: right;
  }

  .pi-right p {
    margin: 0;
    line-height: 1.3;
    font-size: 13px;
    font-family: 'STK Bureau Sans' !important;
  }

  .pi-right p + p { margin-top: 2px; }

  .project-cursor { display: none; }
}

/* MOBILE */
@media (max-width: 767px) {
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 48px !important;
  }

  .projects-grid .project-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .project-item a {
    width: 100%;
    display: block;
    aspect-ratio: 1 / 1.46; /* mantiene el mismo ratio en móvil */
  }

  .project-item img {
    height: 100%; /* re-override para móvil (por la regla de tablet) */
    object-fit: cover;
  }

  .project-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding-top: 10px;
  }

  .pi-left {
    font-size: 14px;
    margin: 0;
  }

  .pi-right {
    text-align: right;
  }

  .pi-right p {
    margin: 0;
    line-height: 1.3;
    font-size: 14px;
  }

  .pi-right p + p { margin-top: 2px; }
}






/* GALERIA MOVIL */

.extgal{width:100%;overflow:hidden}
.extgal-track{display:flex;gap:9px}
.extgal-item{flex:0 0 auto}
.extgal-box{width:100%;aspect-ratio:73/100;overflow:hidden;background:#eee}
.extgal-box img{width:100%;height:100%;object-fit:cover;display:block}



@media (max-width:1024px){
  .elementor-image-carousel .swiper-wrapper{align-items:stretch}
  .elementor-image-carousel .swiper-slide-inner{width:100%;aspect-ratio:73/100;overflow:hidden}
  .elementor-image-carousel .swiper-slide-image{width:100%;height:100%;object-fit:cover;display:block}
}


/* GALERIAS */

#img-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#img-lightbox.on {
  display: flex;
  opacity: 1;
}

#img-lightbox .stage {
  max-width: 85vw;
  max-height: 85vh;
  position: relative;
}

#img-lightbox img {
  max-width: 85vw;
  max-height: 85vh;
  object-fit: contain;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#img-lightbox img.ready {
  opacity: 1;
}

#img-lightbox .toolbar {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  color: #fff;
  font: 500 14px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
}

#img-lightbox .close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 6px;
}

#img-lightbox .counter {
  margin-right: 8px;
  opacity: 0.9;
}

#img-lightbox button {
  text-decoration: none !important;
}

#img-lightbox .arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.14);
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

#img-lightbox .arrow:hover {
  background: rgba(255, 255, 255, 0.24);
}



#img-lightbox .prev {
  left: 24px;
}

#img-lightbox .next {
  right: 24px;
}

@media (max-width: 700px) {
  #img-lightbox .arrow {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }
  #img-lightbox .toolbar {
    top: 12px;
    right: 12px;
  }
}

html.modal-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .desktop-gallery {
    display: none !important;
  }


  #img-lightbox .stage {
    max-width: 70vw;
    max-height: 85vh;
    position: relative;
  }
  
  #img-lightbox img {
    max-width: 70vw;
    max-height: 85vh;
    object-fit: contain;
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  #img-lightbox .prev {
    left: 12px;
  }
  
  #img-lightbox .next {
    right: 12px;
  }
  
}

@media (min-width: 768px) {
  .mobile-gallery {
    display: none !important;
  }
}




/* HEADER */

.elementor-widget-theme-site-logo img {
  display:block;
  width: 96px;    /* número entero */
  height:auto;    /* mantén proporción */
  transform: translateZ(0);
  backface-visibility: hidden;
}
@media (min-width:768px){
  .elementor-widget-theme-site-logo img{ width: 202px; }
}
