/* ══════════════════════════════════════════════════════════════════════════
   Lead Form · 4-Step Modal Dialog
   ══════════════════════════════════════════════════════════════════════════ */

/* Dialog Backdrop */
#leadform-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  z-index: 9998;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--dur-med, 240ms) var(--ease-smooth, cubic-bezier(0.32,0.72,0,1));
}
#leadform-backdrop.open {
  display: block;
  opacity: 1;
}

/* Dialog Container */
#leadform-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--raised, #121214);
  border: 1px solid var(--line-2, rgba(255,255,255,0.10));
  border-radius: var(--r-4);
  max-width: min(100vw - 32px, 520px);
  max-height: 90vh;
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: 9999;
  opacity: 0;
  transition: opacity var(--dur-med, 240ms) var(--ease-smooth, cubic-bezier(0.32,0.72,0,1)),
              transform var(--dur-med, 240ms) var(--ease-smooth, cubic-bezier(0.32,0.72,0,1));
  box-shadow: var(--shadow-4);
}
#leadform-dialog.open {
  display: flex;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  #leadform-backdrop,
  #leadform-dialog {
    transition: opacity 80ms linear;
  }
}

/* Header */
.lf-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line-2, rgba(255,255,255,0.10));
  position: relative;
}
.lf-header h2 {
  font-family: var(--font-serif, Georgia, serif);
  font-size: var(--fs-h3);
  font-weight: 500;
  margin: 0 0 var(--space-1);
  letter-spacing: -0.01em;
  color: var(--ink, #F5F5F7);
}
.lf-header p {
  font-size: var(--fs-body);
  color: var(--ink-2, #A1A1AA);
  margin: 0;
  line-height: var(--lh-body);
}

/* Progress Indicator */
.lf-progress {
  width: 100%;
  height: 3px;
  background: var(--line-2, rgba(255,255,255,0.10));
  border-radius: 2px;
  margin-top: var(--space-2);
  overflow: hidden;
}
.lf-progress-bar {
  height: 100%;
  background: var(--t-accent, #2B6FFF);
  transition: width var(--dur-med, 240ms) var(--ease-smooth, cubic-bezier(0.32,0.72,0,1));
  border-radius: 2px;
}

/* Form Body */
.lf-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  padding-top: 28px;
}

/* Step Container */
.lf-step {
  display: none;
  opacity: 0;
  animation: lf-fade-in var(--dur-med, 240ms) var(--ease-smooth, cubic-bezier(0.32,0.72,0,1)) forwards;
}
.lf-step.active {
  display: block;
  opacity: 1;
}

@keyframes lf-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lf-step {
    animation: none;
    opacity: 1;
  }
  .lf-step.active {
    display: block;
  }
}

/* Step Question/Label */
.lf-question {
  font-family: var(--font-serif, Georgia, serif);
  font-size: var(--fs-lede);
  font-weight: 500;
  margin: 0 0 var(--space-3);
  letter-spacing: -0.01em;
  color: var(--ink, #F5F5F7);
}

/* Form Fields */
.lf-field {
  margin-bottom: 20px;
}
.lf-field label {
  display: block;
  font-size: var(--fs-small);
  color: var(--ink-2, #A1A1AA);
  font-family: var(--font-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
  min-height: 20px;
}
.lf-field input,
.lf-field select,
.lf-field textarea {
  width: 100%;
  background: var(--bg, #0A0A0B);
  border: 1px solid var(--line-2, rgba(255,255,255,0.10));
  border-radius: var(--r-2);
  padding: 12px 14px;
  font-size: var(--fs-body);
  font-family: inherit;
  color: var(--ink, #F5F5F7);
  transition: border-color 200ms, box-shadow 200ms;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}
.lf-field input::placeholder,
.lf-field textarea::placeholder {
  color: var(--ink-3, #8A8A92);
}
.lf-field input:focus,
.lf-field select:focus,
.lf-field textarea:focus {
  outline: none;
  border-color: var(--t-accent, #2B6FFF);
  box-shadow: var(--shadow-ring);
}

/* Textarea */
.lf-field textarea {
  resize: vertical;
  min-height: 100px;
  font-family: var(--font-sans, sans-serif);
  line-height: 1.4;
}

/* Error States */
.lf-field input[aria-invalid="true"],
.lf-field select[aria-invalid="true"],
.lf-field textarea[aria-invalid="true"] {
  border-color: var(--t-danger, #EF4444) !important;
  background: rgba(239,68,68,0.05);
}

/* Error Message */
.lf-error {
  display: none;
  font-size: var(--fs-caption);
  color: var(--t-danger, #EF4444);
  margin-top: 6px;
  line-height: 1.4;
}
.lf-error.show {
  display: block;
}

/* Consent Checkbox */
.lf-consent-label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--ink-2, #A1A1AA);
  cursor: pointer;
  padding: 12px 14px;
  border: 1px solid var(--line-2, rgba(255,255,255,0.10));
  border-radius: var(--r-2);
  background: rgba(255,255,255,0.02);
  transition: background 200ms, border-color 200ms;
}
.lf-consent-label:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--line, rgba(255,255,255,0.06));
}
.lf-consent-label input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--line-2, rgba(255,255,255,0.10));
  border-radius: var(--r-1);
  background: var(--bg, #0A0A0B);
  cursor: pointer;
  transition: all 150ms;
}
.lf-consent-label input[type="checkbox"]:hover {
  border-color: var(--t-accent, #2B6FFF);
}
.lf-consent-label input[type="checkbox"]:checked {
  background: var(--t-accent, #2B6FFF);
  border-color: var(--t-accent, #2B6FFF);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='M4 10l5 5 7-9' stroke='white' stroke-width='2.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
.lf-consent-label input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--t-accent, #2B6FFF);
  outline-offset: 2px;
}
.lf-consent-label a {
  color: var(--t-accent, #2B6FFF);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lf-consent-label a:hover {
  color: var(--ink, #F5F5F7);
}

/* Summary Screen */
.lf-summary {
  display: grid;
  gap: 12px;
}
.lf-summary-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-2);
  padding: 12px 0;
  border-bottom: 1px solid var(--line, rgba(255,255,255,0.06));
}
.lf-summary-item:last-child {
  border-bottom: none;
}
.lf-summary-label {
  font-family: var(--font-mono, monospace);
  font-size: var(--fs-label);
  color: var(--ink-3, #8A8A92);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lf-summary-value {
  font-size: var(--fs-ui);
  color: var(--ink, #F5F5F7);
  line-height: 1.4;
  word-break: break-word;
}

/* Footer / Actions */
.lf-footer {
  display: flex;
  gap: 12px;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--line-2, rgba(255,255,255,0.10));
  background: rgba(0,0,0,0.2);
}

/* Buttons */
button.lf-btn {
  flex: 1;
  padding: 12px 20px;
  font-size: var(--fs-ui);
  font-weight: 500;
  border: none;
  border-radius: var(--r-2);
  cursor: pointer;
  transition: all 150ms var(--ease-smooth, cubic-bezier(0.32,0.72,0,1));
  min-height: 44px;
  font-family: inherit;
}

button.lf-btn-primary {
  background: var(--t-accent-interactive);
  color: var(--cta-fg);
}
button.lf-btn-primary:hover:not(:disabled) {
  background: var(--t-accent-hover);
  transform: translateY(-1px);
}
button.lf-btn-primary:active:not(:disabled) {
  transform: translateY(0);
}
button.lf-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.lf-btn-secondary {
  background: var(--cta-2-bg);
  color: var(--t-ink-2);
}
button.lf-btn-secondary:hover:not(:disabled) {
  background: var(--cta-2-bg-hover);
  color: var(--t-ink);
}
button.lf-btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Close Button */
.lf-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--ink-2, #A1A1AA);
  font-size: var(--fs-h3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms;
}
.lf-close:hover {
  color: var(--ink, #F5F5F7);
}
.lf-close:focus-visible {
  outline: 2px solid var(--t-accent, #2B6FFF);
  outline-offset: 2px;
}

/* Status Message */
.lf-status {
  display: none;
  padding: 12px 16px;
  border-radius: var(--r-2);
  font-size: var(--fs-small);
  margin-bottom: var(--space-2);
}
.lf-status.success {
  background: rgba(34,197,94,0.1);
  color: var(--t-emerald, #22C55E);
  border: 1px solid rgba(34,197,94,0.3);
  display: block;
}
.lf-status.error {
  background: rgba(239,68,68,0.1);
  color: var(--t-danger, #EF4444);
  border: 1px solid rgba(239,68,68,0.3);
  display: block;
}

/* CTA Button (to open dialog) */
button.lf-cta {
  background: var(--t-accent-interactive);
  color: var(--cta-fg);
  border: none;
  padding: 14px 24px;
  font-size: var(--fs-ui);
  font-weight: 500;
  border-radius: var(--r-2);
  cursor: pointer;
  transition: all 150ms var(--ease-smooth, cubic-bezier(0.32,0.72,0,1));
  min-height: 48px;
}
button.lf-cta:hover {
  background: var(--t-accent-hover);
  transform: translateY(-2px);
}
button.lf-cta:active {
  transform: translateY(0);
}
button.lf-cta:focus-visible {
  outline: 2px solid var(--t-accent, #2B6FFF);
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 640px) {
  #leadform-dialog {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: var(--r-4) var(--r-4) 0 0;
    top: auto;
    bottom: 0;
    transform: translate(-50%, 100%);
  }
  #leadform-dialog.open {
    transform: translate(-50%, 0);
  }

  .lf-header,
  .lf-body,
  .lf-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .lf-header h2 {
    font-size: var(--fs-lede);
  }

  .lf-footer {
    flex-direction: column;
  }

  .lf-summary-item {
    grid-template-columns: 1fr;
    gap: var(--space-0);
  }
  .lf-summary-value {
    font-size: var(--fs-small);
  }
}
