/* Winsiders Custom Elements — Texte adaptatif pleine largeur (av_wce_fit_text).
 *
 * One short line of text fitted to the full container width by the front-end
 * script (font-size scaling, see winsiders-fit-text.js). A minimum size acts
 * as the safety net: below it the text keeps the size and wraps on several
 * lines instead of shrinking; an optional maximum caps the fitted size. */

/* Accordion-style float safety: Enfold's av_hr floats left and would shrink
 * this column otherwise. */
.wce-fit-text {
    clear: both;
}

/* Reset the native heading margins/paddings Enfold applies: the fitted line
 * must be measured against the bare container width. */
.wce-fit-text__text {
    margin: 0;
    padding: 0;

    /* Fallback without JS: a readable size; the script overrides it inline
     * once it has measured the real element. */
    font-size: 48px;
    line-height: 1.1;

    /* Zone-aware color (primary, alternate, footer…): an inline
     * --wce-fittext-color from the element, when set, wins because inline
     * styles have higher precedence. */
    color: var(--wce-fittext-color, inherit);
}

/* Alignment matters mainly in the safety-net mode, where the text wraps over
 * several lines. */
.wce-fit-text--align-left .wce-fit-text__text {
    text-align: left;
}

.wce-fit-text--align-center .wce-fit-text__text {
    text-align: center;
}

.wce-fit-text--align-right .wce-fit-text__text {
    text-align: right;
}

.wce-fit-text--upper .wce-fit-text__text {
    text-transform: uppercase;
}

/* --- Progressive visibility (anti-foutre) --- */
/* Before the first fit the text stays invisible: a delayed animation is the
 * safety net so it never remains hidden when the script never loads. The
 * script adds --ready as soon as its first computation ran. */
.wce-fit-text__text {
    opacity: 0;
    animation: wce-fittext-reveal 0.25s ease 0.9s both;
}

.wce-fit-text--ready .wce-fit-text__text {
    animation: none;
    opacity: 1;
}

@keyframes wce-fittext-reveal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- Fit modes (classes applied by the JS on each computation) --- */
/* Fitted: exactly one line, adjusted to the container width. */
.wce-fit-text--fitted .wce-fit-text__text {
    white-space: nowrap;
}

/* Safety net: below the minimum size the text keeps that size and wraps. */
.wce-fit-text--wrapped .wce-fit-text__text {
    overflow-wrap: break-word;
    hyphens: auto;
    text-wrap: balance;
}