/* ═══════════════════════════════════════════════════════════════════
   TLN Lead Form — Design override
   Enqueued ONLY on page-compare-loan-offers.php and page-apply-now.php.
   Reuses :root tokens from theme.css (--tln-teal, --tln-teal-dark, etc.).
   DM Sans loaded via wp_enqueue_style in functions.php.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Trust chips — rendered inside .tln-form-hero ───────────────── */
.tln-trust-chips {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px auto 0;
}

.tln-trust-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.tln-trust-chip::before {
  content: "✓";
  font-size: 0.72rem;
  opacity: 0.85;
}

/* ─── Form card wrapper — narrows to ~640px ───────────────────────── */
/* theme.css sets .tln-form-container max-width to 840px.
   lead-form.css loads after theme.css (dependency chain), so no !important needed. */
.tln-form-container {
  max-width: 660px;
}

/* GF adds min-height: 55vh on every .gform_page via grav-cstm.css.
   Override so the card sizes to its content, not a fixed viewport fraction. */
.tln-form-container .gform_page {
  min-height: auto !important; /* beats grav-cstm.css: .gform_page { min-height: 55vh !important } */
  height: auto !important;
}

/* ─── Progress bar ─────────────────────────────────────────────────── */
/* grav-cstm.css has a global rule: div.gf_progressbar_wrapper { display: none }
   Re-show scoped to our wrapper. !important beats the global hide. */
.tln-form-container .gf_progressbar_wrapper,
.tln-form-container div.gf_progressbar_wrapper {
  display: block !important; /* beats grav-cstm.css: div.gf_progressbar_wrapper { display: none } */
  margin: 0 0 28px;
}

.tln-form-container .gf_progressbar_title {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--tln-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
}

.tln-form-container .gf_progressbar {
  height: 5px;
  background: var(--tln-border);
  border-radius: 999px;
  overflow: hidden;
}

.tln-form-container .gf_progressbar_percentage {
  height: 100%;
  background: var(--tln-teal);
  border-radius: 999px;
  transition: width 0.35s ease;
  font-size: 0;       /* hide the "X%" text node inside the fill bar */
  color: transparent;
}

/* ─── Question label — serif fix ──────────────────────────────────── */
/* Root cause: grav-cstm.css sets
     .form_sublabel_below .gfield_label.gform-field-label { font-family: inter }
   "inter" (lowercase, no stack) fails on any machine that doesn't have Inter
   installed locally → browser falls back to its default = Times New Roman (serif).
   Fix: explicit DM Sans with full sans-serif fallback, scoped here.
   !important on font-* properties beats grav-cstm's font-size: 40px !important. */
.tln-form-container .gfield_label,
.tln-form-container .gfield_label.gform-field-label,
.tln-form-container legend.gfield_label,
.tln-form-container .form_sublabel_below .gfield_label.gform-field-label {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
  /* !important beats grav-cstm.css: font-family: inter (no fallback stack) and font-size: 40px !important */
  font-size: 24px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  color: var(--tln-heading) !important;
  text-align: center;
  margin-bottom: 24px !important;
  padding: 0 !important;
}

/* Contact step (page 15) — h4 heading over the name/email fields */
.tln-form-container .ksks_name-email h4 {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
}

/* ─── Radio choice buttons ─────────────────────────────────────────── */
/* Native radio inputs stay off-screen (grav-cstm hides them too; belt-and-suspenders) */
.tln-form-container .gfield-choice-input,
.tln-form-container .gfield_choice_input {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Choice row — single column, centered */
.tln-form-container .gfield_radio {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  max-width: 420px !important;
  margin: 0 auto !important;
}

/* Two-up for small choice sets (Purchase / Refinance) */
.tln-form-container .custom-form-button .gfield_radio {
  flex-direction: row !important;
  flex-wrap: wrap !important;
}

.tln-form-container .gchoice {
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
}

/* The clickable <label> — solid green pill */
.tln-form-container .gfield_radio label,
.tln-form-container .gfield_radio .gform-field-label--type-inline {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 56px !important;
  height: auto !important;
  padding: 10px 20px !important;
  background: var(--tln-teal) !important;
  color: #fff !important;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  text-align: center !important;
  border: none !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  transition: background 0.15s ease !important;
  /* !important beats grav-cstm.css which styles these as blue outlined pills:
       border: 1px solid #0C71C3; border-radius: 35px; color: #0C71C3; background: transparent */
}

.tln-form-container .gfield_radio label:hover {
  background: var(--tln-teal-dark) !important;
}

.tln-form-container .gfield-choice-input:checked + label,
.tln-form-container .gfield_choice_input:checked + label {
  background: var(--tln-teal-dark) !important;
  box-shadow: 0 0 0 3px rgba(29, 122, 79, 0.25) !important;
}

/* ─── Page footer layout ─────────────────────────────────────────── */
/* Note: does NOT set display — kskd_next_hide pages hide their footer
   via grav-cstm.css: .kskd_next_hide .gform_page_footer { display: none !important }
   We must not fight that. Only override layout within visible footers. */
.tln-form-container .gform_page_footer {
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding-top: 8px !important;
  min-height: auto !important; /* beats grav-cstm: .gform-theme--foundation .gform_page_footer { min-height: 140px } */
  position: static !important;
  margin: 0 !important;
}

/* ─── Next button ───────────────────────────────────────────────────── */
.tln-form-container input.gform_next_button,
.tln-form-container .gform_next_button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  max-width: 420px !important;
  min-height: 56px !important;
  height: 56px !important;
  line-height: 56px !important;
  background: var(--tln-teal) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 10px !important;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 0 !important;
  margin: 0 auto !important;
  transition: background 0.15s ease !important;
  /* !important beats grav-cstm.css: green rounded-pill with uppercase text, variable heights */
}

.tln-form-container input.gform_next_button:hover,
.tln-form-container .gform_next_button:hover {
  background: var(--tln-teal-dark) !important;
}

/* ─── Previous button ───────────────────────────────────────────────── */
.tln-form-container input.gform_previous_button,
.tln-form-container .gform_previous_button {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--tln-muted) !important;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  padding: 6px 20px !important;
  min-height: auto !important;
  height: auto !important;
  line-height: 1.4 !important;
  transition: color 0.15s ease !important;
  /* !important beats grav-cstm.css: uppercase small back button with specific sizing */
}

.tln-form-container input.gform_previous_button:hover {
  color: var(--tln-body) !important;
}

/* ─── Submit button (page 15 — contact info) ─────────────────────── */
.tln-form-container input.gform_button,
.tln-form-container .gform_button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  max-width: 420px !important;
  min-height: 56px !important;
  height: 56px !important;
  line-height: 56px !important;
  background: var(--tln-teal) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 10px !important;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 auto !important;
  transition: background 0.15s ease !important;
}

.tln-form-container input.gform_button:hover {
  background: var(--tln-navy-2) !important;
}

/* ─── Text / email / phone inputs ─────────────────────────────────── */
.tln-form-container .ginput_container input[type="text"],
.tln-form-container .ginput_container input[type="email"],
.tln-form-container .ginput_container input[type="tel"],
.tln-form-container .ginput_container input[type="number"] {
  height: 48px !important;
  border: 1px solid var(--tln-border) !important;
  border-radius: 8px !important;
  font-family: var(--tln-font) !important;
  font-size: 1rem !important;
  color: var(--tln-ink) !important;
  padding: 0 14px !important;
  box-shadow: none !important;
  background: #fff !important;
  width: 100% !important;
  text-align: left !important;
  /* !important on text-align beats .et_pb_code_inner .gform_wrapper { text-align: center } */
}

.tln-form-container .ginput_container input:focus {
  outline: 3px solid rgba(29, 122, 79, 0.3) !important; /* tln-teal focus ring */
  outline-offset: 2px !important;
  border-color: var(--tln-teal) !important;
}

/* ─── Select inputs ─────────────────────────────────────────────── */
.tln-form-container .gfield_select {
  height: 48px !important;
  border: 1px solid var(--tln-border) !important;
  border-radius: 8px !important;
  font-size: 1rem !important;
  font-family: var(--tln-font) !important;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .tln-form-container {
    padding: 0 12px 36px;
  }

  .tln-form-container .gfield_label.gform-field-label {
    font-size: 20px !important;
    margin-bottom: 20px !important;
  }

  .tln-trust-chips {
    gap: 7px;
  }

  .tln-trust-chip {
    font-size: 0.72rem;
    padding: 3px 10px;
  }
}
