//
// Copyright 2021 Google LLC
// SPDX-License-Identifier: Apache-2.0
//
// [Modified by Sandlada & Kai Orion]
//
// Copyright 2025 Sandlada & Kai Orion
// SPDX-License-Identifier: MIT
//

@use 'sass:map';
@use '../../../themes';
@use '../../../tokens';

$motion: tokens.md-sys-motion-values();

@mixin styles() {
    & [data-component='elevation'] {
        // TODO: replace duration with animation tokens
        transition-duration: 280ms;
        transition-timing-function: map.get($motion, 'emphasized-easing');
    }

    &[disabled] [data-component='elevation'] {
        transition: none;
    }

    & [data-component='elevation'] {
        @include themes.md-comp-elevation-theme(
            (
                'level': var(--_container-elevation),
                'shadow-color': var(--_container-shadow-color),
            )
        );
    }

    // apply elevation in order of focused, hovered, pressed, disabled
    // this ensures a button will have hover elevation after being focused
    &:focus-within [data-component='elevation'] {
        @include themes.md-comp-elevation-theme(
            (
                'level': var(--_focus-container-elevation),
            )
        );
    }

    &:hover [data-component='elevation'] {
        @include themes.md-comp-elevation-theme(
            (
                'level': var(--_hover-container-elevation),
            )
        );
    }

    &:active [data-component='elevation'] {
        @include themes.md-comp-elevation-theme(
            (
                'level': var(--_pressed-container-elevation),
            )
        );
    }

    &[disabled] [data-component='elevation'] {
        @include themes.md-comp-elevation-theme(
            (
                'level': var(--_disabled-container-elevation),
            )
        );
    }
}
