* {
  box-sizing: border-box;
}
[hidden], .hidden {
  display: none !important;
}
figure {
  margin: 3rem 0;
  display: flex;
  align-items: center;
  overflow: visible;
  max-width: max-content;
}
/* Colors */
[data-color="violet"], .violet {
  color: #6E3169;
}
.bg-violet,
[data-color="violet"] > .graph__unit, 
.violet > .graph__unit {
  background-color: #6E3169;
}
[data-color="bleu"], .bleu {
  color: #40CCDF;
}
.bg-bleu,
[data-color="bleu"] > .graph__unit, 
.bleu > .graph__unit {
  background-color: #40CCDF;
}
[data-color="orange"], .orange {
  color: #DE7F3F;
}
.bg-orange,
[data-color="orange"] > .graph__unit, 
.orange > .graph__unit {
  background-color: #DE7F3F;
}
[data-color="rose"], .rose {
  color: #D567AC;
}
.bg-rose,
[data-color="rose"] > .graph__unit, 
.rose > .graph__unit {
  background-color: #D567AC;
}
.w-100 {
  width: 100px;
}
.w-50 {
  width: 50px;
}
.h-100 {
  height: 101px;
}
.h-200 {
  height: 201px;
}

/* graph > graph__bar > graph__group > graph__unit */

.graph {
  position: relative;
}
.graph--bars {
  display: flex;
  padding-left: var(--padding-left);
}

/* Graph multiple */
.graph--multiple .graph__bar {
  display: flex;
  align-items: flex-end;
}
.graph--multiple .graph__bar .graph__group {
  display: flex;
  flex-direction: column;
}

/* Graph horizontal */
.graph--h {
  flex-direction: column;
}
.graph--h .graph__bar {
  margin: var(--gap) 0;
}
.graph--h .graph__bar {
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  height: calc(var(--groups) * 10px);
}
.graph--h .graph__bar .graph__group {
  flex-direction: row;
}

/* Graph bar */
.graph__bar {
  display: inline-block;
  width: var(--width);
  margin: 0 var(--gap);
}
.text .graph__bar {
  margin-top: -.5px;
}

.bg-rules {
  background-repeat: repeat;
  background-position: left bottom;
  border-bottom: 1px solid #ccc;
}
.bg-rules--50 {
  background-image: url("data:image/svg+xml,%3Csvg width='1' height='50' viewBox='0 0 1 50' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='0' y='0' width='1' height='1' fill='%23ccc'%3E%3C/rect%3E%3C/svg%3E");
}
.graph--h.bg-rules {
  border-bottom: 0;
}
.graph--h.bg-rules--50 {
  background-image: url("data:image/svg+xml,%3Csvg width='50' height='1' viewBox='0 0 50 1' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='0' y='0' width='1' height='1' fill='%23ccc'%3E%3C/rect%3E%3C/svg%3E");
}


.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.font-data {
  font-family: Menlo, monospace;
  font-size: 15.1px;
  letter-spacing: -4px;
  line-height: 0;
  user-select: none;
  margin: 0;
}
.text .font-data {
  line-height: 10px;
}
.font-mono {
  font-family: "Letter Gothic Std", monospace;
  font-weight: normal;
  font-size: 15px;
  line-height: 1.5;
}
.graph > .data {
  pointer-events: none;
}

/* Fade out siblings on hover */
.fade-out-siblings > [data-number] {
  pointer-events: auto;
  transition: .2s opacity;
}
[data-active] [data-number],
.fade-out-siblings:hover > [data-number] {
  opacity: 0.25;
}
[data-active] [data-hover],
.fade-out-siblings > [data-number]:hover {
  opacity: 1;
}
/* Display tooltip on hover */
[data-active] [data-hover]::before,
.graph [data-number]:hover::before {
  content: attr(data-number) attr(data-unit);
  position: absolute;
  margin-left: 0px;
  margin-top: -30px;
  background: white;
  padding: 4px 3px 2px;
  min-width: 30px;
  letter-spacing: normal;
  line-height: 1.5;
  font-family: "Letter Gothic Std", monospace;
  font-size: 15px;
  text-align: center;
  border: 1px solid gray;
  z-index: 10;
  background: white;
}
.graph__unit {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-top: 1px solid white;
  border-left: 1px solid white;
}

.graph__group .graph__unit {
  float: left;
}

/* Legend */
.legend {
  color: rgba(0,0,0,.5);
  display: flex;
  flex-direction: var(--direction);
  justify-content: space-between;
  position: absolute;
  background: white;
}
.legend--y {
  left: 0;
  top: -10px;
  height: calc(100% + 25px);
}
.legend--y > * {
  height: 25px;
  width: var(--padding-left);
}
.legend--x {
  left: var(--padding-left);
  right: 0;
  bottom: -40px;
}
.legend--x > * {
  height: 25px;
  width: var(--padding-left);
  text-align: center;
  margin: 0 var(--gap);
}
.graph--h .legend--x {
  left: 0;
  top: -10px;
  right: unset;
  bottom: unset;
  height: calc(100% + 25px);
  flex-direction: column;
  justify-content: space-evenly;
}
.graph--h .legend--x > * {
  height: calc(var(--groups) * 10px);
  display: flex;
  align-items: center;
  margin: 0;
}
.graph--h .legend--y {
  left: var(--padding-left);;
  top: unset;
  right: 0;
  bottom: -40px;
  flex-direction: row;
  justify-content: space-evenly;
  height: auto;
  width: 100%;
}
.graph--h .legend--y > * {
  text-align: center;
  transform: translateX(-50%);
}

/* Checkboxes */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  margin: 0 .5em .25em 0;
}
input[type="checkbox"]:not(:checked) {
  opacity: .25;
}
input[type="checkbox"]:checked {
  opacity: 1;
}

figcaption {
  margin-left: 2rem;
}
figcaption p {
  margin: 0;
}
figcaption .graph__unit {
  margin-right: 5px;
}
