/* /apply — full-screen funnel. Loads after styles.css and leans on its :root
   tokens; everything here is scoped to the .apply-body page. Mobile-first. */

.apply-body [hidden] { display: none !important; }

.apply-body {
  margin: 0;
  background: var(--bg-white);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- Progress bar (always visible, very top) ----
   Grouped segments: one pill per SECTION (contact / about you / medical),
   each filling from the inside as its screens are answered. The outlined
   empty remainder is the point — and a section count never changes when
   branch routing reshapes the path, so the frame stays stable. apply.js
   renders the segments. */

.apply-progress {
  /* Sticky, not fixed: the bar occupies real layout space, so the header can
     NEVER render underneath it (the wordmark was getting clipped) — and it
     still pins to the top while the page scrolls. */
  position: sticky;
  top: 0;
  display: flex;
  gap: 6px;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
  background: var(--bg-white);
  z-index: 20;
}

.progress-seg {
  flex: 1;
  height: 8px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  overflow: hidden;
  background: transparent;
}

.progress-seg-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--primary-green);
  transition: width 0.3s ease;
}

.progress-seg.done { border-color: var(--primary-green); }

/* ---- Header: back arrow + wordmark ---- */

.apply-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px 6px;
}

.apply-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  background: var(--bg-white);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-dark);
  cursor: pointer;
  transition: border-color 0.18s, background-color 0.18s;
  padding: 0;
}

.apply-back:hover { border-color: var(--primary-green); background: var(--bg-green-light); }
.apply-back[hidden] { display: none; }

.apply-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.apply-logo .logo-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.apply-logo .logo-sub {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

/* ---- Main step area ---- */

.apply-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 20px 20px 40px;
  box-sizing: border-box;
}

.apply-card {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding-top: clamp(4px, 3.5vh, 48px);
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.apply-card.leave-fwd  { opacity: 0; transform: translateX(-16px); }
.apply-card.leave-back { opacity: 0; transform: translateX(16px); }
.apply-card.enter-fwd  { opacity: 0; transform: translateX(16px); transition: none; }
.apply-card.enter-back { opacity: 0; transform: translateX(-16px); transition: none; }

/* ---- Typography inside a step ---- */

.step-kicker {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-green);
  margin: 0 0 14px;
}

.variant-headline {
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text-dark);
  margin: 0 0 10px;
}

.variant-subline {
  font-size: 16px;
  color: var(--text-gray);
  line-height: 1.55;
  margin: 0 0 20px;
}

.step-title {
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--text-dark);
  margin: 0 0 10px;
  outline: none;
}

.step-body,
.step-help {
  font-size: 16px;
  color: var(--text-gray);
  line-height: 1.6;
  margin: 0 0 12px;
}

.step-encourage {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-green);
  margin: 0 0 10px;
}

/* ---- Interest gate ---- */

.gate-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px 18px;
  margin-top: clamp(4px, 2vh, 32px);
}

.gate-card .step-kicker { margin-bottom: 6px; }
.gate-card .step-title { margin-bottom: 10px; }
.gate-card .step-body { line-height: 1.5; margin-bottom: 8px; }
.gate-card .apply-footnote { margin-top: 14px; }

.gate-lead {
  font-weight: 600;
  color: var(--text-dark);
}

.gate-pay {
  font-weight: 700;
  color: var(--text-dark);
}

.gate-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.gate-actions .apply-btn { width: 100%; letter-spacing: 0.02em; }

/* ---- Paced reveal (info steps) ---- */

/* Bullet formatting for informational lines (gate + revealed info steps) */
.bullet-line {
  position: relative;
  padding-left: 22px;
  margin: 0 0 10px;
}

.bullet-line::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 0.5em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
}

/* Each sentence is its own stacked line. All lines occupy their final space
   from the start (only opacity/transform animate), so nothing ever jumps. */
.reveal-line {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  margin: 0 0 10px;
}

.reveal-line.on { opacity: 1; transform: none; }
.reveal-line.instant { transition: none; }

/* Centered closing line (no bullet, regular weight) */
.reveal-line.line-center {
  text-align: center;
  padding-left: 0;
  font-weight: 400;
}

.reveal-line.line-center::before { display: none; }

.reveal-cta {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.reveal-cta.on {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Info-step art ---- */

.step-art {
  margin: 0 0 22px;
}

.step-art img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

/* Small phones: keep the art from pushing copy and the button below the fold */
@media (max-height: 750px), (max-width: 380px) {
  .step-art { margin-bottom: 16px; }
  .step-art img { max-height: 120px; }
  .variant-headline { margin-bottom: 8px; }
  .apply-main { padding-top: 12px; }
}

/* ---- Textarea + minimum-length counter ---- */

.apply-textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.55;
  font-family: var(--font-sans);
}

.char-counter {
  font-size: 13.5px;
  color: var(--text-faint);
  margin: 8px 0 0;
  transition: color 0.18s;
}

.char-counter.met {
  color: var(--accent-green);
  font-weight: 600;
}

/* ---- Question-first beat: answers hold (space reserved) then fade in ---- */

.q-answers {
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.q-answers.q-hidden {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

/* ---- Options ---- */

.options {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.option-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 15px 18px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  color: var(--text-dark);
  background: var(--bg-white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.18s, background-color 0.18s, box-shadow 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.option-btn:hover { border-color: var(--primary-green); }

.option-btn.selected {
  border-color: var(--primary-green);
  background: var(--bg-green-light);
  box-shadow: 0 0 0 1px var(--primary-green) inset;
}

.option-check {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--primary-green);
  opacity: 0;
  transition: opacity 0.18s;
}

.option-btn.selected .option-check { opacity: 1; }

/* ---- Inputs (min 16px so iOS never zooms) ---- */

.apply-field { margin-top: 16px; }

.apply-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.apply-input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-dark);
  background: var(--bg-white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.apply-input:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(29, 68, 52, 0.12);
}

.apply-input.invalid { border-color: var(--danger); }

.otp-input {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.45em;
  text-align: center;
  padding: 16px 8px 16px calc(8px + 0.45em);
}

.field-error {
  font-size: 13.5px;
  color: var(--danger);
  margin: 6px 0 0;
}

/* ---- Buttons ---- */

.apply-actions { margin-top: 26px; }

.apply-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 15px 28px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary-green);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.18s, opacity 0.18s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  box-sizing: border-box;
}

.apply-btn:hover { background: var(--primary-hover); }
.apply-btn:disabled { opacity: 0.55; cursor: default; }

.apply-btn-ghost {
  background: transparent;
  color: var(--primary-green);
  border: 1px solid var(--border-strong);
}

.apply-btn-ghost:hover { background: var(--bg-green-light); border-color: var(--primary-green); }

.apply-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-green);
  text-decoration: underline;
  cursor: pointer;
}

.apply-link-btn:disabled {
  color: var(--text-faint);
  text-decoration: none;
  cursor: default;
}

/* ---- Consent + small print ---- */

.consent-note {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-gray);
  margin: 18px 0 0;
}

.consent-note a { color: var(--primary-green); }

.apply-footnote {
  font-size: 13px;
  color: var(--text-faint);
  line-height: 1.6;
  margin-top: 22px;
}

.apply-footnote a { color: var(--text-gray); }

.otp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  margin-top: 18px;
}

/* ---- Loading / spinner ---- */

.apply-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 22vh;
  color: var(--text-gray);
  font-size: 15px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-green);
  border-radius: 50%;
  animation: apply-spin 0.8s linear infinite;
}

@keyframes apply-spin { to { transform: rotate(360deg); } }

.busy-note {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-gray);
  margin-top: 14px;
}

.busy-note .spinner { width: 16px; height: 16px; border-width: 2px; }

/* ---- End screens ---- */

.end-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-green-light);
  color: var(--primary-green);
  margin-bottom: 20px;
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  .apply-card,
  .progress-seg-fill,
  .option-btn,
  .option-check,
  .reveal-line,
  .reveal-cta,
  .q-answers {
    transition: none !important;
  }
  .spinner { animation-duration: 1.6s; }
}

@media (min-width: 640px) {
  /* No width:auto on buttons — actions are full width at every size. */
  .apply-header { padding: 12px 32px 8px; }
  .apply-main { padding: 28px 32px 60px; }
}

/* ---- Checking-eligibility beat (between the last answer and the end screen) ---- */

.checking-screen { padding-top: 26vh; }
.checking-screen p { font-weight: 600; color: var(--text-dark); }

/* ---- FAQ on the done screen ----
   The accordion styling itself (faq-item / faq-q / faq-a) rides in from
   styles.css — same component as the home page, on purpose. This just spaces
   the section inside the step card. */

.done-faq { margin-top: 44px; border-top: 1px solid var(--border-color); padding-top: 28px; }

.done-faq-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-dark);
  margin: 0 0 4px;
}

.done-faq .faq-item { padding: 18px 0; }
.done-faq .faq-q { font-size: 16.5px; }

/* "Wrong number? Edit it" sits directly under the code input. */
.otp-edit { margin: 6px 0 0; text-align: center; }

/* ---- Testimonial quote cards on info interstitials ---- */

.info-quotes {
  display: grid;
  gap: 10px;
  margin: 18px 0 4px;
}

.info-quote {
  margin: 0;
  padding: 14px 16px;
  background: var(--bg-green-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.info-quote blockquote {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-dark);
}

.info-quote figcaption {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-green);
}

/* ---- FAQ: header button + overlay ---- */

.apply-faq-btn {
  margin-left: auto;
  padding: 7px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--primary-green);
  background: var(--bg-white);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.18s, background-color 0.18s;
}

.apply-faq-btn:hover { border-color: var(--primary-green); background: var(--bg-green-light); }

.faq-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(16, 24, 20, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

.faq-panel {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px 22px 26px;
}

.faq-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.faq-panel-head .done-faq-title { margin: 0; }

.faq-overlay-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  color: var(--text-gray);
  background: var(--bg-white);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s;
}

.faq-overlay-close:hover { border-color: var(--primary-green); color: var(--primary-green); }

.faq-panel .faq-item { padding: 16px 0; }
.faq-panel .faq-q { font-size: 16px; }
