/* ============================================================================
   hai-lead-form.css  ·  one lead form for every form on Website V2
   Written Nov 15 2026 for VD. Pairs with hai-lead-form.ejs + hai-lead-form.js.

   Two shells, one body:
     .lf--modal   a native <dialog>: centred card on desktop, bottom sheet under 600px
     .lf--inline  the same body dropped straight into a page or panel (webinar pop-up, /start/demo)

   Brand tokens only: gold #FFC61E, gold300 #FFE8A5, violet #341D99, ink #110A33,
   lavender #DDD6FF, mist #F6F4FF, cream #FFF4D2, slate #5B6478, white.
   Errors use violet plus a mark, never colour alone. No green, no red, no #4526CC.

   Size budget: five required fields plus the optional dropdown must fit a 1280x620
   laptop with no inner scroll. Row height is 60px (label 16 + gap 4 + control 40 at
   min 44px tap height via padding), gaps are 12px, the modal pad is 24px.
   ========================================================================== */

.lf {
  --lf-gold: #FFC61E;
  --lf-gold3: #FFE8A5;
  --lf-violet: #341D99;
  --lf-ink: #110A33;
  --lf-lav: #DDD6FF;
  --lf-mist: #F6F4FF;
  --lf-cream: #FFF4D2;
  --lf-slate: #5B6478;
  --lf-disp: "Cabinet Grotesk", Cabinetgrotesk, Arial, sans-serif;
  --lf-body: Manrope, Arial, sans-serif;
  --lf-out: cubic-bezier(.23, 1, .32, 1);
  --lf-sheet: cubic-bezier(.32, .72, 0, 1);
  --lf-pad: 24px;
  --lf-gap: 12px;
  color: var(--lf-ink);
  font: 500 16px/1.5 var(--lf-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: start;
}
.lf *, .lf *::before, .lf *::after { box-sizing: border-box; }

/* ---------------------------------------------------------------- modal shell */
.lf--modal {
  position: fixed; inset: 0; margin: auto;
  width: min(calc(100% - 32px), 544px); max-width: none;
  height: fit-content; max-height: min(calc(100dvh - 40px), 760px);
  padding: 0; border: 0; border-radius: 24px; overflow: hidden;
  background: #fff;
  box-shadow: 0 32px 64px -24px rgba(17, 10, 51, .35), 0 2px 8px rgba(17, 10, 51, .08);
}
.lf--modal:not([open]) { display: none; }
.lf--modal::backdrop { background: rgba(17, 10, 51, .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
html.lf-lock { overflow: hidden; }

/* ---------------------------------------------------------------- inline shell */
.lf--inline {
  display: block; width: 100%; min-width: 0;
  background: #fff; border-radius: 24px;
  box-shadow: inset 0 0 0 1.5px var(--lf-lav);
}
/* a host that already draws its own card passes bare: true and gets no shell of its own */
.lf--inline.lf--bare { background: none; border-radius: 0; box-shadow: none; }
/* Nov 17 2026 (VD): a bare host also draws its own heading (webinar gate, /start/demo, HumanMail), so the form's own goes */
.lf--inline.lf--bare .lf__head { display: none; }
.lf--inline.lf--bare .lf__body { padding: 0; }

/* position: relative keeps the off-screen honeypot anchored to the form, not to the page */
.lf__panel { position: relative; display: flex; flex-direction: column; max-height: inherit; min-width: 0; }

/* ---------------------------------------------------------------------- head */
.lf__head {
  position: relative; z-index: 1; flex: none;
  padding: var(--lf-pad) var(--lf-pad) 12px;
  transition: box-shadow .15s;
}
.lf--modal .lf__head { padding-right: calc(var(--lf-pad) + 40px); }
.lf.is-scrolled .lf__head { box-shadow: 0 1px 0 var(--lf-lav), 0 8px 16px -12px rgba(17, 10, 51, .18); }
.lf .lf__title {
  margin: 0; font: 700 24px/1.15 var(--lf-disp); letter-spacing: -.02em;
  color: var(--lf-ink); text-wrap: balance; outline: none;
}
.lf .lf__lead { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: var(--lf-slate); text-wrap: pretty; }
.lf.is-sent .lf__lead { display: none; }

.lf__x {
  position: absolute; top: 12px; right: 12px; width: 44px; height: 44px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 999px;
  background: transparent; color: var(--lf-slate); cursor: pointer;
  transition-property: background-color, color, transform;
  transition-duration: .15s, .15s, .16s;
  transition-timing-function: ease, ease, var(--lf-out);
}
.lf__x:hover { background: var(--lf-mist); color: var(--lf-ink); }
.lf__x:active { transform: scale(.96); }

/* ---------------------------------------------------------------------- body */
.lf__body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px var(--lf-pad) var(--lf-pad); scrollbar-width: thin;
}
.lf--inline .lf__body { overflow: visible; }
.lf__form { margin: 0; min-width: 0; }

/* field grid: two columns from 440px up, so first/last and company/role pair off */
.lf__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--lf-gap); min-width: 0; }
@media (min-width: 440px) {
  .lf__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lf__field { grid-column: 1 / -1; }
  .lf__field--half { grid-column: auto; }
}
.lf__field { min-width: 0; }
.lf__field[hidden] { display: none; }

/* The short preset: no role, and company sits below the email, shown only for a personal
   address. Every field needs an explicit order here, not just the two that move: a field
   left at the default 0 jumps above them and the optional question lands above the email. */
.lf--short .lf__field--jobtitle { display: none; }
.lf--short .lf__field--name      { order: 1; }
.lf--short .lf__field--email     { order: 3; }
.lf--short .lf__field--company   { order: 4; grid-column: 1 / -1; }
.lf--short .lf__field--extra     { order: 5; }
.lf--short .lf__field--hear      { order: 6; }
@media (prefers-reduced-motion: no-preference) {
  .lf--short .lf__field--company:not([hidden]) { animation: lf-rise .22s var(--lf-out) both; }
}

.lf .lf__label {
  display: block; margin: 0 0 4px; padding: 0;
  font: 700 12px/1.3 var(--lf-body); letter-spacing: .02em;
  color: var(--lf-ink);
}
.lf__opt { font-weight: 600; color: var(--lf-slate); }

.lf__input {
  display: block; width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 0 14px;
  border: 1.5px solid rgba(91, 100, 120, .72); border-radius: 12px; background: var(--lf-mist);
  font: 500 16px/1.3 var(--lf-body); color: var(--lf-ink);
  transition-property: border-color, background-color, box-shadow;
  transition-duration: .15s; transition-timing-function: ease;
}
.lf__input--area { min-height: 76px; padding: 10px 14px; line-height: 1.45; resize: vertical; }
select.lf__input {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23110A33' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.lf__input::placeholder { color: var(--lf-slate); opacity: 1; }
.lf__input:hover { border-color: var(--lf-slate); }
.lf__input:focus, .lf__input:focus-visible {
  outline: none; border-color: var(--lf-ink); background: #fff;
  box-shadow: 0 0 0 3px rgba(52, 29, 153, .22);
}
.lf__input[aria-invalid="true"] { border-color: var(--lf-violet); background: #fff; box-shadow: 0 0 0 3px rgba(52, 29, 153, .12); }
.lf .lf__hint { margin: 4px 0 0; font-size: 12px; line-height: 1.4; color: var(--lf-slate); }

/* errors: violet text, a round mark, and aria-invalid. Never colour on its own. */
.lf .lf__err {
  display: flex; gap: 6px; align-items: flex-start; margin: 4px 0 0;
  font-size: 13px; font-weight: 700; line-height: 1.4; color: var(--lf-violet); text-wrap: pretty;
}
.lf .lf__err::before {
  content: "!"; flex: none; display: grid; place-items: center;
  width: 16px; height: 16px; margin-top: 1px; border-radius: 999px;
  background: var(--lf-violet); color: #fff; font-size: 11px; font-weight: 800; line-height: 1;
}
.lf .lf__err[hidden] { display: none; }

/* --------------------------------------------------- per-form extra: tick cards */
.lf__choices { margin: var(--lf-gap) 0 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 8px; }
.lf__choices > legend { float: left; width: 100%; margin-bottom: 4px; }
.lf__choice {
  position: relative; display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; border: 1.5px solid var(--lf-lav); border-radius: 14px; background: #fff; cursor: pointer;
  transition-property: border-color, background-color; transition-duration: .15s;
}
.lf__choice:hover { border-color: rgba(52, 29, 153, .4); }
.lf__choice:has(input:checked) { border-color: var(--lf-ink); background: var(--lf-mist); }
.lf__choice:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(52, 29, 153, .25); }
.lf__choice-txt { display: grid; gap: 1px; min-width: 0; }
.lf__choice-txt b { font-size: 14px; font-weight: 700; line-height: 1.35; }
.lf__choice-txt span { font-size: 12.5px; line-height: 1.4; color: var(--lf-slate); text-wrap: pretty; }
.lf__choices[aria-invalid="true"] .lf__choice { border-color: var(--lf-violet); }

.lf__choice input, .lf__optin input {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 20px; height: 20px; margin: 1px 0 0;
  border: 1.5px solid var(--lf-ink); border-radius: 6px;
  background: #fff center / 14px no-repeat; cursor: pointer;
  transition-property: background-color, border-color; transition-duration: .15s;
}
.lf__choice input:checked, .lf__optin input:checked {
  background-color: var(--lf-gold);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23110A33' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.lf__choice input:focus-visible, .lf__optin input:focus-visible { outline: 2px solid var(--lf-violet); outline-offset: 2px; }

/* ------------------------------------------------------- opt-in, privacy, send */
.lf__optin {
  display: flex; gap: 10px; align-items: flex-start; margin: var(--lf-gap) 0 0;
  padding: 10px 12px; border-radius: 14px; background: var(--lf-mist);
  font-size: 13px; line-height: 1.4; color: var(--lf-ink); cursor: pointer; text-wrap: pretty;
}
.lf__optin input { width: 18px; height: 18px; border-radius: 5px; background-size: 12px; }

.lf .lf__privacy { margin: 10px 0 0; font-size: 12px; line-height: 1.45; color: var(--lf-slate); text-wrap: pretty; }
.lf__privacy a { color: var(--lf-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

.lf .lf__status { margin: 0; font-size: 13px; font-weight: 700; color: var(--lf-violet); text-wrap: pretty; }
.lf .lf__status:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.lf .lf__status:not(:empty) { margin-top: 12px; }

.lf__submit, .lf__done {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; margin: 16px 0 0; padding: 12px 24px;
  border: 0; border-radius: 999px; background: var(--lf-gold); color: var(--lf-ink);
  font: 700 16px/1 var(--lf-disp); cursor: pointer;
  transition-property: background-color, transform;
  transition-duration: .15s, .16s; transition-timing-function: ease, var(--lf-out);
}
.lf__submit:hover { background: var(--lf-gold3); }
.lf__submit:active, .lf__done:active { transform: scale(.96); }
.lf__submit[aria-busy="true"] { pointer-events: none; background: var(--lf-gold3); }
.lf__spin {
  flex: none; width: 16px; height: 16px; border-radius: 999px;
  border: 2px solid rgba(17, 10, 51, .25); border-top-color: var(--lf-ink);
  animation: lf-spin .7s linear infinite;
}
.lf__submit:not([aria-busy="true"]) .lf__spin { display: none; }
.lf__x:focus-visible, .lf__submit:focus-visible, .lf__done:focus-visible, .lf__privacy a:focus-visible {
  outline: 2px solid var(--lf-violet); outline-offset: 3px;
}

/* ------------------------------------------------------------------ thank you */
.lf__thanks { display: grid; justify-items: center; gap: 10px; padding: 8px 0 0; text-align: center; }
.lf__thanks[hidden] { display: none; }
.lf__tick { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 999px; background: var(--lf-gold); color: var(--lf-ink); }
.lf .lf__thanks-h { margin: 6px 0 0; font: 700 22px/1.2 var(--lf-disp); letter-spacing: -.02em; text-wrap: balance; outline: none; }
.lf .lf__thanks-p { margin: 0; max-width: 38ch; font-size: 14px; line-height: 1.5; color: var(--lf-slate); text-wrap: pretty; overflow-wrap: anywhere; }
.lf .lf__thanks-p b { color: var(--lf-ink); }
.lf__done { width: auto; min-width: 160px; margin-top: 8px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--lf-ink); }
.lf__done:hover { background: var(--lf-ink); color: #fff; }

/* honeypot: off screen, never focusable */
.lf__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Short laptops (1280x620 and the like): tighten the pad and the row gap so the five
   required fields, the optional dropdown and the button still fit with no inner scroll.
   Measured at 544px wide: 570px tall at the normal pad, 548px here, against 580px of room. */
@media (min-width: 600px) and (max-height: 700px) {
  .lf--modal { --lf-pad: 18px; --lf-gap: 10px; }
  .lf--modal .lf__head { padding-bottom: 10px; }
  .lf--modal .lf__submit { margin-top: 14px; }
}

/* ------------------------------------------------------------------- phones */
@media (max-width: 599px) {
  .lf--modal {
    --lf-pad: 18px;
    inset: auto 0 0 0; margin: 0; width: 100%;
    max-height: calc(100dvh - 20px); border-radius: 24px 24px 0 0;
  }
  .lf--modal .lf__head { padding-top: 26px; }
  .lf--modal .lf__head::before {
    content: ""; position: absolute; top: 10px; left: 50%;
    width: 40px; height: 4px; margin-left: -20px; border-radius: 999px; background: var(--lf-lav);
  }
  .lf--modal .lf__x { top: 10px; right: 6px; }
  .lf .lf__title { font-size: 21px; }
  .lf--modal .lf__body { padding-bottom: calc(var(--lf-pad) + env(safe-area-inset-bottom, 0px)); }
}
/* 320px: nothing may sit side by side, and the two-column grid is already off below 440 */
@media (max-width: 359px) {
  .lf { --lf-pad: 16px; }
  .lf .lf__title { font-size: 19px; }
}

/* ------------------------------------------------------------------- motion */
@media (prefers-reduced-motion: no-preference) {
  .lf--modal[open] { animation: lf-in .22s var(--lf-out); }
  .lf--modal[open]::backdrop { animation: lf-fade .22s var(--lf-out); }
  .lf--modal.is-closing { animation: lf-out .16s ease-out forwards; }
  .lf--modal.is-closing::backdrop { animation: lf-fade .16s ease-out reverse forwards; }
  .lf.is-sent .lf__tick { animation: lf-pop .32s var(--lf-out); }
  .lf.is-sent .lf__tick path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: lf-draw .3s .12s var(--lf-out) forwards; }
  .lf__thanks:not([hidden]) > :not(.lf__tick) { animation: lf-rise .26s .08s var(--lf-out) both; }
  @media (max-width: 599px) {
    .lf--modal[open] { animation: lf-sheet-in .3s var(--lf-sheet); }
    .lf--modal.is-closing { animation: lf-sheet-out .2s ease-out forwards; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .lf--modal[open], .lf--modal[open]::backdrop { animation: lf-fade .12s linear; }
  .lf--modal.is-closing, .lf--modal.is-closing::backdrop { animation: lf-fade .1s linear reverse forwards; }
  .lf__x, .lf__submit, .lf__done, .lf__input, .lf__choice { transition: none; }
  .lf__spin { animation-duration: 1.6s; }
}
@keyframes lf-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes lf-out { to { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes lf-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes lf-sheet-out { to { transform: translateY(100%); } }
@keyframes lf-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lf-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes lf-draw { to { stroke-dashoffset: 0; } }
@keyframes lf-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes lf-spin { to { transform: rotate(360deg); } }

@media (forced-colors: active) {
  .lf--modal { border: 2px solid CanvasText; }
  .lf__input:focus, .lf__input:focus-visible { outline: 2px solid Highlight; outline-offset: 1px; }
  .lf__choice input:checked, .lf__optin input:checked { background-color: Highlight; }
}
