/*
 * LJ Posts Grid – frontend.css v1.0.3
 * LJ TechHub
 */

.ljpg-wrap *,
.ljpg-wrap *::before,
.ljpg-wrap *::after { box-sizing: border-box; }

.ljpg-widget-title {
    margin: 0 0 24px;
}

/* ── Grid ── */
.ljpg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) { .ljpg-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .ljpg-grid { grid-template-columns: 1fr; } }

/* ── Card ── */
.ljpg-card {
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Pas de background par défaut — géré via Elementor */
    transition: transform .22s ease, box-shadow .22s ease;
}

.ljpg-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.10);
}

/* Mode carte cliquable */
.ljpg-click-card .ljpg-card[data-href] {
    cursor: pointer;
}
.ljpg-click-card .ljpg-card[data-href]:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0,0,0,.13);
}
.ljpg-click-card .ljpg-card[data-href]:focus {
    outline: 2px solid #0073aa;
    outline-offset: 3px;
}

/* ── Image wrap ── */
.ljpg-card__img-wrap {
    position: relative;
    height: 220px;
    overflow: hidden;
    flex-shrink: 0;          /* empêche l'écrasement */
    background: #e8e8e8;
}

.ljpg-card__img-wrap > a {
    display: block;
    height: 100%;
    overflow: hidden;
}

.ljpg-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .45s ease, opacity .35s ease;
}

.ljpg-card__img-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ddd 0%, #eee 100%);
}

/* ── Hover effects ── */
.ljpg-hover-zoom     .ljpg-card:hover .ljpg-card__img { transform: scale(1.08); }
.ljpg-hover-fade     .ljpg-card:hover .ljpg-card__img { opacity: .70; }
.ljpg-hover-slide-up .ljpg-card:hover .ljpg-card__img { transform: scale(1.04) translateY(-6px); }

.ljpg-hover-overlay .ljpg-card__img-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: transparent;
    transition: background-color .3s ease;
    pointer-events: none;
    z-index: 1;
}
.ljpg-hover-overlay .ljpg-card:hover .ljpg-card__img-wrap::after {
    background-color: rgba(0,0,0,.45);
}

/* ── Badge ── */
.ljpg-badge {
    position: absolute;
    top: 11px;
    left: 11px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    background-color: #cc0000;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    border-radius: 4px;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
}

.ljpg-badge-bar { padding: 12px 12px 0; }
.ljpg-badge--inline { position: relative; top: auto; left: auto; }

/* ── Body ── */
.ljpg-card__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;               /* prend tout l'espace restant */
    min-width: 0;
}

/* ── Title ── */
.ljpg-card__title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 8px;
    padding: 0;
}

.ljpg-card__title a,
.ljpg-card__title span {
    color: #1a1a1a;
    text-decoration: none;
    transition: color .2s ease;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.ljpg-card__title a:hover { color: #cc0000; }
.ljpg-click-card .ljpg-card:hover .ljpg-card__title span { color: #cc0000; }

/* ── Excerpt ── */
.ljpg-card__excerpt {
    font-size: 14px;
    color: #555;
    line-height: 1.65;
    margin: 0 0 12px;
    flex: 1;
}

.ljpg-excerpt-italic { font-style: italic; }
.ljpg-excerpt-lead   { font-size: 15px; font-weight: 500; }
.ljpg-excerpt-muted  { color: #999; }

/* ── Date ── */
.ljpg-card__date {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #888;
    margin-top: auto;
    padding-top: 10px;
    flex-shrink: 0;
}

/* ── Button ── */
.ljpg-card__btn {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 22px;
    background-color: #cc0000;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: background-color .2s ease, transform .15s ease;
    align-self: flex-start;
    cursor: pointer;
    border: none;
}

.ljpg-card__btn:hover {
    background-color: #aa0000;
    color: #fff;
    transform: translateY(-1px);
    text-decoration: none;
}

/* ── States ── */
.ljpg-empty {
    padding: 40px 24px;
    text-align: center;
    color: #888;
    background: #f5f5f5;
    border-radius: 8px;
    font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
    .ljpg-card, .ljpg-card__img, .ljpg-card__btn { transition: none !important; }
}

/* ── Pagination ── */
.ljpg-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px !important;
    margin-top: 32px;
    list-style: none;
    padding: 0;
}

.ljpg-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    margin: 0;                  /* reset tout margin externe */
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: #444;
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none !important;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .12s ease;
    white-space: nowrap;
    user-select: none;
    box-sizing: border-box;
}

.ljpg-page-btn:hover:not(.ljpg-page-active):not(.ljpg-page-disabled):not(.ljpg-page-dots) {
    color: #cc0000;
    background-color: #f8f8f8;
    text-decoration: none;
    transform: translateY(-1px);
}

.ljpg-page-btn.ljpg-page-active {
    color: #fff;
    background-color: #cc0000;
    border-color: #cc0000;
    cursor: default;
    pointer-events: none;
}

.ljpg-page-btn.ljpg-page-disabled {
    color: #bbb;
    background-color: #fafafa;
    border-color: #eee;
    cursor: not-allowed;
    pointer-events: none;
    opacity: .6;
}

.ljpg-page-btn.ljpg-page-dots {
    background: transparent;
    border-color: transparent;
    cursor: default;
    pointer-events: none;
    letter-spacing: .05em;
}

.ljpg-page-prev,
.ljpg-page-next {
    font-weight: 500;
    padding: 0 14px;
}

/* Fallback margin si le theme ecrase le gap du flex */
.ljpg-pagination .ljpg-page-btn + .ljpg-page-btn {
    margin-left: 0; /* gap gere par flex */
}

/* Reset agressif pour les themes qui stylisent les <a> dans nav */
.ljpg-pagination a.ljpg-page-btn,
.ljpg-pagination a.ljpg-page-btn:visited,
.ljpg-pagination a.ljpg-page-btn:link {
    color: #444;
    text-decoration: none;
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    box-shadow: none;
    outline: none;
}

@media (max-width: 480px) {
    .ljpg-page-btn { min-width: 32px; height: 32px; font-size: 13px; padding: 0 8px; }
    .ljpg-page-prev, .ljpg-page-next { padding: 0 10px; }
}
