details[data-help-key] {
  display: inline-block;
  position: relative;
  font-weight: normal;
  font-style: normal;
}

details[data-help-key][open] {
  anchor-name: --cnx-help-trigger;
  z-index: 300;
}

details[data-help-key] > summary {
  align-items: center;
  justify-content: center;
  display: inline-flex;
  border: 1px solid var(--cnx-color-border-strong, #4a4a6a);
  border-radius: 50%;
  color: var(--cnx-color-text-muted, var(--text, #cfd4e8));
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  list-style: none;
  min-inline-size: 1.5rem;
  min-block-size: 1.5rem;
  box-sizing: border-box;
}

details[data-help-key] > summary::-webkit-details-marker {
  display: none;
}

details[data-help-key] > summary:focus-visible {
  outline: 2px solid var(--cnx-color-accent-default, #8ab4f8);
  outline-offset: 2px;
}

details[data-help-key][open] > div {
  box-sizing: border-box;
  background: var(--cnx-color-bg-surface, var(--bg-card, #16162a));
  color: var(--cnx-color-text-default, var(--text, #cfd4e8));
  border: 1px solid var(--cnx-color-border-strong, #3a3a5a);
  border-radius: var(--cnx-radius-md, 0.5rem);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: var(--cnx-font-size-sm, 0.875rem);
  font-weight: normal;
  line-height: 1.5;
  white-space: normal;
  text-align: start;
  overflow-wrap: anywhere;
  inline-size: min(21rem, calc(100vw - 1rem));
  max-inline-size: calc(100vw - 1rem);
  max-block-size: min(24rem, calc(100dvh - 1rem));
  overflow: auto;
  padding: 0.75rem;
  margin: 0;
  position: absolute;
  inset: 100% auto auto 0;
  z-index: 301;
}

details[data-help-key][open] > div a {
  color: var(--cnx-color-accent-text, var(--info-fg, #8ab4f8));
}

details[data-help-key][open] > div > span:first-child {
  font-weight: 600;
}

details[data-help-key][open] > div.cnx-help-align-end {
  left: auto;
  right: 0;
}

details[data-help-key][open] > div.cnx-help-docked {
  position: fixed;
  inset: auto 0.5rem 0.5rem auto;
  margin: 0;
}

details[data-help-key][open] > div[popover] {
  position: fixed;
  inset: auto 0.5rem 0.5rem auto;
}

@supports (top: anchor(bottom)) {
  details[data-help-key][open] > div[popover] {
    position-anchor: --cnx-help-trigger;
    inset: auto;
    top: anchor(bottom);
    left: anchor(left);
    margin-block: 0.25rem;
    position-try-fallbacks: flip-inline, flip-block, flip-block flip-inline;
  }
}

@media (max-width: 50rem) {
  details[data-help-key][open] > div[popover] {
    inset: auto 0.5rem 0.5rem auto;
    margin: 0;
    position-try-fallbacks: none;
  }
}
