/* ============================================================
   08-contact.css — contact / quote form section
   Module: <section id="contact">
   Dark navy background. Two columns: contact info left, form right.
   Form posts to /api/lead (Cloudflare Pages Function).
   ============================================================ */

#contact {
  background: var(--c-navy);
  color: var(--c-white);
  border-top: 4px solid var(--c-yellow);
}
#contact h2, #contact h3 { color: var(--c-white); }
#contact .eyebrow { color: var(--c-yellow); }

.contact-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: var(--s-7);
  align-items: start;
}

/* ---- Left: info + direct contact ---- */
.contact-info h2 { margin-bottom: var(--s-3); }
.contact-info > p {
  color: rgba(255,255,255,0.75);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 54ch;
  margin-bottom: var(--s-5);
}

.contact-methods {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.contact-method {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.contact-method-icon {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.contact-method-icon svg {
  width: 20px; height: 20px;
  stroke: var(--c-yellow);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.contact-method-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  /* Was 0.45 alpha — that read at ~2.5:1 against navy, well under WCAG AA's
     4.5:1 minimum. 0.78 reads at ~5:1 which clears AA while keeping the
     decorative-quiet hierarchy below the bright white data value. */
  color: rgba(255,255,255,0.78);
  display: block;
}
.contact-method-value {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--c-white);
  display: block;
  margin-top: 2px;
}
.contact-method-value a {
  color: var(--c-white);
  transition: color 0.15s var(--ease-out);
}
.contact-method-value a:hover { color: var(--c-yellow); }

.contact-promise {
  margin-top: var(--s-5);
  padding: var(--s-4);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
}
.contact-promise strong { color: var(--c-yellow); }

/* ---- Right: the form ---- */
.contact-form-wrap {
  background: var(--c-white);
  border-radius: var(--radius-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-lg);
}
.contact-form-wrap h3 {
  color: var(--c-navy);
  margin-bottom: var(--s-5);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}
.form-full { grid-column: 1 / -1; }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-muted);
}
.form-field label .required {
  color: var(--c-green);
  margin-left: 2px;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--c-line);
  border-radius: var(--radius);
  background: var(--c-bg);
  font-family: var(--f-body);
  font-size: 0.97rem;
  color: var(--c-black);
  transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
  outline: none;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--c-navy);
  background: var(--c-white);
  box-shadow: 0 0 0 3px rgba(15, 59, 95, 0.1);
}
.form-field textarea { resize: vertical; min-height: 110px; }

.form-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-top: var(--s-4);
}
.form-small {
  font-size: 0.8rem;
  color: var(--c-muted);
  flex: 1;
  min-width: 140px;
}

/* Success state */
.form-success {
  display: none;
  text-align: center;
  padding: var(--s-5);
}
.form-success.is-visible {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  animation: form-success-in 0.4s ease forwards;
}
@keyframes form-success-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
/* Honour the user's OS reduced-motion preference. WCAG 2.1 AA SC 2.3.3. */
@media (prefers-reduced-motion: reduce) {
  .form-success.is-visible {
    animation: none;
  }
}
.form-success-icon {
  width: 64px; height: 64px;
  background: var(--c-green);
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 8px rgba(21, 97, 45, 0.12);
}
.form-success-icon svg {
  width: 28px; height: 28px;
  stroke: var(--c-white);
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.form-success h3 { color: var(--c-navy); margin: 0; }
.form-success p { color: var(--c-muted); margin: 0; font-size: 0.95rem; }

/* Honeypot field. Hidden from real users (visually + assistive tech),
   but bots that auto-fill every input will tick this and trigger the
   server-side trap. Layered hiding: off-screen position + visibility +
   opacity + pointer-events all cooperate so a single CSS quirk can't
   leave the field visible to a real customer. The input itself is also
   forced to 1px so even if the wrapper hiding fails, the input is too
   small to be perceived as a real field. */
.honeypot-field,
.honeypot-field * {
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  max-width: 1px !important;
  max-height: 1px !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

/* Submitting state — disable + spinner feedback */
.contact-form-wrap.is-submitting .form-submit-row .btn {
  opacity: 0.65;
  pointer-events: none;
  cursor: wait;
}
.contact-form-wrap.is-submitting .form-submit-row .btn::after {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: var(--c-white);
  border-radius: 50%;
  animation: spin-submit 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
@keyframes spin-submit {
  to { transform: rotate(360deg); }
}
/* Reduced-motion users still need feedback that the form is submitting,
   but skip the rotation. The opacity dimming + cursor:wait remain. */
@media (prefers-reduced-motion: reduce) {
  .contact-form-wrap.is-submitting .form-submit-row .btn::after {
    animation: none;
  }
}

/* Error state — inline field error */
.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea {
  border-color: var(--c-error);
  background: var(--c-error-bg);
}
.form-field-error {
  display: none;
  font-size: 0.78rem;
  color: var(--c-error);
  font-weight: 600;
  margin-top: 2px;
}
.form-field.has-error .form-field-error { display: block; }

/* Global form error (server-side) */
.form-error-msg {
  display: none;
  background: var(--c-error-bg);
  border: 1.5px solid var(--c-error-line);
  border-radius: var(--radius);
  padding: var(--s-3) var(--s-4);
  font-size: 0.9rem;
  color: var(--c-error);
  margin-top: var(--s-3);
}
.form-error-msg.is-visible { display: block; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; gap: var(--s-5); }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .contact-form-wrap { padding: var(--s-4); }
  .form-submit-row { flex-direction: column; align-items: stretch; }
  .form-submit-row .btn { width: 100%; justify-content: center; }
}
