/**
 * Ambimat Central Intake Platform — shared contact form styles.
 *
 * This file is IDENTICAL on every Ambimat site. It deliberately styles only
 * `.intake-*` classes so it cannot collide with a site's existing form CSS,
 * and it takes every colour and font from that site's own custom properties
 * with a fallback — so it inherits each brand rather than imposing one.
 *
 * Maintenance: change it here, copy it out. Do not fork per-site.
 */

.intake-form {
  --intake-accent: var(--brand-red, #E3222A);
  --intake-ink: var(--ink, #23282a);
  --intake-muted: var(--brand-grey, var(--muted, #6b7280));
  --intake-line: var(--line, #d7dbdd);
  --intake-label: var(--brand-dark, var(--ink, #23282a));
  --intake-field-bg: var(--card-bg, #fff);
  --intake-radius: var(--radius-btn, 6px);
  --intake-font: var(--font-body, 'Source Sans 3', system-ui, -apple-system, sans-serif);
  --intake-display: var(--font-display, 'Montserrat', system-ui, -apple-system, sans-serif);
  --intake-error: #b3261e;
  --intake-error-bg: #fdeceb;
  --intake-error-line: #f3b8b4;
  --intake-ok: #14532d;
  --intake-ok-bg: #ecf7ee;
  --intake-ok-line: #b7dfc0;
  --intake-info-bg: #eef2f7;
  --intake-info-line: #cbd5e1;
  font-family: var(--intake-font);
}

/* Mobile-first: one column, so a phone never gets ~180px fields. The second
   column only appears when there is genuinely room for it. */
.intake-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }

/* Deliberately (min-width:) and not the range notation (width >= 640px):
   range syntax needs Safari 16.4+ (2023) and Chrome 104+, and a contact form
   is the last thing on a site that should require a recent browser. */
/* stylelint-disable-next-line media-feature-range-notation */
@media (min-width: 640px) {
  .intake-grid { grid-template-columns: 1fr 1fr; }
}

.intake-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.intake-row--full { grid-column: 1 / -1; }

.intake-row label {
  font-family: var(--intake-display);
  font-size: 13px; font-weight: 600; letter-spacing: .3px;
  color: var(--intake-label);
}
.intake-req { color: var(--intake-accent); }
.intake-opt { color: var(--intake-muted); font-weight: 400; }

.intake-row input,
.intake-row select,
.intake-row textarea {
  font-family: var(--intake-font);
  font-size: 15px;
  color: var(--intake-ink);
  background: var(--intake-field-bg);
  border: 1px solid var(--intake-line);
  border-radius: var(--intake-radius);
  padding: 12px 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.intake-row textarea { min-height: 140px; resize: vertical; }

.intake-row input:focus,
.intake-row select:focus,
.intake-row textarea:focus {
  outline: none;
  border-color: var(--intake-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--intake-accent) 18%, transparent);
}
/* Keyboard users must always get a ring, including where a design removes it. */
.intake-row input:focus-visible,
.intake-row select:focus-visible,
.intake-row textarea:focus-visible,
.intake-form button:focus-visible,
.intake-status a:focus-visible {
  outline: 2px solid var(--intake-accent);
  outline-offset: 2px;
}

.intake-row input[aria-invalid="true"],
.intake-row select[aria-invalid="true"],
.intake-row textarea[aria-invalid="true"] { border-color: var(--intake-error); }

.intake-hint { font-size: 12.5px; color: var(--intake-muted); line-height: 1.55; margin: 0; }
.intake-err  { font-size: 13px; color: var(--intake-error); margin: 0; }

/* Hidden from people and assistive tech; only bots fill it. */
.intake-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.intake-status { font-size: 14.5px; line-height: 1.6; margin: 0; }
.intake-status.is-visible { padding: 13px 15px; border-radius: var(--intake-radius); }
.intake-status--info,
.intake-status--busy    { background: var(--intake-info-bg);  border: 1px solid var(--intake-info-line);  color: var(--intake-ink); }
.intake-status--error   { background: var(--intake-error-bg); border: 1px solid var(--intake-error-line); color: #8c1d18; }
.intake-status--success { background: var(--intake-ok-bg);    border: 1px solid var(--intake-ok-line);    color: var(--intake-ok); }
.intake-status a { color: inherit; text-decoration: underline; }

.intake-form button[aria-disabled="true"] { opacity: .6; cursor: progress; }

/* Button row. A class rather than an inline style on the secondary action:
   AmbiPower's build audit fails a template that carries inline styles. */
.intake-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.intake-note { font-size: 12.5px; color: var(--intake-muted); line-height: 1.6; margin: 14px 0 0; }
.intake-note a { color: var(--intake-accent); }

@media (prefers-reduced-motion: reduce) {
  .intake-row input, .intake-row select, .intake-row textarea { transition: none; }
}

/* Marketing-consent controls. Injected by intake.js only when
   CONFIG.consentCapture is true, so these rules are inert until then. */
.intake-consent { gap: 10px; }
.intake-consent-lead { font-size: 13px; font-weight: 600; color: var(--intake-label); margin: 0; }
.intake-consent-item {
  display: flex; align-items: flex-start; gap: 10px;
  font-family: var(--intake-font); font-size: 14px; font-weight: 400;
  line-height: 1.55; color: var(--intake-ink); letter-spacing: 0;
  cursor: pointer;
  /* The whole row is the label, so the whole row is the tap target. Without
     this it is 20px tall — under the 24px WCAG 2.5.8 minimum — which mattered
     little while these rules only styled the consent controls (never rendered,
     consentCapture is off) but matters now: the multi-select detail fields the
     schema renders use the same markup and visitors do see them.
     Height and padding do that work on their own. `align-items` stays
     flex-start above: these labels wrap, and centring would drag the checkbox
     to the middle of a two-line block instead of beside its first line, which
     is also what the 3px top margin on the box below is there to fine-tune. */
  min-height: 24px; padding: 2px 0;
}
.intake-consent-item input[type="checkbox"] {
  width: 16px; height: 16px; margin: 3px 0 0; flex: none;
  accent-color: var(--intake-accent); cursor: pointer;
}
.intake-consent-item input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--intake-accent); outline-offset: 2px;
}
