/* =====================================================================
   CAS HEADING — Titre premium pour Elementor
   6 styles : color, gradient, underline, highlight, outline, glow
   5 effets : reveal, split, shine, typing, underline animé
   ===================================================================== */

.cas-h, .cas-h * { box-sizing: border-box; }

.cas-h {
    --cas-h-accent: #d91415;
    --cas-h-accent-2: #ff3b3c;

    position: relative;
    width: 100%;
    line-height: 1.4;
    text-align: left; /* défaut, surchargé par cas-h-align-* */
}

/* Alignement par classes (du prefix_class Elementor) */
.cas-h-align-left .cas-h { text-align: left; }
.cas-h-align-center .cas-h { text-align: center; }
.cas-h-align-right .cas-h { text-align: right; }

@media (max-width: 1024px) {
    .cas-h-align_tablet-left .cas-h { text-align: left; }
    .cas-h-align_tablet-center .cas-h { text-align: center; }
    .cas-h-align_tablet-right .cas-h { text-align: right; }
}
@media (max-width: 767px) {
    .cas-h-align_mobile-left .cas-h { text-align: left; }
    .cas-h-align_mobile-center .cas-h { text-align: center; }
    .cas-h-align_mobile-right .cas-h { text-align: right; }
}

/* ============================================================
   EYEBROW (texte au-dessus)
   ============================================================ */
.cas-h__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--cas-h-accent-2);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    line-height: 1;
}

/* Style pill (badge arrondi) */
.cas-h__eyebrow--pill {
    padding: 8px 18px;
    background: rgba(217, 20, 21, 0.12);
    border: 1px solid rgba(217, 20, 21, 0.3);
    border-radius: 30px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Style simple (juste texte) */
.cas-h__eyebrow--simple {
    padding: 0;
    background: transparent;
    border: none;
}

/* Style avec point clignotant */
.cas-h__eyebrow--dotted {
    padding: 0;
}
.cas-h__eyebrow-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cas-h-accent);
    display: inline-block;
    animation: casHDotPulse 1.6s ease-in-out infinite;
    box-shadow: 0 0 0 0 var(--cas-h-accent);
}
@keyframes casHDotPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(217, 20, 21, 0.6);
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 0 0 6px rgba(217, 20, 21, 0);
    }
}

/* Style avec crochets */
.cas-h__eyebrow--bracket {
    padding: 0;
}
.cas-h__eyebrow-bracket {
    color: var(--cas-h-accent-2);
    opacity: 0.7;
    font-weight: 400;
}

.cas-h__eyebrow-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cas-h__eyebrow-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}
.cas-h__eyebrow-icon i {
    font-size: 14px;
    color: inherit;
}

/* ============================================================
   TITRE PRINCIPAL
   ============================================================ */
.cas-h__title {
    color: #ffffff;
    font-size: clamp(26px, 4vw, 42px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.5px;
    margin: 0;
    position: relative;
    word-wrap: break-word;
}

.cas-h__link {
    color: inherit !important;
    text-decoration: none !important;
    transition: opacity 0.3s;
}
.cas-h__link:hover {
    opacity: 0.85;
}

/* ============================================================
   HIGHLIGHT - Style 1 : COLOR (mot rouge)
   ============================================================ */
.cas-h-hl-color .cas-h__highlight {
    color: var(--cas-h-accent);
}

/* ============================================================
   HIGHLIGHT - Style 2 : GRADIENT
   ============================================================ */
.cas-h-hl-gradient .cas-h__highlight {
    background: linear-gradient(135deg, var(--cas-h-accent), var(--cas-h-accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    display: inline-block;
}

/* ============================================================
   HIGHLIGHT - Style 3 : UNDERLINE (soulignement)
   ============================================================ */
.cas-h-hl-underline .cas-h__highlight {
    color: inherit;
    background-image: linear-gradient(120deg, var(--cas-h-accent), var(--cas-h-accent-2));
    background-repeat: no-repeat;
    background-size: 100% 6px;
    background-position: 0 95%;
    padding-bottom: 4px;
}

/* ============================================================
   HIGHLIGHT - Style 4 : HIGHLIGHT (surlignage marker)
   ============================================================ */
.cas-h-hl-highlight .cas-h__highlight {
    color: inherit;
    background: linear-gradient(120deg, var(--cas-h-accent) 0%, var(--cas-h-accent-2) 100%);
    background-repeat: no-repeat;
    background-size: 100% 40%;
    background-position: 0 88%;
    padding: 0 4px;
}

/* ============================================================
   HIGHLIGHT - Style 5 : OUTLINE (contour vide)
   ============================================================ */
.cas-h-hl-outline .cas-h__highlight {
    color: transparent;
    -webkit-text-stroke: 1.5px var(--cas-h-accent);
    text-stroke: 1.5px var(--cas-h-accent);
    display: inline-block;
}

/* ============================================================
   HIGHLIGHT - Style 6 : GLOW (lueur)
   ============================================================ */
.cas-h-hl-glow .cas-h__highlight {
    color: var(--cas-h-accent);
    text-shadow:
        0 0 10px rgba(217, 20, 21, 0.6),
        0 0 20px rgba(217, 20, 21, 0.4),
        0 0 30px rgba(217, 20, 21, 0.2);
    animation: casHGlowPulse 2.5s ease-in-out infinite;
}
@keyframes casHGlowPulse {
    0%, 100% {
        text-shadow:
            0 0 10px rgba(217, 20, 21, 0.6),
            0 0 20px rgba(217, 20, 21, 0.4),
            0 0 30px rgba(217, 20, 21, 0.2);
    }
    50% {
        text-shadow:
            0 0 14px rgba(217, 20, 21, 0.8),
            0 0 28px rgba(217, 20, 21, 0.6),
            0 0 42px rgba(217, 20, 21, 0.4);
    }
}

/* ============================================================
   SOUS-TITRE
   ============================================================ */
.cas-h__subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(14px, 1.5vw, 17px);
    line-height: 1.6;
    margin: 14px 0 0 0;
    font-weight: 400;
}

/* ============================================================
   SÉPARATEURS DÉCORATIFS
   ============================================================ */
.cas-h__separator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
}

/* Alignement du séparateur selon classes du parent */
.cas-h-align-center .cas-h__separator { justify-content: center; }
.cas-h-align-right .cas-h__separator { justify-content: flex-end; }
.cas-h-align-left .cas-h__separator { justify-content: flex-start; }

/* Tablette */
@media (max-width: 1024px) {
    .cas-h-align_tablet-center .cas-h__separator { justify-content: center; }
    .cas-h-align_tablet-right .cas-h__separator { justify-content: flex-end; }
    .cas-h-align_tablet-left .cas-h__separator { justify-content: flex-start; }
}

/* Mobile */
@media (max-width: 767px) {
    .cas-h-align_mobile-center .cas-h__separator { justify-content: center; }
    .cas-h-align_mobile-right .cas-h__separator { justify-content: flex-end; }
    .cas-h-align_mobile-left .cas-h__separator { justify-content: flex-start; }
}

/* Ligne simple */
.cas-h__sep-line {
    width: 60px;
    height: 3px;
    background: var(--cas-h-accent);
    border-radius: 2px;
    display: inline-block;
}

/* Ligne dégradée */
.cas-h__sep-line--gradient {
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--cas-h-accent), var(--cas-h-accent-2), transparent);
    border-radius: 2px;
}

/* Points */
.cas-h__sep-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cas-h-accent);
    display: inline-block;
}
.cas-h__separator--dots .cas-h__sep-dot:nth-child(1) { opacity: 1; }
.cas-h__separator--dots .cas-h__sep-dot:nth-child(2) { opacity: 0.7; }
.cas-h__separator--dots .cas-h__sep-dot:nth-child(3) { opacity: 0.4; }

/* Tiret point tiret */
.cas-h__separator--dash_line .cas-h__sep-dash {
    width: 30px;
    height: 2px;
    background: var(--cas-h-accent);
    border-radius: 1px;
    display: inline-block;
}

/* Flèche */
.cas-h__sep-arrow {
    width: 60px;
    height: 12px;
    color: var(--cas-h-accent);
}

/* ============================================================
   EFFET : REVEAL (fade in au scroll)
   ============================================================ */
.cas-h--reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.cas-h--reveal.cas-h--in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   EFFET : SPLIT (mots un par un)
   ============================================================ */
.cas-h--split .cas-h__word {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: calc(var(--w-i, 0) * 0.08s);
}
.cas-h--split.cas-h--in-view .cas-h__word {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   EFFET : SHINE (lumière qui traverse le titre)
   N'altère pas le layout : utilise une couche par-dessus le titre
   ============================================================ */
.cas-h--shine .cas-h__title {
    position: relative;
    /* Pas de display imposé - on laisse le titre comme il est */
}
.cas-h--shine .cas-h__title::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transform: skewX(-20deg);
    pointer-events: none;
    z-index: 2;
    opacity: 0;
}
.cas-h--shine.cas-h--in-view .cas-h__title {
    overflow: hidden; /* Activé seulement pendant l'animation */
}
.cas-h--shine.cas-h--in-view .cas-h__title::after {
    opacity: 1;
    animation: casHShine 1.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s both;
}
@keyframes casHShine {
    from { left: -150%; }
    to { left: 200%; }
}

/* Si pas d'animation reveal/split/typing : déclencher le shine au load */
.cas-h--shine:not(.cas-h--reveal):not(.cas-h--split):not(.cas-h--typing) .cas-h__title {
    overflow: hidden;
}
.cas-h--shine:not(.cas-h--reveal):not(.cas-h--split):not(.cas-h--typing) .cas-h__title::after {
    opacity: 1;
    animation: casHShine 1.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s both;
}

/* ============================================================
   EFFET : TYPING (machine à écrire)
   ============================================================ */
.cas-h--typing .cas-h__typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--cas-h-accent);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: casHCursorBlink 0.8s steps(2, start) infinite;
}
@keyframes casHCursorBlink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

/* ============================================================
   EFFET : UNDERLINE ANIMÉ (barre rouge sous le titre)
   ============================================================ */
.cas-h--underline .cas-h__title {
    position: relative;
    display: table; /* table = juste la largeur du contenu, sans imposer 100% */
    padding-bottom: 18px;
    margin-left: 0;
    margin-right: 0;
}
.cas-h--underline .cas-h__title::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    max-width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--cas-h-accent), var(--cas-h-accent-2));
    border-radius: 2px;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
    pointer-events: none;
    z-index: 1;
}
.cas-h--underline.cas-h--in-view .cas-h__title::before {
    width: 100%;
}

/* Si pas d'animation reveal/split/shine/typing : afficher la barre directement */
.cas-h--underline:not(.cas-h--reveal):not(.cas-h--split):not(.cas-h--shine):not(.cas-h--typing) .cas-h__title::before {
    width: 100%;
    transition: none;
}

/* Centré : titre centré (table + auto margins) + barre centrée */
.cas-h-align-center.cas-h--underline .cas-h__title {
    margin-left: auto;
    margin-right: auto;
}
.cas-h-align-center.cas-h--underline .cas-h__title::before {
    left: 50%;
    transform: translateX(-50%);
}

/* Aligné à droite */
.cas-h-align-right.cas-h--underline .cas-h__title {
    margin-left: auto;
    margin-right: 0;
}
.cas-h-align-right.cas-h--underline .cas-h__title::before {
    left: auto;
    right: 0;
}

/* Responsive tablet */
@media (max-width: 1024px) {
    .cas-h-align_tablet-center.cas-h--underline .cas-h__title {
        margin-left: auto;
        margin-right: auto;
    }
    .cas-h-align_tablet-center.cas-h--underline .cas-h__title::before {
        left: 50%;
        transform: translateX(-50%);
    }
    .cas-h-align_tablet-right.cas-h--underline .cas-h__title {
        margin-left: auto;
        margin-right: 0;
    }
    .cas-h-align_tablet-right.cas-h--underline .cas-h__title::before {
        left: auto;
        right: 0;
        transform: none;
    }
}

/* Responsive mobile */
@media (max-width: 767px) {
    .cas-h-align_mobile-center.cas-h--underline .cas-h__title {
        margin-left: auto;
        margin-right: auto;
    }
    .cas-h-align_mobile-center.cas-h--underline .cas-h__title::before {
        left: 50%;
        transform: translateX(-50%);
    }
    .cas-h-align_mobile-right.cas-h--underline .cas-h__title {
        margin-left: auto;
        margin-right: 0;
    }
    .cas-h-align_mobile-right.cas-h--underline .cas-h__title::before {
        left: auto;
        right: 0;
        transform: none;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .cas-h__eyebrow {
        font-size: 11px;
        letter-spacing: 2px;
    }
    .cas-h__eyebrow--pill {
        padding: 6px 14px;
    }
    .cas-h__sep-line { width: 50px; }
    .cas-h__sep-line--gradient { width: 60px; }
    .cas-h__separator--dash_line .cas-h__sep-dash { width: 22px; }
    .cas-h--underline.cas-h--in-view .cas-h__title::before {
        width: 60px;
    }
}
@media (max-width: 480px) {
    .cas-h__eyebrow {
        font-size: 10px;
        letter-spacing: 1.5px;
    }
}

/* ============================================================
   ACCESSIBILITÉ : reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .cas-h--reveal,
    .cas-h--split .cas-h__word {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .cas-h--shine .cas-h__title::after,
    .cas-h__eyebrow-dot,
    .cas-h-hl-glow .cas-h__highlight {
        animation: none !important;
    }
    .cas-h--underline.cas-h--in-view .cas-h__title::before {
        transition: none;
    }
}
