/* --- ESTILOS ESPECÍFICOS PARA PÁGINAS DE PROYECTO --- */

.page-project .project-page-container { 
    padding: 0 !important; 
    border-bottom: none !important;
}

.page-project .project-header {
    background-color: #000000;
    color: #ffffff;
    min-height: 49vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 5rem 2rem;
    text-align: center;
    margin: 0;
}
.page-project .project-header {
    background-color: #000000;
    color: #ffffff;
    min-height: 49vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    
    /* CAMBIO: Aumentamos el padding superior de 5rem a 10rem */
    padding: 10rem 2rem 5rem 2rem; 
    
    text-align: center;
    margin: 0;
}
.page-project .project-description { 
    font-size: 1.1rem; 
    line-height: 1.8;
    max-width: 800px;
    color: #ffffff;
}

/* --- GALERÍA DE BRANDING (.project-gallery-grid) --- */
.project-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    width: 100%;
    max-width: 1400px;
    padding: 6rem 2rem;
    margin: 0 auto;
}
.gallery-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 3 / 4;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.gallery-card--fullwidth {
    grid-column: 1 / -1; 
    aspect-ratio: 16 / 7;
}
.gallery-card--mobile-only {
    display: none;
    aspect-ratio: 1 / 1;
}
.gallery-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.gallery-card img, .gallery-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.gallery-card:hover img, .gallery-card:hover video {
    transform: scale(1.05);
}

/* --- INICIO: NUEVOS ESTILOS PARA LA GALERÍA DE SOCIAL MEDIA --- */
.social-media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columnas en desktop */
    grid-auto-flow: dense; /* Ayuda a rellenar huecos en diseños asimétricos */
    gap: 2rem;
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}
.grid-item-v2 {
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.grid-item-v2.is-visible {
    opacity: 1;
    transform: translateY(0);
}
/* Estilo para tarjetas que ocupan más espacio vertical */
.grid-item-v2.vertical {
    grid-row: span 2;
}
.grid-item-v2 img, .grid-item-v2 video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    background-color: #f0f0f0;
}
.caption-v2 {
    padding: 1rem 0.1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}
.caption-v2-text {
    flex-grow: 1;
}
.caption-v2 h3 { 
    font-family: 'Raleway', sans-serif; 
    font-size: 1rem; 
    font-weight: 700; 
    margin: 0 0 0.2rem 0; 
    color: #000;
}
.caption-v2 p { 
    font-family: 'Raleway', sans-serif; 
    font-size: 0.9rem; 
    color: #555; 
    margin: 0; 
    line-height: 1.4; 
}
.icon-link-custom {
    flex-shrink: 0;
}
.icon-link-custom svg {
    transition: stroke 0.3s ease, transform 0.3s ease;
    stroke: #444;
}
.icon-link-custom:hover svg {
    stroke: var(--acento);
    transform: scale(1.1);
}
/* --- FIN: NUEVOS ESTILOS PARA LA GALERÍA DE SOCIAL MEDIA --- */

/* --- RESPONSIVIDAD PARA PÁGINAS DE PROYECTO --- */
@media (max-width: 992px) {
    .project-gallery-grid, .social-media-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .gallery-card--fullwidth { display: none; }
    .gallery-card--mobile-only { display: block; }
    .project-header h2 { font-size: 14vw; }
    .project-gallery-grid, .social-media-grid {
        padding: 4rem 1rem;
        grid-template-columns: 1fr; /* 1 columna en móvil */
    }
}
/* --- INICIO: ESTILOS MASONRY v7 (SOLUCIÓN DEFINITIVA MÓVIL Y DESKTOP) --- */

/* --- Estilos para Desktop (Tablet y más grandes) --- */
.masonry-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem; 
    grid-auto-rows: 1px;
    padding: 6rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.masonry-gallery.loaded {
    opacity: 1;
}

.masonry-card {
    position: relative;
    height: fit-content;
    opacity: 0;
    transform: translateY(-30px); 
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.masonry-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Estilos de contenido (no cambian) --- */
.masonry-card img { width: 100%; height: auto; display: block; border-radius: 12px; }
.masonry-card__caption { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.25rem 0.75rem; background-color: #ffffff; }
.masonry-card__text { flex-grow: 1; }
.masonry-card__caption h3 { font-family: 'Raleway', sans-serif; font-weight: 700; font-size: 1rem; color: #000000; margin: 0 0 0.25rem 0; line-height: 1.3; }
.masonry-card__caption p { font-family: 'Raleway', sans-serif; font-size: 0.9rem; color: #555555; margin: 0; line-height: 1.5; }
.masonry-card__link { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid #ddd; border-radius: 50%; color: #333; transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease; }
.masonry-card__link:hover { background-color: #f0f0f0; border-color: #333; transform: scale(1.05); }
.masonry-card__link svg { width: 20px; height: 20px; }


/* ---- LA SOLUCIÓN DEFINITIVA PARA MÓVIL (768px o menos) ---- */
@media (max-width: 768px) {
    .masonry-gallery {
        /* APAGAMOS EL GRID: Ahora se comporta como una lista vertical normal. */
        display: block;
        padding: 4rem 1rem;
    }

    /* Añadimos el espaciado vertical que perdimos al quitar 'gap' */
    .masonry-card {
        margin-bottom: 2rem;
    }
}
/* --- FIN: ESTILOS MASONRY v7 --- */
/* --- INICIO: CORRECCIÓN PARA VIDEOS EN GALERÍA MASONRY --- */

/* Esta regla le dice a los videos que se comporten 
  exactamente igual que las imágenes: que ocupen el 100% 
  del ancho de la tarjeta y ajusten su altura automáticamente.
*/
.masonry-card video {
    width: 100%;
    height: auto;
    display: block;
	    border-radius: 12px; /* Añade el borde redondeado aquí */

}
.masonry-card--full {
  grid-column: 1 / -1; /* ocupa todas las columnas del grid */
}

/* --- FIN DE LA CORRECCIÓN --- */
