/**
 * BASE GRID LAYOUT
 * Main structure and positioning styles
 */
#gridpostcustom .custom-masonry {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
    grid-column-gap: 0px;
    grid-row-gap: 0px;
    max-width: 100%;
    height: 100vh; /* Fixed height, can be adjusted as needed */
}

/* Error message styling */
#gridpostcustom .error-message {
    padding: 20px;
    background-color: #f8d7da;
    color: #721c24;
    border-radius: 4px;
    margin: 20px 0;
    text-align: center;
    font-weight: bold;
}

/**
 * BLOCK STYLING
 * Visual appearance of each block
 */
#gridpostcustom .custom-masonry-item {
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertical centering */
    align-items: center; /* Horizontal centering */
    padding: 20px;
    color: white;
    background-size: cover;
    background-position: center;
    position: relative;
    text-align: center; /* Centered text */
}

#gridpostcustom .title-block {
    background: #f0f0f0;
    padding: 20px;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#gridpostcustom .custom-masonry-item::before {
    content: none; /* Removed overlay */
}

#gridpostcustom .content-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    text-align: center;
    background: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    padding: 10px;
    border-radius: 4px;
	max-width: 450px!important
}

#gridpostcustom .titlecontainer{max-width: 450px;}

#gridpostcustom .title-block .content-wrapper {
    text-align: left; /* Specifically left-aligned for the title block */
    background: transparent; /* No background for the title block */
    padding: 0;
}

#gridpostcustom .custom-masonry-item a {
background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 25px;
    text-decoration: none;
    display: inline-block;
    margin-top: 10px;
    border-radius: 25px;
    font-family: "PT Sans", Sans-serif;
    font-size: 16px;
    font-weight: 500;
}

#gridpostcustom .title-block .gridcustomtitle {
    font-size: 30px;
    font-weight: 800;
    font-family: "Raleway", Sans-serif;
	line-height: 35px!important;
}

#gridpostcustom .title-block .gridcustomsub {
	font-size: 15px;
    margin-top: 0;
    line-height: 18px;
	font-family: "PT Sans", Sans-serif;
}

/* Alternating title colors with optimized selectors */
#gridpostcustom .post-odd h2 {
    color: #000000; /* Black for odd posts */
    background-color: rgba(255, 255, 255, 0.7); /* Light background for dark text */
}

#gridpostcustom .post-even h2 {
    color: #ffffff; /* White for even posts */
    background-color: rgba(0, 0, 0, 0.7); /* Dark background for light text */
}

/**
 * ANIMATION STYLES
 * Keyframes and animation properties
 * Modify this section to adjust animation effects
 */
/* Keyframe definitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Block animation base properties */
#gridpostcustom .custom-masonry-item {
    opacity: 0; /* Start invisible */
    animation: fadeIn 0.8s ease-out forwards;
}

/* Content wrapper animation */
#gridpostcustom .content-wrapper {
    opacity: 0;
    animation: contentFadeIn 0.6s ease-out forwards;
}

/* Sequential animation delays for blocks */
#gridpostcustom .title-block {
    animation-delay: 0.1s;
}

#gridpostcustom .post-1 {
    animation-delay: 0.4s;
}

#gridpostcustom .post-2 {
    animation-delay: 0.7s;
}

#gridpostcustom .post-3 {
    animation-delay: 1.0s;
}

#gridpostcustom .post-4 {
    animation-delay: 1.3s;
}

/* Specific animation delays for each block's content */
#gridpostcustom .title-block .content-wrapper {
    animation-delay: 0.4s;
}

#gridpostcustom .post-1 .content-wrapper {
    animation-delay: 0.7s;
}

#gridpostcustom .post-2 .content-wrapper {
    animation-delay: 1.0s;
}

#gridpostcustom .post-3 .content-wrapper {
    animation-delay: 1.3s;
}

#gridpostcustom .post-4 .content-wrapper {
    animation-delay: 1.6s;
}

#gridpostcustom .custom-masonry-item {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

#gridpostcustom .custom-masonry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#gridpostcustom .content-wrapper h2 {
    font-family: "PT Sans", Sans-serif;
    font-size: 20px;
    line-height: 25px;
    /*text-transform: none;*/
    margin: 0px !important;
}

#gridpostcustom .custom-masonry-item:not(.title-block)::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1;
}

/**
 * RESPONSIVE STYLES
/* Desktop layout (larger than 1024px) */
@media (min-width: 1025px) {
	
	
    #gridpostcustom .custom-masonry {
        display: grid;
grid-template-columns: repeat(4, 25%);
        grid-template-rows: repeat(6, 1fr);
        width: 100%;  /* Asegura que el contenedor ocupe todo el ancho disponible */
    }
    
    /* Cada elemento con coordenadas precisas */
    #gridpostcustom .title-block {
        grid-column: 1 / 3;  /* De línea 1 a línea 3 (2 columnas de ancho) */
        grid-row: 1 / 3;
    }
    
    #gridpostcustom .post-1 {
        grid-column: 3 / 5;  /* De línea 3 a línea 5 (2 columnas de ancho) */
        grid-row: 1 / 5;
    }
    
    #gridpostcustom .post-2 {
        grid-column: 1 / 3;  /* De línea 1 a línea 3 (2 columnas de ancho) */
        grid-row: 3 / 7;
    }
    
    #gridpostcustom .post-3 {
        grid-column: 3 / 4;  /* De línea 3 a línea 4 (1 columna de ancho) */
        grid-row: 5 / 7;
    }
    
    #gridpostcustom .post-4 {
        grid-column: 4 / 5;  /* De línea 4 a línea 5 (1 columna de ancho) */
        grid-row: 5 / 7;
    }
}

/* Tablet layout (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    #gridpostcustom .custom-masonry {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(5, 1fr);
        height: 100vh;
    }
    
    #gridpostcustom .title-block {
        grid-area: 1 / 1 / 2 / 3; /* div1 */
    }
    
    #gridpostcustom .post-1 {
        grid-area: 2 / 1 / 4 / 2; /* div2 */
    }
    
    #gridpostcustom .post-2 {
        grid-area: 2 / 2 / 4 / 3; /* div3 */
    }
    
    #gridpostcustom .post-3 {
        grid-area: 4 / 1 / 6 / 2; /* div4 */
    }
    
    #gridpostcustom .post-4 {
        grid-area: 4 / 2 / 6 / 3; /* div5 */
    }
}

/* Mobile layout (less than 768px) */
@media (max-width: 768px) {
    #gridpostcustom .custom-masonry {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto;
        height: auto;
    }
    
    #gridpostcustom .title-block,
    #gridpostcustom .post-1, 
    #gridpostcustom .post-2, 
    #gridpostcustom .post-3, 
    #gridpostcustom .post-4 {
        grid-area: auto;
    }
    
    #gridpostcustom .title-block {
        grid-row: 1;
        grid-column: 1;
    }
    
    #gridpostcustom .post-1 {
        grid-row: 2;
        grid-column: 1;
    }
    
    #gridpostcustom .post-2 {
        grid-row: 3;
        grid-column: 1;
    }
    
    #gridpostcustom .post-3 {
        grid-row: 4;
        grid-column: 1;
    }
    
    #gridpostcustom .post-4 {
        grid-row: 5;
        grid-column: 1;
    }
}