/* Estilos específicos para la página de Trabajos */
@import url('../../assets/css/base-page-styles.css');

/* Hero Section */
.hero {
  background: url('./img/photos/trabajos-hero.webp') no-repeat center center/cover; /* microservicio local */
  height: 100vh;
  min-height: 400px;
  margin-bottom: 4rem;
  position: relative;
  display: flex; /* centrar contenido */
  align-items: center; /* centrar vertical */
  justify-content: center; /* centrar horizontal */
  text-align: center;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 3rem; /* espacio interno para el bloque */
  /* background: rgba(99, 74, 74, 0.451);  un poco más claro */
  background: rgba(144, 126, 94, 0.367);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px); /* blur aún más claro */
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(93, 93, 93, 0.2);
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: #ffffff; /* texto claro */
  text-shadow: 
    0 6px 18px rgba(0, 0, 0, 0.55),
    0 2px 6px rgba(0, 0, 0, 0.35),
    0 0 1px rgba(0, 0, 0, 0.6);
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.9); /* subtítulo menos blanco */
  text-shadow: 
    0 4px 14px rgba(0, 0, 0, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.35);
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(7, 30, 27, 0.8) 0%, rgba(7, 30, 27, 0.6) 100%);
  z-index: 1;
}

/* Intro Section */
.intro {
  padding: 5rem 0 3rem;
  text-align: center;
}

.section-header {
  max-width: 800px;
  margin: 0 auto 3rem;
}

.section-subtitle {
  display: inline-block;
  color: var(--primary);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.section-header h2 {
  font-size: 2.5rem;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  line-height: 1.3;
}

.divider {
  width: 80px;
  height: 3px;
  background: var(--primary);
  margin: 0 auto 1.5rem;
  border-radius: 3px;
}

/* Ocultar línea verde solo en 'Proyectos Destacados' de esta página */
.intro.container .section-header .divider {
  display: none;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 0;
}

/* Filtros */
.filtros {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.filtro-btn {
  background: none;
  border: 2px solid var(--primary);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 1.25rem;
  min-width: 180px;
  box-sizing: border-box;
  border-radius: 50px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.filtro-btn:hover,
.filtro-btn.active {
  background: var(--primary);
  color: white;
}

/* Galería de Trabajos */
.galeria-trabajos {
  padding: 2rem 0 5rem;
  background-color: #f9f9f9;
}

.grid-trabajos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.proyecto-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: none;
}

.proyecto-card.visible {
  display: block;
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.proyecto-imagen {
  position: relative;
  overflow: hidden;
  padding-top: 75%;
  border: 3px solid rgba(7, 30, 27, 0.12);
  border-radius: 12px;
}

.proyecto-imagen img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9; /* transparencia un poco más marcada para unificar contraste visual */
  transition: transform 0.5s ease, opacity 0.3s ease;
}

.proyecto-imagen:hover img {
  transform: scale(1.05);
  opacity: 1; /* en hover recupera el contraste completo */
}

/* Modal de imagen */
.img-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center; /* el contenido ocupará toda la pantalla */
}

.img-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.img-modal__content {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 0; /* modal de pantalla completa */
  padding: clamp(16px, 4vw, 48px); /* respiración en todos los bordes */
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: 100vw; /* ocupa todo el ancho */
  height: 100vh; /* ocupa todo el alto */
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  overflow: auto; /* scroll interno si el contenido excede */
}

.img-modal__figure {
  margin: 0;
  width: min(92vw, 1100px); /* ancho legible en desktop */
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.img-modal__figure img {
  display: block;
  width: 100%; /* ocupa el ancho del bloque controlado */
  height: auto;
  max-height: 60vh; /* más grande en pantalla completa pero dejando espacio para texto */
  border-radius: 10px;
  margin: 0 auto;
}

.img-modal__caption {
  margin-top: 0.25rem;
  padding: 0 0.25rem;
  color: #333;
  font-size: 1rem;
  line-height: 1.7;
  text-align: left;
  max-width: min(92vw, 1100px);
  flex-shrink: 0; /* evitar que se solape con el botón por compresión vertical */
}

/* mantener ancho consistente SOLO para el caption */
.img-modal__caption {
  width: min(92vw, 1100px);
  flex-shrink: 0;
}

/* Título del caption centrado */
.img-modal__cap-title {
  font-weight: 700;
  text-align: center;
  margin: 0.25rem auto 0.5rem;
}

.img-modal__cap-body {
  text-align: left;
}

/* Botón Volver del modal */
.img-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 1.25rem;
  min-width: 180px; /* evitar botón demasiado pequeño */
  border-radius: 50px;
  border: 2px solid var(--primary);
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all .2s ease;
  margin-top: 0.25rem;
  margin-bottom: clamp(16px, 4vh, 40px); /* más espacio inferior */
  align-self: center;
  flex-shrink: 0; /* no permitir que se reduzca por falta de espacio */
}

.img-modal__close:hover,
.img-modal__close:focus {
  background: var(--primary);
  color: #fff;
  outline: none;
}

@media (min-width: 992px) {
  .img-modal__content { gap: 1.5rem; }
  .img-modal__figure img { max-height: 64vh; }
  .img-modal__caption {
    font-size: 1.05rem;
  }
}

/* Ajustes móviles para evitar solapamiento */
@media (max-width: 576px) {
  .img-modal__figure img {
    max-height: 45vh; /* reducir más la imagen en pantallas pequeñas */
  }
  .img-modal__caption {
    margin-top: 0.75rem;
  }
  .img-modal__close {
    margin-top: 1rem;
    width: auto;
    min-width: 170px; /* tamaño mínimo cómodo en móvil */
    max-width: none;
    margin-bottom: max(24px, 6vh); /* extra espacio inferior en pantallas pequeñas */
  }
}

.proyecto-categoria {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 2;
}

.proyecto-info {
  padding: 1.5rem;
}

.proyecto-info h3 {
  font-size: 1.3rem;
  color: var(--text-dark);
  margin: 0 0 0.5rem;
}

.proyecto-info p {
  color: var(--text-muted);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.ver-mas {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 0.75rem;
  min-width: 110px;
  border-radius: 999px;
  border: 1.5px solid var(--primary);
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  transition: all .18s ease;
}

.ver-mas::after {
  content: none;
}

.ver-mas:hover,
.ver-mas:focus {
  background: var(--primary);
  color: #fff;
  outline: none;
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
}

.ver-mas:active {
  transform: translateY(1px);
}

@media (max-width: 576px) {
  .ver-mas {
    height: 32px;
    min-width: 100px;
    font-size: 0.82rem;
    padding: 0 0.6rem;
  }
}

.cargar-mas {
  text-align: center;
  margin-top: 2rem;
}

/* Testimonios */
.testimonios {
  padding: 5rem 0;
  background: white;
}

/* Estilos específicos para el encabezado de testimonios */
.testimonios .section-header h2 {
  color: var(--primary);
}

.testimonios .section-header .divider {
  display: none;
}

.testimonios-slider {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.testimonio {
  background: #f9f9f9;
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column; /* permite empujar el autor al fondo para alinear iconos */
}

.testimonio:hover {
  transform: translateY(-5px);
}

.testimonio-contenido {
  position: relative;
  padding: 0 0 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* el bloque de texto ocupa el espacio flexible, dejando el autor alineado al fondo de la tarjeta */
.testimonio-contenido {
  flex-grow: 1;
}

.testimonio-contenido p {
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
  position: relative;
  padding-left: 1.5rem;
}

.testimonio-contenido p::before {
  content: none; /* se eliminan las comillas decorativas al inicio del párrafo */
}

.testimonio-autor {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.testimonio-autor img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-light);
}

.testimonio-autor h4 {
  margin: 0 0 0.25rem;
  color: var(--text-dark);
  font-size: 1.1rem;
}

.testimonio-autor span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* CTA Section */
.cta {
  position: relative;
  /* Mismo patrón que el CTA de servicios (ev-cta), adaptado a Trabajos */
  background:
    linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)),
    url('./img/photos/cta/cta-empresarial.webp') center/cover no-repeat;
  color: #fff;
  text-align: center;
  padding: clamp(2rem, 4vw, 3rem) 0;
  overflow: hidden;
}

.cta-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  place-items: center;
  gap: 1rem;
}

.cta h2 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.12;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,.28);
  margin-bottom: .6rem;
  letter-spacing: .2px;
}

.cta p {
  color: #fff;
  opacity: .96;
  font-size: clamp(1.0625rem, 2.4vw, 1.3125rem);
  line-height: 1.5;
  margin: 0 auto 1.25rem auto;
  max-width: 58ch;
  text-shadow: 0 1px 2px rgba(0,0,0,.22);
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.cta .button {
  font-weight: 700;
  padding: 1rem 1.5rem;
}

.cta .button.primary {
  background-color: var(--primary);
  color: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.cta .button.secondary {
  background: transparent;
  border: 2px solid white;
  color: white;
}

.cta .button.primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cta .button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.cta-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('../../assets/img/patterns/dots-pattern.png') center/cover;
  opacity: 0.1;
  z-index: 1;
}

/* Aumentar presencia visual del CTA en desktop, igual que ev-cta */
@media (min-width: 1024px){
  .cta {
    height: 100vh; /* fuerza a ocupar toda la altura visible en escritorio */
    background-position: center center;
  }
  .cta-content {
    min-height: 100%;
    display: grid;
    place-items: center;
  }
}

/* Responsive */
@media (max-width: 1200px) {
  .grid-trabajos {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

/* Distribución de filtros en escritorio: 'Todos' solo en primera fila y 6 por fila después */
@media (min-width: 992px) {
  .filtros {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    justify-items: center;
    align-items: stretch;
  }

  .filtro-btn {
    width: 100%;
    min-width: 0; /* para permitir 6 por fila */
  }

  .filtros .filtro-btn:first-child {
    grid-column: 1 / -1; /* ocupa toda la fila */
    width: auto; /* tamaño natural centrado */
    justify-self: center;
  }
}

@media (max-width: 992px) {
  .hero h1 {
    font-size: 3rem;
  }
  
  .section-header h2,
  .cta h2 {
    font-size: 2.2rem;
  }
  
  .grid-trabajos {
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .hero {
    height: 100vh;
  }
  
  .hero h1 {
    font-size: 2.5rem;
  }
  
  .section-header h2,
  .cta h2 {
    font-size: 2rem;
  }
  
  .intro,
  .testimonios,
  .cta {
    padding: 4rem 0;
  }
  
  .filtros {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  .filtros::-webkit-scrollbar {
    display: none;
  }
  
  .filtro-btn {
    white-space: nowrap;
    flex: 0 0 auto;
    height: 40px;
    min-width: 140px;
    font-size: 0.9rem;
  }
  
  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .cta .button {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 576px) {
  .hero h1 {
    font-size: 2rem;
  }
  
  .section-header h2,
  .cta h2 {
    font-size: 1.75rem;
  }
  
  .grid-trabajos {
    grid-template-columns: 1fr;
  }
}
