/**
 * Copyright (c) HashiCorp, Inc.
 * SPDX-License-Identifier: BUSL-1.1
 */

/* CSS active states are partly added at the top of */
/* components/templates/discovery-chain.hbs for reasons */
/* the styling there almost 100% uses our CSS vars */
/* defined in our CSS files, but be sure to */
/* take a look in the discovery-chain.hbs */
%route-card > header ul li {
  @extend %pill-500, %frame-gray-900;
}
%discovery-chain-tween {
  transition-duration: 0.1s;
  transition-timing-function: linear;
}
%discovery-chain-edge,
%chain-node {
  cursor: pointer;
}
%discovery-chain-edge {
  @extend %discovery-chain-tween;
  transition-property: stroke;

  fill: none;
  stroke: var(--token-color-foreground-disabled);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
%discovery-chain.active [id*=':'],
%chain-node-inactive,
%discovery-chain-edge-inactive {
  opacity: 0.5;
}
%chain-node,
%chain-node a {
  color: var(--token-color-foreground-strong) !important;
}
%discovery-chain-edge-active {
  stroke: var(--token-color-foreground-strong);
}
%chain-group {
  border-radius: var(--decor-radius-100);
  border: 1px solid;
  /* TODO: If this color is combined with the above */
  /* border property then the compressor removes the color */
  border-color: var(--token-color-surface-interactive-active);
  background-color: var(--token-color-surface-strong);

  pointer-events: none;
}

%chain-group > header span,
%chain-node {
  pointer-events: all;
}
%chain-group > header > * {
  text-transform: uppercase;
  @extend %body-100-regular;
}
%chain-group > header span::after {
  @extend %with-info-circle-outline-icon, %as-pseudo;
  width: 1.2em;
  height: 1.2em;
  opacity: 0.6;
}
%chain-node {
  @extend %discovery-chain-tween;
  transition-property: opacity background-color border-color;
}
%chain-node-active {
  opacity: 1;
  background-color: var(--token-color-surface-primary);
  border-color: var(--token-color-foreground-faint);
}
/* TODO: More text truncation, centralize */
%route-card header:not(.short) dd {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* Icons */
%route-card section header > * {
  visibility: hidden;
}
%resolver-card dt,
%route-card section header > *::before {
  @extend %with-glyph-icon;
}
%route-card .match-headers header *::before {
  content: 'H';
}
%route-card .match-queryparams header > *::before {
  content: 'Q';
}
%resolver-card dt {
  font-size: 0;
}
%resolver-card dt::before {
  content: '';
  --icon-size: icon-999;
}
%resolver-card dl.failover dt::before {
  --icon-name: icon-cloud-cross;
}
%resolver-card dl.redirect dt::before {
  --icon-name: icon-redirect;
}
/**/
%with-chain-outlet::before {
  @extend %as-pseudo;
  background-color: var(--token-color-surface-primary);

  border-radius: var(--decor-radius-full);
  border: 2px solid;
  /* TODO: If this color is combined with the above */
  /* border property then the compressor removes the color */
  border-color: var(--token-color-foreground-disabled);
}
%discovery-chain circle {
  stroke-width: 2;
  stroke: var(--token-color-foreground-disabled);
  fill: var(--token-color-surface-primary);
}
