/* ============================
   OBRAS - Masonry + Lightbox
   ============================ */

/* --- Grid Masonry (CSS columns) --- */
.obras-section {
  padding: 90px 20px;
  background: #fafafa;
  text-align: center;
}

.obras-filters {
  display: flex;
  gap: 1px;
  justify-content: center;
  flex-wrap: wrap;
}

.section-title {
  font-size: 2.4rem;
  color: #222;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.section-subtitle {
  max-width: 800px;
  margin: 0 auto 40px;
  color: #555;
  line-height: 1.6;
}


/* ============================
   OBRAS - GRID RESPONSIVE
   ============================ */

/* Contenedor */
.obras-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 0 30px;
  opacity: 1;
  transition: opacity 0.35s ease;
}

/* Fade */
.obras-grid.fade-out {
  opacity: 0;
}
.obras-grid.fade-in {
  opacity: 1;
}

/* Items */
.obra-item {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: #111;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  transition: transform .35s ease, box-shadow .35s ease;
}

.obra-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 30px rgba(0,0,0,0.12);
}

.obra-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transition: transform .6s ease;
}

/* Overlay */
.obra-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 18px;
  background: linear-gradient(0deg, rgba(0,0,0,0.6) 15%, rgba(0,0,0,0.15) 60%, rgba(0,0,0,0) 100%);
  color: #fff;
  opacity: 0;
  transition: opacity .28s ease;
  text-align: center;
}

.obra-item:hover .obra-overlay {
  opacity: 1;
}

.obra-overlay h3 {
  color: var(--primary-color, #ffd034);
  margin-bottom: 6px;
  font-size: 1.15rem;
}

.obra-overlay p {
  color: rgba(255,255,255,0.92);
  font-size: 0.95rem;
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .obras-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 480px) {
  .obras-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .obra-item img {
    height: 180px;
  }
}


/* CTA section */
.cta-obras {
  background: url('../../img/excavaciones/excavacion12.jpeg') center/cover no-repeat;
  text-align: center;
  padding: 90px 20px;
  position: relative;
  color: #fff;
}
.cta-obras::before { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.cta-obras .cta-content { position: relative; z-index: 2; max-width: 700px; margin: 0 auto; }
.cta-obras h2 { color: var(--primary-color, #ffd034); margin-bottom: 12px; font-size: 2.2rem; }
.cta-obras p { color: #eee; margin-bottom: 20px; line-height: 1.6; }
.btn-cta { background: var(--primary-color, #ffd034); color: #111; padding: 12px 30px; border-radius: 30px; text-transform: uppercase; font-weight:700; text-decoration:none; }

/* -------------------------
   LIGHTBOX (modal)
   ------------------------- */
.lb-modal {
  position: fixed;
  inset: 0;
  display: none;               /* show when active */
  align-items: center;
  justify-content: center;
  z-index: 2000;
  background: rgba(0,0,0,0.85);
  padding: 30px;
}

.lb-modal.active { display: flex; }

.lb-inner {
  position: relative;
  max-width: 1200px;
  width: 100%;
  max-height: 95vh;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

.lb-image-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 95vh;
}

.lb-image {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}

/* Side panel for caption */
.lb-caption {
  width: 320px;
  max-height: 85vh;
  overflow: auto;
  padding: 13px;
  color: #fff;
  background-color: #00000075;
  border-radius: 10px;
}

.lb-caption h3 { color: var(--primary-color, #ffd034); margin-bottom: 8px; }
.lb-caption p { color: #e7e7e7; line-height: 1.6; font-size: .98rem; }

/* Controls */
.lb-close,
.lb-prev,
.lb-next {
  position: absolute;
  top: 18px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #111;
  background: #c5c5c5;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  transition: transform .18s ease;
  z-index: 2010;
}
.lb-close {
    right: 0;
    transform: translateX(120%);
}
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); width: 54px; height: 54px; border-radius: 12px; }
.lb-prev {
    left: 0;
    transform: translateX(-120%);
}

.lb-next {
    right: 0;
    transform: translateX(120%);
}

.lb-prev svg, .lb-next svg, .lb-close svg { pointer-events: none; }

@media (max-width: 900px) {
  .lb-inner {
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    max-height: 95vh;
  }

  .lb-image-wrap {
    max-height: 55vh;
  }

  .lb-image {
    max-height: 55vh;
    width: 100%;
    height: auto;
    object-fit: contain;
  }

  .lb-caption {
    display: block !important;
    width: 100%;
    max-height: 35vh;
    padding: 15px;
    overflow-y: auto;
    background-color: rgba(0,0,0,0.6);
    border-radius: 10px;
  }

  .lb-prev,
  .lb-next {
    top: 50%;
    transform: translateY(-50%);
  }

  .lb-prev {
    left: 18px;
    transform: translateY(-50%);
  }

  .lb-next {
    right: 18px;
    transform: translateY(-50%);
  }

  .lb-close {
    right: 18px;
    top: 18px;
    transform: none;
  }

}

/* Responsive columns */
@media (max-width: 1100px) {
  .obras-grid { column-width: 300px; column-gap: 18px; }
}
@media (max-width: 800px) {
  .obras-grid { column-width: 220px; }
}
@media (max-width: 480px) {
  .obras-grid { column-width: 160px; }
  .obra-overlay h3 { font-size: 1rem; }
  .obra-overlay p { font-size: .9rem; }
}


