#chart {
  --art-red-rgb: 189, 21, 34;
  --art-red: rgb(var(--art-red-rgb));

  --art-purple-rgb: 46, 41, 107;
  --art-purple: rgb(var(--art-purple-rgb));

  position: relative;
  width: 100%;
  height: 80vh;

  /* background-color: rgba(var(--art-red-rgb), .1); */
  background-color: #eee;
}
#chart > .loading-icon {
  position: absolute;
  top: 0; left: 0;

  display: grid;
  place-items: center;
  width: 100%; height: 100%;
}
#chart > .loading-icon > svg {
  width: 32px;
  height: auto;
  aspect-ratio: 1;
}

.home-cluster{
  --vis-black: black;
  --vis-darkgrey: #555;
  --vis-grey: #999;
  --vis-lightgrey: #ccc;
  --vis-lightergrey: #eee;
  --vis-white: white;
  
  --vis-diameter: 160px;
  --vis-diameter-inactive: 80px;
  --vis-padding: 5px;

  --vis-transition: 250ms;

  position: relative;
}

.home-cluster,
.home-cluster > svg {
  width: 100%;
  height: 100%;
}

/* LOADING */

  .home-cluster.loading {
    pointer-events: none;
  }
  .home-cluster > .loading-icon {
    position: absolute;
    top: 0; left: 0;

    display: grid;
    place-items: center;
    width: 100%; height: 100%;

    z-index: 99;

    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease-out;
  }
  .home-cluster > .loading-icon svg {
    width: 24px;
    height: 24px;
  }
  .home-cluster.loading > .loading-icon {
    opacity: 1;
    pointer-events: all;
  }

/* SIMULATION */

  .home-cluster g.simulation {
    --scale: 1;
  }

/* LINKS */

  .link {
    stroke: var(--art-red);
    /* stroke-width: calc(2px / var(--scale)); */
    stroke-width: 2px;
    transition: all var(--vis-transition) ease-out;
  }
  .link.hidden {
    opacity: 0;
  }

/* NODES */

  .node, .node foreignObject {
    x: 0; y: 0;
    width: 2px; height: 2px;
    pointer-events: all;
    overflow: visible;
  }

  .node .node-content {
    --c: var(--art-red);
    --bc: var(--vis-white);
    --r: 10;
    --f: 1;

    box-sizing: border-box;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate( -50%, -50% );

    width: calc(var(--r) * 2px);
    height: calc(var(--r) * 2px);
    border-radius: 50%;

    font-size: calc(var(--f) * 1rem);
    font-weight: bold;
    text-align: center;

    cursor: pointer;
    pointer-events: all;
    user-select: none;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: .2em;

    padding: 0 .75rem;

    text-align: center;

    color: var(--c);

    transition: 
      all var(--vis-transition) ease-out,
      font-size 0s linear;
  }

  .vis-root:not(.is-highlighting-node) .node.hide-text:not(:hover) .node-content,
  .vis-root.is-highlighting-node .node:not(.highlight) .node-content{
    color: transparent !important;
  }

    .node .node-content:before {
      content: '';
      position: absolute;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%);

      width: 100%;
      height: 100%;
      border-radius: 50%;
      
      border-width: 2px;
      /* border-width: calc(2px / var(--scale)); */
      border-style: solid;
      border-color: var(--c);
      
      background-color: var(--bc);
      z-index: -1;

      transition: all var(--vis-transition) ease-out;
    }

    .node .node-content .info-wrap {
      line-height: 110%;
      display: -webkit-box;
      -webkit-box-orient: vertical; 
      -webkit-line-clamp: 3;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .node .node-content .name {
      -webkit-box-decoration-break: clone;
      box-decoration-break: clone;
      background-color: var(--bc);
      transition: all var(--vis-transition) ease-out;
    }
    .node.hide-text:not(:hover) .node-content .name {
      background-color: transparent;
    }

/* IS HOVERING NODE */

  .is-highlighting-node .node-content {
    opacity: .2;
  }
  .is-highlighting-node .link {
    opacity: 0;
  }

  .is-highlighting-node .node.dragging .node-content,
  .is-highlighting-node .node[class*="highlight"] .node-content{
    --bc: var(--art-purple);
    --c: var(--vis-white);
    opacity: 1;
  }
  .is-highlighting-node .node[class*="highlight"] .node-content .name{
    background-color: var(--bc);
  }
  .is-highlighting-node .link.highlight {
    display: inline !important;
    stroke: var(--art-purple);
    opacity: 1;
  }

/* CONTROLS */

  .home-cluster .vis-controls{
    --control-border: 2px;
    position: absolute;
    top: 0; right: 0; 

    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;

    max-width: 100%;
    border-width: var(--control-border);
    border-style: solid;
    border-color: var(--art-red);
    border-radius: 3px;
    margin: 10px;

    overflow: hidden;
  }

  .home-cluster .vis-controls,
  .home-cluster .vis-controls > * {
    background: var(--vis-white);
    color: var(--art-red);
  }

  .home-cluster .vis-controls > * {
    padding: 5px 10px;
    border: none;
    margin: 0;
    outline: none;
    cursor: pointer;
    user-select: none;
  }

  .home-cluster .vis-controls > *:not(:last-child) {
    border-width: 0 0 var(--control-border) 0;
    border-style: solid;
    border-color: var(--art-red);
  }

  .home-cluster .vis-controls select {
    display: none;
  }

  .home-cluster .vis-controls button {
    display: grid;
    place-items: center;

    font-size: 1.25em;
    font-weight: bold;
    line-height: 0;
    aspect-ratio: 1;
  }

  .home-cluster .vis-controls button:hover {
    background-color: var(--art-red);
    color: var(--vis-white);
  }

/* TOOLTIP */

  .home-cluster .tooltip {
    --x: 0;
    --y: 0;
    position: absolute;
    top: 0; left: 0;
    transform: translate(
      calc( var(--x) * 1px),
      calc( var(--y) * 1px)
    );
    margin-left: 1em;

    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    gap: .5em;

    padding: .5em;
    border-radius: 5px;
    background-color: rgba(0, 0, 0, .85);
    color: white;
    
    font-size: .8em;
    
    opacity: 0;
    transition: opacity .15s ease-out;

    pointer-events: none;
  }
  
  .home-cluster svg.is-highlighting-node + .tooltip {
    opacity: 1;
  }

  .home-cluster .tooltip .name {
    font-weight: bold;
  }
  
/* TYPE GROUPS */

  /* [type-group="lit-works"] > .node-content{
    border-color: var(--vis-main-color);
    background-color: var(--vis-white);
    color: var(--vis-main-color);
  }
    .is-highlighting-node [type-group="lit-works"].node.highlight > .node-content,
    .is-highlighting-node [type-group="lit-works"].node.dragging > .node-content,
    .is-highlighting-node [type-group="lit-works"].node.highlight-origin > .node-content {
      background-color: var(--vis-main-color);
      border-color: var(--vis-white);
      color: var(--vis-white);
    } */

/* SAFARI ONLY */
@media not all and (min-resolution: .001dpcm) {
  /* https://github.com/bkrem/react-d3-tree/issues/284 */
  foreignObject,
  foreignObject * {
    position: unset !important;
    transform-style: unset !important;
    -webkit-transform-style: unset !important;
    backface-visibility: unset !important;
    -webkit-backface-visibility: unset !important;
    transition: unset !important;
    transform: unset !important;
  }
  foreignObject {
    x: initial !important;
    y: initial !important;
    width: initial !important;
    height: initial !important;
  }
}
