/* ============================================================
   Gallipoli Funeral Fund - Membership application wizard
   Form-specific styles only. Reuses tokens & components from styles.css.
   ("Warm Sanctuary": teal/blue brand, Lora + Mulish, rounded cards.)
   ============================================================ */

/* ---------- Layout shell ---------- */
.apply-shell { max-width: 880px; margin: 0 auto; }

.apply-intro { margin-bottom: 1.6rem; }
.apply-intro .lead { margin-top: 0.6rem; }

/* ---------- Progress indicator ---------- */
.wizard-progress { margin: 1.6rem 0 2rem; }
.wizard-progress-bar {
  height: 8px; border-radius: var(--r-pill); background: var(--sand);
  overflow: hidden; box-shadow: inset 0 0 0 1px var(--line);
}
.wizard-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--teal-500), var(--teal-700));
  border-radius: var(--r-pill);
  transition: width .4s var(--ease);
}
.wizard-progress-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 0.7rem; gap: 1rem;
}
.wizard-progress-step {
  font-weight: 700; color: var(--blue-800); font-size: 0.92rem;
}
.wizard-progress-count {
  font-size: 0.82rem; color: var(--muted); font-weight: 600;
  letter-spacing: 0.03em;
}

/* Dot rail (collapses to count on small screens) */
.wizard-dots { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.9rem; }
.wizard-dot {
  flex: 1 1 0; min-width: 22px; height: 5px; border-radius: var(--r-pill);
  background: var(--line); transition: background .3s var(--ease);
}
.wizard-dot.done { background: var(--teal-400); }
.wizard-dot.current { background: var(--teal-700); }

/* ---------- Step card ---------- */
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: stepIn .35s var(--ease); }
@keyframes stepIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .wizard-step.active { animation: none; }
}

.wizard-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--sh-md);
  padding: clamp(1.5rem, 4vw, 2.6rem);
}
.wizard-step-head { margin-bottom: 1.6rem; }
.wizard-step-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 0.4rem; }
.wizard-step-head p { color: var(--muted); font-size: 1rem; }

/* ---------- Fieldsets & groups ---------- */
.apply-fieldset { border: none; padding: 0; margin: 0 0 1.8rem; }
.apply-fieldset:last-child { margin-bottom: 0; }
.apply-fieldset > legend {
  font-family: var(--display); font-size: 1.2rem; color: var(--blue-800);
  font-weight: 500; margin-bottom: 0.4rem; padding: 0;
}
.apply-fieldset > .legend-hint {
  font-size: 0.9rem; color: var(--muted); margin: -0.1rem 0 1rem;
}

.apply-grid { display: grid; gap: 1.1rem 1.2rem; }
.apply-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.apply-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.apply-grid.cols-2-1 { grid-template-columns: 2fr 1fr; }
.col-span-all { grid-column: 1 / -1; }

/* ---------- Fields ---------- */
.apply-field { display: flex; flex-direction: column; }
.apply-field label,
.apply-field > .field-label {
  font-weight: 700; color: var(--blue-800);
  margin-bottom: 0.4rem; font-size: 0.92rem;
}
.apply-field .optional { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.apply-field input[type="text"],
.apply-field input[type="email"],
.apply-field input[type="tel"],
.apply-field input[type="date"],
.apply-field input[type="number"],
.apply-field select {
  width: 100%; padding: 0.82rem 1rem; border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm); background: var(--paper); color: var(--ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.apply-field input:focus,
.apply-field select:focus {
  border-color: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-100); outline: none;
}
.apply-field .field-help { font-size: 0.82rem; color: var(--muted); margin-top: 0.35rem; }

/* Error state */
.apply-field.has-error input,
.apply-field.has-error select {
  border-color: var(--leaf-coral); box-shadow: 0 0 0 3px rgba(224,89,106,0.12);
}
.field-error {
  display: none; color: #B23347; font-size: 0.82rem; font-weight: 600; margin-top: 0.35rem;
}
.apply-field.has-error .field-error { display: block; }

/* ---------- Radio cards (application type, gender, etc.) ---------- */
.radio-cards { display: grid; gap: 0.9rem; }
.radio-cards.cols-2 { grid-template-columns: 1fr 1fr; }
.radio-cards.cols-3 { grid-template-columns: repeat(3, 1fr); }

.radio-card { position: relative; }
.radio-card input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.radio-card label {
  display: block; cursor: pointer; height: 100%;
  border: 1.5px solid var(--line-2); border-radius: var(--r-md);
  background: var(--paper); padding: 1.1rem 1.2rem;
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
  font-weight: 600; color: var(--ink-2); margin: 0;
}
.radio-card label:hover { border-color: var(--teal-300); }
.radio-card label .rc-title {
  display: block; font-family: var(--display); font-size: 1.15rem;
  color: var(--blue-800); font-weight: 500; margin-bottom: 0.15rem;
}
.radio-card label .rc-sub { display: block; font-size: 0.86rem; color: var(--muted); font-weight: 500; }
.radio-card input:checked + label {
  border-color: var(--teal-500); background: var(--teal-50);
  box-shadow: inset 0 0 0 1px var(--teal-500);
}
.radio-card input:checked + label .rc-title { color: var(--teal-700); }
.radio-card input:focus-visible + label {
  outline: 3px solid var(--teal-400); outline-offset: 2px;
}

/* Compact pill-style radios (gender, yes/no) */
.radio-pills { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.radio-pill { position: relative; }
.radio-pill input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.radio-pill label {
  display: inline-flex; align-items: center; cursor: pointer; margin: 0;
  border: 1.5px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--paper); padding: 0.6rem 1.2rem; font-weight: 700;
  color: var(--ink-2); font-size: 0.94rem;
  transition: border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease);
}
.radio-pill label:hover { border-color: var(--teal-300); }
.radio-pill input:checked + label {
  border-color: var(--teal-500); background: var(--teal-50); color: var(--teal-700);
  box-shadow: inset 0 0 0 1px var(--teal-500);
}
.radio-pill input:focus-visible + label {
  outline: 3px solid var(--teal-400); outline-offset: 2px;
}

/* radio-group error message attaches under the group */
.radio-group-wrap.has-error .field-error { display: block; }
.radio-group-wrap .field-error { display: none; margin-top: 0.6rem; }

/* ---------- Checkboxes ---------- */
.apply-check { display: flex; gap: 0.7rem; align-items: flex-start; }
.apply-check input[type="checkbox"] {
  width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; flex: none;
  accent-color: var(--teal-600); cursor: pointer;
}
.apply-check label { font-weight: 600; color: var(--ink-2); margin: 0; cursor: pointer; }
.apply-check.toggle-row { margin-top: 0.6rem; }

.apply-check-block {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--cream); padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.apply-check-block.has-error { border-color: var(--leaf-coral); }
.apply-check-block .field-error { margin-top: 0.5rem; padding-left: 1.95rem; }
.apply-check-block.has-error .field-error { display: block; }

/* ---------- Conditional reveal sections ---------- */
.reveal-section { margin-top: 1.2rem; }
.reveal-section[hidden] { display: none !important; }

/* ---------- Nominee / sub blocks ---------- */
.sub-block {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--cream); padding: 1.4rem; margin-top: 1.2rem;
}
.sub-block > .sub-block-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem;
}
.sub-block-title {
  font-family: var(--display); font-size: 1.15rem; color: var(--blue-800); font-weight: 500;
}

.link-btn {
  background: none; border: none; color: var(--teal-800); font-weight: 700;
  font-size: 0.92rem; padding: 0.3rem 0; cursor: pointer; text-decoration: underline;
}
.link-btn:hover { color: var(--teal-600); }
.link-btn.remove { color: #B23347; }

/* ---------- Payment / plan helper notes ---------- */
.plan-note {
  margin-top: 1rem; padding: 0.95rem 1.1rem; border-radius: var(--r-md);
  background: var(--teal-50); border: 1px solid var(--teal-200);
  color: var(--ink-2); font-size: 0.92rem;
}

/* ---------- Live fee summary ---------- */
.fee-summary {
  background: linear-gradient(165deg, var(--blue-800), #0F2C3E);
  color: #EAF3F2; border-radius: var(--r-lg); padding: 1.8rem;
  position: relative; overflow: hidden; margin-bottom: 1.8rem;
}
.fee-summary .leaf-mark { position: absolute; right: -50px; top: -50px; width: 200px; opacity: 0.12; }
.fee-summary .result-label {
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--teal-200); font-weight: 700;
}
.fee-summary .fee-benefit {
  font-family: var(--display); font-size: clamp(2.4rem, 6vw, 3.2rem);
  font-weight: 600; color: #fff; line-height: 1; margin: 0.4rem 0 0.2rem;
}
.fee-summary .fee-benefit-sub { color: var(--teal-200); font-size: 0.9rem; }
.fee-summary .fee-divider { height: 1px; background: rgba(255,255,255,0.16); margin: 1.4rem 0; }
.fee-summary .fee-row {
  display: flex; justify-content: space-between; align-items: baseline; padding: 0.45rem 0;
}
.fee-summary .fee-row .k { color: #B9D6DC; font-size: 0.95rem; }
.fee-summary .fee-row .v { font-family: var(--display); font-size: 1.45rem; font-weight: 600; color: #fff; }
.fee-summary .fee-row .v small { font-family: var(--body); font-size: 0.78rem; color: var(--teal-200); font-weight: 600; }
.fee-summary .fee-note { font-size: 0.8rem; color: #E3F1F4; margin-top: 1rem; line-height: 1.5; }

/* ---------- Review summary ---------- */
.review-group { margin-bottom: 1.6rem; }
.review-group h3 {
  font-size: 1.15rem; color: var(--blue-800); margin-bottom: 0.6rem;
  padding-bottom: 0.4rem; border-bottom: 1px solid var(--line);
}
.review-list { display: grid; gap: 0.4rem; }
.review-item {
  display: grid; grid-template-columns: 200px 1fr; gap: 0.6rem 1rem;
  font-size: 0.95rem; padding: 0.15rem 0;
}
.review-item dt { color: var(--muted); font-weight: 600; }
.review-item dd { color: var(--ink); }
.review-edit {
  background: none; border: none; color: var(--teal-800); font-weight: 700;
  font-size: 0.85rem; cursor: pointer; text-decoration: underline; padding: 0;
  margin-left: 0.5rem;
}
.review-edit:hover { color: var(--teal-600); }

/* ---------- Wizard nav buttons ---------- */
.wizard-nav {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 2rem; padding-top: 1.6rem; border-top: 1px solid var(--line);
}
.wizard-nav .btn-back { }
.wizard-nav .nav-spacer { flex: 1; }
.wizard-nav .btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Turnstile container */
.turnstile-wrap { margin: 1.4rem 0; min-height: 0; }

/* ---------- Top-of-step error banner ---------- */
.step-error-banner {
  display: none; gap: 0.7rem; align-items: flex-start;
  background: #FBE2E5; border: 1px solid #E9B3BB; color: #8A2433;
  border-radius: var(--r-md); padding: 0.95rem 1.1rem; margin-bottom: 1.4rem;
  font-size: 0.92rem; font-weight: 600;
}
.step-error-banner.show { display: flex; }
.step-error-banner svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }

/* ---------- Submit / success / error panels ---------- */
.submit-status {
  display: none; margin-top: 1rem; font-size: 0.95rem; font-weight: 600;
}
.submit-status.error { display: block; color: #B23347; }

.success-panel {
  background: var(--paper); border: 1px solid var(--teal-200);
  border-radius: var(--r-xl); box-shadow: var(--sh-lg);
  padding: clamp(2rem, 5vw, 3.5rem); text-align: center;
  position: relative; overflow: hidden;
}
.success-panel .leaf-mark { position: absolute; right: -50px; bottom: -50px; width: 220px; opacity: 0.12; }
.success-icon {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--teal-50); color: var(--teal-700);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.4rem;
}
.success-icon svg { width: 40px; height: 40px; }
.success-panel h2 { margin-bottom: 0.7rem; }
.success-panel .success-ref {
  display: inline-block; margin: 1rem 0; padding: 0.7rem 1.4rem;
  background: var(--teal-50); border: 1px solid var(--teal-200);
  border-radius: var(--r-pill); font-family: var(--display);
  font-size: 1.3rem; font-weight: 600; color: var(--teal-800); letter-spacing: 0.02em;
}
.success-panel .success-next {
  max-width: 540px; margin: 1rem auto 0; color: var(--ink-2);
}

/* ---------- Visually-hidden (honeypot + sr-only) ---------- */
.vh {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .apply-grid.cols-2,
  .apply-grid.cols-3,
  .apply-grid.cols-2-1 { grid-template-columns: 1fr; }
  .radio-cards.cols-2,
  .radio-cards.cols-3 { grid-template-columns: 1fr; }
  .review-item { grid-template-columns: 1fr; gap: 0.1rem; }
  .review-item dt { font-size: 0.82rem; }
  .wizard-nav { flex-direction: column-reverse; }
  .wizard-nav .btn { width: 100%; }
  .wizard-nav .nav-spacer { display: none; }
}

/* ---------- Inline Direct Debit (DDR) ---------- */
.ddr-inline[hidden] { display: none !important; }
.ddr-inline { margin-top: 1.6rem; }
.ddr-collection-note {
  font-size: 0.86rem; line-height: 1.6; color: var(--ink-2);
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 0.9rem 1.1rem; margin: 0.6rem 0 0;
}
.ddr-collection-note a { color: var(--teal-600); text-decoration: underline; }

.ddrsa-box { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--cream); padding: 1.2rem 1.3rem; }
.ddrsa-debituser { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); padding: 0.9rem 1.1rem; margin-bottom: 1.2rem; }
.ddrsa-debituser .du-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; margin-bottom: 0.5rem; }
.ddrsa-debituser .du-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.25rem 0; font-size: 0.9rem; }
.ddrsa-debituser .du-row .k { color: var(--muted); }
.ddrsa-debituser .du-row .v { font-weight: 600; color: var(--ink); text-align: right; }
.ddrsa-section { margin-bottom: 1.1rem; }
.ddrsa-section:last-child { margin-bottom: 0; }
.ddrsa-section h4 { font-family: var(--display); font-size: 1rem; color: var(--blue-800); font-weight: 500; margin-bottom: 0.35rem; }
.ddrsa-section p { font-size: 0.88rem; line-height: 1.65; color: var(--ink-2); margin-bottom: 0.5rem; }
.ddrsa-section p:last-child { margin-bottom: 0; }

.auth-date { font-weight: 700; color: var(--ink); }
.security-note { font-size: 0.82rem; color: var(--muted); margin-top: 1rem; display: flex; gap: 0.5rem; align-items: flex-start; }
.security-note svg { width: 16px; height: 16px; color: var(--teal-600); flex-shrink: 0; margin-top: 2px; }

/* ---------- Section tiles + vertical rhythm (polish) ----------
   Each top-level section becomes a soft panel inside the white step card,
   so the form reads as clear, evenly-spaced groups instead of a flat stack. */
.wizard-card .apply-fieldset {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.15rem, 3.2vw, 1.7rem);
  margin: 0 0 1.1rem;
  box-shadow: 0 1px 2px rgba(16, 44, 62, 0.04);
}
.wizard-card .apply-fieldset:last-of-type { margin-bottom: 0; }
.wizard-card .apply-fieldset > legend { margin-bottom: 0.9rem; }
.wizard-card .apply-fieldset > .legend-hint { margin-top: -0.55rem; }

/* Nested groups (inline questions, DDR sub-sections) stay flat - never a tile
   inside a tile - just given consistent breathing room from what precedes them. */
.wizard-card .apply-fieldset .apply-fieldset {
  background: none; border: 0; border-radius: 0; padding: 0;
  margin: 1.4rem 0 0; box-shadow: none;
}
.wizard-card .apply-fieldset .apply-fieldset > legend { font-size: 1.02rem; margin-bottom: 0.6rem; }

/* Inline radio question (e.g. terminal illness): a field-style label, clearly
   separated from the field above it - fixes the cramped date-of-birth gap. */
.radio-group-inline { margin-top: 1.5rem; }
.radio-group-inline > .field-label {
  display: block; font-weight: 700; color: var(--blue-800);
  font-size: 0.92rem; margin-bottom: 0.55rem;
}
