/* ============================================================
 * Fern — BloomBridge support assistant
 * Palette carried over from the Fern widget demo:
 * navy #2e4a7a · gold #c9a145 · cream #f5f1e8 · leaf #8fc39a
 * ============================================================ */

.fern {
  /* Site tokens, so Fern reads as part of the page rather than a bolt-on.
   * Her navy chrome is kept deliberately — it marks the assistant as its own
   * voice, distinct from the site's own blue links and gold buttons. */
  --fern-navy: #2e4a7a;
  --fern-gold: #C9A84C;
  --fern-blue: #006a9e;
  --fern-cream: #FAF8F3;
  /* Fern's own messages sit on brand gold. Tuned as a wash rather than full
   * saturation so a long conversation stays calm and the ink keeps ~7:1
   * contrast — raise toward #E8C96A for a stronger yellow. */
  --fern-said: #F8EFD6;
  --fern-said-line: #E7D6A6;
  --fern-card: #FFFFFF;
  --fern-line: #E8E2D6;
  --fern-ink: #2C2520;
  --fern-muted: #8A8078;

  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  color: var(--fern-ink);
  line-height: 1.5;
}

.fern *, .fern *::before, .fern *::after { box-sizing: border-box; }

/* ---------- panel ---------- */
.fern-panel {
  background: var(--fern-card);
  border: 1px solid var(--fern-line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fern-head {
  background: var(--fern-navy);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.fern-av {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--fern-card);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}

.fern-who { flex: 1 1 auto; min-width: 0; }

.fern-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 19px;
  line-height: 1.1;
}
.fern-name span {
  font-size: 12.5px;
  font-style: italic;
  color: var(--fern-gold);
  margin-left: 6px;
  font-family: inherit;
}

.fern-status {
  font-size: 12px;
  opacity: .88;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.fern-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #8fc39a;
  display: inline-block;
}

.fern-x {
  background: none; border: 0; color: #fff;
  font-size: 24px; line-height: 1;
  cursor: pointer; padding: 0 2px;
  opacity: .8; flex: 0 0 auto;
}
.fern-x:hover { opacity: 1; }

/* ---------- messages ---------- */
.fern-body {
  flex: 1 1 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
  background: var(--fern-cream);
}

.fern-bubble {
  background: var(--fern-said);
  border: 1px solid var(--fern-said-line);
  border-radius: 4px 14px 14px 14px;
  padding: 11px 14px;
  font-size: 14.5px;
  max-width: 92%;
  white-space: pre-wrap;
}

.fern-bubble.is-me {
  align-self: flex-end;
  background: var(--fern-navy);
  border-color: var(--fern-navy);
  color: #fff;
  border-radius: 14px 4px 14px 14px;
}

/* ---------- pills ---------- */
.fern-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.fern-pill {
  border: 1px solid var(--fern-navy);
  color: var(--fern-navy);
  background: transparent;
  border-radius: 999px;
  padding: 8px 15px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.35;
  cursor: pointer;
  text-align: left;
  transition: background .14s, color .14s;
}
.fern-pill:hover { background: var(--fern-navy); color: #fff; }
.fern-pill:focus-visible { outline: 2px solid var(--fern-gold); outline-offset: 2px; }

.fern-pill.is-strong {
  background: var(--fern-gold);
  border-color: var(--fern-gold);
  color: #fff;
  font-weight: 600;
}
.fern-pill.is-strong:hover { background: #9A7A30; border-color: #9A7A30; }

.fern-pill.is-quiet {
  border-color: var(--fern-line);
  color: var(--fern-muted);
}
.fern-pill.is-quiet:hover { background: var(--fern-line); color: var(--fern-ink); }

.fern-foot {
  border-top: 1px solid var(--fern-line);
  padding: 10px 14px;
  font-size: 11.5px;
  color: var(--fern-muted);
  text-align: center;
  background: var(--fern-card);
}

/* ---------- floating bubble mode ---------- */
.fern--bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;

  /* The closed panel keeps its size (opacity:0, not display:none), so this
     wrapper is a ~370x580 box pinned to the corner. Without this it silently
     swallows every click in that whole region — nav links, buttons, anything
     underneath. Only the launcher and the OPEN panel accept pointer events. */
  pointer-events: none;
}

.fern--bubble > * { pointer-events: none; }
.fern--bubble .fern-launch { pointer-events: auto; }
.fern--bubble.is-open .fern-panel { pointer-events: auto; }

.fern--bubble .fern-panel {
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 130px);
  box-shadow: 0 16px 44px rgba(46, 74, 122, .22);
  transform: translateY(10px) scale(.98);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease;
}

.fern--bubble.is-open .fern-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.fern-launch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--fern-navy);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 11px 20px 11px 12px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(46, 74, 122, .3);
  transition: transform .15s ease, box-shadow .15s ease;
}
.fern-launch:hover { transform: translateY(-1px); box-shadow: 0 11px 26px rgba(46, 74, 122, .36); }
.fern-launch:focus-visible { outline: 2px solid var(--fern-gold); outline-offset: 3px; }

.fern-launch svg {
  background: var(--fern-card);
  border-radius: 50%;
  padding: 4px;
  width: 28px; height: 28px;
  flex: 0 0 auto;
}

/* ---------- inline mode (contact page) ---------- */
.fern--inline { display: block; margin: 0 0 28px; }

.fern--inline .fern-panel {
  max-width: 640px;
  margin: 0 auto;
  box-shadow: 0 8px 26px rgba(46, 74, 122, .10);
}

.fern--inline .fern-body {
  min-height: 300px;
  max-height: 460px;
}

/* the contact form, revealed only when Fern hands off */
#fern-form-wrap[hidden] { display: none; }

#fern-form-wrap.is-open {
  animation: fern-in .3s ease both;
}

@keyframes fern-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fern *, .fern-launch, #fern-form-wrap { transition: none !important; animation: none !important; }
}

@media (max-width: 520px) {
  .fern--bubble { right: 12px; bottom: 12px; }
  .fern--bubble .fern-panel { height: 66vh; }
  .fern-launch span { display: none; }
  .fern-launch { padding: 12px; }
}

/* ---------- signed-in cards ----------
   Data rendered as structure, not narrated in a sentence — dates, names and
   amounts come straight from the customer's own rows. */
.fern-card {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  background: var(--fern-card);
  border: 1px solid var(--fern-line);
  border-radius: 12px;
  padding: 12px;
  max-width: 92%;
}

.fern-card__img {
  width: 62px; height: 62px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--fern-line);
}

.fern-card__body { flex: 1 1 140px; min-width: 0; }

.fern-card__date {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 19px;
  line-height: 1.15;
  color: var(--fern-ink);
}

.fern-card__items { font-size: 14px; font-weight: 600; margin-top: 2px; }

.fern-card__meta {
  font-size: 13px;
  color: var(--fern-muted);
  line-height: 1.5;
  margin-top: 1px;
}

.fern-card__link {
  flex: 1 0 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--fern-blue);
  text-decoration: none;
  padding-top: 2px;
}
.fern-card__link:hover { text-decoration: underline; }

.fern-list {
  background: var(--fern-card);
  border: 1px solid var(--fern-line);
  border-radius: 12px;
  padding: 4px 12px;
  max-width: 92%;
}

.fern-list__row {
  font-size: 13.5px;
  color: var(--fern-ink);
  padding: 8px 0;
  border-bottom: 1px solid var(--fern-cream);
  line-height: 1.45;
}
.fern-list__row:last-child { border-bottom: 0; }

/* ---------- inline sign-in ---------- */
.fern-login {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--fern-card);
  border: 1px solid var(--fern-line);
  border-radius: 12px;
  padding: 14px;
  max-width: 92%;
}

.fern-login__field {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--fern-line);
  border-radius: 8px;
  padding: 11px 13px;
  font: inherit;
  font-size: 15px;
  color: var(--fern-ink);
  background: #fff;
}
.fern-login__field:focus {
  outline: none;
  border-color: var(--fern-gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, .18);
}

.fern-login__go { width: 100%; text-align: center; cursor: pointer; }
.fern-login__go[disabled] { opacity: .6; cursor: default; }

.fern-login__err {
  color: #9a4a42;
  font-size: 13px;
  line-height: 1.45;
  min-height: 0;
}
.fern-login__err:empty { display: none; }

/* A conversation is waiting on this page — a dot, not a takeover. */
.fern-launch.has-thread { position: relative; }
.fern-launch.has-thread::after {
  content: '';
  position: absolute;
  top: 8px; right: 12px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--fern-gold);
  box-shadow: 0 0 0 2px var(--fern-navy);
}

/* honeypot — present for bots, invisible and unreachable for people */
.fern-pot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.fern-login textarea.fern-login__field { min-height: 96px; resize: vertical; }

/* honeypot — present for bots, invisible and unreachable for people */
.fern-pot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important; height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.fern-login textarea.fern-login__field { min-height: 96px; resize: vertical; }
