// Copyright (C) 2023 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

@import "./typefaces";

$border-radius: 2px;
$border-radius-large: 4px;
$anim-timing: 150ms cubic-bezier(0.4, 0, 0.2, 1);

$box-shadow-1: 0px 2px 6px var(--pf-color-box-shadow);
$box-shadow-2: 0px 4px 12px var(--pf-color-box-shadow);
$box-shadow-3: 0px 8px 16px var(--pf-color-box-shadow);

// This function is used to compute the hove color for interactive surfaces such
// as buttons or or menu items. The idea is you give it the surface color and
// the 'on surface' color (i.e. the text/icon color that goes on top of the
// surface) and it will return a color that is a mix of mostly the surface color
// with a hint of the on-surface color.
//
// @param surface: The surface (aka background) color of the element we want to
// apply the color to. Defaults to 'transparent' which will work with most unset
// surfaces.
//
// @param on-surface: The color of the on-surface color i.e. the contrast color.
// Usually the color of the text. Defaults to 'currentColor', which is a CSS
// alias for the current 'color' value whether it be inherited or explicitly
// set.
@function color-hover-surface(
  $surface: transparent,
  $on-surface: currentColor
) {
  @return color-mix(in srgb, $surface, $on-surface 8%);
}

// This function is used to compute the active color for interactive surfaces
// such as buttons or menu items. The idea is you give it the surface color and
// the 'on surface' color (i.e. the text/icon color that goes on top of the
// surface) and it will return a color that is a mix of mostly the surface color
// with a hint of the on-surface color.
//
// @param surface: The surface (aka background) color of the element we want to
// apply the color to. Defaults to 'transparent' which will work with most unset
// surfaces.
//
// @param on-surface: The color of the on-surface color i.e. the contrast color.
// Usually the color of the text. Defaults to 'currentColor', which is a CSS
// alias for the current 'color' value whether it be inherited or explicitly
// set.
@function color-active-surface(
  $surface: transparent,
  $on-surface: currentColor
) {
  @return color-mix(in srgb, $surface, $on-surface 16%);
}

// This function is deprecated and should not be used in new code.
@function color_hover($base) {
  @return color-hover-surface($base, var(--pf-color-interactive-base));
}

// This function is deprecated and should not be used in new code.
@function color_active($base) {
  @return color-active-surface($base, var(--pf-color-interactive-base));
}

@mixin focus {
  outline: 2px solid var(--pf-color-accent);
}

@mixin transition($time: 0.1s) {
  transition:
    opacity $time ease,
    color $time ease,
    background-color $time ease,
    border-color $time ease,
    width $time ease,
    height $time ease,
    max-width $time ease,
    max-height $time ease,
    margin $time ease,
    transform $time ease,
    box-shadow $time ease,
    border-radius $time ease;
}

// Mixin for using material icons inside a pseudo-element.
@mixin material-icon($content) {
  @include icon;
  @include hidden-while-fonts-loading;
  content: $content;
}
