/* WHC Spiritual Gifts — frontend */
.whc-sg {
  --whc-sg-accent: var(--bde-brand-primary-color, var(--hcl-brand-9, #0c243c));
  --whc-sg-accent-hover: var(--bde-brand-primary-color-hover, var(--hcl-brand-10, #00172e));
  --whc-sg-bg: var(--hcl-neutral-2, #f9f9f9);
  --whc-sg-surface: var(--hcl-neutral-1, #fcfcfc);
  --whc-sg-text: var(--hcl-neutral-12, #202020);
  --whc-sg-muted: var(--hcl-neutral-11, #646464);
  --whc-sg-success: var(--hcl-yellow-9, #55c2c3);
  --whc-sg-border: var(--hcl-neutral-4, #e8e8e8);
  --whc-sg-font-heading: var(--bde-heading-font-family, "Playfair Display", Georgia, serif);
  --whc-sg-font-body: var(--bde-body-font-family, "General Sans", system-ui, sans-serif);
  --whc-sg-body-size: var(--bde-body-font-size, 1.05rem);
  --whc-sg-question-size: 1.125rem;
  --whc-sg-radius: var(--hrd-m, 8px);
  --whc-sg-radius-pill: var(--hrd-pill, 500px);
  --whc-sg-btn-height: 48px;

  font-family: var(--whc-sg-font-body);
  color: var(--whc-sg-text);
  font-size: var(--whc-sg-body-size);
  line-height: 1.55;
  max-width: 760px;
  margin: 0 auto;
}

.whc-sg__hero {
  text-align: center;
  padding: 28px 12px 20px;
}

.whc-sg__eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--whc-sg-muted);
}

.whc-sg__title {
  margin: 0 0 12px;
  font-family: var(--whc-sg-font-heading);
  font-weight: 500;
  font-size: clamp(1.85rem, 1.3rem + 1.8vw, 2.65rem);
  line-height: 1.15;
  color: var(--whc-sg-accent);
}

.whc-sg__lead {
  margin: 0 auto 10px;
  max-width: 36em;
  color: var(--whc-sg-text);
}

.whc-sg__trust {
  margin: 0;
  color: var(--whc-sg-muted);
  font-size: 0.875rem;
}

.whc-sg__form,
.whc-sg__success {
  background: var(--whc-sg-surface);
  border: 1px solid var(--whc-sg-border);
  border-radius: calc(var(--whc-sg-radius) + 4px);
  padding: 24px 22px 28px;
  margin: 8px 0 28px;
}

.whc-sg__panel-title {
  margin: 0 0 16px;
  font-family: var(--whc-sg-font-heading);
  font-size: 1.5rem;
  color: var(--whc-sg-accent);
}

.whc-sg__field {
  display: block;
  margin: 0 0 14px;
}

.whc-sg__field > span {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 6px;
  color: var(--whc-sg-muted);
}

.whc-sg__field input {
  width: 100%;
  height: var(--whc-sg-btn-height);
  border: 1px solid var(--whc-sg-border);
  border-radius: var(--whc-sg-radius);
  padding: 0 14px;
  font: inherit;
  color: var(--whc-sg-text);
  background: #fff;
}

.whc-sg__field input:focus {
  outline: 2px solid var(--whc-sg-success);
  outline-offset: 1px;
  border-color: var(--whc-sg-accent);
}

.whc-sg__progress {
  margin: 0 0 18px;
}

.whc-sg__progress-track {
  height: 8px;
  background: var(--whc-sg-border);
  border-radius: 99px;
  overflow: hidden;
}

.whc-sg__progress-fill {
  height: 100%;
  width: 0;
  background: var(--whc-sg-success);
  transition: width 0.25s ease;
}

.whc-sg__progress-label {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: var(--whc-sg-muted);
}

.whc-sg__step-kicker {
  margin: 0 0 14px;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--whc-sg-muted);
}

.whc-sg__q {
  border: 1px solid var(--whc-sg-border);
  border-radius: calc(var(--whc-sg-radius) + 2px);
  padding: 22px 22px 18px;
  margin: 0 0 28px;
  background: #fff;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  animation: whc-sg-pop 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  transition: opacity 0.35s ease, transform 0.35s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Stagger one-at-a-time (not all at once). */
.whc-sg__q:nth-child(1) { animation-delay: 0.05s; }
.whc-sg__q:nth-child(2) { animation-delay: 0.18s; }
.whc-sg__q:nth-child(3) { animation-delay: 0.31s; }
.whc-sg__q:nth-child(4) { animation-delay: 0.44s; }
.whc-sg__q:nth-child(5) { animation-delay: 0.57s; }
.whc-sg__q:nth-child(6) { animation-delay: 0.7s; }
.whc-sg__q:nth-child(7) { animation-delay: 0.83s; }
.whc-sg__q:nth-child(8) { animation-delay: 0.96s; }
.whc-sg__q:nth-child(9) { animation-delay: 1.09s; }
.whc-sg__q:nth-child(10) { animation-delay: 1.22s; }
.whc-sg__q:nth-child(n+11) { animation-delay: 1.35s; }

@keyframes whc-sg-pop {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Answered questions fade 15% (opacity 0.85). Full opacity while changing. */
.whc-sg__q.is-answered {
  opacity: 0.85;
  transform: translateY(0) scale(1);
  animation: none;
  border-color: color-mix(in srgb, var(--whc-sg-border) 70%, var(--whc-sg-success));
}

.whc-sg__q.is-answered:hover,
.whc-sg__q.is-answered:focus-within,
.whc-sg__q.is-answering {
  opacity: 1;
  box-shadow: 0 8px 22px rgba(12, 36, 60, 0.08);
}

/* Focus queue: current question full, next peek ~50%, later ones quieter. */
.whc-sg__q.is-focus {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: none;
  border-color: color-mix(in srgb, var(--whc-sg-accent) 35%, var(--whc-sg-border));
  box-shadow: 0 10px 28px rgba(12, 36, 60, 0.08);
}

.whc-sg__q.is-next {
  opacity: 0.5;
  transform: translateY(0) scale(0.985);
  animation: none;
  filter: saturate(0.85);
}

.whc-sg__q.is-pending {
  opacity: 0.32;
  transform: translateY(0) scale(0.98);
  animation: none;
  filter: saturate(0.7);
}

/* Changing an answer always restores full visibility. */
.whc-sg__q.is-answering {
  opacity: 1 !important;
  filter: none;
  transform: translateY(0) scale(1);
}

.whc-sg__q.is-focus .whc-sg__choices .whc-sg__choice span {
  border-color: color-mix(in srgb, var(--whc-sg-accent) 25%, var(--whc-sg-border));
}

.whc-sg__q.is-next::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  border-radius: 99px;
  background: var(--whc-sg-success);
  margin: 0 0 12px;
  opacity: 0.85;
}

.whc-sg__panel--step {
  animation: whc-sg-fade 0.35s ease;
}

/* Entrance pop must not override focus-queue opacity after first paint. */
.whc-sg__panel--step .whc-sg__q {
  animation: none;
  opacity: 0.32;
  transform: translateY(0) scale(0.98);
}

.whc-sg__panel--step .whc-sg__q.is-focus {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.whc-sg__panel--step .whc-sg__q.is-next {
  opacity: 0.5;
}

.whc-sg__panel--step .whc-sg__q.is-answered {
  opacity: 0.85;
}

@keyframes whc-sg-fade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.whc-sg__q legend {
  padding: 0 6px;
  font-size: var(--whc-sg-question-size);
  font-weight: 500;
  line-height: 1.45;
  max-width: 42em;
}

.whc-sg__q legend {
  padding: 0 6px;
  font-size: var(--whc-sg-question-size);
  font-weight: 500;
}

.whc-sg__choices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.whc-sg__choice {
  cursor: pointer;
}

.whc-sg__choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.whc-sg__choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--whc-sg-border);
  border-radius: var(--whc-sg-radius);
  background: #fff;
  font-size: 0.875rem;
  text-align: center;
  padding: 8px 6px;
  transition: 0.15s ease;
}

.whc-sg__choice input:focus-visible + span {
  outline: 2px solid var(--whc-sg-success);
  outline-offset: 2px;
}

.whc-sg__choice input:checked + span {
  background: var(--whc-sg-accent);
  border-color: var(--whc-sg-accent);
  color: #fff;
}

.whc-sg__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 8px;
}

.whc-sg__btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  min-height: var(--whc-sg-btn-height);
  padding: 0 22px;
  border-radius: var(--whc-sg-radius);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s ease;
  line-height: 1.2;
  white-space: nowrap;
}

.whc-sg__btn--primary,
.whc-sg a.whc-sg__btn--primary {
  background: var(--whc-sg-accent) !important;
  color: #ffffff !important;
  border-color: var(--whc-sg-accent) !important;
}

.whc-sg__btn--primary:hover,
.whc-sg__btn--primary:focus,
.whc-sg__btn--primary:active,
.whc-sg__btn--primary:visited,
.whc-sg a.whc-sg__btn--primary:hover,
.whc-sg a.whc-sg__btn--primary:focus,
.whc-sg a.whc-sg__btn--primary:active,
.whc-sg a.whc-sg__btn--primary:visited {
  background: var(--whc-sg-accent-hover) !important;
  color: #ffffff !important;
  text-decoration: none;
}

.whc-sg__btn--ghost,
.whc-sg a.whc-sg__btn--ghost {
  background: transparent !important;
  color: var(--whc-sg-accent) !important;
  border: 1px solid var(--whc-sg-border) !important;
}

.whc-sg__btn--ghost:hover,
.whc-sg__btn--ghost:focus,
.whc-sg a.whc-sg__btn--ghost:hover,
.whc-sg a.whc-sg__btn--ghost:focus {
  color: var(--whc-sg-accent-hover) !important;
  background: rgba(12, 36, 60, 0.04) !important;
}

.whc-sg__btn--ghost {
  background: transparent;
  color: var(--whc-sg-accent);
  border: 1px solid var(--whc-sg-border);
}

.whc-sg__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.whc-sg__error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--whc-sg-radius);
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.9375rem;
}

.whc-sg__success-card {
  text-align: center;
}

.whc-sg__success-msg {
  color: var(--whc-sg-text);
  max-width: 34em;
  margin: 0 auto 18px;
}

.whc-sg__inline-primary {
  border: 1px solid var(--whc-sg-border);
  border-top: 4px solid var(--whc-sg-accent);
  border-radius: var(--whc-sg-radius);
  padding: 18px;
  margin: 0 auto 20px;
  max-width: 28em;
}

.whc-sg__inline-label {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--whc-sg-muted);
}

.whc-sg__inline-name {
  margin: 8px 0;
  font-family: var(--whc-sg-font-heading);
  font-size: 1.65rem;
  color: var(--whc-sg-accent);
}

.whc-sg__inline-def {
  margin: 0;
  color: var(--whc-sg-muted);
  font-size: 0.9375rem;
}

.whc-sg__hp {
  position: absolute;
  left: -9999px;
  height: 0;
  width: 0;
  opacity: 0;
}

.whc-sg__lang {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.whc-sg__lang-btn {
  appearance: none;
  border: 1px solid var(--whc-sg-border);
  background: transparent;
  color: var(--whc-sg-muted);
  border-radius: var(--whc-sg-radius-pill);
  padding: 6px 14px;
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.whc-sg__lang-btn.is-active {
  background: var(--whc-sg-accent);
  border-color: var(--whc-sg-accent);
  color: #fff;
}

.whc-sg__resume {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--whc-sg-border);
}

.whc-sg__resume-toggle {
  appearance: none;
  border: none;
  background: none;
  color: var(--whc-sg-accent);
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}

.whc-sg__resume-fields {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--whc-sg-border);
  border-radius: var(--whc-sg-radius);
  background: var(--whc-sg-bg);
}

.whc-sg__code-input {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}

.whc-sg__fab {
  position: sticky;
  bottom: 18px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  pointer-events: none;
}

/* [hidden] must win over display:flex */
.whc-sg__fab[hidden] {
  display: none !important;
}

.whc-sg__fab-btn {
  pointer-events: auto;
  appearance: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--whc-sg-accent) !important;
  color: #ffffff !important;
  font: inherit;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(12, 36, 60, 0.28);
  transition: 0.2s ease;
}

.whc-sg__fab-btn:hover,
.whc-sg__fab-btn:focus {
  background: var(--whc-sg-accent-hover) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

.whc-sg__fab-btn.is-saved {
  background: var(--whc-sg-success) !important;
  color: #0c243c !important;
}

.whc-sg__fab-note {
  pointer-events: none;
  margin: 0;
  background: #fff;
  border: 1px solid var(--whc-sg-border);
  color: var(--whc-sg-muted);
  font-size: 0.8125rem;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(12, 36, 60, 0.12);
}

.whc-sg__fab-note.is-error {
  color: #b91c1c;
  border-color: #fecaca;
}

@media (max-width: 640px) {
  .whc-sg__q {
    padding: 18px 14px 14px;
    margin-bottom: 20px;
  }

  .whc-sg__choices {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

@media (max-width: 640px) {
  .whc-sg__choices {
    grid-template-columns: 1fr 1fr;
  }

  .whc-sg__form,
  .whc-sg__success {
    padding: 18px 14px 22px;
  }

  .whc-sg__nav .whc-sg__btn {
    flex: 1 1 100%;
  }
}
