/* =========================================
   RECURSOS - HERO
   ========================================= */
.recursos-hero {
    padding: var(--space-xl) 0 var(--space-lg) 0;
    background-color: var(--color-crema);
    margin-top: 80px;
    text-align: center;
}

.recursos-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    color: var(--color-negro);
    margin-bottom: var(--space-sm);
}

.recursos-subtitle {
    font-size: 1.1rem;
    color: var(--color-negro-suave);
    max-width: 600px;
    margin: 0 auto;
}

/* =========================================
   FILTROS (CHIPS)
   ========================================= */
.recursos-filters {
    padding: var(--space-md) 0 var(--space-lg) 0;
    background: white;
    position: sticky;
    top: 80px;
    z-index: 50;
    border-bottom: 1px solid var(--color-border);
}

.filter-chips {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 0.6rem 1.2rem;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-2px);
}

.filter-chip.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* =========================================
   MASONRY GRID (PINTEREST STYLE)
   ========================================= */
.recursos-grid-section {
    padding: var(--space-lg) 0 var(--space-xl) 0;
    background: var(--color-bg);
}

.masonry-grid {
    column-count: 4;
    column-gap: 1.5rem;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    position: relative;
}

.recurso-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.recurso-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.recurso-imagen-container {
    position: relative;
    overflow: hidden;
}

.recurso-imagen {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.recurso-card:hover .recurso-imagen {
    transform: scale(1.05);
}

.recurso-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1.2rem;
}

.recurso-card:hover .recurso-overlay {
    opacity: 1;
}

.recurso-categoria {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.recurso-card:hover .recurso-categoria {
    opacity: 1;
    transform: translateY(0);
}

.recurso-titulo {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: white;
    margin: 0;
    line-height: 1.3;
}

.recurso-content {
    padding: 1rem 1.2rem;
}

.recurso-titulo-static {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    color: var(--color-text);
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.recurso-descripcion {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Loading y Empty States */
.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

/* =========================================
   RESPONSIVE MASONRY
   ========================================= */
@media (max-width: 1200px) {
    .masonry-grid {
        column-count: 3;
    }
}

@media (max-width: 900px) {
    .masonry-grid {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .masonry-grid {
        column-count: 1;
    }
    
    .recursos-hero {
        margin-top: 70px;
    }
    
    .recursos-filters {
        top: 70px;
    }
}

/* =========================================
   OPTIMIZACIONES DE IMAGEN
   ========================================= */
.recurso-imagen {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Lazy loading blur effect */
.recurso-imagen[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.recurso-imagen.loaded {
    animation: none;
    background: transparent;
}

/* =========================================
   RECURSOS - HERO DIVIDIDO
   ========================================= */
.recursos-hero {
    padding: 0;
    margin-top: 80px;
    background-color: var(--color-crema);
    overflow: hidden;
}

.hero-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 500px;
}

.hero-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 2rem 4rem 4rem;
    z-index: 2;
}

.recursos-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--color-negro);
    margin-bottom: var(--space-md);
    line-height: 1.1;
}

.recursos-subtitle {
    font-size: 1.15rem;
    color: var(--color-negro-suave);
    line-height: 1.7;
    max-width: 500px;
}

.hero-image {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Difuminado sutil en los bordes para integrar con el fondo */
    -webkit-mask-image: radial-gradient(ellipse at center, black 60%, transparent 100%);
    mask-image: radial-gradient(ellipse at center, black 60%, transparent 100%);
}

/* =========================================
   MASONRY GRID (PINTEREST STYLE)
   ========================================= */
.recursos-grid-section {
    padding: var(--space-xl) 0;
    background: var(--color-bg);
}

.masonry-grid {
    column-count: 4;
    column-gap: 1.5rem;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    position: relative;
}

.recurso-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
}

.recurso-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.recurso-imagen-container {
    position: relative;
    overflow: hidden;
    cursor: zoom-in; /* Indica que se puede ampliar */
}

/* Icono de lupa al hacer hover */
.recurso-imagen-container::after {
    content: '\f00e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: white;
    font-size: 2rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
}

.recurso-card:hover .recurso-imagen-container::after {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.recurso-imagen {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
    image-rendering: -webkit-optimize-contrast;
}

.recurso-card:hover .recurso-imagen {
    transform: scale(1.05);
}

.recurso-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1.2rem;
    z-index: 1;
}

.recurso-card:hover .recurso-overlay {
    opacity: 1;
}

.recurso-categoria {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 3;
}

.recurso-card:hover .recurso-categoria {
    opacity: 1;
    transform: translateY(0);
}

.recurso-titulo {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: white;
    margin: 0;
    line-height: 1.3;
}

.recurso-content {
    padding: 1rem 1.2rem;
}

.recurso-titulo-static {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    color: var(--color-text);
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.recurso-descripcion {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* =========================================
   MODAL DE IMAGEN (LIGHTBOX)
   ========================================= */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.image-modal.is-active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.image-modal.is-active .modal-content {
    transform: scale(1);
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    object-fit: contain;
}

.modal-title {
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    margin-top: 1rem;
    padding: 0 1rem;
}

.modal-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

/* =========================================
   ESTADOS Y RESPONSIVE
   ========================================= */
.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

.recurso-imagen[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.recurso-imagen.loaded {
    animation: none;
    background: transparent;
}

@media (max-width: 1200px) {
    .masonry-grid { column-count: 3; }
}

@media (max-width: 900px) {
    .masonry-grid { column-count: 2; }
}

@media (max-width: 768px) {
    .hero-split {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    
    .hero-text {
        padding: 3rem 1.5rem;
        text-align: center;
        order: 2;
    }
    
    .recursos-subtitle {
        margin: 0 auto;
    }
    
    .hero-image {
        height: 300px;
        order: 1;
    }
    
    .masonry-grid { column-count: 1; }
    
    .modal-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}

/* =========================================
   RECURSOS - HERO COMPACTO
   ========================================= */
.recursos-hero {
    padding: 0;
    margin-top: 80px;
    background-color: var(--color-crema);
    overflow: hidden;
}

.hero-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 280px; /* ✅ Aún más compacto */
    align-items: center;
}

.hero-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 2rem 2rem 3rem;
    z-index: 2;
}

.recursos-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 3.5vw, 2.5rem); /* ✅ Más compacto */
    color: var(--color-negro);
    margin-bottom: 0.8rem;
    line-height: 1.1;
    font-weight: 700;
}

.recursos-subtitle {
    font-size: 0.95rem;
    color: var(--color-negro-suave);
    line-height: 1.5;
    max-width: 450px;
    margin: 0;
}

.hero-image {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Difuminado radial que integra la imagen con el fondo crema */
    -webkit-mask-image: radial-gradient(ellipse at center, black 50%, transparent 100%);
    mask-image: radial-gradient(ellipse at center, black 50%, transparent 100%);
}

/* =========================================
   RESPONSIVE DEL HERO
   ========================================= */
@media (max-width: 768px) {
    .hero-split {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    
    .hero-text {
        padding: 2rem 1.5rem 1rem;
        text-align: center;
        order: 2;
    }
    
    .recursos-title {
        font-size: 1.8rem;
    }
    
    .recursos-subtitle {
        margin: 0 auto;
        font-size: 0.9rem;
    }
    
    .hero-image {
        height: 200px;
        order: 1;
    }
}

/* =========================================
   RECURSOS - HERO COMPACTO
   ========================================= */
.recursos-hero {
    padding: 0;
    margin-top: 80px;
    background-color: var(--color-crema);
    overflow: hidden;
}

.hero-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 280px;
    align-items: center;
}

.hero-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 2rem 2rem 3rem;
    z-index: 2;
}

.recursos-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    color: var(--color-negro);
    margin-bottom: 0.8rem;
    line-height: 1.1;
    font-weight: 700;
    text-align: center; /* ✅ Centrado */
}

.recursos-subtitle {
    font-size: 0.95rem;
    color: var(--color-negro-suave);
    line-height: 1.5;
    max-width: 100%; /* ✅ Mismo ancho que el título */
    margin: 0 auto; /* ✅ Centrado */
    text-align: center; /* ✅ Centrado */
}

.hero-image {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    -webkit-mask-image: radial-gradient(ellipse at center, black 50%, transparent 100%);
    mask-image: radial-gradient(ellipse at center, black 50%, transparent 100%);
}

/* =========================================
   RESPONSIVE DEL HERO
   ========================================= */
@media (max-width: 768px) {
    .hero-split {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    
    .hero-text {
        padding: 2rem 1.5rem 1rem;
        order: 2;
    }
    
    .recursos-title {
        font-size: 1.8rem;
    }
    
    .recursos-subtitle {
        font-size: 0.9rem;
    }
    
    .hero-image {
        height: 200px;
        order: 1;
    }
}