/* ==========================================================================
   EPA Lead Form — vanilla build stylesheet
   Zero dependencies. Everything is scoped under .epa-form so it cannot leak
   into (or be broken by) the host site's stylesheet.

   Contrast (WCAG 2.1 AA / AAA):
     --epa-ink        #1A1A1A on white ........ 17.4:1
     --epa-ink-muted  #4A4A4A on white ........  8.9:1
     --epa-ink        #1A1A1A on gold .........  8.4:1   ← buttons use BLACK text
     --epa-gold-ink   #5A5117 on white ........  8.0:1   ← the "gold" TEXT color
   Never put white text on the gold, and never use raw gold as a text color.
   ========================================================================== */

.epa-form {
  /* --- Brand tokens: edit here or override from the page ---------------- */
  --epa-gold: #c4b454;
  --epa-gold-hover: #b3a343;
  --epa-gold-ink: #5a5117;
  --epa-gold-wash: #faf7ea;
  --epa-gold-border: #8a7c2e;
  --epa-ink: #1a1a1a;
  --epa-ink-muted: #4a4a4a;
  --epa-border: #6b6b6b;
  --epa-border-subtle: #d6d6d6;
  --epa-surface: #ffffff;
  --epa-surface-alt: #f7f6f2;
  --epa-error: #b3261e;
  --epa-error-wash: #fdf3f2;
  --epa-success: #1b5e20;
  --epa-success-wash: #f1f8f2;
  --epa-focus: #1a1a1a;
  --epa-radius: 10px;
  --epa-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  --epa-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  font-family: var(--epa-sans);
  font-size: 18px;              /* minimum body size */
  line-height: 1.6;
  color: var(--epa-ink);
  background: var(--epa-surface);
  text-align: left;
  box-sizing: border-box;
}

.epa-form *,
.epa-form *::before,
.epa-form *::after { box-sizing: inherit; }

.epa-form p,
.epa-form h2,
.epa-form h3,
.epa-form h4,
.epa-form ul,
.epa-form ol,
.epa-form fieldset,
.epa-form legend { margin: 0; padding: 0; }

.epa-form ul,
.epa-form ol { list-style: none; }

.epa-form fieldset { border: 0; min-width: 0; }

/* --- Focus: one visible, high-contrast ring everywhere ------------------ */
.epa-form :focus-visible {
  outline: 3px solid var(--epa-focus);
  outline-offset: 2px;
  border-radius: 4px;
}
.epa-form-card:has(:focus-visible),
.epa-form-option:has(:focus-visible) {
  outline: 3px solid var(--epa-focus);
  outline-offset: 2px;
}

/* --- Screen-reader-only ------------------------------------------------- */
.epa-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Header ------------------------------------------------------------- */
.epa-header { margin-bottom: 24px; }

.epa-headline {
  font-family: var(--epa-serif);
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 12px;
  color: var(--epa-ink);
}
.epa-headline:focus { outline: none; }
.epa-headline:focus-visible { outline: 3px solid var(--epa-focus); outline-offset: 4px; }

.epa-reassurance { font-size: 1.125rem; color: var(--epa-ink-muted); }

/* Privacy promise — visible from the first screen and still on screen while
   they type their contact details on step 3. */
.epa-privacy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--epa-border-subtle);
  border-radius: var(--epa-radius);
  background: var(--epa-surface-alt);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--epa-ink-muted);
}
.epa-privacy svg { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 3px; fill: var(--epa-gold-ink); }

.epa-step-title {
  font-family: var(--epa-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: block;
}

/* --- Progress ----------------------------------------------------------- */
.epa-progress { margin-bottom: 28px; }
.epa-progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.epa-progress-step { font-size: 1.125rem; font-weight: 600; }
.epa-progress-label { font-size: 1rem; color: var(--epa-ink-muted); }
.epa-progress-track {
  height: 12px;
  border-radius: 999px;
  background: var(--epa-surface-alt);
  box-shadow: inset 0 0 0 1px var(--epa-border-subtle);
  overflow: hidden;
}
.epa-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--epa-gold-border);
  transition: width 300ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* --- Resume notice ------------------------------------------------------ */
.epa-resume {
  margin-bottom: 20px;
  padding: 12px 16px;
  border: 1px solid var(--epa-gold-border);
  border-radius: var(--epa-radius);
  background: var(--epa-gold-wash);
  font-size: 1.0625rem;
}

/* --- Steps -------------------------------------------------------------- */
.epa-step { display: grid; gap: 28px; }
.epa-step[hidden] { display: none; }
.epa-step-enter { animation: epaStepIn 260ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }
@keyframes epaStepIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* --- Step 1 interest cards ---------------------------------------------- */
.epa-card-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .epa-card-grid { grid-template-columns: 1fr 1fr; } }

.epa-form-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-height: 96px;
  padding: 16px;
  border: 2px solid var(--epa-border-subtle);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}
.epa-form-card:hover { border-color: var(--epa-ink); background: var(--epa-surface-alt); }
.epa-form-card.is-selected {
  border-color: var(--epa-gold-border);
  background: var(--epa-gold-wash);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.epa-card-body { flex: 1 1 auto; min-width: 0; }
.epa-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.3;
}
.epa-card-title svg { flex: 0 0 auto; width: 24px; height: 24px; fill: var(--epa-gold-ink); }
.epa-card-desc { display: block; margin-top: 4px; font-size: 1.0625rem; color: var(--epa-ink-muted); }

/* --- Radio option rows --------------------------------------------------- */
.epa-question { min-width: 0; }
.epa-legend { display: block; font-size: 1.25rem; font-weight: 600; margin-bottom: 4px; }
.epa-optional { font-weight: 400; font-size: 1.0625rem; color: var(--epa-ink-muted); margin-left: 8px; }
.epa-help { font-size: 1.0625rem; color: var(--epa-ink-muted); margin-bottom: 12px; }
.epa-options { display: grid; gap: 12px; margin-top: 12px; }

.epa-form-option {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 12px 16px;
  border: 2px solid var(--epa-border-subtle);
  border-radius: var(--epa-radius);
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}
.epa-form-option:hover { border-color: var(--epa-ink); background: var(--epa-surface-alt); }
.epa-form-option.is-selected { border-color: var(--epa-gold-border); background: var(--epa-gold-wash); }
.epa-option-label { display: block; font-size: 1.125rem; font-weight: 500; }
.epa-option-hint { display: block; margin-top: 2px; font-size: 1rem; color: var(--epa-ink-muted); }

.epa-form input[type="radio"],
.epa-form input[type="checkbox"] {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--epa-gold-border);
  cursor: pointer;
}
.epa-form .epa-consent-box input[type="checkbox"] { width: 28px; height: 28px; }

/* --- Text fields --------------------------------------------------------- */
.epa-field { min-width: 0; }
.epa-label {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.epa-hint { font-size: 1rem; color: var(--epa-ink-muted); margin-bottom: 8px; }

.epa-form input[type="text"],
.epa-form input[type="tel"],
.epa-form input[type="email"],
.epa-form input[type="date"],
.epa-form select,
.epa-form textarea {
  display: block;
  width: 100%;
  min-height: 56px;                 /* well above the 48px minimum target */
  padding: 12px 16px;
  font-family: inherit;
  font-size: 1.25rem;               /* 20px inputs */
  line-height: 1.4;
  color: var(--epa-ink);
  background: #fff;
  border: 2px solid var(--epa-border);
  border-radius: var(--epa-radius);
  transition: border-color 160ms ease;
  -webkit-appearance: none;
  appearance: none;
}
.epa-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z' fill='%231A1A1A'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 28px 28px;
  padding-right: 48px;
}
.epa-form textarea { min-height: 120px; resize: vertical; }
.epa-form input:hover,
.epa-form select:hover,
.epa-form textarea:hover { border-color: var(--epa-ink); }
.epa-form .has-error input,
.epa-form .has-error select,
.epa-form .has-error textarea {
  border-color: var(--epa-error);
  background: var(--epa-error-wash);
}

/* --- Inline errors ------------------------------------------------------- */
.epa-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--epa-error);
}
.epa-error svg { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 3px; fill: currentColor; }
.epa-error[hidden] { display: none; }

/* --- Consent ------------------------------------------------------------- */
.epa-consent-box {
  padding: 16px;
  border: 2px solid var(--epa-border-subtle);
  border-radius: var(--epa-radius);
  background: var(--epa-surface-alt);
}
.epa-consent-box.has-error { border-color: var(--epa-error); background: var(--epa-error-wash); }
.epa-consent-label { display: flex; align-items: flex-start; gap: 16px; cursor: pointer; }
.epa-consent-text { font-size: 1.0625rem; line-height: 1.6; }

/* --- Buttons -------------------------------------------------------------- */
.epa-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}
@media (min-width: 640px) {
  .epa-actions { flex-direction: row-reverse; justify-content: flex-end; align-items: center; }
}

.epa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 12px 28px;
  font-family: inherit;
  font-size: 1.1875rem;
  font-weight: 700;
  border-radius: var(--epa-radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.epa-btn svg { width: 20px; height: 20px; fill: currentColor; }

.epa-btn-primary { background: var(--epa-gold); color: var(--epa-ink); }  /* black on gold = 8.4:1 */
.epa-btn-primary:hover { background: var(--epa-gold-hover); }
.epa-btn-primary[disabled] { opacity: 0.6; cursor: not-allowed; }

.epa-btn-secondary {
  background: #fff;
  color: var(--epa-ink);
  border-color: var(--epa-ink);
  font-weight: 600;
  font-size: 1.125rem;
}
.epa-btn-secondary:hover { background: var(--epa-surface-alt); }

.epa-btn-block { width: 100%; }
@media (min-width: 640px) { .epa-btn-block { width: auto; } }

.epa-spinner { animation: epaSpin 900ms linear infinite; }
@keyframes epaSpin { to { transform: rotate(360deg); } }

/* --- Trust row + call link ------------------------------------------------ */
.epa-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  font-size: 1rem;
  color: var(--epa-ink-muted);
}
.epa-trust li { display: flex; align-items: center; gap: 6px; }
.epa-trust svg { width: 18px; height: 18px; fill: var(--epa-gold-ink); flex: 0 0 auto; }

.epa-fineprint { margin-top: 16px; text-align: center; font-size: 1rem; color: var(--epa-ink-muted); }

.epa-callbar {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 2px solid var(--epa-border-subtle);
  text-align: center;
}
.epa-call-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: var(--epa-radius);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--epa-gold-ink);            /* 8:1 on white — not raw gold */
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.epa-call-link:hover { background: var(--epa-gold-wash); color: var(--epa-ink); }
.epa-call-link svg { width: 24px; height: 24px; fill: currentColor; flex: 0 0 auto; }
.epa-locations { margin-top: 8px; font-size: 1rem; color: var(--epa-ink-muted); }

/* --- Success / error panels ----------------------------------------------- */
.epa-panel { border-radius: 12px; border: 2px solid; padding: 28px 24px; outline: none; }
@media (min-width: 640px) { .epa-panel { padding: 40px 36px; } }

.epa-panel-success { border-color: var(--epa-success); background: var(--epa-success-wash); }
.epa-panel-error { border-color: var(--epa-error); background: var(--epa-error-wash); }

/* Confirmation header: mark and text side by side so the fold shows the
   thank-you AND the dynamic promise together. */
.epa-success-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}
.epa-success-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--epa-success);
}
.epa-success-mark svg { width: 32px; height: 32px; fill: #fff; }
.epa-success-sub { margin-bottom: 0 !important; font-size: 1.0625rem; color: var(--epa-ink-muted); }

.epa-panel h2 { font-family: var(--epa-serif); font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin-bottom: 10px; }
.epa-panel h3 { font-size: 1.1875rem; font-weight: 700; margin-bottom: 8px; }
.epa-panel h4 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; color: var(--epa-error); }
.epa-panel p { margin-bottom: 16px; }

/* Sets expectations for the conversation — the one thing the assurance card
   above it doesn't already say. */
.epa-success-note {
  margin-bottom: 28px !important;
  padding-left: 20px;
  border-left: 4px solid var(--epa-gold);
  font-size: 1.0625rem;
  color: var(--epa-ink-muted);
}

/* The dynamic "how we'll reach you" promise — the most important thing on
   the screen, so it gets a card of its own. */
.epa-assurance {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 24px;
  margin-bottom: 28px;
  border: 2px solid var(--epa-gold-border);
  border-radius: 12px;
  background: #fff;
}
.epa-assurance > svg { flex: 0 0 auto; width: 32px; height: 32px; fill: var(--epa-gold-ink); }
.epa-assurance-body { min-width: 0; }
.epa-assurance-headline {
  margin-bottom: 8px !important;
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;      /* long email addresses must not overflow */
}
.epa-assurance-detail { margin-bottom: 0 !important; font-size: 1.0625rem; color: var(--epa-ink-muted); }

.epa-callout {
  padding: 24px;
  border: 1px solid var(--epa-border-subtle);
  border-radius: var(--epa-radius);
  background: #fff;
}
.epa-callout p { margin-bottom: 12px; font-size: 1.0625rem; color: var(--epa-ink-muted); }
.epa-callout-title {
  margin-bottom: 6px !important;
  font-weight: 700;
  color: var(--epa-ink) !important;
  font-size: 1.125rem !important;
}
/* Pull the link's own padding back so its text aligns with the copy above. */
.epa-callout .epa-call-link { margin-left: -12px; }
.epa-callout .epa-locations { margin-top: 12px; margin-bottom: 0 !important; }

/* Actions: primary route back to the site, Close only inside the modal. */
.epa-success-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 2px solid var(--epa-border-subtle);
}
.epa-success-actions .epa-btn { width: 100%; text-decoration: none; }
@media (min-width: 640px) {
  .epa-success-actions { flex-direction: row; align-items: center; }
  .epa-success-actions .epa-btn { width: auto; }
}

.epa-error-actions { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 640px) { .epa-error-actions { flex-direction: row; align-items: center; } }

/* --- Compact variant ------------------------------------------------------ */
.epa-form-compact .epa-step { gap: 24px; }
.epa-form-compact .epa-headline { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.875rem); }
.epa-row { display: grid; gap: 24px; }
@media (min-width: 640px) { .epa-row { grid-template-columns: 1fr 1fr; } }
.epa-pills { display: flex; flex-wrap: wrap; gap: 12px; }
.epa-pills .epa-form-option { flex: 1 1 140px; justify-content: center; min-height: 48px; }

/* --- Honeypot: never visible, never focusable ----------------------------- */
.epa-hp {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Modal ---------------------------------------------------------------- */
.epa-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.6);
  animation: epaFade 180ms ease both;
}
@media (min-width: 768px) { .epa-modal-backdrop { align-items: center; padding: 24px; } }
@keyframes epaFade { from { opacity: 0; } to { opacity: 1; } }

.epa-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 46rem;
  margin: auto;
  padding: 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  outline: none;
  animation: epaDialogIn 220ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
@media (min-width: 640px) { .epa-modal-dialog { padding: 36px; } }
@keyframes epaDialogIn { from { opacity: 0; transform: translateY(16px) scale(0.99); } to { opacity: 1; transform: none; } }

.epa-modal-close {
  position: absolute;
  top: 12px; right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #1a1a1a;
  cursor: pointer;
}
.epa-modal-close:hover { border-color: #1a1a1a; background: #f7f6f2; }
.epa-modal-close svg { width: 28px; height: 28px; fill: currentColor; }
.epa-modal-body { padding-top: 32px; }
@media (min-width: 640px) { .epa-modal-body { padding-top: 8px; } }

.epa-scroll-lock { overflow: hidden !important; }

/* --- Reduced motion -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .epa-form *,
  .epa-modal-backdrop,
  .epa-modal-dialog {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Forced colors / Windows high contrast --------------------------------- */
@media (forced-colors: active) {
  .epa-form-card,
  .epa-form-option,
  .epa-btn { border: 2px solid ButtonText; }
  .epa-form-card.is-selected,
  .epa-form-option.is-selected { border-color: Highlight; }
}
