.vis-chart-block {
  --vis-fg: #2f2f2f;
  --vis-bg: #e8e6db;
  --vis-bg-accent: #faf9f5;
  margin: 0;
  font-family: "PPMori", sans-serif;
  color: var(--vis-fg);

  &.dark {
    --vis-fg: #faf9f5;
    --vis-bg: #2f2f2f;
    --vis-bg-accent: #2f2f2f;
    background: var(--vis-bg);
  }
}

.vis-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding-bottom: 16px;
  border-bottom: 1px dotted var(--vis-fg);
}

.vis-select,
.vis-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.vis-select-label {
  text-transform: uppercase;
  color: #8a8a84;
}

.vis-select select {
  font: inherit;
  color: inherit;
  background: transparent;
  padding: 4px 8px;
}

.vis-select option {
  color: #2f2f2f;
}

/* an option of the page's dropdowns without data for the current selection */
.vis-dropdown-item-dimmed {
  opacity: 0.5;
}

.vis-chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 64px;
  margin: 16px 0;
}

.vis-button-group-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
}

.vis-button-group-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vis-button {
  /* fixed 24px total height; reset host page button styles (min-height,
     line-height, margin) so the live embed matches the test page */
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  height: 24px;
  min-height: 0;
  max-height: none;
  margin: 0;
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.5px 12px 0;
  color: inherit;
  border: 1px solid var(--vis-fg);
  border-radius: 100px;
  background: transparent;
  cursor: pointer;
  font-style: normal;
  letter-spacing: 0.24px;
  transition:
    background 0.2s ease,
    color 0.2s ease;
  /* matches MOBILE_QUERY in ChartFrame.js */
  @media (max-width: 767px) {
    font-size: 11px;
  }
  &:hover {
    background: var(--vis-fg);
    color: var(--vis-bg);
  }
}

.vis-button.selected {
  background: var(--vis-fg);
  color: var(--vis-bg-accent);
}

.vis-button-group.disabled {
  opacity: 0.35;
  .vis-button {
    cursor: default;
    pointer-events: none;
  }
}

.vis-chart-container {
  position: relative;
  width: 100%;
}

.vis-tooltip {
  position: absolute;
  z-index: 10;
  padding: 16px 20px;
  border-radius: 16px;
  pointer-events: none;
  white-space: nowrap;

  p {
    margin: 0;
    font-size: 12px;
    line-height: 1.25;
    /* host pages may set text-wrap on p (e.g. Webflow's "p { text-wrap: balance }"),
       which overrides the inherited nowrap */
    white-space: nowrap;
  }

  .vis-tooltip-title {
    padding-bottom: 8px;
    /* 1px dot every 4px, same pattern as .vis-baseline */
    background: linear-gradient(to right, currentColor 1px, transparent 1px)
      left bottom / 4px 1px repeat-x;
  }

  .vis-tooltip-item {
    margin-top: 16px;
  }

  .vis-tooltip-value {
    margin-top: 4px;
    font-family: "Pitch", monospace;
  }

  &.dark {
    background: #2f2f2f;
    color: #faf9f5;

    .vis-tooltip-title {
      font-weight: 600;
    }
  }

  &.light {
    background: #faf9f5;
    color: #2f2f2f;

    .vis-tooltip-label {
      font-weight: 600;
    }
  }
}

.vis-hover-dot {
  stroke: var(--vis-bg);
  stroke-width: 1.5;
  pointer-events: none;
}

.vis-chart {
  display: block;
  overflow: visible;
}

.vis-axis-line {
  stroke: var(--vis-fg);
  stroke-width: 1;
}

.vis-baseline {
  stroke: var(--vis-fg);
  stroke-width: 1;
  stroke-dasharray: 1 3;
}

.vis-axis-label {
  font-family: "Pitch", monospace;
  font-size: 12px;
  fill: var(--vis-fg);
}

.vis-event-line {
  stroke: var(--vis-fg);
  stroke-width: 1;
  stroke-dasharray: 1 3;
  pointer-events: none;
}

.vis-event-dot {
  fill: var(--vis-fg);
  pointer-events: none;
}

/* the icon files are used as masks, so they take the chart's foreground color;
   outline and filled icon are stacked and crossfaded on hover */
.vis-event-icon {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;

  &::before,
  &::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--vis-fg);
    transition: opacity 0.2s ease;
  }

  &::before {
    mask: var(--icon) center / contain no-repeat;
    -webkit-mask: var(--icon) center / contain no-repeat;
  }

  &::after {
    mask: var(--icon-filled) center / contain no-repeat;
    -webkit-mask: var(--icon-filled) center / contain no-repeat;
    opacity: 0;
  }

  &.hovered::before {
    opacity: 0;
  }

  &.hovered::after {
    opacity: 1;
  }
}

.vis-event-label {
  position: absolute;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  pointer-events: none;

  &.flip {
    align-items: flex-end;
    transform: translateX(-100%);
  }

  p {
    margin: 0;
    padding: 2px 14px;
    font-family: "Pitch", monospace;
    font-size: 12px;
    white-space: nowrap;
    background: var(--vis-fg);
    color: var(--vis-bg);
  }
}

.vis-no-data {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 16px;
  font-size: 14px;
  text-align: center;
}

.vis-no-data-text {
  margin: 0;
}

.vis-no-data-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* same look as .vis-no-data-text */
.vis-chart-message {
  font-size: 14px;
  fill: var(--vis-fg);
}
