
/* =========================================================
   RBAI40 — Opportunity Comparison Scorecard™
   FINAL CSS v1.0.3
   Focus: readability, premium styling, spacing, responsiveness
   Scope: RBAI40 component + existing Kadence hero-spacing rule
   ========================================================= */

#rbai40,
#rbai40 * {
  box-sizing: border-box;
}

#rbai40 {
  --rb40-ink: #172554;
  --rb40-muted: #526581;
  --rb40-line: #dfe6f1;
  --rb40-blue: #2563eb;
  --rb40-violet: #7c3aed;
  --rb40-teal: #0f9f9a;
  --rb40-surface: #ffffff;
  --rb40-soft: #f8faff;
  --rb40-lavender: #eef2ff;

  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 0 32px;
  color: var(--rb40-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#rbai40 button,
#rbai40 input,
#rbai40 select {
  font-family: inherit;
}

#rbai40 button {
  cursor: pointer;
}

#rbai40 [hidden] {
  display: none !important;
}

/* =========================
   HERO
   ========================= */

#rbai40 .rbai40-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(28px, 4vw, 46px);
  margin: 0 0 26px;
  border: 1px solid #4338ca;
  border-radius: 24px;
  background: linear-gradient(
    125deg,
    #10265c 0%,
    #3730a3 48%,
    #7c3aed 100%
  );
  color: #fff;
  box-shadow: 0 16px 38px rgba(55, 48, 163, 0.15);
}

#rbai40 .rbai40-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 250px;
  height: 250px;
  right: -65px;
  top: -100px;
  border: 34px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

#rbai40 .rbai40-hero * {
  color: #fff;
}

#rbai40 .rbai40-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.5;
}

#rbai40 .rbai40-kicker-dot {
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #67e8f9;
  box-shadow: 0 0 0 5px rgba(103, 232, 249, 0.15);
}

#rbai40 .rbai40-hero h2 {
  margin: 17px 0 14px;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

#rbai40 .rbai40-hero h2 span {
  background: linear-gradient(90deg, #a5f3fc, #ddd6fe);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

#rbai40 .rbai40-intro {
  max-width: 800px;
  margin: 0;
  color: #e8edff;
  font-size: 17px;
  line-height: 1.75;
}

#rbai40 .rbai40-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

#rbai40 .rbai40-hero-pills span {
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.27);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

/* =========================
   MAIN PANELS
   ========================= */

#rbai40 .rbai40-panel {
  min-width: 0;
  padding: clamp(22px, 3vw, 32px);
  margin: 0 0 24px;
  border: 1px solid var(--rb40-line);
  border-radius: 22px;
  background: var(--rb40-surface);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.045);
}

#rbai40 .rbai40-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

#rbai40 .rbai40-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #5145d8;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.14em;
  line-height: 1.5;
}

#rbai40 h3 {
  margin: 0;
  color: var(--rb40-ink);
  font-size: clamp(23px, 2.5vw, 29px);
  font-weight: 820;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

#rbai40 .rbai40-muted {
  margin: 10px 0 23px;
  color: var(--rb40-muted);
  font-size: 15px;
  line-height: 1.75;
}

/* =========================
   BUTTONS
   ========================= */

#rbai40 .rbai40-btn {
  min-height: 44px;
  padding: 11px 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  white-space: normal;
  text-align: center;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

#rbai40 .rbai40-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(30, 41, 59, 0.12);
}

#rbai40 .rbai40-btn:active {
  transform: translateY(0);
}

#rbai40 .rbai40-btn-primary {
  border-color: transparent;
  background: linear-gradient(110deg, #2563eb, #7c3aed);
  color: #fff;
}

#rbai40 .rbai40-btn-primary:hover {
  background: linear-gradient(110deg, #1d4ed8, #6d28d9);
  color: #fff;
}

#rbai40 .rbai40-btn-light {
  border-color: #dce4f0;
  background: #f1f5fb;
  color: #243451;
}

#rbai40 .rbai40-btn-light:hover {
  background: #e8edfa;
  color: #172554;
}

#rbai40 .rbai40-btn:focus-visible,
#rbai40 input:focus-visible,
#rbai40 select:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 3px;
}

/* =========================
   PRIORITY WEIGHT CARDS
   ========================= */

#rbai40 .rbai40-weight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

#rbai40 .rbai40-weight {
  display: block;
  min-width: 0;
  padding: 17px;
  border: 1px solid #e0e6f0;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff, #f7f9fd);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

#rbai40 .rbai40-weight:focus-within {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

#rbai40 .rbai40-weight span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
  color: #243451;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.5;
}

#rbai40 .rbai40-weight b {
  flex-shrink: 0;
  color: #5145e5;
  font-size: 18px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

/* =========================
   RANGE SLIDERS
   Retains native browser behavior
   ========================= */

#rbai40 input[type="range"] {
  display: block !important;
  width: 100% !important;
  max-width: 100%;
  height: 28px !important;
  min-height: 28px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  accent-color: #6d5ce8 !important;
  cursor: pointer !important;
  opacity: 1 !important;
  appearance: auto !important;
  -webkit-appearance: auto !important;
}

/* =========================
   COMBINED WEIGHT SUMMARY
   ========================= */

#rbai40 .rbai40-weight-total {
  display: flex;
  align-items: center;
  gap: 12px 15px;
  flex-wrap: wrap;
  margin-top: 17px;
  padding: 15px 18px;
  border: 1px solid #e0e7ff;
  border-radius: 15px;
  background: linear-gradient(110deg, #eef2ff, #f4f3ff);
}

#rbai40 .rbai40-weight-total span {
  color: #243451;
  font-size: 14px;
  font-weight: 800;
}

#rbai40 .rbai40-weight-total strong {
  color: #4338ca;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

#rbai40 .rbai40-weight-total small {
  color: #526581;
  font-size: 13px;
  line-height: 1.6;
}

/* =========================
   OPPORTUNITY CARDS
   ========================= */

#rbai40 .rbai40-opportunities {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

#rbai40 .rbai40-op-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dce6f7;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(30, 64, 175, 0.035);
}

#rbai40 .rbai40-op-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 19px;
  border-bottom: 1px solid #e0e7ff;
  background: linear-gradient(110deg, #eff6ff, #f5f3ff);
}

#rbai40 .rbai40-op-head h4 {
  min-width: 0;
  margin: 0;
  color: #172554;
  font-size: 17px;
  font-weight: 820;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#rbai40 .rbai40-remove {
  flex-shrink: 0;
  padding: 8px 11px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff1f2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

#rbai40 .rbai40-remove:hover {
  background: #fee2e2;
}

#rbai40 .rbai40-op-body {
  padding: 19px;
}

/* Form labels and controls */
#rbai40 .rbai40-field {
  display: block;
  min-width: 0;
  margin-bottom: 16px;
}

#rbai40 .rbai40-field > span {
  display: block;
  margin-bottom: 7px;
  color: #334563;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

#rbai40 .rbai40-field input,
#rbai40 .rbai40-field select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 11px;
  background-color: #fff;
  color: #172554;
  font-size: 15px;
  line-height: 1.5;
  box-shadow: none;
}

#rbai40 .rbai40-field input::placeholder {
  color: #8795aa;
  opacity: 1;
}

#rbai40 .rbai40-field input:hover,
#rbai40 .rbai40-field select:hover {
  border-color: #a5b4fc;
}

#rbai40 .rbai40-field small {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
}

/* Rating fields */
#rbai40 .rbai40-rating-title {
  margin: 20px 0 12px;
  color: #475569;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.5;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

#rbai40 .rbai40-rating-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#rbai40 .rbai40-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

/* =========================
   RESULTS
   ========================= */

#rbai40 .rbai40-results-tag {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid #e0e7ff;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

#rbai40 .rbai40-empty {
  margin-top: 20px;
  padding: 38px 18px;
  border: 1px dashed #bfcafa;
  border-radius: 17px;
  background: linear-gradient(135deg, #f8fafc, #f5f3ff);
  text-align: center;
}

#rbai40 .rbai40-empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 17px;
  background: linear-gradient(135deg, #2563eb, #9333ea);
  color: #fff;
  font-size: 27px;
}

#rbai40 .rbai40-empty strong {
  color: #172554;
  font-size: 18px;
  font-weight: 850;
  line-height: 1.5;
}

#rbai40 .rbai40-empty p {
  margin: 8px 0 0;
  color: #526581;
  font-size: 15px;
  line-height: 1.7;
}

/* Result cards automatically adapt to available space.
   Compatible replacement for the former :has() selector. */
#rbai40 .rbai40-result-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
  gap: 18px;
  margin-top: 22px;
}

#rbai40 .rbai40-result-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 22px;
  border: 1px solid #dfe6f1;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.035);
}

#rbai40 .rbai40-result-card.rbai40-winner {
  border-color: #a5b4fc;
  background: linear-gradient(145deg, #eef2ff 0%, #fff 72%);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.08);
}

#rbai40 .rbai40-rank {
  color: #5145d8;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.5;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

#rbai40 .rbai40-result-card h4 {
  margin: 8px 0 16px;
  color: #172554;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Score and progress bar */
#rbai40 .rbai40-score-line {
  display: flex;
  align-items: center;
  gap: 16px;
}

#rbai40 .rbai40-score {
  flex-shrink: 0;
  color: #4338ca;
  font-size: 42px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

#rbai40 .rbai40-score small {
  color: #526581;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0;
}

#rbai40 .rbai40-meter {
  flex: 1;
  min-width: 40px;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

#rbai40 .rbai40-meter span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #06b6d4, #6366f1, #8b5cf6);
}

#rbai40 .rbai40-score-caption {
  margin: 12px 0 19px;
  color: #526581;
  font-size: 14px;
  line-height: 1.7;
}

/* Factor breakdown */
#rbai40 .rbai40-breakdown {
  display: grid;
  gap: 11px;
}

#rbai40 .rbai40-break-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
}

#rbai40 .rbai40-break-row strong {
  color: #172554;
  font-size: 14px;
  font-weight: 850;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Notes and eligibility guidance */
#rbai40 .rbai40-result-notes {
  margin-top: 19px;
  padding-top: 16px;
  border-top: 1px solid #dfe6f1;
  color: #475569;
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

#rbai40 .rbai40-result-notes b {
  color: #172554;
  font-weight: 850;
}

/* Disclaimer */
#rbai40 .rbai40-disclaimer {
  margin: 23px 0 0;
  padding-top: 18px;
  border-top: 1px solid #dfe6f1;
  color: #526581;
  font-size: 14px;
  line-height: 1.85;
}

/* Privacy note */
#rbai40 .rbai40-footer {
  padding: 12px 14px;
  color: #526581;
  font-size: 14px;
  line-height: 1.8;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Notifications */
#rbai40 .rbai40-toast {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  display: none;
  width: fit-content;
  max-width: calc(100% - 24px);
  margin: 14px auto 0;
  padding: 12px 17px;
  border: 1px solid #334155;
  border-radius: 12px;
  background: #172554;
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.5;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.20);
}

#rbai40 .rbai40-toast.is-visible {
  display: block;
}

/* =========================
   TABLET
   ========================= */

@media (max-width: 900px) {
  #rbai40 {
    padding-top: 16px;
  }

  #rbai40 .rbai40-weight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #rbai40 .rbai40-panel {
    padding: 23px;
  }

  #rbai40 .rbai40-opportunities {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Compatible replacement for the former :has() selector. */
  #rbai40 .rbai40-result-list {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  }
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 600px) {
  #rbai40 {
    padding: 10px 0 22px;
    font-size: 16px;
  }

  #rbai40 .rbai40-hero {
    padding: 25px 21px;
    margin-bottom: 19px;
    border-radius: 18px;
  }

  #rbai40 .rbai40-hero h2 {
    font-size: clamp(28px, 7vw, 36px);
  }

  #rbai40 .rbai40-intro {
    font-size: 16px;
  }

  #rbai40 .rbai40-hero-pills {
    gap: 8px;
    margin-top: 19px;
  }

  #rbai40 .rbai40-hero-pills span {
    font-size: 13px;
  }

  #rbai40 .rbai40-panel {
    padding: 20px 17px;
    margin-bottom: 19px;
    border-radius: 18px;
  }

  #rbai40 .rbai40-section-head {
    align-items: flex-start;
    gap: 13px;
  }

  #rbai40 h3 {
    font-size: 24px;
  }

  #rbai40 .rbai40-muted {
    font-size: 15px;
    margin-bottom: 19px;
  }

  #rbai40 .rbai40-weight-grid,
  #rbai40 .rbai40-opportunities,
  #rbai40 .rbai40-result-list {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Preserve the original single-column mobile override. */
  #rbai40 .rbai40-result-list {
    grid-template-columns: minmax(0, 1fr);
  }

  #rbai40 .rbai40-weight {
    padding: 16px;
  }

  #rbai40 .rbai40-weight span {
    font-size: 15px;
  }

  #rbai40 .rbai40-weight-total {
    gap: 9px 12px;
    padding: 14px;
  }

  #rbai40 .rbai40-weight-total small {
    flex-basis: 100%;
  }

  #rbai40 .rbai40-rating-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  #rbai40 .rbai40-op-head {
    align-items: flex-start;
    padding: 15px;
  }

  #rbai40 .rbai40-op-body {
    padding: 16px;
  }

  #rbai40 .rbai40-result-card {
    padding: 19px;
  }

  #rbai40 .rbai40-result-card h4 {
    font-size: 20px;
  }

  #rbai40 .rbai40-score {
    font-size: 38px;
  }

  #rbai40 .rbai40-results-tag {
    display: none;
  }

  #rbai40 .rbai40-actions {
    flex-direction: column;
    align-items: stretch;
  }

  #rbai40 .rbai40-actions .rbai40-btn {
    width: 100%;
    white-space: normal;
  }

  #rbai40 .rbai40-section-head > .rbai40-btn {
    max-width: 100%;
  }

  #rbai40 .rbai40-disclaimer,
  #rbai40 .rbai40-footer {
    font-size: 13px;
  }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
  #rbai40 *,
  #rbai40 *::before,
  #rbai40 *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* Existing Kadence hero spacing rule — PRESERVED */
body.page .entry-hero.page-hero-section {
  min-height: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body.page .entry-hero.page-hero-section .entry-header {
  display: none !important;
  min-height: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}
