/* Hover popovers on factor lines, the help dialog, and the Find nicest ZIP button */

.search button.secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}

.search button.secondary:hover:not(:disabled) {
  background: var(--surface-strong);
  box-shadow: none;
}

.search button:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

/* Factor lines */
.factors .factor {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
}

.info {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 0.65rem;
  font-style: italic;
  font-weight: 700;
  color: var(--muted);
  cursor: help;
  outline: none;
}

.info:focus-visible {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
}

.popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 5;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text);
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
}

.info:hover .popover,
.info:focus .popover {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.popover-text {
  color: var(--muted);
}

/* "How is this calculated?" button in the banner title */
.nd-help {
  margin-left: 0.5rem;
  padding: 0.2rem 0.6rem;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 999px;
  cursor: pointer;
}

.nd-help:hover {
  background: rgba(56, 189, 248, 0.2);
}

/* Help dialog */
.help-dialog {
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #111c33;
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.help-dialog::backdrop {
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.help-body {
  padding: 1.5rem;
}

.help-title {
  margin: 0 0 0.75rem;
  font-size: 1.3rem;
}

.help-intro {
  margin: 0 0 0.9rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.help-list {
  margin: 0 0 1rem;
}

.help-list dt {
  margin-top: 0.8rem;
  font-weight: 700;
}

.help-list dd {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
}

.help-close {
  margin-top: 0.5rem;
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 600;
  color: #0f172a;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
