/* =============================================================================
   FLMHS Landing Form — mobile-first, elderly-friendly
   Inherits the Clean SaaS palette from cma_service but bumps every touch target
   and font size to what an older prospect can read/tap comfortably on a phone.
   ============================================================================= */

:root {
  --ink:          #0A0E27;
  --navy:         #002868;
  --navy-accent:  #0039A6;
  --red:          #B22234;
  --red-quiet:    #FEF2F2;
  --red-line:     #FCA5A5;
  --paper:        #FDFDFC;
  --paper-lift:   #FFFFFF;
  --rule:         #E7E5E4;
  --rule-strong:  #D6D3D1;
  --mute:         #6B6B76;
  --mute-strong:  #44444F;
  --focus:        #93C5FD;
  --success:      #16A34A;

  /* Bumped type scale for readability. Base is 18px, not 14px. */
  --fs-xs:  14px;
  --fs-sm:  15px;
  --fs-md:  16px;
  --fs-base:18px;
  --fs-lg:  20px;
  --fs-xl:  24px;
  --fs-2xl: 28px;
  --fs-3xl: 36px;

  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 16px;

  --tap: 56px;   /* minimum comfortable tap target */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-base);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

/* -----------------------------------------------------------------------------
   Header — logo on left, big "Call us" CTA on right
   ----------------------------------------------------------------------------- */
.app-header {
  background: var(--paper-lift);
  border-bottom: 1px solid var(--rule);
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo { height: 40px; width: auto; object-fit: contain; }

.call-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-decoration: none;
  color: var(--navy);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  line-height: 1.15;
}
.call-cta:active { background: var(--paper); }
.call-cta-line1 {
  font-size: var(--fs-xs);
  color: var(--mute);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.call-cta-line2 {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

/* -----------------------------------------------------------------------------
   Progress track — hairline at top under header
   ----------------------------------------------------------------------------- */
.progress-track {
  height: 4px;
  background: var(--rule);
  position: sticky;
  top: 64px;
  z-index: 9;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-accent) 100%);
  transition: width 0.35s ease;
}

/* -----------------------------------------------------------------------------
   Main layout — single column, comfortable margins
   ----------------------------------------------------------------------------- */
.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.question-card {
  background: var(--paper-lift);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 28px 22px;
  box-shadow: 0 1px 2px rgba(10, 14, 39, 0.03);
  animation: cardIn 0.28s ease;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.q-meta {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.q-label {
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.q-help {
  font-size: var(--fs-md);
  color: var(--mute);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* -----------------------------------------------------------------------------
   Option cards — full-width, big, high-contrast when selected
   ----------------------------------------------------------------------------- */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 16px 18px;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-lift);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
  text-align: left;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
.option:hover { border-color: var(--rule-strong); }
.option:active { transform: scale(0.99); }
.option.selected {
  border-color: var(--navy);
  background: #EEF2FF;
  color: var(--navy);
  font-weight: 600;
}
.option .check {
  width: 22px; height: 22px;
  border: 2px solid var(--rule-strong);
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.12s ease;
  background: var(--paper-lift);
}
.option.selected .check {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--paper-lift);
}
.option.selected .check::after {
  content: '';
  width: 6px; height: 10px;
  border: solid var(--paper-lift);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
/* multipicklist checkboxes look square */
.option.multi .check { border-radius: 4px; }
.option.multi.selected .check::after { transform: rotate(45deg) translate(-1px, -1px); }

/* -----------------------------------------------------------------------------
   Number / text input
   ----------------------------------------------------------------------------- */
.num-input, .text-input {
  width: 100%;
  min-height: var(--tap);
  padding: 14px 16px;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--ink);
  background: var(--paper-lift);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  -webkit-appearance: none;
  appearance: none;
}
.text-input { font-size: var(--fs-base); font-weight: 500; text-align: left; }
.num-input:focus, .text-input:focus {
  outline: none;
  border-color: var(--navy-accent);
  box-shadow: 0 0 0 4px var(--focus);
}
.num-input.currency::before { content: '$'; }
.num-prefix {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-lift);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.num-prefix:focus-within {
  border-color: var(--navy-accent);
  box-shadow: 0 0 0 4px var(--focus);
}
.num-prefix .prefix {
  padding: 0 14px;
  display: flex; align-items: center;
  font-size: var(--fs-xl); font-weight: 600;
  color: var(--mute-strong);
  background: var(--paper);
  border-right: 1px solid var(--rule);
}
.num-prefix .num-input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
  min-width: 0;
}

/* Kill number input spinners for cleaner look */
.num-input::-webkit-inner-spin-button,
.num-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.num-input { -moz-appearance: textfield; }

/* -----------------------------------------------------------------------------
   Slider — big touch-friendly thumb
   ----------------------------------------------------------------------------- */
.slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}
.slider-value {
  font-size: var(--fs-3xl);
  font-weight: 300;
  color: var(--navy);
  text-align: center;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 8px 0;
}
.slider-value .of {
  font-size: var(--fs-md);
  color: var(--mute);
  font-weight: 400;
  margin-left: 4px;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: var(--rule);
  border-radius: 999px;
  outline: none;
  padding: 0;
  margin: 12px 0;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--navy);
  cursor: pointer;
  border: 4px solid var(--paper-lift);
  box-shadow: 0 2px 8px rgba(0, 40, 104, 0.3);
}
.slider::-moz-range-thumb {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--navy);
  cursor: pointer;
  border: 4px solid var(--paper-lift);
  box-shadow: 0 2px 8px rgba(0, 40, 104, 0.3);
}
.slider-ends {
  display: flex; justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--mute);
  padding: 0 2px;
}

/* -----------------------------------------------------------------------------
   Action buttons — big, thumb-friendly, always at the bottom of the card
   ----------------------------------------------------------------------------- */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.btn {
  min-height: var(--tap);
  padding: 14px 20px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.25;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease, color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:not(:disabled):active { transform: scale(0.99); }
.btn.primary {
  background: var(--navy); color: var(--paper-lift);
  border-color: var(--navy);
}
.btn.primary:not(:disabled):hover { background: var(--navy-accent); border-color: var(--navy-accent); }
.btn.ghost {
  background: transparent; color: var(--mute-strong);
  border-color: transparent;
  min-height: 44px;
  padding: 10px 14px;
  font-weight: 500;
  font-size: var(--fs-md);
}
.btn.ghost:not(:disabled):hover { color: var(--ink); background: var(--paper); }
.btn.back {
  background: transparent; color: var(--mute-strong);
  border-color: var(--rule-strong);
  min-height: 44px;
  padding: 10px 14px;
  font-weight: 500;
  font-size: var(--fs-md);
}

/* -----------------------------------------------------------------------------
   Error / toast
   ----------------------------------------------------------------------------- */
.field-error {
  color: var(--red);
  font-size: var(--fs-sm);
  margin-top: -8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--red-quiet);
  border-left: 3px solid var(--red);
  border-radius: 4px;
}
.load-state, .error-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--mute);
  font-size: var(--fs-md);
}
.error-state {
  color: var(--red);
  border: 1px solid var(--red-line);
  background: var(--red-quiet);
  border-radius: var(--radius);
  padding: 24px 20px;
}
.error-state h2 { font-size: var(--fs-xl); margin-bottom: 8px; color: var(--red); }

/* -----------------------------------------------------------------------------
   Welcome (first-touch) card — shown only on first visit before any answer
   ----------------------------------------------------------------------------- */
.welcome-card {
  background: var(--paper-lift);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
}
.welcome-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.welcome-title {
  font-size: var(--fs-3xl);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.welcome-body {
  font-size: var(--fs-base);
  color: var(--mute-strong);
  line-height: 1.55;
  margin-bottom: 8px;
}
.welcome-body strong { color: var(--ink); font-weight: 600; }
.welcome-body + .welcome-body { margin-top: 12px; }
.welcome-actions { margin-top: 28px; }

/* -----------------------------------------------------------------------------
   Review card — final "check your answers" screen before submit
   ----------------------------------------------------------------------------- */
.review-card {
  background: var(--paper-lift);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px 20px;
  animation: cardIn 0.28s ease;
}
.review-header { margin-bottom: 20px; }
.review-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.review-title {
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.review-help {
  font-size: var(--fs-md);
  color: var(--mute);
  line-height: 1.5;
  margin-bottom: 12px;
}
.review-help strong { color: var(--ink); font-weight: 600; }
.review-meta {
  font-size: var(--fs-sm);
  color: var(--mute);
  font-weight: 500;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}
.review-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
  margin-top: 12px;
}
.review-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--rule);
  min-height: 60px;
}
.review-row:last-child { border-bottom: none; }
.review-cell { flex: 1; min-width: 0; }
.review-q {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
.review-a {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
  word-break: break-word;
}
.review-a.skipped {
  color: var(--mute);
  font-weight: 400;
  font-style: italic;
}
.review-edit {
  min-height: 40px;
  padding: 8px 14px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--paper-lift);
  color: var(--navy);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: border-color 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.review-edit:hover { border-color: var(--navy); background: var(--paper); }
.review-edit:active { transform: scale(0.97); }

/* -----------------------------------------------------------------------------
   Completion card — the friendly "thanks, text us photos" screen
   ----------------------------------------------------------------------------- */
.done-card {
  background: var(--paper-lift);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
}
.done-checkmark {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--success);
  color: var(--paper-lift);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.done-checkmark::after {
  content: '';
  width: 20px; height: 34px;
  border: solid var(--paper-lift);
  border-width: 0 4px 4px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.done-title {
  font-size: var(--fs-3xl);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.done-body {
  font-size: var(--fs-base);
  color: var(--mute-strong);
  line-height: 1.55;
  margin-bottom: 20px;
}
.done-body strong { color: var(--ink); font-weight: 600; }
.done-photo-cta {
  display: block;
  margin: 20px 0 8px;
  padding: 20px;
  background: var(--paper);
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  color: var(--navy);
  text-decoration: none;
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.3;
}
.done-photo-cta .small {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--mute);
  margin-top: 4px;
}

/* -----------------------------------------------------------------------------
   Footer — quiet reassurance
   ----------------------------------------------------------------------------- */
.app-footer {
  border-top: 1px solid var(--rule);
  padding: 20px 16px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  margin-top: 24px;
  background: var(--paper);
}
.footer-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--mute);
}

/* -----------------------------------------------------------------------------
   Wider screens — modest lift, still single column
   ----------------------------------------------------------------------------- */
@media (min-width: 720px) {
  .app-header { padding: 16px 32px; }
  .logo { height: 48px; }
  .call-cta-line2 { font-size: var(--fs-lg); }
  .progress-track { top: 76px; }
  .question-card { padding: 40px 44px; }
  .welcome-card, .done-card { padding: 48px 44px; }
  .q-label { font-size: var(--fs-3xl); }
  .actions {
    flex-direction: row-reverse;
    justify-content: flex-start;
  }
  .actions .btn.primary { flex: 1; max-width: 320px; }
  .actions .btn.back { flex: 0 0 auto; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
