/* ══════════════════════════════════════════════════════════════════
   WP CATEGORY BROWSER v2 — Thème SecureX (blog archive)
   Palette conservée : bleus #0F4C81/#1A6BAF, orange #F28C28, rouges.
   ══════════════════════════════════════════════════════════════════ */

.wpcb-wrapper * { box-sizing: border-box; }
.wpcb-wrapper {
    --wpcb-blue:        #0F4C81;
    --wpcb-blue-mid:    #1A6BAF;
    --wpcb-blue-light:  #DCEEFF;
    --wpcb-blue-bg:     #EDF5FB;
    --wpcb-orange:      #F28C28;
    --wpcb-orange-soft: #FEF3E6;
    --wpcb-red:         #D32F2F;
    --wpcb-red-bg:      #FFEBEE;
    --wpcb-green:       #2E7D32;
    --wpcb-green-bg:    #E8F5E9;
    --wpcb-text:        #1A1A2E;
    --wpcb-muted:       #5C6880;
    --wpcb-border:      #D6E2EC;
    --wpcb-bg:          #F8FAFC;
    --wpcb-surface:     #FFFFFF;
    --wpcb-skeleton:    #E7EEF4;
    --wpcb-skeleton-hi: #F4F8FB;
    --wpcb-title:       var(--wpcb-blue);
    --wpcb-radius:      10px;
    --wpcb-shadow:      0 10px 26px rgba(15, 76, 129, 0.14);

    max-width: 1100px;
    margin: 0 auto;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: var(--wpcb-text);
    line-height: 1.6;
}

/* Mode sombre : les variables suffisent, le reste suit. */
@media (prefers-color-scheme: dark) {
    .wpcb-wrapper {
        --wpcb-blue-light:  #123A5C;
        --wpcb-blue-bg:     #10202F;
        --wpcb-text:        #E8EDF4;
        --wpcb-muted:       #9AA8BC;
        --wpcb-border:      #2A3B4D;
        --wpcb-bg:          #0D1620;
        --wpcb-surface:     #16222F;
        --wpcb-skeleton:    #1E2C3B;
        --wpcb-skeleton-hi: #27384A;
        --wpcb-title:       #7FB4E4;
        --wpcb-shadow:      0 10px 26px rgba(0, 0, 0, 0.45);
    }
}

/* ── HERO ─────────────────────────────────────────────────────── */
.wpcb-hero {
    background: linear-gradient(135deg, #7B1010 0%, #C62828 40%, #0F4C81 100%);
    border-radius: 16px;
    padding: 48px 44px 40px;
    position: relative;
    overflow: hidden;
}
.wpcb-hero::before {
    content: '';
    position: absolute;
    top: -50px; right: -50px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: rgba(242, 140, 40, 0.12);
    pointer-events: none;
}
.wpcb-hero::after {
    content: '';
    position: absolute;
    bottom: -70px; left: 25%;
    width: 320px; height: 320px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
}
.wpcb-hero-flame {
    position: absolute;
    top: 20px; right: 36px;
    font-size: 56px;
    opacity: .18;
    pointer-events: none;
    line-height: 1;
}
.wpcb-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(242, 140, 40, 0.20);
    border: 1px solid rgba(242, 140, 40, 0.45);
    color: #FFB347;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 18px;
}
.wpcb-hero-title {
    font-size: clamp(22px, 3.6vw, 30px);
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    margin: 0 0 12px;
}
.wpcb-hero-title span { color: var(--wpcb-orange); }
.wpcb-hero-sub {
    font-size: 15.5px;
    color: rgba(255, 255, 255, 0.82);
    max-width: 580px;
    margin: 0 0 26px;
    line-height: 1.7;
}
.wpcb-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.wpcb-meta-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.90);
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 20px;
}
.wpcb-meta-pill svg { flex-shrink: 0; opacity: .9; }

/* ── ACCENT STRIP ─────────────────────────────────────────────── */
.wpcb-strip {
    height: 5px;
    background: linear-gradient(90deg, #D32F2F, #F28C28, #D32F2F);
    border-radius: 0 0 6px 6px;
    margin-bottom: 36px;
}

/* ── TOOLBAR : SEARCH + COMPTEUR ──────────────────────────────── */
.wpcb-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.wpcb-search {
    position: relative;
    flex: 1 1 320px;
}
.wpcb-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--wpcb-muted);
    pointer-events: none;
}
.wpcb-search input {
    width: 100%;
    padding: 13px 44px 13px 44px;
    font-size: 16px;
    font-family: inherit;
    color: var(--wpcb-text);
    border: 1px solid var(--wpcb-border);
    border-radius: var(--wpcb-radius);
    background: var(--wpcb-surface);
    transition: border-color .2s ease, box-shadow .2s ease;
    appearance: none;
}
.wpcb-search input::-webkit-search-cancel-button { display: none; }
.wpcb-search input:focus {
    outline: none;
    border-color: var(--wpcb-blue-mid);
    box-shadow: 0 0 0 3px var(--wpcb-blue-light);
}
.wpcb-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--wpcb-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.wpcb-search-clear:hover {
    background: var(--wpcb-blue-bg);
    color: var(--wpcb-blue-mid);
}
.wpcb-results-count {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--wpcb-muted);
    white-space: nowrap;
}

/* ── CATEGORIES ───────────────────────────────────────────────── */
.wpcb-categories-scroll { position: relative; margin-bottom: 32px; }
.wpcb-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.wpcb-cat-btn {
    padding: 8px 16px;
    border: 1.5px solid var(--wpcb-border);
    background: var(--wpcb-surface);
    color: var(--wpcb-text);
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    white-space: nowrap;
    transition: color .18s ease, border-color .18s ease, background .18s ease,
                transform .18s ease, box-shadow .18s ease;
}
.wpcb-cat-btn:hover {
    border-color: var(--wpcb-blue-mid);
    color: var(--wpcb-blue-mid);
    transform: translateY(-1px);
}
.wpcb-cat-btn.active {
    background: var(--wpcb-blue);
    color: #fff;
    border-color: var(--wpcb-blue);
    animation: wpcb-pop .25s ease;
    box-shadow: 0 4px 12px rgba(15, 76, 129, 0.28);
}
@keyframes wpcb-pop {
    0%   { transform: scale(0.94); }
    60%  { transform: scale(1.04); }
    100% { transform: scale(1); }
}
.wpcb-count { opacity: .65; font-size: 12px; }

/* Mobile : rangée horizontale scrollable avec bords en fondu. */
@media (max-width: 640px) {
    .wpcb-categories {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 4px 24px 10px 4px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .wpcb-categories::-webkit-scrollbar { display: none; }
    .wpcb-categories-scroll::before,
    .wpcb-categories-scroll::after {
        content: '';
        position: absolute;
        top: 0; bottom: 6px;
        width: 28px;
        pointer-events: none;
        z-index: 1;
    }
    .wpcb-categories-scroll::before {
        left: 0;
        background: linear-gradient(90deg, var(--wpcb-bg), transparent);
    }
    .wpcb-categories-scroll::after {
        right: 0;
        background: linear-gradient(-90deg, var(--wpcb-bg), transparent);
    }
}

/* ── POSTS GRID ───────────────────────────────────────────────── */
.wpcb-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    min-height: 140px;
    margin-bottom: 8px;
}
@media (max-width: 1024px) {
    .wpcb-posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .wpcb-posts-grid { grid-template-columns: 1fr; }
}

/* État vide. */
.wpcb-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 52px 16px;
    color: var(--wpcb-muted);
}
.wpcb-empty-illu {
    color: var(--wpcb-border);
    margin-bottom: 14px;
}
.wpcb-empty-title {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: var(--wpcb-text);
}
.wpcb-empty-sub {
    margin: 0;
    font-size: 14px;
}
/* Rétro-compat : ancien message de chargement (non-JS / thèmes tiers). */
.wpcb-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 44px 0;
    color: var(--wpcb-muted);
    font-size: 14.5px;
}

/* Carte. */
.wpcb-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: var(--wpcb-surface);
    border: 1px solid var(--wpcb-border);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.wpcb-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--wpcb-blue);
    z-index: 1;
}
.wpcb-card:nth-child(3n+2)::before { background: var(--wpcb-orange); }
.wpcb-card:nth-child(3n+3)::before { background: var(--wpcb-red); }

.wpcb-card:hover {
    box-shadow: var(--wpcb-shadow);
    transform: translateY(-4px);
    border-color: var(--wpcb-blue-mid);
}

/* Média : ratio fixe = zéro layout shift même sans image. */
.wpcb-card-media {
    aspect-ratio: 16 / 9.6;
    background: var(--wpcb-blue-bg);
    overflow: hidden;
}
.wpcb-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.wpcb-card:hover .wpcb-card-media img { transform: scale(1.04); }
.wpcb-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wpcb-border);
}

.wpcb-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 18px 20px;
}
.wpcb-card-date {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--wpcb-muted);
    margin-bottom: 8px;
}
.wpcb-card-body h3 {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--wpcb-title);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wpcb-card-body p {
    margin: 0;
    font-size: 13.5px;
    color: var(--wpcb-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Animation d'entrée en cascade (via --wpcb-i posé par PHP/JS). */
.wpcb-card--enter {
    animation: wpcb-fade-up .4s ease both;
    animation-delay: calc(var(--wpcb-i, 0) * 55ms);
}
@keyframes wpcb-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── SKELETONS ────────────────────────────────────────────────── */
.wpcb-skeleton { pointer-events: none; }
.wpcb-skeleton::before { background: var(--wpcb-border); }
.wpcb-skeleton-media {
    aspect-ratio: 16 / 9.6;
    background: var(--wpcb-skeleton);
}
.wpcb-skeleton-line {
    height: 13px;
    border-radius: 6px;
    background: var(--wpcb-skeleton);
    margin-bottom: 10px;
    width: 100%;
}
.wpcb-skeleton-line--sm { width: 36%; height: 10px; }
.wpcb-skeleton-line--lg { width: 88%; height: 17px; }
.wpcb-skeleton-line--md { width: 62%; margin-bottom: 0; }
.wpcb-skeleton-media,
.wpcb-skeleton-line {
    position: relative;
    overflow: hidden;
}
.wpcb-skeleton-media::after,
.wpcb-skeleton-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--wpcb-skeleton-hi), transparent);
    transform: translateX(-100%);
    animation: wpcb-shimmer 1.3s infinite;
}
@keyframes wpcb-shimmer {
    to { transform: translateX(100%); }
}

/* ── PAGINATION ───────────────────────────────────────────────── */
.wpcb-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 30px;
    margin-bottom: 10px;
}
.wpcb-page-btn {
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1.5px solid var(--wpcb-border);
    background: var(--wpcb-surface);
    color: var(--wpcb-text);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    text-decoration: none;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.wpcb-page-btn:hover {
    border-color: var(--wpcb-blue-mid);
    color: var(--wpcb-blue-mid);
}
.wpcb-page-btn.active {
    background: var(--wpcb-blue);
    color: #fff;
    border-color: var(--wpcb-blue);
}
.wpcb-page-prev,
.wpcb-page-next { font-size: 18px; }
.wpcb-page-ellipsis {
    min-width: 24px;
    text-align: center;
    color: var(--wpcb-muted);
    user-select: none;
}

/* ── FOCUS VISIBLE (clavier) ──────────────────────────────────── */
.wpcb-wrapper a:focus-visible,
.wpcb-wrapper button:focus-visible,
.wpcb-wrapper input:focus-visible {
    outline: 3px solid var(--wpcb-orange);
    outline-offset: 2px;
    border-radius: 8px;
}
.wpcb-card:focus-visible {
    outline-offset: 3px;
    border-radius: 12px;
}

/* ── REDUCED MOTION ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .wpcb-wrapper *,
    .wpcb-wrapper *::before,
    .wpcb-wrapper *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .wpcb-card:hover { transform: none; }
    .wpcb-card:hover .wpcb-card-media img { transform: none; }
}

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 640px) {
    .wpcb-hero { padding: 34px 22px 30px; }
    .wpcb-toolbar { align-items: flex-start; }
    .wpcb-results-count { width: 100%; }
}
