/**
 * Web Micro Galerie Photo — Frontend Styles
 * Modern Redesign
 */

/* ═══════════════════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════════════════ */
:root {
    /* Brand — couleur unique bleue */
    --wmg-primary:        #2563eb;
    --wmg-primary-dark:   #1d4ed8;
    --wmg-primary-light:  #eff6ff;
    --wmg-secondary:      #0ea5e9;
    --wmg-gradient:       #2563eb; /* plus de dégradé — alias vers primary */

    /* Neutrals (Slate scale) */
    --wmg-950: #0f172a;
    --wmg-900: #1e293b;
    --wmg-800: #1e293b;
    --wmg-700: #334155;
    --wmg-500: #64748b;
    --wmg-400: #94a3b8;
    --wmg-200: #e2e8f0;
    --wmg-100: #f1f5f9;
    --wmg-50:  #f8fafc;

    /* Shadows */
    --wmg-shadow-xs: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --wmg-shadow-sm: 0 2px 10px rgba(0,0,0,.07);
    --wmg-shadow-md: 0 8px 28px rgba(0,0,0,.10);
    --wmg-shadow-lg: 0 24px 56px rgba(0,0,0,.15);
    --wmg-shadow-glow: 0 8px 28px rgba(37,99,235,.28);

    /* Radii */
    --wmg-r-xs:   6px;
    --wmg-r-sm:   10px;
    --wmg-r:      16px;
    --wmg-r-lg:   22px;
    --wmg-r-full: 999px;

    /* Motion */
    --wmg-ease:        cubic-bezier(0.4, 0, 0.2, 1);
    --wmg-ease-out:    cubic-bezier(0, 0, 0.2, 1);
    --wmg-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --wmg-t-fast: 0.18s;
    --wmg-t:      0.28s;
    --wmg-t-slow: 0.45s;

    /* Legacy compat */
    --wmg-transition:    all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    --wmg-border-radius: 16px;
    --wmg-gray:          #64748b;
    --wmg-dark:          #0f172a;
    --wmg-light:         #f8fafc;
}


/* ═══════════════════════════════════════════════════════════
   HOMEPAGE — GRILLE MASONRY
   ═══════════════════════════════════════════════════════════ */

.wmg-galleries-grid {
    display: grid;
    grid-auto-flow: dense;
    gap: 14px;
    padding: 20px 0;
}

/* ── Layouts masonry (inline styles PHP + helpers CSS) ── */
.wmg-count-1 { grid-template-columns: 1fr; grid-auto-rows: 420px; }
.wmg-count-2 { grid-template-columns: 3fr 2fr; grid-auto-rows: 340px; }
.wmg-count-3,
.wmg-count-4 { grid-template-columns: 3fr 2fr; grid-auto-rows: 168px; }
.wmg-count-3 .wmg-gallery-card:first-child { grid-row: span 2; }
.wmg-auto-grid .wmg-gallery-card:first-child { grid-column: span 2; grid-row: span 2; }

/* ── Carte ── */
.wmg-gallery-card {
    position: relative;
    border-radius: var(--wmg-r);
    overflow: hidden;
    box-shadow: var(--wmg-shadow-sm);
    transition:
        transform var(--wmg-t) var(--wmg-ease),
        box-shadow var(--wmg-t) var(--wmg-ease);
    min-height: 0;
    animation: wmg-fadeUp 0.6s var(--wmg-ease-out) both;
}

.wmg-gallery-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: var(--wmg-shadow-lg);
}

.wmg-gallery-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* ── Cover ── */
.wmg-gallery-cover {
    position: relative;
    height: 100%;
    overflow: hidden;
}

.wmg-gallery-cover > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--wmg-t-slow) var(--wmg-ease);
}

.wmg-gallery-card:hover .wmg-gallery-cover > img {
    transform: scale(1.08);
}

/* ── Placeholder ── */
.wmg-gallery-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #c7d2fe 0%, #fbcfe8 100%);
}

.wmg-gallery-placeholder .dashicons {
    font-size: 52px;
    width: 52px;
    height: 52px;
    color: rgba(255,255,255,.75);
}

/* ── Gradient overlay ── */
.wmg-gallery-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 25%,
        rgba(15, 23, 42, 0.25) 50%,
        rgba(15, 23, 42, 0.70) 75%,
        rgba(15, 23, 42, 0.92) 100%
    );
    pointer-events: none;
    transition: opacity var(--wmg-t) var(--wmg-ease);
}

.wmg-gallery-card:hover .wmg-gallery-gradient {
    opacity: 1.15;
}

/* ── Info overlay ── */
.wmg-gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 22px 20px 18px;
    z-index: 2;
    transform: translateY(4px);
    transition: transform var(--wmg-t) var(--wmg-ease);
}

.wmg-gallery-card:hover .wmg-gallery-info {
    transform: translateY(0);
}

.wmg-gallery-title {
    margin: 0 0 10px !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    color: #fff !important;
    line-height: 1.3 !important;
    letter-spacing: -0.01em !important;
    text-shadow: 0 2px 12px rgba(0,0,0,.5) !important;
}

.wmg-gallery-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wmg-gallery-category {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    border-radius: var(--wmg-r-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border: 1px solid rgba(255,255,255,.25);
    transition: background var(--wmg-t-fast) var(--wmg-ease);
}

.wmg-gallery-card:hover .wmg-gallery-category {
    background: rgba(255,255,255,.25);
}

/* Délais d'animation pour les cartes */
.wmg-gallery-card:nth-child(1) { animation-delay: 0.05s; }
.wmg-gallery-card:nth-child(2) { animation-delay: 0.12s; }
.wmg-gallery-card:nth-child(3) { animation-delay: 0.19s; }
.wmg-gallery-card:nth-child(4) { animation-delay: 0.26s; }
.wmg-gallery-card:nth-child(5) { animation-delay: 0.33s; }
.wmg-gallery-card:nth-child(6) { animation-delay: 0.40s; }
.wmg-gallery-card:nth-child(7) { animation-delay: 0.47s; }
.wmg-gallery-card:nth-child(8) { animation-delay: 0.54s; }


/* ═══════════════════════════════════════════════════════════
   GALERIE UNIQUE — LIGHTBOX GRID
   ═══════════════════════════════════════════════════════════ */

.wmg-single-gallery {
    display: grid;
    grid-template-columns: repeat(var(--wmg-columns, 3), 1fr);
    gap: 12px;
    padding: 20px 0;
}

/* Layout masonry via column-count */
.wmg-single-gallery.wmg-layout-masonry {
    display: block;
    column-count: var(--wmg-columns, 3);
    column-gap: 12px;
}

.wmg-layout-masonry .wmg-gallery-item {
    break-inside: avoid;
    margin-bottom: 12px;
}

.wmg-layout-masonry .wmg-gallery-item img {
    width: 100%;
    height: auto;
}

/* ── Item ── */
.wmg-gallery-item {
    position: relative;
    margin: 0;
    overflow: hidden;
    border-radius: var(--wmg-r-sm);
    background: var(--wmg-100);
}

.wmg-single-gallery:not(.wmg-layout-masonry) .wmg-gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.wmg-gallery-item img {
    transition: transform var(--wmg-t-slow) var(--wmg-ease);
    display: block;
}

.wmg-gallery-item:hover img {
    transform: scale(1.07);
}

/* ── Lien lightbox ── */
.wmg-image-link {
    display: block;
    position: relative;
    overflow: hidden;
}

.wmg-image-link::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at center, rgba(37,99,235,.5) 0%, rgba(15,23,42,.55) 100%);
    opacity: 0;
    transition: opacity var(--wmg-t) var(--wmg-ease);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wmg-image-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    background: rgba(255,255,255,.18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23fff' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center/20px no-repeat;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.35);
    opacity: 0;
    transform: scale(0.7);
    transition:
        opacity var(--wmg-t) var(--wmg-ease),
        transform var(--wmg-t) var(--wmg-ease-spring);
}

.wmg-image-link:hover::after  { opacity: 1; }
.wmg-image-link:hover::before { opacity: 1; transform: scale(1); }

/* Messages vides */
.wmg-no-galleries,
.wmg-no-images {
    text-align: center;
    padding: 64px 24px;
    background: var(--wmg-50);
    border-radius: var(--wmg-r);
    color: var(--wmg-500);
    font-size: 1.05rem;
    border: 1px dashed var(--wmg-200);
}


/* ═══════════════════════════════════════════════════════════
   TOOLBAR & FILTRE RÉTRACTABLE
   ═══════════════════════════════════════════════════════════ */

/* ── Toolbar (compteur + bouton filtre) ── */
.wmg-pg-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    min-height: 40px;
    position: relative;
}

/* ── Bouton toggle filtre ── */
.wmg-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border: 1.5px solid var(--wmg-200);
    border-radius: var(--wmg-r-full);
    background: #fff;
    color: var(--wmg-700);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        border-color var(--wmg-t-fast) var(--wmg-ease),
        background   var(--wmg-t-fast) var(--wmg-ease),
        color        var(--wmg-t-fast) var(--wmg-ease),
        box-shadow   var(--wmg-t-fast) var(--wmg-ease);
    white-space: nowrap;
    box-shadow: var(--wmg-shadow-xs);
    flex-shrink: 0;
}

.wmg-filter-toggle:hover {
    border-color: var(--wmg-primary);
    color: var(--wmg-primary);
    background: var(--wmg-primary-light);
}

.wmg-filter-toggle.wmg-toggle-active {
    background: var(--wmg-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
}

.wmg-filter-toggle.wmg-toggle-active:hover {
    box-shadow: 0 8px 28px rgba(37,99,235,.40);
}

.wmg-filter-toggle-icon { flex-shrink: 0; }

.wmg-toggle-chevron {
    flex-shrink: 0;
    transition: transform var(--wmg-t) var(--wmg-ease);
}

.wmg-filter-toggle.wmg-panel-open .wmg-toggle-chevron {
    transform: rotate(180deg);
}

/* Badge filtres actifs */
.wmg-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: var(--wmg-r-full);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
    background: rgba(255,255,255,.30);
    color: #fff;
}

.wmg-filter-toggle:not(.wmg-toggle-active) .wmg-filter-badge {
    background: var(--wmg-primary);
    color: #fff;
}

/* ── Panneau filtres rétractable (inline) ── */
.wmg-filter-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-bottom: 0;
    transition:
        max-height    0.38s var(--wmg-ease),
        opacity       0.26s var(--wmg-ease),
        margin-bottom 0.38s var(--wmg-ease);
}

.wmg-filter-panel.wmg-panel-open {
    max-height: 600px;
    opacity: 1;
    margin-bottom: 20px;
}

.wmg-filter-panel-inner {
    padding: 20px;
    background: #fff;
    border-radius: var(--wmg-r);
    border: 1px solid var(--wmg-200);
    box-shadow: var(--wmg-shadow-lg), 0 0 0 1px rgba(37,99,235,.06);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
    margin-top: 2px;
}

/* Liseré accent à gauche */
.wmg-filter-panel-inner::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--wmg-primary);
    border-radius: 0 2px 2px 0;
}

.wmg-filter-divider {
    height: 1px;
    background: var(--wmg-200);
}

/* ── Recherche ── */
.wmg-search-wrapper {
    position: relative;
    width: 100%;
    display: block;
}

.wmg-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--wmg-400);
    pointer-events: none;
    z-index: 2;
    transition: color var(--wmg-t-fast) var(--wmg-ease);
}

.wmg-search-wrapper:focus-within .wmg-search-icon {
    color: var(--wmg-primary);
}

/* Spécificité haute pour résister aux overrides du thème */
.wmg-filter-panel-inner .wmg-search-input,
.wmg-search-wrapper .wmg-search-input {
    display: block;
    width: 100% !important;
    height: 44px !important;
    padding: 0 40px 0 46px !important;
    border: 1.5px solid var(--wmg-200) !important;
    border-radius: var(--wmg-r-sm) !important;
    font-size: 0.9rem !important;
    color: var(--wmg-900) !important;
    background: var(--wmg-50) !important;
    outline: none !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    transition:
        border-color var(--wmg-t-fast) var(--wmg-ease),
        background    var(--wmg-t-fast) var(--wmg-ease),
        box-shadow    var(--wmg-t-fast) var(--wmg-ease);
    margin: 0 !important;
}

.wmg-filter-panel-inner .wmg-search-input::placeholder,
.wmg-search-wrapper .wmg-search-input::placeholder { color: var(--wmg-400); }

.wmg-filter-panel-inner .wmg-search-input:focus,
.wmg-search-wrapper .wmg-search-input:focus {
    border-color: var(--wmg-primary) !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.13) !important;
}

.wmg-search-input::-webkit-search-decoration,
.wmg-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Bouton effacer */
.wmg-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: none;
    background: var(--wmg-200);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wmg-500);
    transition:
        background     var(--wmg-t-fast) var(--wmg-ease),
        opacity        var(--wmg-t-fast) var(--wmg-ease),
        transform      var(--wmg-t-fast) var(--wmg-ease-spring);
    padding: 0;
    line-height: 1;
}

.wmg-search-clear:hover {
    background: var(--wmg-primary);
    color: #fff;
    transform: translateY(-50%) scale(1.1);
}

/* ── Filtres catégories ── */
.wmg-category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.wmg-filter-btn {
    height: 34px;
    padding: 0 15px;
    border: 1.5px solid var(--wmg-200);
    border-radius: var(--wmg-r-full);
    background: transparent;
    color: var(--wmg-500);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        border-color var(--wmg-t-fast) var(--wmg-ease),
        background   var(--wmg-t-fast) var(--wmg-ease),
        color        var(--wmg-t-fast) var(--wmg-ease),
        box-shadow   var(--wmg-t-fast) var(--wmg-ease),
        transform    var(--wmg-t-fast) var(--wmg-ease-spring);
    white-space: nowrap;
    letter-spacing: 0.01em;
    line-height: 1;
}

.wmg-filter-btn:hover {
    border-color: var(--wmg-primary);
    color: var(--wmg-primary);
    background: var(--wmg-primary-light);
    transform: translateY(-1px);
}

.wmg-filter-btn.wmg-filter-active {
    background: var(--wmg-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.30);
    transform: translateY(-1px);
}

.wmg-filter-btn.wmg-filter-active:hover {
    box-shadow: 0 8px 28px rgba(37,99,235,.40);
}


/* ═══════════════════════════════════════════════════════════
   GALERIE PAGINÉE — CONTENEUR + EN-TÊTE
   ═══════════════════════════════════════════════════════════ */

.wmg-paginated-gallery {
    position: relative;
    padding: 4px 0 0;
}

.wmg-pg-count-info {
    margin: 0;
    font-size: 0.82rem;
    color: var(--wmg-400);
    font-weight: 500;
    letter-spacing: 0.03em;
}


/* ═══════════════════════════════════════════════════════════
   GALERIE PAGINÉE — GRILLE DE CARTES
   ═══════════════════════════════════════════════════════════ */

.wmg-pg-grid {
    display: grid;
    grid-template-columns: repeat(var(--wmg-pg-columns, 3), 1fr);
    gap: 16px;
}

/* ── Carte ── */
.wmg-pg-card {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    box-shadow: 0 2px 14px rgba(0,0,0,.14);
    transition:
        transform  .38s cubic-bezier(0.22,1,0.36,1),
        box-shadow .38s ease;
    animation: wmg-fadeUp .5s var(--wmg-ease-out) both;
}

.wmg-pg-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 44px rgba(0,0,0,.26);
}

.wmg-pg-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* ── Image — aspect-ratio définit la hauteur de la carte ── */
.wmg-pg-cover {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #111827;
}

.wmg-pg-cover > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .7s cubic-bezier(0.22,1,0.36,1);
}

.wmg-pg-card:hover .wmg-pg-cover > img {
    transform: scale(1.08);
}

/* Voile sombre : discret au repos, s'intensifie au survol */
.wmg-pg-cover-tint {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.24);
    transition: background .4s ease;
    pointer-events: none;
    z-index: 1;
}

.wmg-pg-card:hover .wmg-pg-cover-tint {
    background: rgba(0,0,0,.56);
}

/* Placeholder */
.wmg-pg-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111827;
}

.wmg-pg-placeholder .dashicons {
    font-size: 44px;
    width: 44px;
    height: 44px;
    color: rgba(255,255,255,.13);
}

/* ── Body : overlay absolu sur l'image ── */
.wmg-pg-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 52px 18px 18px;
    display: flex;
    flex-direction: column;
}

/* Catégorie + compteur : cachés au repos, glissent depuis le haut */
.wmg-pg-body-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition:
        opacity   .32s ease,
        transform .32s cubic-bezier(0.22,1,0.36,1);
}

.wmg-pg-card:hover .wmg-pg-body-top {
    opacity: 1;
    transform: translateY(0);
}

/* Catégorie : texte épuré, pas de fond */
.wmg-pg-tag {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #93c5fd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Compteur */
.wmg-pg-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255,255,255,.50);
    margin-left: auto;
    flex-shrink: 0;
}

.wmg-pg-count svg {
    opacity: .7;
}

/* Titre : toujours visible, ancré en bas de l'image */
.wmg-pg-title {
    margin: 0 !important;
    font-size: 1.08rem !important;
    font-weight: 800 !important;
    color: #fff !important;
    line-height: 1.3 !important;
    letter-spacing: -0.02em !important;
    text-shadow: 0 2px 12px rgba(0,0,0,.5) !important;
}

/* CTA : caché au repos, glisse depuis le bas */
.wmg-pg-footer {
    display: flex;
    align-items: center;
    margin-top: 12px;
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity   .30s ease .05s,
        transform .30s cubic-bezier(0.22,1,0.36,1) .05s;
}

.wmg-pg-card:hover .wmg-pg-footer {
    opacity: 1;
    transform: translateY(0);
}

.wmg-pg-open {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.77rem;
    font-weight: 600;
    color: rgba(255,255,255,.88);
    letter-spacing: 0.01em;
    transition: gap .28s cubic-bezier(0.34,1.56,0.64,1);
}

.wmg-pg-card:hover .wmg-pg-open {
    gap: 12px;
}

.wmg-pg-arrow {
    flex-shrink: 0;
    transition: transform .28s cubic-bezier(0.34,1.56,0.64,1);
}

.wmg-pg-card:hover .wmg-pg-arrow {
    transform: translateX(5px);
}

/* Barre bleue gauche : monte depuis le bas au survol */
.wmg-pg-accent {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--wmg-primary);
    border-radius: 0 3px 3px 0;
    transform: scaleY(0);
    transform-origin: bottom center;
    transition: transform .45s cubic-bezier(0.22,1,0.36,1);
    z-index: 4;
}

.wmg-pg-card:hover .wmg-pg-accent {
    transform: scaleY(1);
}

/* Compat */
.wmg-pg-meta        { display: none; }
.wmg-pg-photo-count { display: none; }


/* ═══════════════════════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════════════════════ */

/* Spinner centré */
.wmg-paginated-gallery::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(37,99,235,.15);
    border-top-color: var(--wmg-primary);
    border-radius: 50%;
    animation: wmg-spin 0.7s linear infinite;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 20;
}

.wmg-paginated-gallery.wmg-is-loading::after {
    opacity: 1;
}

.wmg-pg-grid.wmg-grid-loading {
    pointer-events: none;
    opacity: 0.4;
    filter: blur(2px);
    transition: opacity 0.2s ease, filter 0.2s ease;
}


/* ═══════════════════════════════════════════════════════════
   ÉTAT VIDE
   ═══════════════════════════════════════════════════════════ */

.wmg-pg-no-results {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 72px 24px;
    text-align: center;
}

.wmg-pg-no-results > svg {
    margin-bottom: 20px;
    color: var(--wmg-300);
}

.wmg-no-results-title {
    margin: 0 0 8px !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: var(--wmg-700) !important;
}

.wmg-no-results-sub {
    margin: 0 0 28px !important;
    font-size: 0.88rem !important;
    color: var(--wmg-400) !important;
    max-width: 320px;
    line-height: 1.6 !important;
}

.wmg-reset-filters {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 20px;
    border: 1.5px solid var(--wmg-primary);
    border-radius: var(--wmg-r-sm);
    background: transparent;
    color: var(--wmg-primary);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--wmg-transition);
}

.wmg-reset-filters:hover {
    background: var(--wmg-primary);
    color: #fff;
    box-shadow: var(--wmg-shadow-glow);
    transform: translateY(-1px);
}


/* ═══════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════ */

.wmg-pagination-wrapper {
    margin-top: 48px;
}

.wmg-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
    padding: 4px 0;
}

/* Boutons numérotés et flèches */
.wmg-page-num,
.wmg-page-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 4px;
    border-radius: var(--wmg-r-sm);
    border: 1.5px solid var(--wmg-200);
    background: #fff;
    color: var(--wmg-700);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition:
        background    var(--wmg-t-fast) var(--wmg-ease),
        border-color  var(--wmg-t-fast) var(--wmg-ease),
        color         var(--wmg-t-fast) var(--wmg-ease),
        transform     var(--wmg-t-fast) var(--wmg-ease-spring),
        box-shadow    var(--wmg-t-fast) var(--wmg-ease);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    box-shadow: var(--wmg-shadow-xs);
}

.wmg-page-num:hover,
.wmg-page-arrow:not(.wmg-page-disabled):hover {
    background: var(--wmg-primary);
    border-color: var(--wmg-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--wmg-shadow-primary-sm);
}

/* Page courante */
.wmg-page-current {
    background: var(--wmg-primary);
    border-color: transparent;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
    transform: scale(1.06);
    cursor: default;
    pointer-events: none;
}

/* Flèches */
.wmg-page-arrow { min-width: 40px; }

/* Désactivé */
.wmg-page-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--wmg-50);
    box-shadow: none;
}

/* Ellipsis */
.wmg-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 40px;
    color: var(--wmg-400);
    font-size: 1rem;
    letter-spacing: 0.1em;
    -webkit-user-select: none;
    user-select: none;
}


/* ═══════════════════════════════════════════════════════════
   FANCYBOX 3 — CUSTOMISATION
   ═══════════════════════════════════════════════════════════ */

.fancybox-caption {
    text-align: center;
    color: #fff !important;
    font-size: 1rem;
    line-height: 1.6;
    padding: 18px 28px;
    background: linear-gradient(to top, rgba(15,23,42,.90) 0%, rgba(15,23,42,.65) 55%, transparent 100%);
    font-weight: 400;
}

.fancybox-caption::before { display: none; }

.wmg-fancybox-caption {
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.55;
    padding: 10px 0;
    text-align: center;
}

.fancybox-toolbar { background: transparent; }

.fancybox-button {
    background: rgba(15,23,42,.55);
    border-radius: 8px;
    margin: 4px;
    transition: background 0.2s ease, transform 0.2s ease;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.1);
}

.fancybox-button:hover {
    background: var(--wmg-primary);
    transform: scale(1.05);
}

.fancybox-button--share svg { width: 17px; height: 17px; }

/* Navigation */
.fancybox-navigation .fancybox-button {
    background: rgba(15,23,42,.6);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    padding: 0;
    min-width: 48px;
    min-height: 48px;
}

.fancybox-navigation .fancybox-button:hover {
    background: var(--wmg-primary);
}

/* Flèches custom */
.fancybox-button--arrow_left,
.fancybox-button--arrow_right {
    position: relative;
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
}

.fancybox-button--arrow_left svg,
.fancybox-button--arrow_right svg,
.fancybox-button--arrow_left div,
.fancybox-button--arrow_right div { display: none !important; }

.fancybox-button--arrow_left::after,
.fancybox-button--arrow_right::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 11px;
    height: 11px;
    border-top: 2.5px solid #fff;
    border-right: 2.5px solid #fff;
    transform-origin: center;
}

.fancybox-button--arrow_left::after  { transform: translate(-25%, -50%) rotate(-135deg); }
.fancybox-button--arrow_right::after { transform: translate(-75%, -50%) rotate(45deg); }

/* Miniatures */
.fancybox-thumbs { background: rgba(15,23,42,.96); }
.fancybox-thumbs__list a { border-radius: 6px; overflow: hidden; }
.fancybox-thumbs__list a::before { border-color: var(--wmg-primary); }

.fancybox-infobar {
    color: rgba(255,255,255,.75);
    font-size: 0.875rem;
}

.fancybox-button--play.fancybox-button--pause { background: var(--wmg-primary); }

/* Curseurs */
.fancybox-is-zoomable .fancybox-content { cursor: zoom-in; }
.fancybox-can-pan      .fancybox-content { cursor: grab; }
.fancybox-is-dragging  .fancybox-content { cursor: grabbing; }


/* ═══════════════════════════════════════════════════════════
   MENU DE PARTAGE SOCIAL
   ═══════════════════════════════════════════════════════════ */

.wmg-share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.75);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.wmg-share-overlay.active { opacity: 1; visibility: visible; }

.wmg-share-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    background: rgba(15,23,42,.97);
    border-radius: var(--wmg-r-lg);
    padding: 32px 28px 28px;
    z-index: 99999;
    box-shadow: 0 28px 70px rgba(0,0,0,.60), 0 0 0 1px rgba(255,255,255,.08);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 92vw;
    border: 1px solid rgba(255,255,255,.06);
}

.wmg-share-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Titre */
.wmg-share-menu::before {
    content: 'Partager cette image';
    display: block;
    text-align: center;
    color: rgba(255,255,255,.9);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    letter-spacing: -0.01em;
}

/* Bouton fermer */
.wmg-share-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255,255,255,.08);
    border-radius: 50%;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    padding: 0;
}

.wmg-share-close svg { width: 16px; height: 16px; fill: currentColor; }

.wmg-share-close:hover {
    background: rgba(255,255,255,.18);
    transform: rotate(90deg);
}

/* Liens réseau social */
.wmg-share-menu a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 16px;
    color: #fff;
    text-decoration: none;
    transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 0.68rem;
    font-weight: 700;
    gap: 6px;
    letter-spacing: 0.02em;
}

.wmg-share-menu a svg { width: 26px; height: 26px; }

.wmg-share-menu a:hover {
    transform: translateY(-5px) scale(1.06);
    box-shadow: 0 12px 24px rgba(0,0,0,.35);
}

.wmg-share-main,
.wmg-share-extra { display: flex; gap: 8px; }

.wmg-share-extra {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.1);
}

/* Couleurs réseaux */
.wmg-share-facebook  { background: #1877f2; }
.wmg-share-facebook:hover { background: #0d65d9; }
.wmg-share-twitter   { background: #000; }
.wmg-share-twitter:hover { background: #1a1a1a; }
.wmg-share-pinterest { background: #e60023; }
.wmg-share-pinterest:hover { background: #c8001f; }
.wmg-share-messenger { background: #0084ff; }
.wmg-share-messenger:hover { background: #006fd4; }
.wmg-share-whatsapp  { background: #25d366; }
.wmg-share-whatsapp:hover { background: #1da851; }
.wmg-share-linkedin  { background: #0a66c2; }
.wmg-share-linkedin:hover { background: #084e96; }
.wmg-share-email     { background: #2563eb; }
.wmg-share-email:hover { background: #1d4ed8; }
.wmg-share-copy      { background: #475569; }
.wmg-share-copy:hover { background: #334155; }
.wmg-share-copy.wmg-copied { background: #22c55e; }

.wmg-share-more {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(255,255,255,.15);
    border: 2px solid rgba(255,255,255,.3);
    color: #fff; cursor: pointer;
    transition: all 0.2s ease;
}

.wmg-share-more:hover {
    background: rgba(255,255,255,.25);
    transform: scale(1.1);
}


/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

@keyframes wmg-fadeUp {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes wmg-spin {
    to { transform: rotate(360deg); }
}

@keyframes wmg-slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Délais pour les cartes paginées */
.wmg-pg-card:nth-child(1)  { animation-delay: 0.04s; }
.wmg-pg-card:nth-child(2)  { animation-delay: 0.09s; }
.wmg-pg-card:nth-child(3)  { animation-delay: 0.14s; }
.wmg-pg-card:nth-child(4)  { animation-delay: 0.19s; }
.wmg-pg-card:nth-child(5)  { animation-delay: 0.24s; }
.wmg-pg-card:nth-child(6)  { animation-delay: 0.29s; }
.wmg-pg-card:nth-child(7)  { animation-delay: 0.34s; }
.wmg-pg-card:nth-child(8)  { animation-delay: 0.39s; }
.wmg-pg-card:nth-child(9)  { animation-delay: 0.44s; }
.wmg-pg-card:nth-child(10) { animation-delay: 0.49s; }


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
    .wmg-galleries-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        grid-auto-rows: 186px !important;
    }

    .wmg-auto-grid .wmg-gallery-card:first-child {
        grid-column: span 2;
        grid-row: span 2;
    }

    .wmg-auto-grid .wmg-gallery-card:nth-child(n+2):not(:last-child) {
        grid-column: span 1;
        grid-row: span 1;
    }
}

@media (max-width: 992px) {
    .wmg-galleries-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-auto-rows: 210px !important;
    }

    .wmg-galleries-grid .wmg-gallery-card:first-child {
        grid-column: span 1 !important;
        grid-row: span 2;
    }

    .wmg-galleries-grid .wmg-gallery-card:nth-child(n+2) {
        grid-column: span 1 !important;
    }

    .wmg-single-gallery { --wmg-columns: 2 !important; }
    .wmg-single-gallery.wmg-layout-masonry { column-count: 2 !important; }

    .wmg-pg-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 14px; }
}

@media (max-width: 768px) {
    /* Dropdown filtre pleine largeur sur mobile */
    .wmg-filter-panel {
        position: static;
        width: 100%;
        max-width: 100%;
    }

    .wmg-filter-panel-inner {
        padding: 16px;
        box-shadow: var(--wmg-shadow-md);
    }

    .wmg-category-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .wmg-category-filters::-webkit-scrollbar { display: none; }
}

@media (max-width: 576px) {
    .wmg-galleries-grid {
        grid-template-columns: 1fr !important;
        grid-auto-rows: 230px;
        gap: 10px;
    }

    .wmg-galleries-grid .wmg-gallery-card {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }

    .wmg-gallery-title { font-size: 1.05rem !important; }

    .wmg-single-gallery { --wmg-columns: 1 !important; }
    .wmg-single-gallery.wmg-layout-masonry { column-count: 1 !important; }

    .wmg-pg-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    /* Pagination compacte */
    .wmg-pagination-wrapper { margin-top: 32px; }

    .wmg-pagination { gap: 4px; }

    .wmg-page-num,
    .wmg-page-arrow {
        min-width: 36px;
        height: 36px;
        font-size: 0.82rem;
        border-radius: 8px;
    }
}

/* Respect des préférences de réduction de mouvement */
@media (prefers-reduced-motion: reduce) {
    *,
    .wmg-gallery-card,
    .wmg-pg-card,
    .wmg-page-num,
    .wmg-page-arrow {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}
