/* =======================================================
   1. ESTILOS BASE Y HEADER (Mantiene estilo Cultura)
   ======================================================= */
:root {
    --primary-lit: #AF52DE;
    --primary-lit-dark: #8e3eb8;
}

.lit-header {
    text-align: center;
    padding: 60px 20px 20px;
    position: relative;
    z-index: 2;
}

.lit-header h1 {
    font-size: 3.2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 15px;
    letter-spacing: -1px;
}

.lit-header p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 650px;
    margin: 0 auto 30px;
    line-height: 1.6;
}

.lit-header i.header-icon {
    font-size: 4rem;
    color: var(--primary-lit);
    margin-bottom: 20px;
    display: inline-block;
    filter: drop-shadow(0 10px 15px rgba(175, 82, 222, 0.3));
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

/* =======================================================
   2. FILTROS (Apple-style Pill Tabs)
   ======================================================= */
.filtros-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 40px;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

.btn-filtro {
    background: rgba(175, 82, 222, 0.1);
    color: var(--primary-lit);
    border: 1px solid rgba(175, 82, 222, 0.2);
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn-filtro:hover {
    background: rgba(175, 82, 222, 0.2);
    transform: translateY(-2px);
}

.btn-filtro.activo {
    background: var(--primary-lit);
    color: white;
    box-shadow: 0 8px 20px rgba(175, 82, 222, 0.3);
    border-color: var(--primary-lit);
}

/* Clase base para el indicador de scroll (Oculto en desktop) */
.scroll-hint-mobile {
    display: none;
}

/* =======================================================
   3. GRID DE RELATOS (Glassmorphism)
   ======================================================= */
.lit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 0 40px 80px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.lit-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--glass-shine), var(--card-shadow);
    cursor: pointer; /* Indica que toda la tarjeta es clicable */
}

[data-theme="dark"] .lit-card {
    box-shadow: var(--glass-shine), var(--modal-glow);
}

.lit-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-lit);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 0 30px rgba(175, 82, 222, 0.15);
}

.lit-portada {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid var(--glass-border);
    background: #e2e8f0;
}

.lit-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.lit-badge {
    align-self: flex-start;
    background: rgba(175, 82, 222, 0.15);
    color: var(--primary-lit);
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.lit-title {
    color: var(--text-main);
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0 0 10px;
    line-height: 1.3;
}

.lit-author {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.lit-excerpt {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 25px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-leer {
    background: var(--primary-lit);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    border: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none; /* Asegura que el clic lo maneje la tarjeta */
}

.lit-card:hover .btn-leer {
    background: var(--primary-lit-dark);
    box-shadow: 0 8px 15px rgba(175, 82, 222, 0.4);
    transform: translateY(-2px);
}

/* =======================================================
   4. MODAL DE LECTURA (Lienzo para Leer)
   ======================================================= */
.lectura-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lectura-modal.activo {
    display: flex;
    opacity: 1;
}

.lectura-contenedor {
    background: var(--bg-card);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 24px;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
}

.lectura-modal.activo .lectura-contenedor {
    transform: translateY(0);
}

.lectura-header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

[data-theme="dark"] .lectura-header {
    background: rgba(30, 41, 59, 0.9);
}

.btn-cerrar-modal {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.btn-cerrar-modal:hover {
    background: #ef4444;
    color: white;
}

.lectura-body {
    padding: 40px;
    color: var(--text-main);
}

.lectura-body img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.lectura-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-main);
}

.lectura-meta {
    font-size: 1rem;
    color: var(--primary-lit);
    font-weight: 600;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lectura-texto {
    font-family: 'Georgia', serif;
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-main);
    white-space: pre-line;
}

/* =======================================================
   5. BOTONES DE NAVEGACIÓN (Desktop)
   ======================================================= */
.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 10;
}

.btn-back:hover {
    background: var(--primary-lit);
    color: white;
    border-color: var(--primary-lit);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(175, 82, 222, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .lit-header {
        padding: 30px 20px 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .lit-header h1 {
        font-size: 2.5rem;
    }

    .btn-back {
        position: relative;
        top: 0;
        left: 0;
        margin: 0 auto 20px auto;
        width: max-content;
    }

    /* Indicador de scroll activo en móvil */
    .scroll-hint-mobile {
        display: block;
        text-align: center;
        color: var(--text-muted);
        font-size: 0.9rem;
        margin-bottom: 10px;
        font-weight: 500;
        animation: swipeHint 2s infinite ease-in-out;
    }

    @keyframes swipeHint {
        0%, 100% { transform: translateX(0); opacity: 0.6; }
        50% { transform: translateX(5px); opacity: 1; }
    }

    /* Scroll horizontal en una línea para móviles */
    .filtros-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 15px;
        -webkit-overflow-scrolling: touch;
        -ms-overflow-style: none;  /* IE y Edge */
        scrollbar-width: none;  /* Firefox */
    }

    .filtros-container::-webkit-scrollbar {
        display: none; /* Chrome, Safari y Opera */
    }

    .btn-filtro {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .lit-grid {
        padding: 10px 20px 60px;
        grid-template-columns: 1fr;
    }

    .lectura-body {
        padding: 25px 20px;
    }

    .lectura-title {
        font-size: 1.8rem;
    }

    .lectura-texto {
        font-size: 1.05rem;
    }
}