/* =====================================================================
   BreizhPub - Cards front (photo encadree par un contour bleu -> noir + texte en overlay)
   ===================================================================== */

.bp-featured-categories {
    max-width: 1400px;
    margin: 50px auto;
    padding: 0 20px;
    clear: both;
    width: 100%;
    box-sizing: border-box;
}

/* Si le bloc est déplacé hors de la zone principale (par notre JS)
   on le force à prendre toute la largeur du viewport */
.bp-featured-categories[data-bp-marker] {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    max-width: 100vw;
}

.bp-featured-categories h2 {
    text-align: center;
    color: #232323;
    font-size: 28px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 30px 0;
    position: relative;
}
.bp-featured-categories h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: #e63946;
    margin: 12px auto 0;
}

.bp-cat-grid {
    display: grid;
    grid-template-columns: repeat(var(--bp-columns, 5), 1fr);
    gap: 18px;
    justify-content: center;
}

/* Si la grille doit respecter des dimensions fixes (largeur OU hauteur définies en BO)
   on passe en mode flexbox pour centrer et laisser les cartes respirer */
.bp-featured-categories[data-bp-width]:not([data-bp-width="0"]) .bp-cat-grid,
.bp-featured-categories[data-bp-height]:not([data-bp-height="0"]) .bp-cat-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

@media (max-width: 992px) {
    .bp-cat-grid { gap: 12px; }
    .bp-featured-categories { padding: 0 12px; }
}
@media (max-width: 600px) {
    .bp-cat-grid { gap: 8px; }
    .bp-featured-categories { padding: 0 8px; }
    .bp-cat-card-sub { font-size: 10px; }
}

/* Carte : le contour = degrade bleu marine -> noir, la photo est posee a l'interieur */
.bp-cat-card {
    --bp-frame: 0px;
    position: relative;
    display: block;
    aspect-ratio: var(--bp-aspect, 1) / 1;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none !important;
    background: linear-gradient(160deg, #1a2657 0%, #0b1230 55%, #000 100%);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    isolation: isolate;
    container-type: inline-size;
}

/* Override : largeur / hauteur fixes definies en BO */
.bp-featured-categories[data-bp-width]:not([data-bp-width="0"]) .bp-cat-card {
    width: var(--bp-w, 200px);
    flex: 0 0 auto;
}
.bp-featured-categories[data-bp-width]:not([data-bp-width="0"])
[data-bp-height="0"] .bp-cat-card {
    height: auto;
}
.bp-featured-categories[data-bp-height]:not([data-bp-height="0"]) .bp-cat-card {
    height: var(--bp-h, 200px);
    aspect-ratio: unset;
}
.bp-featured-categories[data-bp-height]:not([data-bp-height="0"])
:not([data-bp-width]:not([data-bp-width="0"])) .bp-cat-card {
    width: var(--bp-h, 200px);
}

.bp-cat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.28);
}

/* Photo (posee dans le cadre) */
.bp-cat-image {
    position: absolute;
    inset: var(--bp-frame);
    border-radius: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    transition: transform 0.4s ease;
}

.bp-cat-image--empty {
    background: linear-gradient(135deg, #1a2657 0%, #0d1638 100%);
}

.bp-cat-card:hover .bp-cat-image {
    transform: scale(1.05);
}

/* Overlay sombre en bas pour rendre le texte lisible */
.bp-cat-overlay {
    position: absolute;
    inset: var(--bp-frame);
    border-radius: 0;
    z-index: 1;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0) 40%,
        rgba(0, 0, 0, 0.55) 75%,
        rgba(0, 0, 0, 0.8) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px 6px;
    pointer-events: none;
    text-align: center;
}

/* Titre : une seule ligne, taille proportionnelle a la largeur de la carte (aucun mot coupe) */
.bp-cat-card-title {
    color: #fff !important;
    font-size: clamp(10px, 10.5cqw, 18px) !important;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1.15;
    margin: 0 0 4px 0;
    letter-spacing: 0;
    max-width: 100%;
    white-space: nowrap;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.bp-cat-card-sub {
    color: #a3d95d !important;
    font-size: clamp(8px, 7.5cqw, 11px);
    font-weight: 700;
    text-transform: uppercase;
    margin: 0;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* Badge - pastille en haut à droite */
.bp-cat-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    background: #e63946;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1;
    padding: 10px 8px;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    transform: rotate(-8deg);
    transform-origin: center;
    animation: bp-badge-pop 0.4s ease-out;
}

@keyframes bp-badge-pop {
    from { transform: rotate(-8deg) scale(0); }
    to   { transform: rotate(-8deg) scale(1); }
}

/* Pas de cartes : message */
.bp-featured-categories:empty::before {
    content: "Aucune carte active. Ajoutez-en via BO > Modules > BreizhPub Cards Manager.";
    display: block;
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px 20px;
}
