/* Estilos para Masonry */
.gallery-grid {
    width: 100%;
}

.grid-sizer,
.gallery-item {
    width: 32%;
}

.gutter-sizer {
    width: 2%;
}

.gallery-item {
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.gallery-item.wide {
    width: 66%;
}


/* ===== PORTFOLIO HEADER ===== */
.portfolio-header {
   padding: 150px 0 50px;
  text-align: center;
  /*background-color: var(--color-light);*/ 
  /*background-image: url("../images/ImagenPortfolio-Design.jpg");*/
  min-height: 60vh;
  background-position: center;
  background-size: cover;
  display: flex;
  align-items: end;
  margin-top: 80px;
  flex-direction: column;
  @media(max-width: 1400px) { padding: 100px 0 30px;  min-height: 50vh;  }
  @media(max-width: 768px) { padding: 80px 20px 20px;  min-height: 40vh;  } 
}

.portfolio-header h1 {
    margin-bottom: var(--spacing-sm);
    animation-delay: 0.2s;
    color: var(--color-primary);
    font-weight: 300;
  font-size: 2.5em;
}

.portfolio-header p {
    max-width: 600px;
    margin: 0 auto;
    animation-delay: 0.4s;
}

.portfolio-hero-images {
    display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  margin: var(--spacing-lg) auto;
  max-width: 1800px;
  padding: 0 60px;
  position: relative;
   @media(max-width: 768px) {
    flex-direction: column;
    align-items: center;
    padding: 0 15px !important;
      margin: 0 auto;
    }
}

.portfolio-hero-images img {
    width: 30%;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform var(--transition-medium);
    cursor: pointer;
    @media(max-width: 768px) { width: 100%; }
}

.portfolio-hero-images img:nth-child(2) {
    scale: 1.2;
    @media(max-width: 768px) {
        scale: 1;
        }
}

.portfolio-hero-images img:hover {
    transform: scale(1.05);
    z-index: 20;
}

/* ===== PORTFOLIO FILTERS ===== */
.portfolio-filters {
    padding: var(--spacing-md) 0;
    text-align: center;
}



.filters {
    display: inline-flex;
    background-color: var(--color-light);
    border-radius: 30px;
    padding: 5px;
    margin-bottom: var(--spacing-md);
}


.filter-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-secondary);
    cursor: pointer;
    border-radius: 25px;
    transition: var(--transition-fast);
}

.filter-btn:hover {
    color: var(--color-primary);
}

.filter-btn.active {
    background-color: var(--color-pink);
    color: var(--color-white);
}

/* ===== PORTFOLIO GALLERY ===== */
.portfolio-gallery {
    padding: var(--spacing-md) 0 var(--spacing-xl);
}

/* Masonry layout */
.gallery-grid {
    width: 100%;
}

.grid-sizer,
.gallery-item {
    width: 32%;
}

.gutter-sizer {
    width: 2%;
}

.gallery-item {
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.gallery-item.wide {
    width: 66%;
}

.gallery-item.tall {
    /* Masonry will determine the height automatically */
    border: none;
}

.item-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform var(--transition-medium);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: var(--spacing-md);
    background: linear-gradient(to top, rgba(255, 255, 255, 1), transparent);
    color: var(--color-primary);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition-medium);
    height: 100%;
  display: flex;
  justify-content: start;
  align-items: end;
}



.gallery-item:hover .item-overlay {
    opacity: 1;
    transform: translateY(0);
}

.item-overlay-content {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    max-width: 250px;
    border-left: 1px solid var(--color-primary);
    padding-left: 20px;
}

.item-overlay h3 {
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.item-overlay p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    opacity: 0.8;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.item-overlay p::after {
    content:"";
    display: block;
    width: 50px;
    border-top: 1px solid var(--color-primary);
    height: 1px;
    margin-top: 10px;
}


.item-overlay h4 {
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.view-project {
    color: var(--color-white);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: underline;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--color-white);
    font-size: 1.5rem;
    z-index: 2;
    pointer-events: none;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    overflow-y: auto;
    padding: 55px 0 30px;
    box-sizing: border-box;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
}

.close-lightbox {
    position: absolute;
    top: -40px;
    right: 0;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    z-index: 2010;
}

.lightbox-media-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    border: 5px solid #fff;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 2;
}

.lightbox-prev {
    left: 15px;
}

.lightbox-next {
    right: 15px;
}

.lightbox-counter {
    display: none;
    color: #fff;
    margin: -10px 0 0;
}

.lightbox-video-container {
    width: 80vw;
    height: 45vw; /* Proporción 16:9 */
    max-width: 1000px;
    max-height: 70vh;
    background-color: #000;
    display: none;
    border: 5px solid #fff;
    position: relative;
}

.lightbox-caption {
    color: #fff;
    text-align: center;
    width: 100%;
    max-width: 800px;
    padding: 15px;
}

/* Videos en la galería */
.video-thumbnail {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* Proporción 16:9 */
    background-color: #000;
    overflow: hidden;
}

.video-thumbnail iframe,
.video-thumbnail video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-thumbnail.html5 {
    padding-bottom: 0;
    height: auto;
}

.video-thumbnail.html5 video {
    position: relative;
    width: 100%;
    height: auto;
}

.video-thumbnail.vimeo {
    position: absolute;
}


.video-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
}

/* Estilos para el indicador de carga ****************************************************************************************************/
.loading-container {
    position: relative;
    width: 100%;
    margin-bottom: 30px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-spinner {
    text-align: center;
    width: 200px;
    margin: 0 auto 30px;
}

.progress-container {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--color-pink);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.loading-text {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

.loading-progress {
    font-weight: 700;
}

/* Estilos para el efecto de esqueleto */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.skeleton-item {
    height: 250px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    border-radius: 5px;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive para el esqueleto */
@media (max-width: 992px) {
    .skeleton-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .skeleton-grid {
        grid-template-columns: 1fr;
    }
}

/* Cuando la galería está cargada, ocultamos el indicador */
.gallery-loaded .loading-container {
    opacity: 0;
    visibility: hidden;
    height: 0;
    margin: 0;
    overflow: hidden;
}

/*              *********************************************************************/
/*nuevos estilos gif animado ****************************************************/

/* Estilos para el indicador de carga con GIF */
.loading-container {
    position: relative;
    width: 100%;
    height: 300px; /* Altura mínima mientras carga */
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f9f9f9; /* Color de fondo sutil */
    transition: opacity 0.5s ease, visibility 0.5s ease, height 0.5s ease;
    margin-bottom: 30px;
}

.loading-spinner {
    text-align: center;
}

.loading-gif {
    width: 80px; /* Ajusta según el tamaño de tu GIF */
    height: auto;
    margin: 15px auto;
}

.loading-spinner p {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
    margin-top: 10px;
}

/* Cuando la galería está cargada, ocultamos el indicador */
.gallery-loaded .loading-container {
    opacity: 0;
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* PRECARGA DE IMÁGENES EN LA GALERÍA END ************************************************************************************************************/


/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 992px) {
    .grid-sizer,
    .gallery-item {
        width: 48%;
    }
    
    .gutter-sizer {
        width: 4%;
    }
    
    .gallery-item.wide {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .filters {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .filter-btn {
        margin: 5px;
    }
}

@media (max-width: 576px) {
    .grid-sizer,
    .gallery-item,
    .gallery-item.wide {
        width: 100%;
    }
    
    .gutter-sizer {
        width: 0;
    }
}