/* ===========================================================================
   BOOK A CALL — centered modal (.bcall*), opened from every "Book a call"
   CTA (topbar pill, service cards, closer). One question per step, three
   steps, then a success screen with an optional Calendly handoff. A quiet
   "email us instead" copy-chip lives on the panel floor.
   Motion: iOS-sheet feel — the panel settles in on the Ionic drawer curve
   (translateY + scale + fade over a blurred ink veil); steps slide
   horizontally, forward = in from the right. Logic in js/book-call.js.
   Lives outside .pages, so the site tokens are re-declared here (same
   pattern as css/footer.css). Page language: paper, ink, hairlines,
   grotesque + mono.
   =========================================================================== */

.bcall {
  /* site tokens (mirror css/pages.css) */
  --ink: #38393d;
  --ink-body: #3a3a38;
  --ink-soft: #6b6b69;
  --hair: rgba(56, 57, 61, 0.13);
  --paper: #f4f3ef;
  --fs-label: 0.72rem;
  --fs-body: clamp(1.02rem, 0.97rem + 0.3vw, 1.18rem);
  --fs-statement: clamp(1.4rem, 1.15rem + 1.05vw, 1.9rem);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --lead-read: 1.42;
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);   /* iOS drawer curve */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);   /* easeOutQuint */

  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: clamp(0.9rem, 3vw, 2rem);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.bcall[hidden] { display: none; }

/* scroll lock while open (Lenis is paused in JS; this covers native/touch) */
html.bcall-lock,
html.bcall-lock body { overflow: hidden; }

/* ---- veil ---------------------------------------------------------------- */
.bcall__veil {
  position: absolute;
  inset: 0;
  background: rgba(30, 30, 33, 0.42);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  backdrop-filter: blur(10px) saturate(1.15);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.bcall.is-open .bcall__veil { opacity: 1; }

/* ---- panel --------------------------------------------------------------- */
.bcall__panel {
  position: relative;
  width: min(100%, 34rem);
  max-height: min(88dvh, 46rem);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* glass, tinted to the site's paper so it stays on-brand: translucent
     panel over the blurred page, bright top edge catching the light */
  background: rgba(244, 243, 239, 0.78);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  backdrop-filter: blur(28px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 22px;
  box-shadow: 0 32px 80px -28px rgba(20, 20, 22, 0.5),
              inset 0 1px 0 rgba(255, 255, 255, 0.55);
  padding: clamp(1.3rem, 3vw, 2rem) clamp(1.3rem, 3vw, 2.2rem);
  opacity: 0;
  transform: translateY(18px) scale(0.955);
  transition: opacity 0.34s ease, transform 0.46s var(--ease-ios);
  will-change: transform;
}
/* the sheet itself is not interactive — no focus ring when it takes focus */
.bcall__panel:focus,
.bcall__panel:focus-visible { outline: none; }

/* no backdrop-filter support → solid paper panel */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .bcall__panel { background: var(--paper); }
}
@media (prefers-reduced-transparency: reduce) {
  .bcall__panel {
    background: var(--paper);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
.bcall.is-open .bcall__panel { opacity: 1; transform: none; }
/* exit is quicker than enter */
.bcall.is-closing .bcall__veil { opacity: 0; transition-duration: 0.22s; }
.bcall.is-closing .bcall__panel {
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.22s ease;
}

/* ---- header: just back / close — the progress slider says the rest ------- */
.bcall__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.9rem;
  min-height: 2rem;
}
.bcall__back {
  margin: 0;
  padding: 0.2rem 0.1rem;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;               /* also removes it from tab order */
  transform: translateX(4px);
  transition: opacity 0.25s ease, transform 0.3s var(--ease-out),
              visibility 0s linear 0.25s;
}
.bcall__back.is-on {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: none;
  transition: opacity 0.25s ease, transform 0.3s var(--ease-out), visibility 0s;
}
.bcall__x {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--hair);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1;
  transition: background 0.25s ease, color 0.25s ease, transform 0.16s ease-out;
}
.bcall__x:hover { background: var(--ink); color: var(--paper); }
.bcall__x:active { transform: scale(0.94); }

/* progress slider under the header — now the sole step indicator, so it gets
   a touch more presence than a hairline */
.bcall__progress {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--hair);
  margin: 0.9rem 0 0;
  overflow: hidden;
}
.bcall__progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s var(--ease-out);
}

/* ---- stage / steps -------------------------------------------------------- */
.bcall__stage {
  position: relative;
  margin-top: clamp(1.3rem, 2.6vw, 1.8rem);
  transition: height 0.38s var(--ease-ios);
  overflow: hidden;
}
.bcall__step {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(30px);
  transition: opacity 0.28s ease, transform 0.34s var(--ease-out),
              visibility 0s linear 0.34s;
}
.bcall__step.is-left { transform: translateX(-30px); }
.bcall__step.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.3s ease 0.08s, transform 0.38s var(--ease-out) 0.08s,
              visibility 0s;
}

.bcall__q {
  display: block;
  margin: 0 0 clamp(1rem, 2vw, 1.4rem);
  padding: 0;
  font-size: var(--fs-statement);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.18;
  color: var(--ink);
}

/* ---- step 1: choice chips ------------------------------------------------- */
.bcall__chips {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.bcall__chip {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.95rem 1.15rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(56, 57, 61, 0.06);
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease,
              transform 0.16s ease-out;
}
.bcall__chip:hover { border-color: var(--ink); }
.bcall__chip:active { transform: scale(0.98); }
.bcall__chip.is-picked { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.bcall__chip-t {
  display: block;
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.25;
}
.bcall__chip-s {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.bcall__chip.is-picked .bcall__chip-s { color: rgba(244, 243, 239, 0.75); }

/* ---- steps 2/3: fields ----------------------------------------------------- */
.bcall__field {
  display: block;
  position: relative;         /* anchors the inline error, top-right */
  margin: 0 0 1.15rem;
}
.bcall__lab {
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.bcall__input {
  display: block;
  width: 100%;
  padding: 0.45em 0 0.5em;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hair);
  border-radius: 0;
  font-family: inherit;
  font-size: var(--fs-body);
  color: var(--ink-body);
  transition: border-color 0.25s ease;
}
.bcall__input:focus {
  outline: none;
  border-bottom-color: var(--ink);
}
.bcall__input::placeholder { color: rgba(107, 107, 105, 0.55); }
/* Inline error — floats on the field's label line (top-right), so showing it
   never shifts or expands the layout. */
.bcall__err {
  position: absolute;
  top: 0;
  right: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.06em;
  color: var(--ink);
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s ease;
}
.bcall__err.is-on { opacity: 1; transform: none; }
/* the field's underline also flags the error */
.bcall__field:has(.bcall__err.is-on) .bcall__input { border-bottom-color: var(--ink); }
/* submit failure note lives in flow under the button (rare, needs the room) */
.bcall__submit-err {
  position: static;
  display: none;
  margin-top: 0.85rem;
  transform: none;
}
.bcall__submit-err.is-on { display: block; opacity: 1; }

/* continue / submit — same pill language as every site CTA */
.bcall__go {
  margin-top: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 1.4em;
  background: none;
  border: 1px solid var(--ink);
  border-radius: 100px;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.3s var(--ease-out), color 0.3s var(--ease-out),
              transform 0.16s ease-out, opacity 0.2s ease;
}
.bcall__go:hover { background: var(--ink); color: var(--paper); }
.bcall__go:active { transform: scale(0.97); }
.bcall__go[disabled] { opacity: 0.55; pointer-events: none; }

/* ---- success -------------------------------------------------------------- */
.bcall__done-eyebrow {
  margin: 0 0 0.7rem;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.bcall__done-msg {
  margin: 0 0 1.3rem;
  font-size: var(--fs-statement);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.22;
  color: var(--ink);
}
.bcall__cal {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.9em 1.5em;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 100px;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.3s var(--ease-out), color 0.3s var(--ease-out),
              transform 0.16s ease-out;
}
.bcall__cal:hover { background: none; color: var(--ink); }
.bcall__cal:active { transform: scale(0.97); }
.bcall__done-note {
  margin: 0.9rem 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

/* ---- floor: email escape hatch --------------------------------------------- */
.bcall__foot {
  margin-top: clamp(1.4rem, 2.8vw, 1.9rem);
  padding-top: clamp(0.9rem, 1.8vw, 1.2rem);
  border-top: 1px solid var(--hair);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.bcall__foot-cap {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.bcall__copy {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.55em 0.95em;
  background: none;
  border: 1px solid var(--hair);
  border-radius: 100px;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease,
              transform 0.16s ease-out;
}
.bcall__copy:hover { border-color: var(--ink); }
.bcall__copy:active { transform: scale(0.97); }
.bcall__copy.is-copied { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.bcall__copy-k { text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-soft); }
.bcall__copy.is-copied .bcall__copy-k { color: rgba(244, 243, 239, 0.75); }

/* honeypot — visually gone, present for bots */
.bcall__hp {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---- reduced motion --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .bcall__veil,
  .bcall__panel,
  .bcall__step,
  .bcall__back,
  .bcall__progress-fill { transition: opacity 0.2s linear; transform: none; }
  .bcall__stage { transition: none; }
}

/* ---- phones: inline errors in flow + comfortable touch targets -------------
   The absolute top-right error slot collides with the field label on narrow
   screens ("brand / company" + "we need a name…" share one line). In flow,
   the note slides open under its own field — nothing ever overlaps. The
   stage height re-syncs from js/book-call.js when an error toggles. -------- */
@media (max-width: 720px) {
  .bcall__err {
    position: static;
    display: block;
    max-height: 0;
    margin: 0;
    overflow: hidden;
    transform: translateY(-3px);
    transition: max-height 0.3s var(--ease-out), opacity 0.22s ease,
                transform 0.3s var(--ease-out), margin 0.3s var(--ease-out);
  }
  .bcall__err.is-on {
    max-height: 3.4em;
    margin-top: 0.5rem;
  }
  /* the submit-failure note keeps its own in-flow rules */
  .bcall__submit-err { max-height: none; overflow: visible; }

  /* touch targets: 44px-class close, full-width continue/submit, a roomier
     back hit-area (padding grows inward, layout position unchanged) */
  .bcall__x { width: 2.75rem; height: 2.75rem; }
  .bcall__back { padding: 0.65rem 0.5rem; margin: -0.45rem 0 -0.45rem -0.5rem; }
  .bcall__go {
    width: 100%;
    justify-content: center;
    min-height: 3.1rem;
    margin-top: 0.6rem;
  }
  .bcall__cal { min-height: 3.1rem; }
  .bcall__copy { min-height: 2.75rem; }
  .bcall__field { margin-bottom: 1.3rem; }
  /* a touch more breathing room between question and fields */
  .bcall__q { margin-bottom: 1.15rem; }
}
