/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

@use '@carbon/styles/scss/config' as *;
@use '@carbon/styles/scss/motion' as *;
@use '@carbon/styles/scss/spacing' as *;
@use '@carbon/styles/scss/theme' as *;
@use '../../globals/vars' as *;
@use '../../globals/imports' as *;
@use '@carbon/styles/scss/components/button' as *;

@mixin back-to-top {
  :host(#{$c4d-prefix}-back-to-top) {
    position: sticky;
    z-index: 9999;
    display: flex;
    block-size: 0;
    inset-block-end: 0;
    outline: none;
    padding-inline-end: $spacing-05;

    .#{$prefix}--back-to-top__btn {
      position: relative;
      border-radius: 50%;
      block-size: $spacing-09;
      inline-size: $spacing-09;
      inset-block-end: $spacing-10;
      margin-inline-start: auto;
      opacity: 1;
      transition: all $duration-fast-02 motion(standard, productive);
      visibility: visible;
    }

    &[hidden] {
      .#{$prefix}--back-to-top__btn {
        opacity: 0;
        visibility: hidden;
      }
    }
  }

  @media print {
    :host(#{$c4d-prefix}-back-to-top) {
      display: none;
    }
  }
}
