/* =============================================
   PUBLICACIONES - Cards en Home + Detalle + Galería + Lightbox
   ============================================= */

/* =====================
   GRID DE PUBLICACIONES (HOME)
   ===================== */

.pub-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 0;
}

.pub-col {
    display: flex;
}

/* =====================
   CARD DE PUBLICACIÓN
   ===================== */

.pub-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid #eee;
}

.pub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* Imagen - VERTICAL (500x625 = 4:5) */
.pub-card-img {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/5;
    background: #f0f0f0;
}

.pub-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.pub-card:hover .pub-card-img img {
    transform: scale(1.05);
}

/* Fecha sobre la imagen */
.pub-card-date {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(11, 92, 33, 0.92);
    color: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    text-align: center;
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    backdrop-filter: blur(4px);
}

.pub-date-day {
    font-size: 22px;
    font-weight: 700;
    display: block;
    line-height: 1;
}

.pub-date-month {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 400;
    display: block;
    margin-top: 2px;
}

.pub-date-year {
    font-size: 10px;
    opacity: 0.7;
    display: block;
}

/* Badge de galería */
.pub-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(200, 168, 78, 0.92);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

/* Cuerpo */
.pub-card-body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pub-card-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 8px 0;
    color: #1a1a1a;
    font-family: 'Lato', sans-serif;
}

.pub-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.pub-card-title a:hover {
    color: #0B5C21;
}

.pub-card-subtitle {
    font-size: 13px;
    color: #0B5C21;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.pub-card-text {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 14px 0;
    flex: 1;
}

.pub-card-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #0B5C21;
    text-decoration: none;
    transition: gap 0.2s;
    margin-top: auto;
}

.pub-card-more:hover {
    gap: 8px;
    color: #094a1a;
    font-weight: 600;
}

/* Card sin imagen */
.pub-card-img.no-image {
    background: linear-gradient(135deg, #0B5C21 0%, #1a8a3e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pub-card-img.no-image::after {
    content: '\f1ea';
    font-family: FontAwesome;
    font-size: 40px;
    color: rgba(255,255,255,0.2);
}

/* Legacy cards (publicaciones viejas) */
.pub-card-legacy {
    overflow: auto;
}

.pub-card-legacy .pub-card-body {
    padding: 0;
}

.pub-card-legacy .single-blog {
    box-shadow: none;
    border: none;
    margin: 0;
}

/* =====================
   PAGINACIÓN (HOME)
   ===================== */

.pub-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    padding: 20px 0;
    flex-wrap: wrap;
}

.pub-pag-num,
.pub-pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.pub-pag-num {
    background: #fff;
    color: #555;
    border: 1px solid #ddd;
}

.pub-pag-num:hover {
    border-color: #0B5C21;
    color: #0B5C21;
    font-weight: 600;
}

.pub-pag-num.active {
    background: #0B5C21;
    color: #fff;
    border-color: #0B5C21;
}

.pub-pag-btn {
    background: #f5fbf6;
    color: #0B5C21;
    border: 1px solid #c8e6cc;
}

.pub-pag-btn:hover {
    background: #0B5C21;
    color: #fff;
    font-weight: 600;
}

/* =====================
   RESPONSIVE GRID
   ===================== */

@media (max-width: 1200px) {
    .pub-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 900px) {
    .pub-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

@media (max-width: 560px) {
    .pub-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* En móvil, card horizontal para no ocupar tanto alto */
    .pub-card {
        flex-direction: row;
    }

    .pub-card-img {
        aspect-ratio: 3/4;
        width: 130px;
        min-width: 130px;
        flex-shrink: 0;
    }

    .pub-card-body {
        padding: 14px;
    }

    .pub-card-title {
        font-size: 15px;
    }

    .pub-card-text {
        font-size: 12px;
        margin-bottom: 10px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .pub-card-date {
        padding: 4px 7px;
        min-width: 40px;
        top: 8px;
        left: 8px;
    }

    .pub-date-day {
        font-size: 16px;
    }

    .pub-date-month {
        font-size: 9px;
    }

    .pub-date-year {
        display: none;
    }

    .pub-card-badge {
        top: auto;
        bottom: 8px;
        right: 8px;
        top: unset;
        font-size: 10px;
        padding: 3px 8px;
    }

    .pub-pagination {
        gap: 4px;
    }

    .pub-pag-num, .pub-pag-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 0 10px;
    }
}


/* ====================================================
   DETALLE DE PUBLICACIÓN (publicacion.php)
   ==================================================== */

.pub-detail {
    padding-bottom: 30px;
}

/* Breadcrumb */
.pub-breadcrumb {
    font-size: 13px;
    color: #888;
    margin-bottom: 24px;
    font-family: 'Lato', sans-serif;
}

.pub-breadcrumb a {
    color: #0B5C21;
    text-decoration: none;
}

.pub-breadcrumb a:hover {
    text-decoration: underline;
}

.pub-breadcrumb-sep {
    margin: 0 8px;
    color: #ccc;
}

/* Header */
.pub-header {
    margin-bottom: 28px;
}

.pub-header-date {
    display: inline-block;
    font-size: 13px;
    color: #0B5C21;
    font-weight: 600;
    margin-bottom: 10px;
    background: #f0faf2;
    padding: 5px 14px;
    border-radius: 20px;
}

.pub-header-date i {
    margin-right: 4px;
}

.pub-header-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.25;
    margin: 0 0 10px 0;
    font-family: 'Lato', sans-serif;
}

.pub-header-subtitle {
    font-size: 18px;
    color: #0B5C21;
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
    border-left: 3px solid #0B5C21;
    padding-left: 14px;
}

/* =====================
   LAYOUT IMAGEN + TEXTO (DETALLE)
   Imagen vertical a la izquierda, texto envuelve
   ===================== */

.pub-content-layout {
    margin-bottom: 30px;
    overflow: hidden; /* clearfix para float */
}

.pub-hero-float {
    float: left;
    width: 320px;
    margin: 0 28px 16px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.pub-hero-float img {
    width: 100%;
    height: auto;
    display: block;
}

.pub-body {
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 30px;
}

.pub-body p {
    margin-bottom: 10px;
}

.pub-text-heading {
    font-size: 20px;
    font-weight: 700;
    color: #0B5C21;
    margin: 24px 0 10px 0;
    font-family: 'Lato', sans-serif;
}

/* Fallback: imagen hero sin float (cuando no hay imagen o para compatibilidad) */
.pub-hero-img {
    margin-bottom: 30px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.pub-hero-img img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 500px;
    object-fit: cover;
}

/* Firma */
.pub-firma {
    padding: 16px 20px;
    border-left: 4px solid #0B5C21;
    background: #f5fbf6;
    border-radius: 0 8px 8px 0;
    margin-bottom: 24px;
    max-width: 400px;
    clear: both;
}

.pub-firma p {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.5;
}

/* Compartir */
.pub-share {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
}

.pub-share-label {
    font-size: 13px;
    font-weight: 600;
    color: #888;
}

.pub-share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pub-share-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
    color: #fff;
}

.pub-share-wp { background: #25d366; }
.pub-share-fb { background: #1877f2; }

/* Volver */
.pub-back {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

.pub-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: #f0faf2;
    color: #0B5C21;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #c8e6cc;
    transition: all 0.2s;
}

.pub-btn-back:hover {
    background: #0B5C21;
    color: #fff;
    font-weight: 600;
}


/* ====================================================
   GALERÍA DE IMÁGENES
   ==================================================== */

.pub-gallery-section {
    margin: 40px 0 0;
    padding-top: 30px;
    border-top: 2px solid #eee;
    clear: both;
}

.pub-gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.pub-gallery-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    font-family: 'Lato', sans-serif;
}

.pub-gallery-header h2 i {
    color: #0B5C21;
    margin-right: 6px;
}

.pub-gallery-count {
    font-size: 13px;
    color: #888;
    background: #f5f5f5;
    padding: 4px 14px;
    border-radius: 20px;
}

/* Grid de galería */
.pub-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.pub-gallery-thumb {
    display: block;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: #f0f0f0;
    cursor: pointer;
}

.pub-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.pub-gallery-thumb:hover img {
    transform: scale(1.08);
}

.pub-gallery-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 92, 33, 0.0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.pub-gallery-thumb-overlay i {
    color: #fff;
    font-size: 28px;
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.3s ease;
}

.pub-gallery-thumb:hover .pub-gallery-thumb-overlay {
    background: rgba(11, 92, 33, 0.4);
}

.pub-gallery-thumb:hover .pub-gallery-thumb-overlay i {
    opacity: 1;
    transform: scale(1);
}

/* Botones de descarga */
.pub-gallery-downloads {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pub-btn-download-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #fff;
    color: #0B5C21;
    border: 2px solid #0B5C21;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    font-family: 'Lato', sans-serif;
}

.pub-btn-download-all:hover {
    background: #0B5C21;
    color: #fff;
    font-weight: 600;
}


/* ====================================================
   LIGHTBOX CUSTOM (uom-lightbox para evitar conflicto
   con el plugin lightbox.js viejo)
   ==================================================== */

.uom-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.uom-lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.uom-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}

.uom-lightbox-content {
    position: relative;
    z-index: 1;
    width: 90vw;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.uom-lightbox-close {
    position: absolute;
    top: -44px;
    right: 0;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 26px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
    z-index: 2;
}

.uom-lightbox-close:hover {
    color: #fff;
}

.uom-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 22px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.uom-lightbox-nav:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.uom-lightbox-prev { left: -60px; }
.uom-lightbox-next { right: -60px; }

.uom-lightbox-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: calc(90vh - 70px);
    overflow: hidden;
}

.uom-lightbox-img-wrap img {
    max-width: 100%;
    max-height: calc(90vh - 70px);
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    user-select: none;
}

.uom-lightbox-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 14px;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    width: 100%;
    justify-content: center;
}

.uom-lightbox-title {
    flex: 1;
    text-align: center;
    font-weight: 500;
}

.uom-lightbox-counter {
    font-size: 12px;
    opacity: 0.6;
}

.uom-lightbox-download {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.uom-lightbox-download:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-weight: 600;
}


/* =====================
   RESPONSIVE DETALLE + GALERÍA + LIGHTBOX
   ===================== */

@media (max-width: 768px) {
    .pub-header-title {
        font-size: 24px;
    }

    .pub-header-subtitle {
        font-size: 15px;
    }

    /* Imagen arriba del texto en móvil, no al costado */
    .pub-hero-float {
        float: none;
        width: 100%;
        max-width: 400px;
        margin: 0 auto 20px auto;
    }

    .pub-hero-img img {
        max-height: 300px;
    }

    .pub-body {
        font-size: 14px;
    }

    .pub-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .pub-gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .uom-lightbox-prev { left: 8px; }
    .uom-lightbox-next { right: 8px; }

    .uom-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .uom-lightbox-close {
        top: -36px;
        right: 4px;
    }

    .uom-lightbox-footer {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .pub-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pub-header-title {
        font-size: 20px;
    }

    .pub-share {
        flex-wrap: wrap;
    }

    .pub-hero-float {
        max-width: 100%;
    }
}


/* ====================================================
   ARCHIVOS PDF DESCARGABLES
   ==================================================== */

.pub-archivos-section {
    margin: 30px 0;
    clear: both;
}

.pub-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px 0;
    font-family: 'Lato', sans-serif;
}

.pub-section-title i {
    color: #0B5C21;
    margin-right: 6px;
}

.pub-section-title .fa-file-pdf-o {
    color: #c0392b;
}

.pub-section-title .fa-youtube-play {
    color: #e52d27;
}

.pub-archivos-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pub-archivo-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}

.pub-archivo-item:hover {
    border-color: #c0392b;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    transform: translateY(-2px);
    color: #333;
}

.pub-archivo-icon {
    width: 44px;
    height: 44px;
    background: #fef2f2;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pub-archivo-icon i {
    font-size: 22px;
    color: #c0392b;
}

.pub-archivo-titulo {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.pub-archivo-btn {
    font-size: 13px;
    font-weight: 600;
    color: #0B5C21;
    background: #f0faf2;
    padding: 6px 14px;
    border-radius: 6px;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.pub-archivo-item:hover .pub-archivo-btn {
    background: #0B5C21;
    color: #fff;
}


/* ====================================================
   VIDEOS YOUTUBE EMBEBIDOS
   ==================================================== */

.pub-videos-section {
    margin: 30px 0;
    clear: both;
}

.pub-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.pub-video-item {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.pub-video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.pub-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.pub-video-titulo {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
    border-top: 1px solid #f0f0f0;
}


/* =====================
   RESPONSIVE PDFs + VIDEOS
   ===================== */

@media (max-width: 560px) {
    .pub-archivo-item {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
    }

    .pub-archivo-btn {
        width: 100%;
        text-align: center;
    }

    .pub-videos-grid {
        grid-template-columns: 1fr;
    }
}
