////
///
/// Heartbeat Animations Mixin Module
/// ===========================================================================
///
/// Provides rhythmic heartbeat-style scaling animations that mimic a pulse.
/// Includes fast and slow variants with customizable scale factors. Ideal
/// for health indicators, love icons, and life animations.
///
/// @group Animations
/// @author Scape Agency
/// @link https://move.gl
/// @since 0.1.0 initial release
/// @access public
///
////


// ============================================================================
// Use
// ============================================================================

@use "../../dev" as *;
@use "../../variables" as *;
@use "../keyframes" as *;
@use "base" as *;


// ============================================================================
// Mixins
// ============================================================================


///
/// Heartbeat Animation
/// ---------------------------------------------------------------------------
/// Creates a heartbeat animation where the element scales up and down.
///
/// @name animate_heartbeat
/// @param {Number} $scale_min [0.9] - Minimum scale of the heartbeat
/// @param {Number} $scale_max [1.1] - Maximum scale of the heartbeat
/// @param {Time} $duration [$animate_base_duration] - Animation duration
/// @param {String} $timing_function [linear] - Timing function
/// @param {Number|String} $iteration_count - Number of iterations
///
/// @example scss - Basic usage
///   .heart {
///     @include animate_heartbeat;
///   }
///
@mixin animate_heartbeat(
    $scale_min: 0.9,
    $scale_max: 1.1,
    $duration: $animate_base_duration,
    $timing_function: linear,
    $iteration_count: $animate_base_iteration_count
) {
    @include animate_base(
        animate_heartbeat,
        $duration,
        $timing_function,
        $iteration_count,
    );
    @keyframes animate_heartbeat {
        0%, 100% { transform: scale(1); }
        25% { transform: scale($scale_min); }
        50% { transform: scale($scale_max); }
        75% { transform: scale($scale_min); }
    }
}


///
/// Rapid Heartbeat Animation
/// ---------------------------------------------------------------------------
/// Creates a rapid heartbeat animation with faster scaling transitions.
///
/// @name animate_heartbeat_fast
/// @param {Number} $scale_min [0.85] - Minimum scale of the heartbeat
/// @param {Number} $scale_max [1.15] - Maximum scale of the heartbeat
/// @param {Time} $duration [$animate_base_duration_fast] - Animation duration
/// @param {String} $timing_function [linear] - Timing function
/// @param {Number|String} $iteration_count - Number of iterations
///
/// @example scss - Usage
///   .urgent-heart {
///     @include animate_heartbeat_fast;
///   }
///
@mixin animate_heartbeat_fast(
    $scale_min: 0.85,
    $scale_max: 1.15,
    $duration: $animate_base_duration_fast,
    $timing_function: linear,
    $iteration_count: $animate_base_iteration_count
) {
    @include animate_base(
        animate_heartbeat_fast,
        $duration,
        $timing_function,
        $iteration_count,
    );
    @keyframes animate_heartbeat_fast {
        0%, 100% { transform: scale(1); }
        14%, 86% { transform: scale($scale_min); }
        28%, 72% { transform: scale($scale_max); }
        42%, 58% { transform: scale($scale_min); }
    }
}


///
/// Slow Heartbeat Animation
/// ---------------------------------------------------------------------------
/// Creates a slow heartbeat animation with more gradual scaling transitions.
///
/// @name animate_heartbeat_slow
/// @param {Number} $scale_min [0.95] - Minimum scale of the heartbeat
/// @param {Number} $scale_max [1.05] - Maximum scale of the heartbeat
/// @param {Time} $duration [$animate_base_duration_slow] - Animation duration
/// @param {String} $timing_function [ease-in-out] - Timing function
/// @param {Number|String} $iteration_count - Number of iterations
///
/// @example scss - Usage
///   .calm-heart {
///     @include animate_heartbeat_slow;
///   }
///
@mixin animate_heartbeat_slow(
    $scale_min: 0.95,
    $scale_max: 1.05,
    $duration: $animate_base_duration_slow,
    $timing_function: ease-in-out,
    $iteration_count: $animate_base_iteration_count
) {
    @include animate_base(
        animate_heartbeat_slow,
        $duration,
        $timing_function,
        $iteration_count
    );
    @keyframes animate_heartbeat_slow {
        0%, 100% { transform: scale(1); }
        25% { transform: scale($scale_min); }
        50% { transform: scale($scale_max); }
        75% { transform: scale($scale_min); }
    }
}


///
/// Heartbeat with Color Change Animation
/// ---------------------------------------------------------------------------
/// Creates a heartbeat animation that includes a color transition.
///
/// @name animate_heartbeat_color
/// @param {Number} $scale_min [0.9] - Minimum scale of the heartbeat
/// @param {Number} $scale_max [1.1] - Maximum scale of the heartbeat
/// @param {Time} $duration [$animate_base_duration] - Animation duration
/// @param {String} $timing_function [linear] - Timing function
/// @param {Number|String} $iteration_count - Number of iterations
/// @param {Color} $color_start - Starting color of the element
/// @param {Color} $color_end - Ending color of the element
///
/// @example scss - Usage
///   .color-heart {
///     @include animate_heartbeat_color;
///   }
///
@mixin animate_heartbeat_color(
    $scale_min: 0.9,
    $scale_max: 1.1,
    $duration: $animate_base_duration,
    $timing_function: linear,
    $iteration_count: $animate_base_iteration_count,
    $color_start: $animate_base_color_start,
    $color_end: $animate_base_color_end,
) {
    @include animate_base(
        animate_heartbeat_color,
        $duration,
        $timing_function,
        $iteration_count,
    );
    @keyframes animate_heartbeat_color {
        0%, 100% {
            transform: scale(1);
            color: $color_start;
        }
        50% {
            transform: scale($scale_max);
            color: $color_end;
        }
    }
}
