@use "../../wc";

.tile {
  position: relative;
  display: flex;
  justify-content: space-between;

  &--has-image,
  &--has-text,
  &--has-caption,
  &--has-description,
  &--has-properties,
  &--has-actions,
  &--has-image {
    padding: var(--zn-spacing-large);
  }


  &--has-href {
    cursor: pointer;

    &:hover {
      background-color: var(--zn-color-neutral-100);
    }
  }

  &--flush {
    padding: 0;
  }

  &--flush-x {
    padding-inline: 0;
  }

  &--flush-y {
    padding-block: 0;
  }
}

::slotted(zn-icon) {
  display: flex;
  justify-content: center;
  align-items: center;
}

.tile__left {
  display: flex;
  align-items: center;
  column-gap: var(--zn-spacing-medium);
  padding-right: var(--zn-spacing-medium);
  width: 100%;
  max-width: 400px;

  @include wc.container-query(null, md) {
    max-width: 320px;
  }
}

.tile__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 50%;
  flex-grow: 1;
  column-gap: var(--zn-spacing-large);
}

.tile__properties {
  display: flex;
  flex-direction: row;
  column-gap: 30px;
  overflow: auto;

  @include wc.container-query(null, md) {
    display: none;
  }
}

a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.tile__content {
  flex: auto;
  min-width: 0;

  @extend %property;
}

.tile--inline .tile__content {
  display: flex;
  align-items: center;
  gap: 5px;

  .tile__description {
    margin: 0;
  }
}

.tile__actions {
  display: flex;
  column-gap: var(--zn-spacing-small);
  margin-left: auto;
}

.tile__link {
  width: 100%;
}

%property {
  .tile__caption {
    display: block;
    font-weight: 500;
    margin: 0;
    font-size: 14px;
    color: rgb(var(--zn-text-heading));
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .tile__description {
    display: block;
    font-weight: 400;
    margin: var(--zn-spacing-2x-small) 0 0;
    font-size: var(--zn-font-size-medium);
    color: rgb(var(--zn-text-color));
    text-overflow: ellipsis;
    overflow: hidden;
  }
}

// Tile property
.tile__property {
  display: flex;
  flex-direction: column;
  max-width: 150px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;

  @extend %property;
}
