/* The chat button and its panel (chat-launcher.js). Built on origination.css
   tokens; scoped to .chat-launch and .chat-panel so nothing else on a page
   changes. */

.chat-launch{position:fixed;z-index:60;
  right:calc(24px + env(safe-area-inset-right,0px));bottom:calc(24px + env(safe-area-inset-bottom,0px));
  display:inline-flex;align-items:center;gap:10px;min-height:56px;padding:0 22px 0 18px;border:0;border-radius:999px;
  background:var(--ink,#040912);color:var(--paper,#f4f2ed);font-family:var(--sans,'Inter Tight',system-ui,sans-serif);font-size:var(--fs-xs,12.5px);
  font-weight:500;letter-spacing:.12em;text-transform:uppercase;cursor:pointer;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.18),0 1px 2px rgba(4,9,18,.2),0 8px 22px -8px rgba(4,9,18,.45)}
.chat-launch svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linejoin:round}
.chat-launch:focus-visible{outline:none;filter:brightness(1.3)}
@media (hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference){
  .chat-launch{transition:transform .2s cubic-bezier(.22,1,.36,1)}
  .chat-launch:hover{transform:translateY(-1px)}
}

.chat-panel{position:fixed;z-index:61;right:calc(24px + env(safe-area-inset-right,0px));
  bottom:calc(92px + env(safe-area-inset-bottom,0px));width:min(480px,calc(100vw - 48px));
  /* Clear of the floating menu (it ends 102px down): the window's top stays
     20px under it, the same 20px the menu keeps from the top of the screen. */
  height:min(780px,calc(100vh - 92px - 122px));display:flex;flex-direction:column;overflow:hidden;overflow:clip;
  background:var(--paper,#f4f2ed);border:1px solid var(--hair-strong,rgba(4,9,18,.26));border-radius:var(--radius,18px);
  box-shadow:0 24px 60px -20px rgba(4,9,18,.45)}
.chat-panel[hidden]{display:none}
/* THE TITLE IS CENTRED, as every Register a Mandate heading on the site is
   (.intake-head, "centred, as quote.html", UI-DECISIONS section 9), with the
   close button balanced by an equal empty column on the left so the title sits
   on the window's true centre (the three-column bar of design book
   rule.layout.nav-never-moves). Its type is the form's 19px step heading:
   Cormorant 500, uppercase, .1em (.review-group h3; public-site capitals,
   rule.copy.casing-per-surface). */
.chat-panel-head{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:8px;
  padding:6px 8px;border-bottom:1px solid var(--hair,rgba(4,9,18,.16));flex:none}
.chat-panel-title{grid-column:2;margin:0;text-align:center;text-wrap:balance;font-family:var(--serif,'Cormorant',Georgia,serif);font-weight:500;
  font-size:19px;line-height:1.25;letter-spacing:.1em;text-transform:uppercase;color:var(--ink,#040912)}
.chat-panel-close{grid-column:3}
.chat-panel-title:focus{outline:none}
.chat-panel-close{display:grid;place-items:center;width:44px;height:44px;border:0;border-radius:999px;
  background:transparent;color:var(--ink,#040912);cursor:pointer}
.chat-panel-close svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}
.chat-panel-close:hover{background:rgba(4,9,18,.05)}
.chat-panel-close:focus-visible{outline:none;background:rgba(4,9,18,.08)}
.chat-panel-frame{flex:1;width:100%;border:0;background:var(--paper,#f4f2ed)}

/* A phone: the button is a round icon, and the chat opens as a window above
   it with the page still showing round its edge (owner, 25 Nov: "doesnt need
   to open up full page just a suffice rectangular window"). */
@media (max-width:640px){
  .chat-launch{right:calc(16px + env(safe-area-inset-right,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));
    width:56px;padding:0;justify-content:center}
  .chat-launch-text{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .chat-panel{left:calc(12px + env(safe-area-inset-left,0px));right:calc(12px + env(safe-area-inset-right,0px));
    width:auto;top:calc(88px + env(safe-area-inset-top,0px));bottom:calc(84px + env(safe-area-inset-bottom,0px));height:auto}
}

/* A FOCUSED BUTTON DARKENS; IT DOES NOT UNDERLINE (design book rule.focus.no-boxes:
   "a focused link underlines, a focused button darkens slightly"). The site's
   pill buttons are links, so origination.css's link underline reached them: the
   Register a Mandate pill showed underlined text when focus came back to it
   after the chat window closed. Only those pills, and only on the pages that
   carry the chat button; nothing else on the live pages changes. */
a.btn[href$="/originations/mandate"]:focus-visible{text-decoration:none;filter:brightness(.93)}

/* OPEN, THE WINDOW TAKES THE BUTTON'S PLACE: the button hides and the window
   runs down to the button's own 24px margin (16px on a phone), so the whole
   details card fits a laptop window without scrolling. The window's own
   close (x) and Escape shut it, and the button comes back. */
html.chat-open .chat-launch{display:none}
html.chat-open .chat-panel{bottom:calc(24px + env(safe-area-inset-bottom,0px));
  height:min(780px,calc(100vh - 24px - 122px))}
@media (max-width:640px){
  html.chat-open .chat-panel{bottom:calc(16px + env(safe-area-inset-bottom,0px));height:auto}
}

/* A PHONE: THE CHAT IS A FULL-SCREEN SHEET (owner, 30 Nov: "why so big on
   phone?" and "let's do what the best in the world do"). This supersedes his
   25 Nov ruling for a rectangular window on a phone. It covers the whole screen,
   the site's bar included, so nothing peeks behind it; its own head keeps the
   title and close, clear of the notch and home bar. */
@media (max-width:760px){
  .chat-panel,html.chat-open .chat-panel{inset:0;width:auto;height:auto;border:0;border-radius:0;box-shadow:none;
    padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
}

/* THE ROUND BUTTON NEVER SITS ON A ROW'S CONTROL WHEN IT MATTERS (screen
   check, 30 Nov): on a phone, jumping or tabbing to anything stops 88px above
   the bottom (the button's 56px, its 16px margin and 16px clear), and an FAQ
   list ends with that much room, so its last row can always rest above the
   button. */
@media (max-width:640px){
  html:not([data-members-portal]){scroll-padding-bottom:calc(88px + env(safe-area-inset-bottom,0px))}
  .faq-audience>.faq-list{padding-bottom:88px}
}
