/* ============================================================
   Aratice · Grille services — layouts par position de catégorie
   ============================================================ */

.asg {
    --asg-blue: #163C79;
    --asg-blue-dark: #0F2A5A;
    --asg-green: #8FBE3E;
    --asg-green-soft: #F4F8EC;
    --asg-bg: #FAFBFC;
    --asg-card: #FFFFFF;
    --asg-text: #1F2D44;
    --asg-text-muted: #5A6573;
    --asg-text-soft: #8A95A3;
    --asg-border: #E4E7EC;
    --asg-border-soft: #F0F2F5;
    --asg-radius: 14px;
    --asg-radius-sm: 10px;

    color: var(--asg-text);
}

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

.asg-empty {
    color: var(--asg-text-soft);
    font-style: italic;
    text-align: center;
    padding: 40px;
}

/* ============================================================
   HEADER DE SECTION
   ============================================================ */
.asg-section__header {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin: 56px 0 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--asg-border-soft);
    flex-wrap: wrap;
}

.asg-section__header:first-of-type,
.asg .asg-section__header:first-child {
    margin-top: 0;
}

.asg-section__num {
    font-size: 13px;
    font-weight: 700;
    color: var(--asg-green);
    letter-spacing: 0.1em;
    font-feature-settings: "tnum";
}

.asg-section__title {
    color: var(--asg-blue);
    font-size: 26px;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.3px;
}

.asg-section__subtitle {
    color: var(--asg-text-soft);
    font-size: 14px;
    font-weight: 500;
}

.asg-section__count {
    margin-left: auto;
    color: var(--asg-text-soft);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}

/* ============================================================
   LAYOUTS
   ============================================================ */

/* Layout 1 — Triple fonce : 3 colonnes égales */
.asg-layout--triple-fonce {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    min-height: 280px;
}

.asg-layout--triple-fonce .asg-card {
    min-height: 280px;
}

/* Layout 2 / 4 / 5 — Double image-côté : 2 colonnes égales */
.asg-layout--double-imagecote {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

/* Layout 3 — Mosaïque 4 : 1 tall (col 1 rows 1-2) + 2 small top + 1 wide bottom */
.asg-layout--mosaic-4 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: minmax(220px, 1fr) minmax(220px, 1fr);
    gap: 20px;
}

.asg-mosaic-4__slot-0 {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.asg-mosaic-4__slot-1 {
    grid-column: 2;
    grid-row: 1;
}

.asg-mosaic-4__slot-2 {
    grid-column: 3;
    grid-row: 1;
}

.asg-mosaic-4__slot-3 {
    grid-column: 2 / span 2;
    grid-row: 2;
}

/* Services supplémentaires (5+) sous la mosaïque 4 */
.asg-layout--triple-fonce-extras {
    margin-top: 20px;
}

/* Layout par défaut (positions 6+) : grille 3 colonnes simple */
.asg-layout--default {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.asg-layout--default:first-child {
    margin-top: 0;
}

/* ============================================================
   CARTE — base commune
   ============================================================ */
.asg-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--asg-radius);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease, box-shadow .25s ease;
    isolation: isolate;
}

.asg-card:hover {
    text-decoration: none;
    color: inherit;
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(22, 60, 121, 0.12);
}

.asg-card__media {
    display: block;
    overflow: hidden;
    background: var(--asg-bg);
}

/* Force le rendu cover sur l'img : on neutralise les attributs width/height
   que WordPress ajoute automatiquement et qui peuvent casser le sizing. */
.asg .asg-card__media img,
.asg-card__media>img {
    width: 100% !important;
    padding: 0;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    transition: transform .6s ease;
}

.asg-card:hover .asg-card__media img {
    transform: scale(1.04);
}

.asg-card__title {
    margin: 0;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.2px;
}

.asg-card__accroche {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.asg-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: gap .2s;
}

.asg-card__cta-arrow {
    display: inline-block;
    transition: transform .2s;
}

.asg-card:hover .asg-card__cta {
    gap: 12px;
}

/* ============================================================
   STYLE : FONCÉ (image bg + overlay + texte bottom-left blanc)
   ============================================================ */
.asg-card--fonce {
    background: linear-gradient(135deg, var(--asg-blue), var(--asg-blue-dark));
    color: #FFFFFF;
    min-height: 240px;
}

.asg-card--fonce .asg-card__media {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

/* Overlay sombre limité à la moitié basse de la card pour le bloc de texte.
   La moitié haute de l'image reste totalement visible au repos. */
.asg-card--fonce .asg-card__media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
            rgba(15, 42, 90, 0.98) 0%,
            rgba(15, 42, 90, 0.85) 25%,
            rgba(15, 42, 90, 0.5) 45%,
            rgba(15, 42, 90, 0) 55%);
    pointer-events: none;
}

.asg-card--fonce.is-title-only .asg-card__media::after {
    background: linear-gradient(to top,
            rgba(15, 42, 90, 0.9) 0%,
            rgba(15, 42, 90, 0.6) 25%,
            rgba(15, 42, 90, 0.2) 45%,
            rgba(15, 42, 90, 0) 55%);
}

/* Couche supplémentaire qui fade-in au hover : darken uniforme assez fort
   sur toute la card pour garantir la lisibilité du texte sur les photos
   claires. Transition pure opacity → smooth garantie. */
.asg-card--fonce .asg-card__media::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(15, 42, 90, 0.7) !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
}

.asg-card--fonce:hover .asg-card__media::before {
    opacity: 1 !important;
}

/* Variante sans image : on garde juste le fond gradient bleu */
.asg-card--fonce.is-no-image {
    background: linear-gradient(135deg, var(--asg-blue), var(--asg-blue-dark));
}

.asg-card--fonce.is-no-image::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(143, 190, 62, 0.18);
    z-index: 0;
    pointer-events: none;
}

.asg-card--fonce .asg-card__body {
    position: relative;
    z-index: 1;
    padding: 24px 26px;
    margin-top: auto;
    max-width: 90%;
}

.asg-card--fonce .asg-card__title {
    color: #FFFFFF;
    font-size: 20px;
    max-width: 22ch;
}

.asg-card--fonce .asg-card__accroche {
    color: rgba(255, 255, 255, 0.92);
    max-width: 32ch;
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    transform: translateY(8px);
    transition: opacity .3s ease, max-height .35s ease, margin-top .35s ease, transform .3s ease;
}

.asg-card--fonce .asg-card__cta {
    color: var(--asg-green);
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    transform: translateY(8px);
    transition: opacity .3s ease .05s, max-height .35s ease, margin-top .35s ease, transform .3s ease .05s, gap .2s;
}

.asg-card--fonce:hover .asg-card__accroche {
    opacity: 1;
    max-height: 120px;
    margin-top: 8px;
    transform: translateY(0);
}

.asg-card--fonce:hover .asg-card__cta {
    opacity: 1;
    max-height: 40px;
    margin-top: 14px;
    transform: translateY(0);
}

/* Titre seul → plus compact, juste le titre lisible au bas */
.asg-card--fonce.is-title-only .asg-card__title {
    font-size: 18px;
    max-width: 24ch;
}

/* Carte tall (mosaïque slot 0) : titre plus grand */
.asg-mosaic-4__slot-0 .asg-card__title {
    font-size: 22px;
    max-width: 18ch;
}

/* Carte wide (mosaïque slot 3) : titre plus grand */
.asg-mosaic-4__slot-3 .asg-card__title {
    font-size: 22px;
    max-width: 20ch;
}

/* ============================================================
   STYLE : IMAGE-CÔTÉ (split horizontal text + image)
   ============================================================ */
.asg-card--imagecote {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 240px;
}

.asg-card--imagecote .asg-card__body {
    padding: 28px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.asg-card--imagecote .asg-card__title {
    font-size: 18px;
    max-width: 18ch;
}

.asg-card--imagecote .asg-card__accroche {
    margin-top: 10px;
    max-width: 30ch;
}

.asg-card--imagecote .asg-card__cta {
    margin-top: 16px;
    align-self: flex-start;
}

.asg-card--imagecote .asg-card__media {
    position: relative;
    height: 100%;
    min-height: 240px;
    overflow: hidden;
}

/* Variant LIGHT : fond blanc, texte bleu */
.asg-card--imagecote-light {
    background: var(--asg-card);
    border: 1px solid var(--asg-border);
}

.asg-card--imagecote-light .asg-card__title {
    color: var(--asg-blue);
}

.asg-card--imagecote-light .asg-card__accroche {
    color: var(--asg-text-muted);
}

.asg-card--imagecote-light .asg-card__cta {
    color: var(--asg-green);
}

/* Variant DARK : fond bleu marine, texte blanc */
.asg-card--imagecote-dark {
    background: var(--asg-blue);
    color: #FFFFFF;
}

.asg-card--imagecote-dark .asg-card__title {
    color: #FFFFFF;
}

.asg-card--imagecote-dark .asg-card__accroche {
    color: rgba(255, 255, 255, 0.85);
}

.asg-card--imagecote-dark .asg-card__cta {
    color: var(--asg-green);
}

/* ============================================================
   STYLE : CLAIR (fallback layout par défaut)
   ============================================================ */
.asg-card--clair {
    background: var(--asg-card);
    border: 1px solid var(--asg-border);
    min-height: 280px;
}

.asg-card--clair .asg-card__media {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-bottom: 1px solid var(--asg-border-soft);
}

.asg-card--clair .asg-card__body {
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

.asg-card--clair .asg-card__title {
    color: var(--asg-blue);
    font-size: 18px;
}

.asg-card--clair .asg-card__accroche {
    color: var(--asg-text-muted);
    flex: 1;
}

.asg-card--clair .asg-card__cta {
    color: var(--asg-green);
    margin-top: auto;
    align-self: flex-start;
}

/* ============================================================
   BLOC BAS "BESOIN D'UN CONSEIL"
   ============================================================ */
.asg-footer {
    background: linear-gradient(135deg, var(--asg-blue), var(--asg-blue-dark));
    color: #FFFFFF;
    border-radius: var(--asg-radius);
    padding: 32px 36px;
    margin-top: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.asg-footer::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(143, 190, 62, 0.12);
    pointer-events: none;
}

.asg-footer__text {
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 280px;
}

.asg-footer__eyebrow {
    display: block;
    color: var(--asg-green);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.asg-footer__title {
    color: #FFFFFF;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.25;
    margin: 0;
    letter-spacing: -0.3px;
    max-width: 38ch;
}

.asg-footer__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.asg-footer__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s, border-color .2s, color .2s, transform .15s;
}

.asg-footer__btn--ghost {
    background: #FFFFFF;
    color: var(--asg-blue);
}

.asg-footer__btn--ghost:hover {
    background: rgba(255, 255, 255, 0.92);
    color: var(--asg-blue-dark);
    text-decoration: none;
    transform: translateY(-1px);
}

.asg-footer__btn--primary {
    background: var(--asg-green);
    color: #FFFFFF;
}

.asg-footer__btn--primary:hover {
    background: #7BA82F;
    color: #FFFFFF;
    text-decoration: none;
    transform: translateY(-1px);
}

/* ============================================================
   MODAL FORMULAIRE RAPPEL
   ============================================================ */
.asg-modal {
    /* CSS vars redéclarées ici pour rendre le modal autonome : il peut être
       rendu hors du wrapper .asg (ex: par le widget service-single) et garder
       son style. */
    --asg-blue: #163C79;
    --asg-blue-dark: #0F2A5A;
    --asg-green: #8FBE3E;
    --asg-green-soft: #F4F8EC;
    --asg-bg: #FAFBFC;
    --asg-card: #FFFFFF;
    --asg-text: #1F2D44;
    --asg-text-muted: #5A6573;
    --asg-text-soft: #8A95A3;
    --asg-border: #E4E7EC;
    --asg-border-soft: #F0F2F5;
    --asg-radius: 14px;
    --asg-radius-sm: 10px;

    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--asg-text);
}

.asg-modal.is-open {
    display: flex;
}

.asg-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 42, 90, 0.5);
    backdrop-filter: blur(3px);
}

.asg-modal__panel {
    position: relative;
    background: var(--asg-card);
    border-radius: var(--asg-radius);
    box-shadow: 0 24px 64px rgba(15, 42, 90, 0.3);
    width: 100%;
    max-width: 540px;
    padding: 30px 34px 32px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    animation: asgModalIn .25s ease;
}

@keyframes asgModalIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.asg-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: var(--asg-bg);
    color: var(--asg-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}

.asg-modal__close svg {
    width: 22px !important;
    height: 22px !important;
}

.asg-modal__close:hover {
    background: var(--asg-blue);
    color: #FFFFFF;
}

.asg-modal__header {
    margin-bottom: 22px;
    padding-right: 40px;
}

.asg-modal__eyebrow {
    display: block;
    color: var(--asg-green);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.asg-modal__title {
    color: var(--asg-blue);
    font-size: 22px;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 8px;
}

.asg-modal__sub {
    color: var(--asg-text-muted);
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.asg-modal__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.asg-modal__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.asg-modal__field>span {
    color: var(--asg-blue);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.asg-modal__req {
    color: #C0392B;
}

.asg-modal input[type="text"],
.asg-modal input[type="email"],
.asg-modal input[type="tel"] {
    width: 100%;
    background: var(--asg-bg);
    border: 1px solid transparent;
    border-radius: var(--asg-radius-sm);
    padding: 11px 14px;
    font-size: 14px;
    color: var(--asg-text);
    font-family: inherit;
    transition: background .2s, border-color .2s, box-shadow .2s;
}

.asg-modal input[type="text"]:focus,
.asg-modal input[type="email"]:focus,
.asg-modal input[type="tel"]:focus {
    outline: none;
    background: #FFFFFF;
    border-color: var(--asg-blue);
    box-shadow: 0 0 0 3px rgba(22, 60, 121, 0.12);
}

.asg-modal__check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--asg-bg);
    border-radius: var(--asg-radius-sm);
    font-size: 13px;
    line-height: 1.5;
    color: var(--asg-text-muted);
    cursor: pointer;
    margin: 6px 0 14px;
}

.asg-modal__check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid #C9D1DC;
    background: #FFFFFF;
    margin: 0;
    margin-top: 1px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}

.asg-modal__check input[type="checkbox"]:checked {
    background: var(--asg-blue);
    border-color: var(--asg-blue);
}

.asg-modal__check input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 0;
    width: 5px;
    height: 10px;
    border: solid #FFFFFF;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.asg-modal__feedback {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: var(--asg-radius-sm);
    font-size: 13px;
}

.asg-modal__feedback.is-error {
    background: #FDECEA;
    color: #B32D2E;
    border: 1px solid #F5C2C2;
}

.asg-modal__feedback.is-success {
    background: #E8F6EC;
    color: #1E7E34;
    border: 1px solid #B4DDB9;
}

.asg-modal__actions {
    display: flex;
    justify-content: flex-end;
}

.asg-modal__submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--asg-green);
    color: #FFFFFF;
    border: 0;
    padding: 13px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s, gap .2s;
}

.asg-modal__submit:hover:not(:disabled) {
    background: #7BA82F;
    gap: 12px;
}

.asg-modal__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .asg-layout--triple-fonce {
        grid-template-columns: 1fr;
    }

    .asg-layout--mosaic-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto;
    }

    .asg-mosaic-4__slot-0 {
        grid-column: 1 / span 2;
        grid-row: auto;
    }

    .asg-mosaic-4__slot-1 {
        grid-column: 1;
        grid-row: auto;
    }

    .asg-mosaic-4__slot-2 {
        grid-column: 2;
        grid-row: auto;
    }

    .asg-mosaic-4__slot-3 {
        grid-column: 1 / span 2;
        grid-row: auto;
    }

    .asg-layout--default {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .asg-section__header {
        margin: 40px 0 20px;
    }

    .asg-section__title {
        font-size: 22px;
    }

    .asg-layout--triple-fonce,
    .asg-layout--double-imagecote,
    .asg-layout--mosaic-4,
    .asg-layout--default {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .asg-mosaic-4__slot-0,
    .asg-mosaic-4__slot-1,
    .asg-mosaic-4__slot-2,
    .asg-mosaic-4__slot-3 {
        grid-column: auto;
        grid-row: auto;
    }

    .asg-card {
        min-height: 220px !important;
    }

    /* Image-côté en mobile : reflow vertical, image au-dessus */
    .asg-card--imagecote {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .asg-card--imagecote .asg-card__media {
        order: 1;
        aspect-ratio: 16 / 10;
        min-height: 0;
    }

    .asg-card--imagecote .asg-card__body {
        order: 2;
        padding: 22px 24px;
    }

    /* Footer en colonne */
    .asg-footer {
        padding: 28px 24px;
        flex-direction: column;
        align-items: flex-start;
    }

    .asg-footer__title {
        font-size: 22px;
    }

    .asg-footer__actions {
        width: 100%;
    }

    .asg-footer__btn {
        flex: 1;
        justify-content: center;
    }

    /* Modal mobile */
    .asg-modal__panel {
        padding: 24px 22px 26px;
    }

    .asg-modal__title {
        font-size: 19px;
    }

    .asg-modal__row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}