// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

@use '../mixins';
@use '../variables';

.module-staged-link-preview {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;

  min-height: 65px;

  &__no-image {
    align-items: center;
    background-color: variables.$color-white;
    border-radius: 14px;
    display: flex;
    flex-direction: row;
    height: 74px;
    justify-content: center;
    margin-inline-end: 32px;
    width: 74px;

    &::after {
      @include mixins.color-svg(
        '../images/icons/v3/link/link.svg',
        variables.$color-black
      );
      & {
        content: '';
        height: 44px;
        width: 44px;
      }
    }
  }
}

.module-staged-link-preview--is-loading {
  align-items: center;
}
.module-staged-link-preview__loading {
  text-align: center;
  flex-grow: 1;
  flex-shrink: 1;

  @include mixins.light-theme {
    color: variables.$color-gray-60;
  }
  @include mixins.dark-theme {
    color: variables.$color-gray-25;
  }
}

.module-staged-link-preview__icon-container {
  margin-inline-end: 8px;
}
.module-staged-link-preview__icon-container-call-link {
  margin-inline-end: 8px;
  margin: 4px;
}
.module-staged-link-preview__content {
  display: flex;
  flex-direction: column;
  margin-inline-end: 20px;

  &--only-url {
    justify-content: center;
  }
}
.module-staged-link-preview__title {
  @include mixins.font-body-1-bold;

  @include mixins.light-theme {
    color: variables.$color-gray-90;
  }
  @include mixins.dark-theme {
    color: variables.$color-gray-05;
  }

  & {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }
}
.module-staged-link-preview__description {
  @include mixins.font-body-1;

  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.module-staged-link-preview__footer {
  @include mixins.font-body-2;

  display: flex;
  flex-flow: row wrap;
  align-items: center;

  @include mixins.light-theme {
    color: variables.$color-gray-60;
  }
  @include mixins.dark-theme {
    color: variables.$color-gray-25;
  }

  > *:not(:first-child) {
    display: flex;

    &:before {
      content: '•';
      font-size: 50%;
      margin-inline: 0.2rem;
    }
  }
}
.module-staged-link-preview__location {
  @include mixins.font-body-2;

  text-transform: lowercase;

  @include mixins.light-theme {
    color: variables.$color-gray-60;
  }
  @include mixins.dark-theme {
    color: variables.$color-gray-25;
  }
}
.module-staged-link-preview__close-button {
  @include mixins.button-reset;

  & {
    position: absolute;
    top: 0px;
    inset-inline-end: 0px;

    height: 16px;
    width: 16px;
  }

  @include mixins.light-theme {
    @include mixins.color-svg(
      '../images/icons/v3/x/x.svg',
      variables.$color-gray-60
    );
  }
  @include mixins.keyboard-mode {
    &:focus {
      @include mixins.color-svg(
        '../images/icons/v3/x/x.svg',
        variables.$color-ultramarine
      );
    }
  }

  @include mixins.dark-theme {
    @include mixins.color-svg(
      '../images/icons/v3/x/x.svg',
      variables.$color-gray-25
    );
  }
  @include mixins.dark-keyboard-mode {
    &:focus {
      @include mixins.color-svg(
        '../images/icons/v3/x/x.svg',
        variables.$color-ultramarine-light
      );
    }
  }
}
