.sa-questions-container {
  width: 100%;
  box-sizing: border-box;
  padding: var(--sa-padding-top, 16px) var(--sa-padding-right, 0px) var(--sa-padding-bottom, 16px) var(--sa-padding-left, 0px);
}

.sa-questions-heading {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--sa-heading-size, 16px);
  font-weight: var(--sa-heading-weight, 600);
  margin: 0 0 0.75em;
  color: inherit;
}

.sa-questions-icon {
  flex-shrink: 0;
}

.sa-questions-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sa-pill-gap, 8px);
}

/* Pill button.
   Selectors are scoped under .sa-questions-pills (specificity 0,2,0) so they
   beat theme button resets like `[type=button], button { ... }` (0,1,0) that
   otherwise override color/border/radius. */
.sa-questions-pills .sa-question-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.5em 1em;
  font-size: var(--sa-pill-size, 14px);
  line-height: 1.3;
  font-family: inherit;
  /* The page's own text color at rest: readable whatever the primary color.
     The primary color is the border, and the fill on hover. */
  color: inherit;
  background: transparent;
  border: 1.5px solid var(--sa-primary-color, #6366f1);
  border-radius: var(--sa-pill-radius, 999px);
  min-height: 40px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: normal;
  text-align: start;
  -webkit-appearance: none;
  appearance: none;
}

.sa-questions-pills .sa-question-pill:hover,
.sa-questions-pills .sa-question-pill:active {
  background: var(--sa-primary-color, #6366f1);
  color: var(--sa-on-primary, #fff);
}

/* Keyboard focus: a dark ring with a light gap, visible on any background and
   whatever the primary color. */
.sa-questions-pills .sa-question-pill:focus-visible {
  outline: 2px solid #1d2327;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff;
}

/* Subtle hover: a tint of the primary color, text unchanged. Also used for a
   color whose lightness is unknown (a CSS custom property). */
[data-hover-style="subtle"] .sa-questions-pills .sa-question-pill:hover,
[data-hover-style="subtle"] .sa-questions-pills .sa-question-pill:active {
  background: rgba(99, 102, 241, 0.12);
  background: color-mix(in srgb, var(--sa-primary-color, #6366f1) 12%, transparent);
  color: inherit;
}

/* CTA pill */
.sa-questions-pills .sa-question-pill--cta {
  border-style: dashed;
}

/* Skeleton loading state */
.sa-question-skeleton {
  display: inline-block;
  height: 2.2em;
  border-radius: var(--sa-pill-radius, 999px);
  background: #e5e7eb;
  animation: sa-pulse 1.5s ease-in-out infinite;
}

.sa-question-skeleton:nth-child(1) { width: 10em; }
.sa-question-skeleton:nth-child(2) { width: 14em; }
.sa-question-skeleton:nth-child(3) { width: 11em; }

@keyframes sa-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Desktop/mobile split from the Advanced pills placement. */
@media (max-width: 768px) {
  .sa-questions-container[data-sa-device="desktop"] {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .sa-questions-container[data-sa-device="mobile"] {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sa-questions-pills .sa-question-pill {
    transition: none;
  }

  .sa-question-skeleton {
    animation: none;
  }
}

/* Windows high contrast: system colors instead of the brand color. */
@media (forced-colors: active) {
  .sa-questions-pills .sa-question-pill {
    border-color: ButtonText;
    color: ButtonText;
  }

  .sa-questions-pills .sa-question-pill:hover,
  .sa-questions-pills .sa-question-pill:active {
    background: Highlight;
    color: HighlightText;
  }

  .sa-questions-pills .sa-question-pill:focus-visible {
    outline-color: Highlight;
    box-shadow: none;
  }
}
