/* ── Modulo Blocks — Bouton avancé — Styles front ────────────────────────────── */

.mt-svg-btn {
    position    : relative;
    display     : flex;
    align-items : center;
    justify-content: center;
    width       : var(--mt-btn-w, auto);
    max-width   : 100%;
    min-height  : var(--mt-btn-h, 40px);
    color       : var(--mt-btn-text, var(--mb-c-on-accent));
    text-decoration: none;
    cursor      : pointer;
    transition  : color .25s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Largeur naturelle au texte */
.mt-svg-btn--auto-width {
    width: fit-content;
}

/* ── Justification (gauche / centre / droite), comme le bouton natif ── */
/* Conteneur racine du bloc.
   Il ne touche PAS à ses propres marges : WordPress lui applique
   `max-width: <content-size>` et des marges auto (en !important) au titre de
   la mise en page contrainte, ce qui le fait coïncider avec la colonne de
   contenu. C'est précisément ce qu'on veut conserver.

   La justification est appliquée À L'INTÉRIEUR du conteneur, via
   justify-content : aucun !important nécessaire, et surtout aucun risque de
   faire sortir le bloc de la colonne — ce qui arrivait tant que la
   justification passait par les marges du bouton lui-même (un
   `margin-left: 0` le collait au bord du conteneur pleine largeur, très à
   gauche de la colonne). */
.mt-svg-btn-wrap {
    display: flex;
    justify-content: flex-start;   /* défaut = gauche, cohérent avec le contrôle */
}

.mt-svg-btn-wrap.is-justified-left   { justify-content: flex-start; }
.mt-svg-btn-wrap.is-justified-center { justify-content: center; }
.mt-svg-btn-wrap.is-justified-right  { justify-content: flex-end; }

.mt-svg-btn--full {
    width: 100% !important;
}

/* ── Fond CSS direct ── */
.mt-svg-btn--standard {
    background     : var(--mt-btn-fill, var(--wp--preset--color--primary-light, #d9a166));
    background-image: var(--mt-btn-fill-grad, none);
    border-radius  : var(--mt-btn-radius, 6px);
    border         : var(--mt-btn-stroke-w, 0px) solid var(--mt-btn-stroke, transparent);
    transition     : background-color .25s ease, background-image .25s ease, color .25s ease, border-color .25s ease;
}
.mt-svg-btn--standard:hover {
    background-color: var(--mt-btn-hover, var(--mb-c-accent-dark));
    background-image: var(--mt-btn-hover-grad, none);
}

/* ── Contenu intérieur ── */
.mt-svg-btn__inner {
    position       : relative;
    z-index        : 1;
    padding        : var(--mt-btn-pad, 0 24px);
    width          : 100%;
    text-align     : center;
    color          : inherit;
    display        : flex;
    align-items    : center;
    justify-content: center;
    gap            : 8px;
    flex-wrap      : wrap;
}

/* Hériter la couleur sur tous les enfants, et neutraliser leurs marges par défaut
   (un <p> WordPress a des marges qui gonflaient artificiellement la hauteur du bouton) */
.mt-svg-btn__inner *,
.mt-svg-btn__inner p,
.mt-svg-btn__inner span,
.mt-svg-btn__inner a {
    color : inherit !important;
    margin: 0 !important;
}
.mt-svg-btn__inner p {
    line-height: 1.3;
}

/* ── Hover — couleur ── */
.mt-svg-btn:hover {
    color: var(--mt-btn-hover-text, var(--mb-c-on-accent));
}

/* ── Bouton à icône ── */
.mt-svg-btn__icon {
    position       : relative;
    z-index        : 1;
    display        : inline-flex;
    align-items    : center;
    justify-content: center;
    flex-shrink    : 0;
    width          : var(--mt-btn-icon-size, 28px);
    height         : var(--mt-btn-icon-size, 28px);
    color          : var(--mt-btn-icon-color, currentColor);
}
.mt-svg-btn__icon svg {
    width : 100%;
    height: 100%;
    display: block;
    fill  : currentColor;
}
.mt-svg-btn--icon {
    gap    : 8px;
    padding: var(--mt-btn-pad, 12px 20px);
}
.mt-svg-btn--icon .mt-svg-btn__inner {
    width  : auto;
    padding: 0;
}
.mt-svg-btn--icon-left   { flex-direction: row; }
.mt-svg-btn--icon-right  { flex-direction: row-reverse; }
.mt-svg-btn--icon-top    { flex-direction: column; gap: 4px; }

/* Icône sans fond : l'icône tient lieu de bouton. */
.mt-svg-btn--bare {
    background      : transparent;
    background-image: none;
}
.mt-svg-btn--bare:hover {
    background-color: transparent;
    background-image: none;
}
.mt-svg-btn--bare.mt-svg-btn--hover-gradient:hover {
    background-image: var(--mt-btn-hover-grad, none);
}

/* « Icône seule » : le texte reste lisible par les lecteurs d'écran. */
.mt-svg-btn .mt-svg-btn__inner--sr {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Focus accessibilité ── */
.mt-svg-btn:focus-visible {
    outline       : 2px solid var(--mt-btn-fill, var(--wp--preset--color--primary-light, #d9a166));
    outline-offset: 4px;
    border-radius : 4px;
}

/* ── Reduced motion ── */
/* Marge intérieure (et hauteur) sur tablette et mobile : variables posées par le bloc ; !important
   pour l'emporter sur la valeur ordinateur écrite dans l'attribut style. */
@media (max-width: 980px) {
    .mt-svg-btn.mt-svg-btn--pad-t { --mt-btn-pad: var(--mt-btn-pad-t) !important; --mt-btn-h: var(--mt-btn-h-t) !important; }
}
@media (max-width: 600px) {
    .mt-svg-btn.mt-svg-btn--pad-m { --mt-btn-pad: var(--mt-btn-pad-m) !important; --mt-btn-h: var(--mt-btn-h-m) !important; }
}

@media (prefers-reduced-motion: reduce) {
    .mt-svg-btn {
        transition: none !important;
        animation : none !important;
    }
}
