/* Subtle ancestry control in the site footer. */
.ancestry {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
}

.ancestry__btn {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--faint);
  opacity: .72;
  cursor: pointer;
}

.ancestry__btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.ancestry__btn:hover,
.ancestry__btn:focus-visible {
  opacity: 1;
  color: var(--muted);
}

.ancestry__btn:focus-visible {
  outline: 2px solid var(--berkly, var(--accent));
  outline-offset: 2px;
}

.ancestry__tip {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: calc(100% + 10px);
  width: max-content;
  min-width: 188px;
  padding: 10px 12px 8px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--muted);
  font: 400 .75rem/1.35 var(--sans);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
  pointer-events: none;
}

.ancestry__tip::after {
  content: "";
  position: absolute;
  right: 7px;
  bottom: -5px;
  width: 8px;
  height: 8px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}

.ancestry:hover .ancestry__tip,
.ancestry:focus-within .ancestry__tip,
.ancestry.is-open .ancestry__tip {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.ancestry__title {
  display: block;
  margin: 0 0 6px;
  font: 600 .68rem/1 var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}

.ancestry__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ancestry__row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--text);
}

.ancestry__pct {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .ancestry__tip,
  .ancestry__btn {
    transition: none;
  }
}
