/**
 * FEF Text Widget — structural layout + effect animations.
 *
 * Colors, typography, box (padding/margin/border/shadow) and icon
 * size/color/gap are all Elementor-generated inline styles driven by control
 * `selectors` in FEF_Text_Widget.php — this file only supplies (a) the flex
 * layout that makes icon placement (before/after/above/below) actually work,
 * and (b) the @keyframes every effect/animation animates with.
 *
 * Entrance-style effects — Word Per Line, Letter by Letter, and per-segment
 * entrance animations (Multi Text mode) — start paused and are only released
 * by fef-text.js setting [data-anim-ready="1"] on the wrapper (that's what
 * makes "On Page Load" vs "When Scrolled Into View", and "Replay", work).
 * Continuous effects — Wave, Circle rotation, Animated Gradient — are NOT
 * gated; they always run.
 */

.fef-text-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.fef-text-wrap.fef-text-stacked {
    flex-direction: column;
    align-items: flex-start;
}
.fef-text-el {
    margin: 0;
    min-width: 0;
}
.fef-text-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex: 0 0 auto;
}

/* ── Plain (no effect, no per-segment entrance) ── */
.fef-text-plain { display: inline; }

/* ══════════════════════════════════════════════
   Wave (continuous)
   ══════════════════════════════════════════════ */
.fef-text-wave-group { display: inline-block; }
.fef-text-wave-char {
    display: inline-block;
    animation-name: fef-text-wave-bob;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}
@keyframes fef-text-wave-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(calc(var(--fef-text-wave-amp, 10px) * -1)); }
}

/* ══════════════════════════════════════════════
   Circle (continuous)
   ══════════════════════════════════════════════ */
.fef-text-circle-group { vertical-align: middle; }
.fef-text-circle-char { display: inline-block; }
.fef-text-circle-rotating {
    animation-name: fef-text-circle-spin;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
@keyframes fef-text-circle-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════
   Word Per Line (entrance, gated)
   ══════════════════════════════════════════════ */
.fef-text-word-group { display: flex; flex-direction: column; }
.fef-text-word-line {
    display: block;
    opacity: 0;
    animation-fill-mode: both;
    animation-play-state: paused;
    animation-timing-function: ease-out;
}
.fef-text-wrap[data-anim-ready="1"] .fef-text-word-line { animation-play-state: running; }

/* ══════════════════════════════════════════════
   Letter by Letter (entrance, gated)
   ══════════════════════════════════════════════ */
.fef-text-letter-group { display: inline-block; }
.fef-text-letter {
    display: inline-block;
    opacity: 0;
    animation-fill-mode: both;
    animation-play-state: paused;
    animation-timing-function: ease-out;
}
.fef-text-wrap[data-anim-ready="1"] .fef-text-letter { animation-play-state: running; }

/* Shared direction/fade keyframes — used by Word Per Line, Letter by
   Letter, AND the slide_word/slide_char per-segment entrance animations. */
.fef-text-anim-fade   { animation-name: fef-text-anim-fade; }
.fef-text-anim-left   { animation-name: fef-text-anim-left; }
.fef-text-anim-right  { animation-name: fef-text-anim-right; }
.fef-text-anim-top    { animation-name: fef-text-anim-top; }
.fef-text-anim-bottom { animation-name: fef-text-anim-bottom; }

@keyframes fef-text-anim-fade   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fef-text-anim-left   { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fef-text-anim-right  { from { opacity: 0; transform: translateX(24px); }  to { opacity: 1; transform: translateX(0); } }
@keyframes fef-text-anim-top    { from { opacity: 0; transform: translateY(-24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fef-text-anim-bottom { from { opacity: 0; transform: translateY(24px); }  to { opacity: 1; transform: translateY(0); } }

/* ══════════════════════════════════════════════
   Animated Gradient (continuous — always runs)
   ══════════════════════════════════════════════ */
@property --fef-text-grad-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
@keyframes fef-text-grad-shift  { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
@keyframes fef-text-grad-rotate { to { --fef-text-grad-angle: 360deg; } }
@keyframes fef-text-grad-pulse  { 0%, 100% { background-size: 120% 120%; } 50% { background-size: 260% 260%; } }

/* ══════════════════════════════════════════════
   Per-segment Entrance Animations (Multi Text mode, entrance, gated)
   ══════════════════════════════════════════════ */
.fef-text-seg { display: inline-block; }
.fef-text-entr-group { display: inline-block; }
.fef-text-entr-word,
.fef-text-entr-char { display: inline-block; }

.fef-text-entr-fade,
.fef-text-entr-fly,
.fef-text-entr-swing,
.fef-text-entr-word,
.fef-text-entr-char {
    opacity: 0;
    animation-fill-mode: both;
    animation-play-state: paused;
}
.fef-text-entr-typewriter,
.fef-text-entr-reveal {
    animation-fill-mode: both;
    animation-play-state: paused;
}

.fef-text-wrap[data-anim-ready="1"] .fef-text-entr-fade,
.fef-text-wrap[data-anim-ready="1"] .fef-text-entr-fly,
.fef-text-wrap[data-anim-ready="1"] .fef-text-entr-swing,
.fef-text-wrap[data-anim-ready="1"] .fef-text-entr-word,
.fef-text-wrap[data-anim-ready="1"] .fef-text-entr-char,
.fef-text-wrap[data-anim-ready="1"] .fef-text-entr-typewriter,
.fef-text-wrap[data-anim-ready="1"] .fef-text-entr-reveal,
.fef-text-wrap[data-anim-ready="1"] .fef-text-entr-typewriter::after {
    animation-play-state: running;
}

.fef-text-entr-fade { animation-name: fef-text-anim-fade; animation-timing-function: ease-out; }
.fef-text-entr-word { animation-name: fef-text-anim-bottom; animation-timing-function: ease-out; }
.fef-text-entr-char { animation-name: fef-text-anim-bottom; animation-timing-function: ease-out; }

.fef-text-entr-typewriter {
    position: relative;
    display: inline-block;
    opacity: 1;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: bottom;
    width: 0;
    animation-name: fef-text-typewriter;
    animation-timing-function: steps(40, end);
}
@keyframes fef-text-typewriter { from { width: 0; } to { width: 100%; } }
.fef-text-entr-typewriter::after {
    content: '';
    display: inline-block;
    width: .08em;
    height: 1em;
    margin-left: 2px;
    vertical-align: -0.1em;
    background: currentColor;
    animation: fef-text-caret-blink .8s step-end infinite;
    animation-play-state: paused;
}
@keyframes fef-text-caret-blink { 50% { opacity: 0; } }

.fef-text-entr-reveal {
    display: inline-block;
    opacity: 1;
    clip-path: inset(0 100% 0 0);
    animation-name: fef-text-reveal;
    animation-timing-function: cubic-bezier(.65, 0, .35, 1);
}
@keyframes fef-text-reveal {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0 0 0); }
}

.fef-text-entr-fly {
    animation-name: fef-text-fly-in;
    animation-timing-function: cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes fef-text-fly-in {
    from { opacity: 0; transform: translateY(50px) scale(.85); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.fef-text-entr-swing {
    display: inline-block;
    transform-origin: top center;
    animation-name: fef-text-swing;
    animation-timing-function: ease-in-out;
}
@keyframes fef-text-swing {
    0%   { opacity: 0; transform: rotate(-18deg); }
    60%  { opacity: 1; transform: rotate(6deg); }
    100% { opacity: 1; transform: rotate(0deg); }
}

/* ══════════════════════════════════════════════
   Mobile
   ══════════════════════════════════════════════ */
@media (max-width: 767px) {
    .fef-text-wrap.fef-text-stacked { gap: 8px; }
}
