/* =====================================================================
   APPLICATION MODAL
   ---------------------------------------------------------------------
   Additive layer. Everything is namespaced bl-* so this file and
   styles.css cannot collide — restyle the site freely and this keeps
   working. It reads styles.css's own tokens (--purple, --teal, --ink,
   --sans) so any palette change here is inherited automatically.
   ===================================================================== */

.bl-modal{
  /* Local fallbacks in case this file is ever used without styles.css. */
  --bl-purple:var(--purple,#7361f7);
  --bl-teal:var(--teal,#35c7b2);
  --bl-orange:var(--orange,#ff7833);
  --bl-ink:var(--ink,#14161c);
  --bl-soft:var(--ink-soft,#3a3d45);
  --bl-line:#d8dae2;
  --bl-danger:#e05252;

  width:min(540px,calc(100vw - 32px));
  max-height:min(92vh,940px);
  /* styles.css resets `* { margin:0 }`, which kills the UA's `margin:auto`
     and pins a native dialog to the top-left. Restore centring explicitly. */
  inset:0;
  margin:auto;
  padding:0;
  border:0;
  background:transparent;
  overflow:visible;
  color:var(--bl-ink);
  font-family:var(--sans,'Matter',sans-serif);
}

.bl-modal::backdrop{
  background:rgba(14,15,19,.62);
  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
}

.bl-modal[open]{animation:bl-in .34s cubic-bezier(.2,.9,.3,1)}
.bl-modal[open]::backdrop{animation:bl-fade .34s ease}
@keyframes bl-in{from{opacity:0;transform:translateY(14px) scale(.985)}to{opacity:1;transform:none}}
@keyframes bl-fade{from{opacity:0}to{opacity:1}}

/* ---------- panel ---------- */
.bl-panel{
  position:relative;
  max-height:min(92vh,940px);
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:40px 42px 36px;
  border-radius:26px;
  background:#fff;
  box-shadow:0 30px 80px rgba(20,22,28,.32);
  scrollbar-width:thin;
  scrollbar-color:#cfd2db transparent;
}
.bl-panel::-webkit-scrollbar{width:10px}
.bl-panel::-webkit-scrollbar-track{background:transparent}
.bl-panel::-webkit-scrollbar-thumb{background:#cfd2db;border-radius:999px;border:3px solid transparent;background-clip:content-box}

.bl-close{
  position:absolute;top:14px;right:14px;
  width:38px;height:38px;display:flex;align-items:center;justify-content:center;
  border-radius:50%;border:0;background:transparent;color:#9a9da6;cursor:pointer;
  transition:background .2s ease,color .2s ease;
}
.bl-close svg{width:18px;height:18px}
.bl-close:hover{background:#f2f3f7;color:var(--bl-ink)}

/* ---------- header ---------- */
.bl-head{margin-bottom:26px;padding-right:36px}
.bl-eyebrow{
  display:inline-block;
  font-weight:700;letter-spacing:.2em;font-size:.72rem;text-transform:uppercase;
  color:var(--bl-ink);
  border-bottom:3px solid var(--bl-purple);
  padding-bottom:7px;margin-bottom:18px;
}
.bl-head h2{
  font-family:var(--sans,'Matter',sans-serif);
  font-weight:600;font-size:clamp(1.7rem,3.6vw,2.15rem);
  letter-spacing:-.02em;line-height:1.06;margin:0;
}
.bl-sub{margin:12px 0 0;font-size:12px;font-weight:500;line-height:1.6;color:var(--bl-soft)}

/* ---------- fields ---------- */
.bl-form{display:flex;flex-direction:column;gap:17px}
/* display:flex beats the UA's [hidden]{display:none}, so restate it or the
   form stays on screen underneath the success panel. */
.bl-form[hidden]{display:none}

.bl-field{display:flex;flex-direction:column;gap:7px}
.bl-field label{
  display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  font-size:12px;font-weight:700;letter-spacing:.01em;color:var(--bl-ink);
  padding-left:4px;
}
.bl-label-link{font-size:11.5px;font-weight:600;color:var(--bl-purple);text-decoration:underline;text-underline-offset:2px}
.bl-label-link:hover{color:#5f4df0}

/* Matches .apply__row input in styles.css so the modal feels native. */
.bl-field input,
.bl-field select{
  width:100%;
  padding:15px 22px;
  border-radius:999px;
  border:1.5px solid #c7c9d1;
  background:#fff;
  color:var(--bl-ink);
  font-family:inherit;
  font-size:.98rem;
  line-height:1.3;
  transition:border-color .2s ease,box-shadow .2s ease;
  appearance:none;-webkit-appearance:none;
}
.bl-field input::placeholder{color:#9a9da6}
.bl-field input:focus,
.bl-field select:focus{
  outline:none;
  border-color:var(--bl-purple);
  box-shadow:0 0 0 4px rgba(115,97,247,.15);
}
.bl-field input[aria-invalid="true"],
.bl-field select[aria-invalid="true"]{border-color:var(--bl-danger);background:#fff7f7}
.bl-field input[aria-invalid="true"]:focus,
.bl-field select[aria-invalid="true"]:focus{box-shadow:0 0 0 4px rgba(224,82,82,.14)}

/* Chrome repaints autofilled inputs near-white with its own background, which
   fights the border and focus ring. An inset shadow is the only way to override it. */
.bl-field input:-webkit-autofill,
.bl-field input:-webkit-autofill:hover,
.bl-field input:-webkit-autofill:focus{
  -webkit-text-fill-color:var(--bl-ink);
  -webkit-box-shadow:0 0 0 1000px #fff inset;
  box-shadow:0 0 0 1000px #fff inset;
  transition:background-color 600000s 0s,color 600000s 0s;
}

.bl-select-wrap{position:relative}
.bl-select-wrap select{padding-right:46px;cursor:pointer}
.bl-select-wrap select:invalid{color:#9a9da6}
.bl-caret{position:absolute;top:50%;right:20px;width:16px;height:16px;margin-top:-8px;color:#9a9da6;pointer-events:none}

.bl-hint{margin:0;padding-left:4px;font-size:11.5px;line-height:1.45;color:var(--bl-soft)}
.bl-err{margin:0;padding-left:4px;font-size:11.5px;line-height:1.45;color:var(--bl-danger);font-weight:600}
.bl-err:empty{display:none}
/* Purple, not red — the link is the way out of the error, not part of it. */
.bl-err-link{color:var(--bl-purple);text-decoration:underline;text-underline-offset:2px;white-space:nowrap}
.bl-err-link:hover{color:#5f4df0}

/* ---------- conditional fields ---------- */
.bl-conditional[hidden]{display:none}
.bl-conditional:not([hidden]){animation:bl-slide .28s cubic-bezier(.2,.9,.3,1)}
@keyframes bl-slide{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}

/* ---------- whitelisting opt-in ---------- */
.bl-check-field{margin-top:2px}
.bl-check{
  display:grid;grid-template-columns:auto 1fr;gap:13px;align-items:start;
  padding:16px 18px;border-radius:18px;
  background:#f4f3ff;border:1.5px solid #e2ddfd;
  cursor:pointer;transition:border-color .2s ease,background .2s ease;
}
.bl-check:hover{border-color:#c9c1fb;background:#f0eeff}
/* Kept in the DOM and focusable — only visually replaced — so keyboard,
   screen readers and form semantics all keep working. */
.bl-check input{position:absolute;width:1px;height:1px;opacity:0;margin:0;pointer-events:none}
.bl-check-box{
  width:21px;height:21px;margin-top:1px;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  border-radius:6px;border:1.5px solid #bfb7f5;background:#fff;color:transparent;
  transition:background .18s ease,border-color .18s ease,color .18s ease;
}
.bl-check-box svg{width:13px;height:13px}
.bl-check input:checked + .bl-check-box{background:var(--bl-purple);border-color:var(--bl-purple);color:#fff}
.bl-check input:focus-visible + .bl-check-box{outline:none;box-shadow:0 0 0 4px rgba(115,97,247,.28)}
.bl-check-copy{display:flex;flex-direction:column;gap:5px}
.bl-check-title{font-size:13.5px;font-weight:700;color:var(--bl-ink)}
.bl-check-desc{font-size:11.5px;line-height:1.5;color:var(--bl-soft)}

/* ---------- submit ---------- */
.bl-submit{position:relative;margin-top:6px;width:100%}
.bl-submit[disabled]{cursor:not-allowed;transform:none;box-shadow:none}
.bl-form.is-submitting .bl-submit{color:transparent}
.bl-form.is-submitting .bl-submit::after{
  content:"";position:absolute;top:50%;left:50%;width:18px;height:18px;margin:-9px 0 0 -9px;
  border-radius:50%;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;
  animation:bl-spin .7s linear infinite;
}
@keyframes bl-spin{to{transform:rotate(360deg)}}
.bl-form.is-submitting input,
.bl-form.is-submitting select{opacity:.6;pointer-events:none}

.bl-status{margin:0;font-size:12.5px;font-weight:600;line-height:1.5;text-align:center;color:var(--bl-soft)}
.bl-status:empty{display:none}
.bl-status.is-error{color:var(--bl-danger)}

/* ---------- success ---------- */
.bl-done{
  display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px;
  padding:16px 0 6px;animation:bl-slide .34s cubic-bezier(.2,.9,.3,1);
}
.bl-done[hidden]{display:none}
.bl-done-mark{
  width:62px;height:62px;display:flex;align-items:center;justify-content:center;
  border-radius:50%;background:var(--bl-teal);color:#fff;
  box-shadow:0 12px 30px rgba(53,199,178,.4);
}
.bl-done-mark svg{width:28px;height:28px}
.bl-done h3{font-family:var(--sans,'Matter',sans-serif);font-size:1.6rem;font-weight:700;margin:0;letter-spacing:-.02em}
.bl-done p{margin:0;max-width:340px;font-size:12.5px;font-weight:500;line-height:1.6;color:var(--bl-soft)}
.bl-done .btn{margin-top:8px;min-width:150px}

/* ---------- honeypot ---------- */
/* Off-screen rather than display:none, so bots that skip hidden inputs still
   fill it, while people and screen readers never reach it. */
.bl-hp{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;opacity:0;pointer-events:none}

/* Stops the page behind the modal scrolling on iOS, where a native dialog
   does not lock the body on its own. */
body.bl-locked{overflow:hidden}

/* ---------- responsive ---------- */
@media(max-width:560px){
  .bl-modal{width:100vw;max-width:100vw;max-height:100dvh;inset:0;margin:0}
  .bl-panel{max-height:100dvh;min-height:100dvh;padding:62px 20px 30px;border-radius:0}
  .bl-modal[open]{animation:bl-sheet .34s cubic-bezier(.2,.9,.3,1)}
  @keyframes bl-sheet{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:none}}
  /* 16px minimum stops iOS Safari zooming the viewport on focus. */
  .bl-field input,.bl-field select{font-size:16px}
}

@media(prefers-reduced-motion:reduce){
  .bl-modal[open],.bl-modal[open]::backdrop,.bl-conditional:not([hidden]),.bl-done{animation:none}
  .bl-form.is-submitting .bl-submit::after{animation:none}
}

/* ==========================================================================
   Step 2 — agreement gate
   ========================================================================== */

/* The fields were direct children of .bl-form and spaced by its gap. Wrapping
   them in .bl-step made them grandchildren, so the gap stopped applying and
   everything below the last field collapsed together. Restate it here. */
.bl-step{display:flex;flex-direction:column;gap:17px}
.bl-step[hidden]{display:none}

.bl-step-intro{
  margin:0 0 16px;font-size:12.5px;font-weight:500;line-height:1.6;color:var(--bl-soft);
}

/* The agreement scroller. overscroll-behavior:contain stops a flick at the
   end of this box from scrolling the panel behind it, which otherwise reads
   as the modal jumping. */
.bl-agree-box{
  max-height:clamp(220px,38vh,360px);
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:20px 22px;
  border:1.5px solid var(--bl-line,#e2ddfd);
  border-radius:16px;
  background:#fbfaff;
  font-size:12px;
  line-height:1.62;
  color:var(--bl-soft);
  scrollbar-width:thin;
  scrollbar-color:#cfd2db transparent;
}
.bl-agree-box:focus-visible{outline:2px solid var(--bl-purple);outline-offset:2px}
.bl-agree-box::-webkit-scrollbar{width:9px}
.bl-agree-box::-webkit-scrollbar-track{background:transparent}
.bl-agree-box::-webkit-scrollbar-thumb{background:#cfd2db;border-radius:999px;border:3px solid transparent;background-clip:content-box}

.bl-agree-box > *{margin:0 0 10px}
.bl-agree-box > *:last-child{margin-bottom:0}
.bl-agree-h{
  font-family:var(--sans,'Matter',sans-serif);font-size:15px;font-weight:700;
  letter-spacing:-.01em;color:var(--bl-ink,#14161c);margin-bottom:14px;
}
.bl-agree-box h4{
  font-family:var(--sans,'Matter',sans-serif);font-size:12.5px;font-weight:700;
  letter-spacing:.04em;text-transform:uppercase;color:var(--bl-purple);
  margin:20px 0 8px;
}
.bl-agree-box h5{
  font-family:var(--sans,'Matter',sans-serif);font-size:12px;font-weight:700;
  color:var(--bl-ink,#14161c);margin:14px 0 6px;
}
.bl-agree-box strong{color:var(--bl-ink,#14161c);font-weight:700}
.bl-agree-box ul,.bl-agree-box ol{margin:0 0 10px;padding-left:18px}
.bl-agree-box li{margin-bottom:5px}
.bl-agree-box table{width:100%;border-collapse:collapse;margin:0 0 12px;font-size:11.5px}
.bl-agree-box th{
  text-align:left;font-weight:700;color:var(--bl-ink,#14161c);
  border-bottom:1.5px solid var(--bl-line,#e2ddfd);padding:6px 8px 6px 0;
}
.bl-agree-box td{border-bottom:1px solid #eeecfb;padding:6px 8px 6px 0;vertical-align:top}
.bl-agree-box th:last-child,.bl-agree-box td:last-child{text-align:right;padding-right:0;white-space:nowrap}
.bl-agree-end{
  margin-top:16px;padding-top:12px;border-top:1.5px solid var(--bl-line,#e2ddfd);
  font-weight:700;color:var(--bl-purple);
}

.bl-agree-hint{
  display:flex;align-items:center;gap:7px;
  margin:10px 0 14px;font-size:11.5px;font-weight:600;color:var(--bl-orange);
}
.bl-agree-hint::before{
  content:"";flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:currentColor;
}
.bl-agree-hint.is-unlocked{color:var(--bl-teal)}

/* Locked checkbox. Not just visually dimmed — the input carries [disabled],
   so it cannot be checked by click, keyboard or script-free autofill. */
.bl-check--gate input[disabled] ~ .bl-check-box{opacity:.4;border-style:dashed}
.bl-check--gate:has(input[disabled]){opacity:.62;cursor:not-allowed}
.bl-check--gate:has(input[disabled]) .bl-check-title{color:var(--bl-soft)}

.bl-back{
  display:block;width:100%;margin-top:12px;padding:6px;
  border:0;background:none;cursor:pointer;
  font-family:inherit;font-size:12px;font-weight:600;color:var(--bl-soft);
  text-decoration:underline;text-underline-offset:3px;
}
.bl-back:hover{color:var(--bl-purple)}

.bl-next{width:100%}

/* ---------- success panel: what happens next ---------- */
.bl-next-steps{
  width:100%;margin-top:4px;padding:18px 20px;
  border:1.5px solid var(--bl-line,#e2ddfd);border-radius:16px;background:#fbfaff;
  text-align:left;
}
/* Two classes, not one: `.bl-done p{margin:0}` further up is (0,1,1) and
   would otherwise out-specify a lone `.bl-next-title`, silently zeroing this
   margin. */
.bl-next-steps .bl-next-title{
  margin:0 0 16px;font-size:10px;letter-spacing:.13em;text-transform:uppercase;
  font-weight:700;color:var(--bl-purple);
}
.bl-next-steps ol{margin:0;padding:0;list-style:none;counter-reset:blstep}
.bl-next-steps li{
  position:relative;padding-left:28px;margin-bottom:13px;counter-increment:blstep;
}
.bl-next-steps li:last-child{margin-bottom:0}
.bl-next-steps li::before{
  content:counter(blstep);
  position:absolute;left:0;top:0;
  width:19px;height:19px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:10px;font-weight:800;color:#fff;background:var(--bl-purple);
}
.bl-next-steps b{
  display:block;font-size:12.5px;font-weight:700;color:var(--bl-ink,#14161c);margin-bottom:2px;
}
.bl-next-steps span{
  display:block;font-size:11.5px;font-weight:500;line-height:1.55;color:var(--bl-soft);
}
.bl-done p{max-width:none}
.bl-panel--done .bl-head{display:none}
.bl-sub[hidden]{display:none}
