/* ==========================================================================================
   LifeLine Plus LLC — apply.css  (employment application page only; loaded after site.css)
   Owner: apply agent. Adds ONLY what site.css §9 (generic forms) lacks:
     §1  Page layout: intro grid, sticky progress list on wide screens
     §2  Progress list (at-a-glance section status)
     §3  Numbered sections
     §4  Repeated-entry cards (references, employers, education) + invalid group state
     §5  Conditional fields (reveal animation; disabled under prefers-reduced-motion)
     §6  Turnstile container + fail-closed fallback box
     §7  Submit row, status line, confirmation panel
   No new colours: every rule reuses the :root tokens from site.css, so the contrast table there
   still holds. No URLs, no fonts, no inline styles anywhere.
   ========================================================================================== */

/* §1 Page layout ---------------------------------------------------------------------------- */
.intro-grid { display: grid; gap: 1.5rem; margin-top: 1.5rem; }
@media (min-width: 760px) { .intro-grid { grid-template-columns: 1.2fr 1fr; align-items: start; } }
.intro-grid .card > h2 { font-size: 1.25rem; margin-top: 0; }
.intro-grid .steps { gap: 1rem; margin-bottom: 0; }
.intro-grid .steps h3 { font-size: 1.05rem; }
.intro-grid .list-check { margin-bottom: 0; }
/* The callout keeps its site-wide 1.5rem block margins elsewhere; inside the grid the parent .flow owns
   the rhythm, so zero them: both column tops align and both columns get the same item gap. The grid's
   own margin-top stays — 51px section padding + 25.5px = 76.5px, the same header-to-content gap as the
   .section band that follows the page header on /services, /careers and /about (SPEC §11.2 item 10). */
.intro-grid .callout { margin: 0; }

/* Two-column form layout from 1040px: progress list on the left stays in view while scrolling. */
.apply-layout { display: grid; gap: 2rem; }
@media (min-width: 1040px) {
  .apply-layout { grid-template-columns: 16rem minmax(0, 1fr); gap: 3rem; align-items: start; }
  .apply-layout > .progress { position: sticky; top: 1.5rem; }
}
.apply-form { min-width: 0; max-width: 52rem; }

/* §2 Progress list -------------------------------------------------------------------------- */
.progress {
  padding: 1.1rem 1.25rem;
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: var(--radius);
}
.progress-heading {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green-900);
  margin: 0 0 0.6rem;
}
.progress-list { counter-reset: progress; margin: 0; }
.progress-list > li {
  counter-increment: progress;
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr);
  column-gap: 0.6rem;
  align-items: start;
  margin: 0;
  padding: 0.35rem 0;
  border-top: 1px solid var(--green-100);
}
.progress-list > li:first-child { border-top: 0; }
.progress-list > li::before {
  content: counter(progress);
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  margin-top: 0.25rem;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--green-700);
  color: var(--green-900);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
}
.progress-list > li.is-complete::before { content: "\2713"; background: var(--green-700); color: #fff; }
.progress-list > li.is-invalid::before { border-color: var(--error); color: var(--error); }
.progress-list a {
  display: inline-block;
  min-height: 2.2rem;                    /* generous target without inflating the list */
  padding: 0.25rem 0;
  color: var(--green-900);
  font-weight: 600;
  text-decoration: none;
}
.progress-list a:hover { text-decoration: underline; }
.progress-status { display: block; grid-column: 2; font-size: 0.85rem; line-height: 1.3; color: var(--ink-2); }
.progress-status:empty { display: none; }
.is-complete .progress-status { color: var(--green-700); font-weight: 600; }
.is-invalid .progress-status { color: var(--error); font-weight: 600; }
.progress-note { margin: 0.75rem 0 0; font-size: 0.9rem; color: var(--ink-2); }

/* §3 Numbered sections ---------------------------------------------------------------------- */
.app-section { padding-top: 0.5rem; margin-bottom: 2.5rem; scroll-margin-top: 1.25rem; }
.app-section + .app-section { border-top: 1px solid var(--line); padding-top: 2.25rem; }
.app-section > h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
}
.section-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--green-700);
  color: #fff;                           /* 6.29:1 */
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}
.section-intro { color: var(--ink-2); margin-bottom: 1.5rem; max-width: 62ch; }

/* Compact rows for short paired fields (years, pay). .form-row-4 holds From / To / Starting pay /
   Ending pay; two columns keep the "(month/year or "Present")" notes on one or two lines. */
.form-row-tight { grid-template-columns: 1fr 1fr; }
@media (min-width: 600px) { .form-row-4 { grid-template-columns: repeat(2, 1fr); } }

/* Short answers (middle initial, unit #, date signed): narrow the CONTROL, not the whole field, so
   the label and its "(optional)" note keep a full line instead of wrapping word by word. */
.apply-form .field-xs, .apply-form .field-sm { max-width: none; }
.apply-form .field-xs > input { max-width: 7rem; }
.apply-form .field-sm > input, .apply-form .field-sm > select { max-width: 14rem; }

/* Character guidance under long answers (JS updates the count). */
.char-count { display: block; margin: 0.3rem 0 0; font-size: 0.9rem; color: var(--ink-2); text-align: right; }

/* §4 Repeated-entry cards ------------------------------------------------------------------- */
.entry-card {
  margin-bottom: 1.5rem;
  padding: 0 1.25rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 5px solid var(--green-100);
  border-radius: var(--radius);
}
.entry-card > legend {
  float: left;                           /* lets the legend sit inside the padded box on every browser */
  width: 100%;
  margin: 0 0 1rem;
  padding: 0.85rem 0 0.6rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-head);
  font-size: 1.15rem;
  color: var(--green-900);
}
.entry-card > legend + * { clear: both; }
.entry-card.is-required { border-left-color: var(--green-700); }
.entry-card .form-row:last-child, .entry-card .field:last-child { margin-bottom: 0; }

/* Radio/checkbox groups nest inside the section fieldsets: render them as a light inner panel
   rather than a second heavy box, and keep them flush inside .form-row cells. */
fieldset[data-group] {
  margin-bottom: 1.25rem;
  padding: 0.7rem 1rem 0.5rem;
  background: var(--bg-alt);
  border-color: var(--line);
}
fieldset[data-group] > legend {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}
fieldset[data-group] > .hint { margin: 0.1rem 0 0.4rem; }
fieldset[data-group] > .choice-group { margin-top: 0.15rem; }
fieldset > fieldset[data-group]:last-child { margin-bottom: 0; }
.form-row > fieldset[data-group] { margin-bottom: 0; }

/* A group that failed validation: red edge, same shadow trick as inputs (no layout shift). */
fieldset[data-group][aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: inset 5px 0 0 var(--error);
}
fieldset[data-group] > .field-error { margin: 0 0 0.6rem; }

/* §5 Conditional fields --------------------------------------------------------------------- */
/* Hidden via the `hidden` attribute (site.css: [hidden]{display:none!important}); when JS removes
   it the block fades/slides in. Under prefers-reduced-motion, site.css §12 collapses every animation
   to 0.01ms, and the rule below removes the movement entirely. */
.conditional {
  margin-top: -0.25rem;
  padding: 0.9rem 1rem 1rem;
  background: var(--bg-alt);
  border-left: 4px solid var(--green-700);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.conditional:not([hidden]) { animation: conditional-reveal var(--speed) ease-out; }
@keyframes conditional-reveal {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .conditional:not([hidden]) { animation: none; }
}

/* §6 Turnstile ------------------------------------------------------------------------------ */
.turnstile-field { margin-top: 1.5rem; }
.turnstile {
  min-height: 65px;                      /* the Managed widget is 300x65; reserving it avoids a layout jump */
  min-width: 300px;
  max-width: 100%;
}
.turnstile iframe { max-width: 100%; }
.turnstile-fallback {
  margin: 0.75rem 0 0;
  padding: 1rem 1.25rem;
  background: var(--error-bg);
  border: 1px solid var(--error);
  border-left-width: 5px;
  border-radius: var(--radius);
}
.turnstile-fallback > :last-child { margin-bottom: 0; }
.turnstile-fallback .callout-title { color: var(--error); }

/* §7 Submit row, status line, confirmation -------------------------------------------------- */
.submit-row { align-items: flex-start; }
.submit-row .form-note { max-width: 34rem; }
.btn-submit { min-width: 14rem; }

/* Shown while the Submit button is still disabled in markup (JavaScript off, or apply.js failed to
   load); apply.js hides it at boot. The Turnstile fallback box covers the widget-failure case. */
.submit-help { margin: 0.75rem 0 0; max-width: 34rem; }

/* Status line announced while sending / after a server-side error (aria-live region). */
.form-status { margin: 1rem 0 0; font-weight: 600; color: var(--ink-2); }
.form-status:empty { display: none; }

.confirmation {
  max-width: 46rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--green-50);
  border: 1px solid var(--green-700);
  border-left-width: 6px;
  border-radius: var(--radius);
  scroll-margin-top: 1.5rem;
}
.confirmation > h2 { margin-top: 0; }
.confirmation .ref-number {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--green-100);
  border-radius: var(--radius-sm);
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--green-900);
}
.confirmation .steps { margin: 1.25rem 0; }
.confirmation > :last-child { margin-bottom: 0; }

@media print {
  .progress, .turnstile-field, .submit-row, .submit-help { display: none !important; }
  .entry-card, .conditional, .confirmation { background: #fff !important; }
}
