h1 {    
    color: #2c3e50 !important;
    margin-bottom: 50px !important;
}

h1 span {
    color: #e74c3c !important;
}

.title-block {
    text-align: center;
    margin-bottom: 2rem;
}

.title-block h1 {
    font-size: 4.5rem;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1;
}

@media (max-width: 990px) {
    .title-block h1 {
        font-size: 3rem;
        font-weight: 600;
    }
}

@media (max-width: 760px) {
    .title-block h1 {
        margin-top: 20px;
    }
}

@media (max-width: 450px) {
    .title-block h1 {
        font-size: 2.5rem;
        font-weight: 600;
    }
}

.video-gallery-container {
    max-width: 1200px; /* Consistent with photo gallery */
    width: 100%;    
    border-radius: 12px;
    /*box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);*/
    padding: 30px;
    box-sizing: border-box;
}

.video-gallery {
    /* Fallback for older browsers */
    column-count: 4;
    column-gap: 15px;

    /* Modern grid layout */
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    grid-auto-rows: 1px; /* Clave para el efecto masonry con grid */
}

.video-item {
    display: block; /* Changed from inline-block to fix layout breaks */
    width: 100%; /* Make it fill its column */
    background: transparent; /* Eliminamos el fondo blanco */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    padding: 0; /* Eliminamos el padding que creaba el marco */
    border-radius: 8px; /* Mantenemos las esquinas redondeadas para el contenedor */
    margin-bottom: 15px; /* Space between items */
    position: relative; /* Required for the play icon overlay */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Hover effect */            
    text-decoration: none; /* Remove underline from link */            
    align-self: start; /* Clave para que el item se alinee al inicio de su celda */
}

.video-item-placeholder {
    /* background: #f9f9f9; */ /* Use the item's white background */
    box-shadow: none;
    cursor: default;
    border: 2px dashed #e0e0e0; /* Dashed border to indicate placeholder */
    background-color: #fafafa; /* Slightly off-white background */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='%23e0e0e0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='23 7 16 12 23 17 23 7'%3E%3C/polygon%3E%3Crect x='1' y='5' width='15' height='14' rx='2' ry='2'%3E%3C/rect%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    min-height: 150px; /* Ensure a minimum height */
    /* Remove hover effects for placeholder */
    transform: none !important;
    box-shadow: none !important;
}

.video-item:hover {
    transform: translateY(-5px); /* Lift effect on hover */
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); /* Enhanced shadow on hover */
}

/* Cuando la autoreproducción falla, hacemos el item clickeable */
.video-item.autoplay-failed {
    cursor: pointer;
}

.video-item .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9); /* Consistent scale */
    width: 70px;
    height: 70px;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Ensures the link is clickable */
    opacity: 0; /* Oculto por defecto */
    transition: opacity 0.2s ease-in-out;
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
/* Mostramos el icono solo si la autoreproducción ha fallado */
.video-item.autoplay-failed .play-icon {
    opacity: 1;
}

.video-item .play-icon::after {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23333'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
}

.video-item video {
    width: 100%;
    height: auto;
    display: block;
    /* Redondeamos solo las esquinas superiores para que encaje con el contenedor */
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

/* --- Estilos para el vídeo circular --- */
.video-item-circular {
    border-radius: 50% !important; /* Hacemos el contenedor principal redondo */
    overflow: hidden; /* Ocultamos lo que se salga del círculo */
    padding: 0px !important; /* Reducimos un poco el marco blanco para que se vea mejor */
}

.video-item-circular video {
    border-radius: 50% !important; /* Aseguramos que el vídeo también sea redondo */
    object-fit: cover; /* Evita que el vídeo se deforme si no es perfectamente cuadrado */
}
/* --- Fin estilos vídeo circular --- */

.video-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.5); /* Fondo semitransparente */
    color: #fff; /* Texto blanco para contraste */
    padding: 10px;
    text-align: center;
    font-size: 0.9em;
    font-weight: 600;
    transition: background-color 0.3s ease;
    /* Redondeamos las esquinas inferiores para que coincidan con el contenedor */
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Al pasar el ratón, el fondo del título se vuelve más opaco para mejor lectura */
.video-item:hover .video-title {
    background-color: rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {
    .video-gallery {
        grid-template-columns: 1fr; /* Single column on small screens */
        column-count: 1;
    }
    .video-gallery-container {
        box-shadow: none !important;
        padding: 10px !important;
        border-radius: 0px !important;
    }
    .video-item-placeholder {
        display: none; /* Oculta los placeholders en vista móvil */
    }
}
@media (min-width: 769px) and (max-width: 992px) {
    .video-gallery {
        grid-template-columns: repeat(2, 1fr); /* Two columns on tablets */
        column-count: 2;
    }
}
@media (min-width: 993px) and (max-width: 1200px) {
    .video-gallery {
        grid-template-columns: repeat(3, 1fr); /* Three columns on medium screens */
        column-count: 3;
    }
}