/* =============================================================
   BriskCoders — inline enquiry form
   Opens underneath a section when its button is clicked and
   submits the section's selected options together with the
   visitor's details through the existing Jotform.

   Self-contained on purpose: the homepage does not load
   css/styles.css, so every value needed is declared here and
   mirrors the site design system (#F4900C orange, #FFF4E5
   cream, #EADBC6 lines, Unbounded headings, Figtree body).

   Visibility is driven by data attributes on <html>, never by
   inline styles, so it stays stable on the homepage where the
   markup is re-rendered by React.
   ============================================================= */

.bbif {
  --bbif-orange: #F4900C;
  --bbif-ink: #000000;
  --bbif-ink-2: #3D3D3D;
  --bbif-ink-3: #5C5C5C;
  --bbif-line: #EADBC6;
  --bbif-field: #D9D2C7;
  --bbif-err: #B4231B;
  --bbif-head: Unbounded, "Arial Black", sans-serif;
  --bbif-body: Figtree, ui-sans-serif, system-ui, sans-serif;

  display: none;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-top: clamp(22px, 3vw, 34px);
  font-family: var(--bbif-body);
  color: var(--bbif-ink);
  text-align: left;
}
.bbif *, .bbif *::before, .bbif *::after { box-sizing: border-box; }

/* ---------- Open / closed ---------- */
html[data-bbif-on~="leaks"]  .bbif[data-bbif="leaks"],
html[data-bbif-on~="quote"]  .bbif[data-bbif="quote"],
html[data-bbif-on~="health"] .bbif[data-bbif="health"],
html[data-bbif-on~="app"]    .bbif[data-bbif="app"] { display: block; }

@media (prefers-reduced-motion: no-preference) {
  html[data-bbif-on] .bbif { animation: bbif-in .34s cubic-bezier(.2,.7,.2,1) both; }
}
@keyframes bbif-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

.bbif-live { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Card ---------- */
.bbif-card {
  background: #FFFFFF;
  border: 1px solid var(--bbif-line);
  border-radius: 28px;
  padding: clamp(20px, 3vw, 36px);
  box-shadow: 0 30px 70px -40px rgba(80, 35, 0, .45);
}
.bbif-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; margin: 0 0 20px; }
.bbif-head-txt { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.bbif-eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #A85A00; }
.bbif-eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--bbif-orange); display: block; flex: none; }
.bbif-title { font-family: var(--bbif-head); font-weight: 600; font-size: clamp(21px, 2.4vw, 28px); line-height: 1.18; letter-spacing: -0.02em; margin: 0; }
.bbif-sub { margin: 0; font-size: 16px; line-height: 1.6; color: var(--bbif-ink-2); max-width: 54ch; }

.bbif-close {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  border: 1.5px solid var(--bbif-ink); background: transparent; color: var(--bbif-ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.bbif-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bbif-close:hover { background: var(--bbif-ink); color: #FFFFFF; }

/* ---------- Fields ---------- */
.bbif form { margin: 0; }
.bbif-fields { display: flex; flex-direction: column; gap: 16px; }
.bbif-row { display: flex; flex-wrap: wrap; gap: 16px; }
.bbif-field { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bbif-field-full { flex: 1 1 100%; }
.bbif-field label { font-size: 14px; font-weight: 600; }
.bbif-field label .bbif-req { color: var(--bbif-orange); }
.bbif-field input,
.bbif-field textarea {
  width: 100%; border: 1.5px solid var(--bbif-field); border-radius: 12px;
  padding: 0 14px; font-family: var(--bbif-body); font-size: 16px;
  background: #FFFFFF; color: var(--bbif-ink);
}
.bbif-field input { height: 50px; }
.bbif-field textarea { min-height: 112px; padding: 13px 14px; line-height: 1.55; resize: vertical; }
.bbif-field input:focus, .bbif-field textarea:focus { border-color: var(--bbif-ink); outline: none; }
.bbif-field input:focus-visible, .bbif-field textarea:focus-visible { outline: 3px solid var(--bbif-orange); outline-offset: 2px; }
.bbif-field input::placeholder, .bbif-field textarea::placeholder { color: #9A9186; }

/* Read-only summary of what the visitor picked in the section above */
.bbif-field input.bbif-sel { background: #FFF9F0; border-style: dashed; color: var(--bbif-ink-2); cursor: default; }
.bbif-note { font-size: 13px; line-height: 1.5; color: var(--bbif-ink-3); }

/* Validation */
.bbif-err { display: none; font-size: 13px; font-weight: 600; color: var(--bbif-err); }
.bbif-field.is-bad input, .bbif-field.is-bad textarea { border-color: var(--bbif-err); }
.bbif-field.is-bad .bbif-err { display: block; }

/* ---------- Actions ---------- */
.bbif-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 2px; }
.bbif-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 56px; padding: 0 30px; border: 0; border-radius: 999px;
  background: var(--bbif-orange); color: var(--bbif-ink);
  font-family: var(--bbif-body); font-size: 17px; font-weight: 700; cursor: pointer;
  transition: transform .2s ease, filter .2s ease;
}
.bbif-submit:hover { transform: translateY(-2px); filter: brightness(.95); }
.bbif-submit svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.bbif-submit[disabled] { cursor: wait; opacity: .72; transform: none; filter: none; }
.bbif-busy { display: none; }
.bbif-privacy { font-size: 13px; color: var(--bbif-ink-3); }

/* Busy state (set on <html>, so React re-renders cannot undo it) */
html[data-bbif-wait~="leaks"]  .bbif[data-bbif="leaks"]  .bbif-label,
html[data-bbif-wait~="quote"]  .bbif[data-bbif="quote"]  .bbif-label,
html[data-bbif-wait~="health"] .bbif[data-bbif="health"] .bbif-label,
html[data-bbif-wait~="app"]    .bbif[data-bbif="app"]    .bbif-label { display: none; }
html[data-bbif-wait~="leaks"]  .bbif[data-bbif="leaks"]  .bbif-busy,
html[data-bbif-wait~="quote"]  .bbif[data-bbif="quote"]  .bbif-busy,
html[data-bbif-wait~="health"] .bbif[data-bbif="health"] .bbif-busy,
html[data-bbif-wait~="app"]    .bbif[data-bbif="app"]    .bbif-busy { display: inline; }

/* ---------- Success ---------- */
.bbif-done { display: none; flex-direction: column; align-items: flex-start; gap: 14px; padding: 6px 0 2px; }
.bbif-done-ok { width: 56px; height: 56px; border-radius: 50%; background: var(--bbif-orange); display: flex; align-items: center; justify-content: center; }
.bbif-done-ok svg { width: 28px; height: 28px; fill: none; stroke: #000; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.bbif-done h3 { font-family: var(--bbif-head); font-weight: 600; font-size: clamp(21px, 2.3vw, 26px); line-height: 1.2; margin: 0; }
.bbif-done p { margin: 0; font-size: 17px; line-height: 1.6; color: var(--bbif-ink-2); max-width: 46ch; }
.bbif-again {
  min-height: 48px; padding: 0 22px; border: 2px solid var(--bbif-ink); border-radius: 999px;
  background: #FFFFFF; color: var(--bbif-ink); font-family: var(--bbif-body);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.bbif-again:hover { background: var(--bbif-ink); color: #FFFFFF; }

html[data-bbif-ok~="leaks"]  .bbif[data-bbif="leaks"]  .bbif-fields,
html[data-bbif-ok~="quote"]  .bbif[data-bbif="quote"]  .bbif-fields,
html[data-bbif-ok~="health"] .bbif[data-bbif="health"] .bbif-fields,
html[data-bbif-ok~="app"]    .bbif[data-bbif="app"]    .bbif-fields { display: none; }
html[data-bbif-ok~="leaks"]  .bbif[data-bbif="leaks"]  .bbif-done,
html[data-bbif-ok~="quote"]  .bbif[data-bbif="quote"]  .bbif-done,
html[data-bbif-ok~="health"] .bbif[data-bbif="health"] .bbif-done,
html[data-bbif-ok~="app"]    .bbif[data-bbif="app"]    .bbif-done { display: flex; }

/* ---------- On a dark section (homepage leak checker) ---------- */
.bbif-on-dark .bbif-card { border-color: rgba(255, 255, 255, .14); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .8); }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .bbif-card { border-radius: 22px; padding: 20px 16px 22px; }
  .bbif-row { gap: 14px; }
  .bbif-field { flex: 1 1 100%; }
  .bbif-submit { width: 100%; }
  .bbif-actions { gap: 12px; }
  .bbif-privacy { text-align: center; width: 100%; }
}
