/* =====================================================================
   Lead-Funnel (views/partials/funnel.ejs, public/js/funnel.js)
   Werte 1:1 aus design-handoff/source/design/Funnel.dc.html.
   Breite kommt vom Eltern-Element (.funnel-slot 424px | /anfrage/ max 520px).
   ===================================================================== */

.fn { width: 100%; max-width: 100%; min-width: 0; margin: 0; padding: 0; border: 0; position: relative; background: var(--white); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow-funnel); color: var(--navy); text-align: left; }
.fn p { margin: 0; max-width: none; }
.fn .f-err { color: #b42318; font-size: 13px; font-weight: 400; line-height: 1.4; }
.fn [hidden] { display: none; }

/* ---------- Kopf ---------- */
.fn-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--navy); padding: 18px min(var(--card-x), 24px); }
.fn-head-text { min-width: 0; }
.fn .fn-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; color: var(--orange-dark); text-transform: uppercase; }
.fn .fn-title { font-size: 17px; font-weight: 700; color: var(--white); margin-top: 3px; line-height: 1.25; }
.fn-head-meta { text-align: right; flex: 0 0 auto; }
.fn .fn-step-label { font-size: 13px; font-weight: 700; color: var(--white); }
.fn .fn-est { font-size: 11.5px; color: rgba(255, 255, 255, .6); margin-top: 2px; }

/* ---------- Beraterzeile ---------- */
.fn-advisor { display: flex; align-items: center; gap: 12px; padding: 14px min(var(--card-x), 24px); border-bottom: 1px solid #e9edf3; background: var(--white); }
.fn-advisor-img { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--white); box-shadow: 0 2px 8px rgba(4, 8, 24, .15); }
.fn-advisor-text { min-width: 0; flex: 1 1 auto; }
.fn .fn-advisor-name { font-size: 13.5px; color: var(--navy); line-height: 1.3; }
.fn .fn-advisor-status { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--text-2); }
.fn-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--green); }

/* ---------- Fortschritt ---------- */
.fn-progress { display: flex; gap: 5px; padding: 14px min(var(--card-x), 24px) 0; }
.fn-seg { flex: 1 1 0; height: 4px; border-radius: var(--r-pill); background: var(--line); transition: background-color .2s; }
.fn-seg.is-on { background: var(--blue); }

/* ---------- Body / Schritte ---------- */
.fn-body { padding: 20px min(var(--card-x), 24px) 22px; }
.fn-step { margin: 0; padding: 0; border: 0; min-width: 0; }
.fn-legend { display: block; width: 100%; padding: 0; margin: 0; }
.fn-q { font-size: var(--fs-h3); font-weight: 700; color: var(--navy); margin: 0; line-height: 1.3; }
.fn-q:focus { outline: none; }
.fn .fn-sub { font-size: 13.5px; color: var(--text-2); margin-top: 5px; line-height: 1.45; overflow-wrap: anywhere; }
.fn .fn-sub b { color: var(--navy); }
.fn .fn-noscript { margin: 0 0 16px; }
.fn .fn-noscript a { font-weight: 700; color: #b42318; text-decoration: underline; }

/* Optionen: echtes Radio (unsichtbar, deckt das Label ab → Tap-Ziel = Karte), Optik auf .fn-opt-body */
.fn-opt { position: relative; display: block; min-width: 0; cursor: pointer; }
.fn-radio-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; appearance: none; -webkit-appearance: none; }
.fn-opt-body { display: flex; align-items: center; border: 2px solid var(--line); background: var(--white); color: var(--navy); transition: border-color .15s, background-color .15s; }
.fn-opt:hover .fn-opt-body { border-color: var(--blue); }
.fn-radio-input:checked + .fn-opt-body { border-color: var(--blue); background: var(--blue-light); }
.fn-radio-input:focus-visible + .fn-opt-body { outline: 3px solid var(--blue); outline-offset: 3px; }

/* Schritt 1: Listenzeilen */
.fn-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.fn-opt--row .fn-opt-body { gap: 12px; border-radius: var(--r-inner); padding: 8px 12px 8px 8px; }
.fn-opt-img { width: 56px; height: 56px; flex: 0 0 56px; border-radius: var(--r-thumb); object-fit: cover; }
.fn-opt-text { flex: 1 1 auto; min-width: 0; display: block; }
.fn-opt-title { display: block; font-size: 14px; font-weight: 700; color: var(--navy); line-height: 1.25; overflow-wrap: anywhere; hyphens: auto; }
.fn-opt-sub { display: block; font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.35; overflow-wrap: anywhere; }
.fn-radio { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; border: 2px solid var(--line-3); background: transparent; display: flex; align-items: center; justify-content: center; transition: background-color .15s, border-color .15s; }
.fn-radio .ic { color: var(--white); opacity: 0; transition: opacity .15s; }
.fn-radio-input:checked + .fn-opt-body .fn-radio { background: var(--blue); border-color: var(--blue); }
.fn-radio-input:checked + .fn-opt-body .fn-radio .ic { opacity: 1; }

/* Schritt 2 & 3: Kacheln */
.fn-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.fn-opt--tile .fn-opt-body { justify-content: center; text-align: center; min-height: 72px; height: 100%; border-radius: 14px; padding: 12px; font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; hyphens: auto; }

/* Schritt 4: Inputs */
.fn-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.fn-field--full { grid-column: 1 / -1; }
.fn-input { width: 100%; min-width: 0; border: 1.5px solid var(--line-3); background: var(--white); border-radius: var(--r-inner); padding: 13px 16px; font-size: 15px; color: var(--navy); outline: none; min-height: 48px; transition: border-color .15s, box-shadow .15s; }
.fn-input::placeholder { color: var(--text-3); opacity: 1; }
.fn-input:focus { border-color: var(--blue); }
.fn-input:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(5, 144, 255, .2); }
.fn-input[aria-invalid="true"] { border-color: #d92d20; }
.fn-step .f-err[hidden] { display: none; }
.fn .fn-step-err { margin-top: 10px; }

/* ---------- Erfolg ---------- */
.fn-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 14px 0 10px; }
.fn-done[hidden] { display: none; }
.fn-done-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--blue); color: var(--white); display: flex; align-items: center; justify-content: center; }
.fn-done-title { font-size: 20px; font-weight: 700; color: var(--navy); margin: 4px 0 0; }
.fn-done-title:focus { outline: none; }
.fn .fn-done-text { font-size: 14px; color: var(--text-2); line-height: 1.5; max-width: 300px; }

/* ---------- Statusmeldung (Serverfehler) ---------- */
.fn-msg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; }
.fn-msg[hidden] { display: none; }
.fn-msg-phone { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: inherit; text-decoration: underline; min-height: 44px; }

/* ---------- CTA & Zurück ---------- */
.fn-cta { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: var(--orange); border-radius: var(--r-pill); padding: 16px 0; color: var(--white); font-size: 15px; font-weight: 700; line-height: 1.2; margin-top: 18px; min-height: 50px; transition: opacity .15s, background-color .15s; }
.fn-cta:hover { background: var(--orange-hover); }
.fn-cta.is-incomplete { opacity: .5; }
.fn-cta:disabled { cursor: default; opacity: .7; }
.fn-cta[hidden] { display: none; }
.fn-back { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 44px; margin: -2px 0 -14px; font-size: 13px; color: var(--blue); font-weight: 600; }
.fn-back[hidden] { display: none; }
.fn-back:hover { text-decoration: underline; }

/* ---------- Trust-Zeile ---------- */
.fn .fn-trust { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 24px 16px; font-size: 12px; color: var(--text-2); /* Kontrast ≥ 4.5:1 (Lighthouse a11y) */ flex-wrap: wrap; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  .fn-head { padding: 16px 20px; }
  .fn-advisor { padding: 12px 20px; }
  .fn-progress { padding: 14px 20px 0; }
  .fn-body { padding: 18px 20px 20px; }
  .fn .fn-trust { padding: 10px 20px 14px; gap: 8px 12px; }
}

@media (max-width: 380px) {
  .fn-head { padding: 16px; gap: 10px; }
  .fn .fn-eyebrow { font-size: 10.5px; letter-spacing: .8px; }
  .fn-advisor { padding: 12px 16px; }
  .fn-progress { padding: 14px 16px 0; }
  .fn-body { padding: 18px 16px 20px; }
  .fn .fn-trust { padding: 10px 16px 14px; }
  .fn-opt--row .fn-opt-body { gap: 10px; padding: 8px 10px 8px 8px; }
  .fn-opt-img { width: 48px; height: 48px; flex-basis: 48px; }
  .fn-opt-title { font-size: 13.5px; }
  .fn-opt--tile .fn-opt-body { padding: 12px 8px; font-size: 13.5px; }
  .fn-fields { grid-template-columns: minmax(0, 1fr); }
  .fn-field--full { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .fn-seg, .fn-opt-body, .fn-radio, .fn-radio .ic, .fn-input, .fn-cta { transition: none; }
}
