/* ============================================================
   Blog Post Grid — Beps PuroOmega Widgets
   ============================================================ */

/* === ARCHIVO DE CATEGORÍA === */

/* Heading + pills en la misma fila; pills wrappean si son muchas */
.beps-bg-archive-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 48px;
    flex-wrap: nowrap;
    margin-bottom: 40px;
}

.beps-bg-archive-heading {
    font-size: 40px;
    font-weight: 600;
    color: #130f32;
    margin: 0;
    line-height: 1.15;
    flex: 0 0 auto;
    white-space: nowrap;
    padding-top: 6px;  /* alinea visualmente con el centro de la primera fila de pills */
}

/* Pills: toman el espacio restante, se alinean a la derecha y wrappean si no caben */
.beps-bg-archive-header .beps-bg-tabs--archive {
    margin-bottom: 0;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
}
.beps-bg-tabs--archive .beps-bg-tab {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

@media (max-width: 767px) {
    .beps-bg-archive-header {
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 24px;
    }
    .beps-bg-archive-heading {
        font-size: 28px;
        flex: 0 0 100%;
        padding-top: 0;
    }
    .beps-bg-archive-header .beps-bg-tabs--archive {
        justify-content: flex-start;
        flex: 0 0 100%;
    }
}

/* === GRID === */
.beps-bg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* === CARD === */
.beps-bg-card {
    display: flex;
    flex-direction: column;
}

/* === IMAGE WRAP === */
.beps-bg-image-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.beps-bg-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.beps-bg-card:hover .beps-bg-image {
    transform: scale(1.04);
}

/* === CATEGORY BADGE === */
.beps-bg-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background-color: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 5px 13px;
    border-radius: 50px;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
}

/* === CONTENT === */
.beps-bg-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* === TITLE === */
.beps-bg-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.45;
    margin: 0 0 8px 0;
}

.beps-bg-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.beps-bg-title a:hover {
    color: #141436;
}

/* === EXCERPT === */
.beps-bg-excerpt {
    font-size: 14px;
    color: #666666;
    line-height: 1.65;
    margin: 0;
    flex: 1;
}

/* === META (author + date) === */
.beps-bg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.beps-bg-author-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

.beps-bg-author-icon circle,
.beps-bg-author-icon path {
    stroke: #888888;
}

.beps-bg-author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.beps-bg-meta-text {
    font-size: 13px;
    color: #888888;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === TABS DE CATEGORÍA === */
.beps-bg-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.beps-bg-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border: 1px solid #e5e5e5;
    border-radius: 50px;
    background: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #666666;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.beps-bg-tab:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
    color: #1a1a1a;
}

.beps-bg-tab--active {
    background-color: #141436;
    color: #fff;
    border-color: #141436;
}

/* === LAYOUT DESTACADO (featured) === */
.beps-bg-grid--featured {
    display: flex;
    align-items: stretch;
    /* gap hereda del control grid_gap */
}

/* Card destacada: columna izquierda, ocupa toda la altura del bloque */
.beps-bg-card--featured {
    flex: 1.3;
    display: flex;
    flex-direction: column;
}

.beps-bg-card--featured .beps-bg-image-wrap {
    flex: 1;
    min-height: 200px;
    margin-bottom: 0;
}

/* La imagen destacada rellena el alto del wrapper (posición absoluta).
   !important necesario para sobrescribir el selector Elementor de image_height. */
.beps-bg-card--featured .beps-bg-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100% !important;
}

.beps-bg-card--featured .beps-bg-content {
    flex-shrink: 0;
    padding-top: 16px;
}

/* Columna secundaria (cards apiladas) */
.beps-bg-featured-secondary {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* gap hereda del control grid_gap vía selector CSS */
}

.beps-bg-card--secondary {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* === PAGINACIÓN NUMERADA === */
.beps-bg-pagination {
    display: flex !important;
    gap: 4px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 40px;
    align-items: center;
}

.beps-bg-page-btn {
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1;
    text-decoration: none;
    transition: color 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.beps-bg-page-btn:hover {
    background: none !important;
    background-color: transparent !important;
    border-color: transparent !important;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.beps-bg-page-btn[aria-current="page"] {
    background: none !important;
    background-color: transparent !important;
    border-color: transparent !important;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 700;
    cursor: default;
}

.beps-bg-page-prev,
.beps-bg-page-next {
    font-size: 18px;
    font-weight: 400;
    text-decoration: none !important;
    padding: 4px 4px;
}

/* === CARGAR MÁS === */
.beps-bg-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.beps-bg-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    background-color: #141436;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.beps-bg-load-more:hover {
    background-color: #1e1e5a;
}

.beps-bg-load-more:disabled,
.beps-bg-load-more.beps-bg-loading {
    opacity: 0.6;
    cursor: wait;
}

/* === WRAP === */
.beps-bg-wrap {
    max-width: 1640px;
    margin-left: auto;
    margin-right: auto;
}

/* Estado de carga del wrap durante paginación numerada */
.beps-bg-wrap.beps-bg-loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* === PROGRESS BAR (oculta siempre; el modo carrusel la activa en móvil) === */
.beps-bg-progress { display: none; }

/* === RESPONSIVE ============================================================ */
@media (max-width: 1024px) {
    .beps-bg-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {

    /* ── Modo Carrusel (deslizable horizontal) ─────────────────────────── */
    .beps-bg-wrap--mobile-carousel {
        overflow-x: hidden;
    }

    .beps-bg-wrap--mobile-carousel .beps-bg-grid:not(.beps-bg-grid--featured) {
        display: flex !important;
        grid-template-columns: unset !important;
        overflow-x: scroll;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 16px;
        /* padding-right omitido: los browsers lo ignoran en flex overflow-x scroll.
           Se compensa con ::after (ver abajo). */
        padding: 4px 0 8px 20px;
    }
    .beps-bg-wrap--mobile-carousel .beps-bg-grid:not(.beps-bg-grid--featured)::-webkit-scrollbar { display: none; }

    /* Spacer final que sustituye al padding-right ignorado por el browser */
    .beps-bg-wrap--mobile-carousel .beps-bg-grid:not(.beps-bg-grid--featured)::after {
        content: '';
        display: block;
        min-width: 20px;
        flex-shrink: 0;
    }

    .beps-bg-wrap--mobile-carousel .beps-bg-grid:not(.beps-bg-grid--featured) .beps-bg-card {
        scroll-snap-align: start;
        min-width: calc(100vw - 40px);
        max-width: calc(100vw - 40px);
        flex-shrink: 0;
    }

    .beps-bg-wrap--mobile-carousel .beps-bg-progress {
        display: block;
        height: 3px;
        background: #e5e5e5;
        border-radius: 3px;
        margin: 14px 20px 0;
        overflow: hidden;
    }
    .beps-bg-wrap--mobile-carousel .beps-bg-progress-fill {
        height: 100%;
        background: #141436;
        border-radius: 3px;
        width: 0%;
        transition: width 0.15s ease;
    }

    /* ── Modo Grid con paginación ──────────────────────────────────────── */
    .beps-bg-wrap--mobile-grid .beps-bg-grid:not(.beps-bg-grid--featured) {
        display: grid !important;
        overflow-x: visible;
        gap: 32px;
    }
    .beps-bg-wrap--mobile-grid .beps-bg-progress { display: none !important; }

    /* ── Layout Featured (compartido por ambos modos) ──────────────────── */
    .beps-bg-grid--featured {
        flex-direction: column;
        overflow-x: visible;
    }
    .beps-bg-card--featured .beps-bg-image-wrap { flex: none; }
    .beps-bg-card--featured .beps-bg-image {
        position: static;
        width: 100%;
        height: 240px !important;
    }
    .beps-bg-featured-secondary { flex-direction: column; }
    .beps-bg-card--featured,
    .beps-bg-card--secondary {
        min-width: unset;
        max-width: unset;
        flex-shrink: 1;
    }
}
