// Copyright 2024 Palantir Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0.

@import "../../common/variables";
@import "../../common/variables-extended";

.#{$ns}-entity-title {
  align-items: center;
  display: flex;
  gap: 0.7 * $pt-grid-size;
  min-width: 0;

  &.#{$ns}-fill {
    width: 100%;
  }

  &-icon-container {
    &.#{$ns}-entity-title-has-subtitle {
      align-self: flex-start;
    }

    &:not(.#{$ns}-entity-title-has-subtitle) {
      align-items: center;
      display: flex;
    }
  }

  &-text {
    display: flex;
    flex-direction: column;

    .#{$ns}-fill & {
      flex-grow: 1;
    }
  }

  &-title-and-tags {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 0.5 * $pt-grid-size;
  }

  &-tags-container {
    display: flex;
    gap: 0.2 * $pt-grid-size;
    margin-left: 0.5 * $pt-grid-size;
  }

  &-title {
    margin-bottom: 0;
    min-width: 0;
    overflow-wrap: break-word;

    .#{$ns}-fill & {
      flex-grow: 1;
    }
  }

  &-subtitle {
    font-size: $pt-font-size-small;
    margin-top: 0.2 * $pt-grid-size;
  }

  &-ellipsize,
  &-ellipsize &-text {
    overflow: hidden;
  }

  @each $tag, $props in $headings {
    &-heading-#{$tag} .#{$ns}-icon-container {
      align-items: center;
      display: flex;
      // Aligning icon which has unknown dimensions on the title size
      height: nth($props, 2);
    }
  }

  &-heading-h1,
  &-heading-h2,
  &-heading-h3 {
    gap: 1.5 * $pt-grid-size;

    .#{$ns}-entity-title-status-tag {
      margin-left: $pt-grid-size;
    }

    .#{$ns}-entity-title-subtitle {
      font-size: $pt-font-size;
    }
  }

  &-heading-h4,
  &-heading-h5,
  &-heading-h6 {
    gap: $pt-grid-size;

    .#{$ns}-entity-title-subtitle {
      font-size: $pt-font-size-small;
    }
  }
}
