/* ==========================================================================
   GALLERY GRID (100% Genérico + Buscador + Caption)
   ========================================================================== */

/* --- HEADER DE LA GALERÍA --- */
.realyvax-navid-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    gap: 2rem;
}

.realyvax-navid-gallery-intro {
    flex: 1;
}

.realyvax-navid-gallery-intro h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 2.25rem;
    line-height: 1.2;
}

.realyvax-navid-gallery-intro p {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 600px;
}

/* --- TOOLBAR (buscador + filtros) --- */
.realyvax-navid-gallery-toolbar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* --- BUSCADOR --- */
.realyvax-navid-gallery-search {
    position: relative;
    max-width: 420px;
    width: 100%;
}

.realyvax-navid-gallery-search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid rgba(24, 24, 24, 0.15);
    border-radius: 50px;
    font-size: 0.95rem;
    background-color: #ffffff;
    color: var(--text-color, #333);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 1rem center;
    background-size: 18px;
}

.realyvax-navid-gallery-search-input:focus {
    outline: none;
    border-color: var(--primary-color, #181818);
    box-shadow: 0 0 0 3px rgba(24, 24, 24, 0.08);
}

.realyvax-navid-gallery-search-input::placeholder {
    color: #999;
}

/* Mensaje "sin resultados" */
.realyvax-navid-gallery-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #888;
    font-style: italic;
    font-size: 0.95rem;
    margin: 2rem 0;
}

/* --- CATEGORÍAS (TAGS) --- */
.realyvax-navid-gallery-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.realyvax-navid-gallery-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    cursor: default;
}

.realyvax-navid-filters .realyvax-navid-gallery-tag {
    cursor: pointer;
    border: 1px solid transparent;
}

.realyvax-navid-filters .realyvax-navid-gallery-tag:not(.active) {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.realyvax-navid-filters .realyvax-navid-gallery-tag:not(.active):hover {
    background-color: rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.realyvax-navid-filters .realyvax-navid-gallery-tag.active {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.realyvax-navid-filters .realyvax-navid-gallery-tag.active:hover {
    opacity: 0.85;
    transform: translateY(0);
}

.realyvax-navid-filters .realyvax-navid-gallery-tag:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* --- GRID DE IMÁGENES --- */
.realyvax-navid-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* ⭐ ITEM: tarjeta con fondo gris + caption en franja inferior */
.realyvax-navid-gallery-item {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: #f3f4f6;              /* ✅ FONDO GRIS */
    border: 1px solid rgba(24, 24, 24, 0.08);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.realyvax-navid-gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(24, 24, 24, 0.10);
}

/* ⭐ IMAGEN: 4:3 por defecto, cubre todo el ancho */
.realyvax-navid-gallery-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background-color: transparent;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.realyvax-navid-gallery-item:hover img {
    transform: scale(1.06);
}

/* ⭐ CAPTION: franja blanca inferior con borde superior */
.realyvax-navid-gallery-caption {
    background-color: #fafbfc;
    border-top: 1px solid rgba(24, 24, 24, 0.06);
    font-size: 0.85rem;
    font-weight: 600;
    color: #181818;
    text-align: left;
    padding: 0.75rem 1rem;
    line-height: 1.3;
    word-break: break-word;
    hyphens: auto;
    transition: color 0.2s ease;
}

.realyvax-navid-gallery-item:hover .realyvax-navid-gallery-caption {
    color: #fac814;
}

/* ==========================================================================
   ANIMACIÓN DE FILTRADO
   ========================================================================== */
.realyvax-navid-gallery-item.filtered-out {
    display: none;
}

.realyvax-navid-gallery-item.filtered-in {
    animation: realyvax-filter-in 0.4s ease forwards;
}

@keyframes realyvax-filter-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   RESPONSIVE GALLERY GRID
   ========================================================================== */
@media (max-width: 1024px) {
    .realyvax-navid-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .realyvax-navid-gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .realyvax-navid-gallery-intro h2 {
        font-size: 2rem;
    }

    .realyvax-navid-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .realyvax-navid-gallery-categories {
        justify-content: center;
    }

    .realyvax-navid-gallery-caption {
        font-size: 0.8rem;
        padding: 0.6rem 0.75rem;
    }

    .realyvax-navid-gallery-search {
        max-width: 100%;
    }
}

@media (max-width: 500px) {
    .realyvax-navid-gallery-grid {
        grid-template-columns: 1fr;
    }
}