
/* =========================
   PROYECTOS DESTACADOS — full-bleed hero + thumbnails
   ========================= */

.proyectos-destacados {
  padding: 4rem 0 0;
}

/* Separador visual hacia la galería */
.gallery-section {
  position: relative;
}

.gallery-section::before {
  /* content: "GALERIA"; */
  display: block;
  text-align: center;
  letter-spacing: 0.22em;
  font-size: 2rem;
  font-weight: 600;
  color: #292323;
  padding: 3.5rem 0 0;
}

/* ---- Card de proyecto — altura dinámica según contenido ---- */
.proyecto-destacado {
  position: relative;
  width: 100%;
  overflow: hidden;
  margin-bottom: 4px;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.proyecto-destacado.pd--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Imagen de fondo fija */
.pd-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 8s ease;
  transform-origin: center center;
}

.proyecto-destacado:hover .pd-bg {
  transform: scale(1.04);
}

/* Overlay degradado */
.pd-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right,
      rgba(0, 0, 0, 0.82) 0%,
      rgba(0, 0, 0, 0.65) 40%,
      rgba(0, 0, 0, 0.55) 100%);
  z-index: 1;
}

/* Info — en flujo normal, define la altura de la card */
.pd-info {
  position: relative;
  z-index: 3;
  padding: 3rem 3rem 3rem 3rem;
  /* Deja espacio a la derecha para las thumbs (45% del ancho) */
  width: 55%;
  box-sizing: border-box;
}

.pd-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.pd-numero {
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.pd-cat {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  padding: 0.28em 0.75em;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  backdrop-filter: blur(4px);
}

.pd-titulo {
  font-size: clamp(1.6rem, 3.5vw, 2.8rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: #fff;
  margin: 0 0 0.5rem;
}

.pd-cliente {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 1rem;
  letter-spacing: 0.03em;
  background-color: #000000c5;
  display: inline-block;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  margin-top: 0.5rem;
}

.pd-descripcion {
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
  
}


/* ---- Thumbnails — grid adaptativo derecha ---- */
.pd-thumbs {
  position: absolute;
  right: 3rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: grid;
  /* default: 2 cols — se sobreescribe según count */
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  width: 40%;
  aspect-ratio: 16 / 9;
}

/* 1 thumb: ocupa todo el ancho derecho, sin grid hueco */
.pd-thumbs[data-count="1"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  aspect-ratio: 16 / 9;
}

/* 2 thumbs: fila única, dos columnas iguales */
.pd-thumbs[data-count="2"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  aspect-ratio: 32 / 9;   /* el doble de ancho, misma altura */
}

/* 3 thumbs: 2 en primera fila, 1 centrado abajo (o col derecha doble) */
.pd-thumbs[data-count="3"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 16 / 9;
}

/* El tercer thumb en grid 2×2 ocupa las dos columnas de la segunda fila */
.pd-thumbs[data-count="3"] .pd-thumb:nth-child(3) {
  grid-column: 1 / -1;
}

/* 4 thumbs: 2×2, unchanged */

/* 5 thumbs: 3 cols, 2 rows */
.pd-thumbs[data-count="5"] {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 24 / 9;
}

/* 6 thumbs: 3 cols, 2 rows */
.pd-thumbs[data-count="6"] {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 24 / 9;
}

/* Selector CSS moderno como progressive enhancement */
@supports selector(:has(*)) {
  .pd-thumbs:has(.pd-thumb:nth-child(1):last-child) {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    aspect-ratio: 16 / 9;
  }
  .pd-thumbs:has(.pd-thumb:nth-child(2):last-child) {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    aspect-ratio: 32 / 9;
  }
  .pd-thumbs:has(.pd-thumb:nth-child(3):last-child) .pd-thumb:nth-child(3) {
    grid-column: 1 / -1;
  }
}

.pd-thumb {
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.55);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.pd-thumb:hover {
  border-color: rgba(255, 255, 255, 0.75);
  transform: scale(1.03);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.65);
  z-index: 1;
}

.pd-thumb--active {
  border-color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.75);
  z-index: 1;
}

.pd-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s ease, transform 0.25s ease;
  opacity: 0.72;
}

.pd-thumb:hover img,
.pd-thumb--active img {
  opacity: 1;
  transform: scale(1.04);
}

/* Play icon en thumb video */
.pd-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  background-color: rgba(255, 255, 255, 0.92);
  mask: url("../img/play.svg") center/contain no-repeat;
  -webkit-mask: url("../img/play.svg") center/contain no-repeat;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

/* =========================
   LIGHTBOX — navegación prev/next
   ========================= */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, transform 0.12s ease;
  z-index: 10020;
  backdrop-filter: blur(4px);
  padding: 0;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-nav--prev {
  left: 20px;
}

.lightbox-nav--next {
  right: 20px;
}

.lightbox-nav:active {
  transform: translateY(-50%) scale(0.94);
}

/* Ocultar nav cuando no hay items para navegar */
.lightbox-nav.lb-hidden {
  display: none;
}

/* Contador de posición */
.lightbox-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.12em;
  z-index: 10020;
  pointer-events: none;
}

/* =========================
   RESPONSIVE PROYECTOS DESTACADOS
   ========================= */
@media (max-width: 900px) {
  .pd-info {
    width: 52%;
    padding: 2.5rem 2rem 2.5rem 2rem;
  }

  .pd-thumbs {
    right: 1.5rem;
    width: 43%;
    gap: 6px;
  }
}

@media (max-width: 600px) {
  .pd-overlay {
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.705) 1%,
        rgb(0, 0, 0) 100%);
  }

  /* Móvil: info ocupa todo el ancho */
  .pd-info {
    width: 100%;
    padding: 1.6rem 1.2rem 1.4rem;
  }

  .pd-titulo {
    font-size: 1.5rem;
  }

  .proyectos-destacados {
    padding: 2.5rem 0 0;
  }

  /* Thumbs: debajo del texto, ancho completo, se adaptan al count */
  .pd-thumbs {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    transform: none;
    width: 95%;
    margin: 0 auto 1.4rem;
    gap: 5px;
    /* aspect-ratio base para 2×2 */
    aspect-ratio: 4 / 2.1;
  }

  /* 1 thumb mobile: relación 16/9 limpia */
  .pd-thumbs[data-count="1"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    aspect-ratio: 16 / 9;
    width: 95%;
  }

  /* 2 thumbs mobile: lado a lado */
  .pd-thumbs[data-count="2"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    aspect-ratio: 2 / 0.6;
  }

  /* 3 thumbs mobile: 2 arriba + 1 abajo full ancho */
  .pd-thumbs[data-count="3"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 4 / 2.5;
  }

  .pd-thumbs[data-count="3"] .pd-thumb:nth-child(3) {
    grid-column: 1 / -1;
  }

  /* 4 thumbs mobile: 2×2 */
  .pd-thumbs[data-count="4"] {
    aspect-ratio: 4 / 2.1;
  }

  /* 5 thumbs mobile: 3 cols, 2 rows */
  .pd-thumbs[data-count="5"],
  .pd-thumbs[data-count="6"] {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 4 / 2.1;
  }

  /* Progressive enhancement mobile */
  @supports selector(:has(*)) {
    .pd-thumbs:has(.pd-thumb:nth-child(1):last-child) {
      grid-template-columns: 1fr;
      grid-template-rows: 1fr;
      aspect-ratio: 16 / 9;
    }
    .pd-thumbs:has(.pd-thumb:nth-child(2):last-child) {
      grid-template-columns: 1fr 1fr;
      grid-template-rows: 1fr;
      aspect-ratio: 2 / 0.6;
    }
    .pd-thumbs:has(.pd-thumb:nth-child(3):last-child) .pd-thumb:nth-child(3) {
      grid-column: 1 / -1;
    }
  }
}