@import 'functions/mod';
@import 'functions/rem';

@import 'env';

@font-face {
  font-family: 'futura-condensed-medium';
  src: url(assets/fonts/futura-condensed/futura-condensed-medium.otf);
}

* {
  font-family: $-font-default;
}

input {
  font-size: inherit;
  opacity: 0.7;

  &:hover:not([disabled]) {
    opacity: 1;
  }
}

::selection {
  color: $-color-background;
  background: mod($-color-background, 1);
}

*,
*::before,
*::after {
  outline: 0;
  user-select: none;
  color: inherit;
  box-sizing: border-box;
}

*,
*::before,
*::after,
button,
input,
textarea,
optgroup,
select {
  line-height: 1em;
}

input:not([type='checkbox']),
textarea,
select {
  display: block;
  padding: $-size-gap * 0.5;
  background: transparent;
  color: mod($-color-background, 1);
}

input[type='text'] {
  border: 3px solid #808081;
  &:hover {
    border: 3px solid mod($-color-background, 0.75);
  }

  &:focus-visible {
    border: 3px solid mod($-color-background, 0.9);
  }
}

input[type='range'] {
  border: 0;
  padding: 0;
  --thumb-size: 0.8em;
}

input:not([type='checkbox']),
textarea {
  user-select: contain;
}

option {
  background: $-color-background;
}

button {
  border: 0;
  opacity: 0.5;
  font-size: 1rem;
  text-transform: uppercase;
  background: transparent;
  padding: $-size-gap * 0.5;
  color: mod($-color-background, 1);

  &:hover:not([disabled]),
  &[data-style-active='true'] {
    opacity: 1;
  }

  &[data-style-active='true'][data-style-ornament='inverted'] {
    &::before,
    &::after {
      opacity: 1;
      transform: translateX(0);
    }
  }

  &:hover:not([disabled])[data-style-ornament='simple'] {
    &::before,
    &::after {
      opacity: 1 !important;
    }
  }

  &[data-style-align='left'] {
    text-align: left;

    &::after {
      display: none;
    }
  }

  &[data-style-align='center'] {
    text-align: center;
    justify-content: space-between;
  }

  &[data-style-align='right'] {
    text-align: right;

    &::before {
      display: none;
    }
  }

  &[data-style-ornament] {
    display: flex;
    align-items: center;
    padding: 0.3rem;

    &::before,
    &::after {
      opacity: 0;
      width: 1em;
      height: 1em;
      content: '';
      background: center / contain no-repeat;
    }

    &::before {
      margin-right: $-size-gap * 0.5;
    }

    &::after {
      margin-left: $-size-gap * 0.5;
    }
  }

  &[data-style-ornament='simple'] {
    &::before {
      background-image: url(assets/images/arrow/east.svg);
    }

    &::after {
      background-image: url(assets/images/arrow/west.svg);
    }
  }

  &[data-style-ornament='inverted'] {
    &::before,
    &::after {
      opacity: 0;
      transition: all $-time-transition;
    }

    &::before {
      background-image: url(assets/images/arrow/west.svg);
      transform: translateX(-$-size-gap);
    }

    &::after {
      background-image: url(assets/images/arrow/east.svg);
      transform: translateX($-size-gap);
    }
  }
}

:root {
  font-size: 16px;
  --scrollbar-thickness: 0.7rem;
}

::-webkit-scrollbar {
  width: var(--scrollbar-thickness);
}

::-webkit-scrollbar-button:single-button {
  background-repeat: no-repeat;
  background-position: center;

  width: var(--scrollbar-thickness);
  height: var(--scrollbar-thickness);

  &:vertical:decrement {
    background-image: url('assets/images/scrollbar/button-north-inactive.svg');
  }
  &:vertical:increment {
    background-image: url('assets/images/scrollbar/button-south-inactive.svg');
  }
  &:horizontal:decrement {
    background-image: url('assets/images/scrollbar/button-west-inactive.svg');
  }
  &:horizontal:increment {
    background-image: url('assets/images/scrollbar/button-east-inactive.svg');
  }
}

::-webkit-scrollbar-track {
  border: 0.1rem solid rgba(255, 255, 255, 0.5);
  background-color: rgba(255, 255, 255, 0.3);
  background-clip: content-box;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.5);
  background-clip: content-box;

  &:hover {
    background-color: rgba(255, 255, 255, 0.8);
  }
}

input[type='range'] {
  display: flex;
  -webkit-appearance: none;

  &::before {
    content: '';
    width: var(--thumb-size);
    height: var(--thumb-size);
    background-image: url(./assets/images/arrow/west.svg);
  }
  &::after {
    content: '';
    width: var(--thumb-size);
    height: var(--thumb-size);
    background-image: url(./assets/images/arrow/east.svg);
  }
}

input[type='checkbox'] {
  width: $scrollbar;
  height: $scrollbar;
  max-width: $scrollbar;
  max-height: $scrollbar;

  margin: 0;

  appearance: none;
  background-size: contain;
  background-image: url(./assets/images/checkbox/unchecked.svg);
  background-repeat: no-repeat;
  background-position: center;

  &:checked {
    background-image: url(./assets/images/checkbox/checked.svg);
  }
}

::-webkit-slider-runnable-track {
  border: 16 solid transparent;
  border-image: url(./assets/images/slider.svg) 16 fill;
}

::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--thumb-size);
  height: var(--thumb-size);

  background-repeat: no-repeat;
  background-position: center;
  background-image: url(assets/images/arrow/north.svg);
}

body {
  margin: 0;
  cursor: default;
  overflow: hidden;
  color: mod($-color-background);
  background: transparent;
}

app-root {
  height: 100vh;
}

html,
body {
  height: 100%;
  margin: 0;
}

hr {
  border-image: url(./assets/images/separator/single.svg) 3;
}

.separator {
  text-align: center;
  border: 0;
  white-space: nowrap;
  display: block;
  overflow: hidden;
  padding: 0;
  margin: 0;

  & > * {
    display: inline-block;
    vertical-align: middle;
  }

  &:before,
  &:after {
    content: '';
    height: 2px;
    width: 50%;
    margin-right: 0.5em;
    margin-left: 0.5em;
    display: inline-block;
    vertical-align: middle;
    margin-bottom: 0.1rem;
    border-bottom: 0.1rem solid;
    border-image: url(./assets/images/separator/single.svg) 3;
  }

  &:before {
    margin-left: -100%;
  }

  &:after {
    margin-right: -100%;
  }
}
