/* E4L Support Chat Widget
   Rebranded from the canonical Brand Visual Identity doc (v1, 2026-08-28).
   Client register (Brand doc §2.3): cream/ink base + clay accent — the
   confirmed final choice after comparing all three registers (client/clay,
   core/brass, practitioner/teal) live, including against a recreation of the
   BWS practitioner-portal artifact as a backdrop. The wordmark's "4" and the
   eyebrow labels stay brass/gold regardless of register per the doc's own
   "gold 4 stays gold in every lockup" rule — only interactive chrome
   (buttons, hovers, bubbles) uses clay. Radii follow the app spec (14-22px),
   not the flatter marketing-site spec, since a chat panel is a touch product
   like the GEM app. */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Hanken+Grotesk:wght@400;600;700;800&display=swap');

:root {
  --e4l-cream: #F7F3EA;
  --e4l-cream-2: #FCFAF4;
  --e4l-ink: #1E1C17;
  --e4l-ink-2: #26241E;
  --e4l-charcoal: #2C2A26;
  --e4l-body-ink: #45413A;
  --e4l-slate: #5E594F;
  --e4l-stone: #8A8478;
  --e4l-line: #E6DFCF;

  --e4l-brass: #EFB52A;
  --e4l-gold-deep: #9C7F38;

  --e4l-clay: #A66A3F;
  --e4l-clay-deep: #7E4E2D;

  --e4l-accent: var(--e4l-clay);
  --e4l-accent-hover: var(--e4l-clay-deep);
  --e4l-accent-text: var(--e4l-cream);

  --e4l-user-bubble: var(--e4l-clay);
  --e4l-bot-bubble: var(--e4l-cream-2);

  --e4l-font-serif: 'Cormorant Garamond', Georgia, serif;
  --e4l-font-sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#e4l-launcher {
  position: fixed; bottom: 24px; right: 24px; width: 60px; height: 60px;
  border-radius: 50%; background: linear-gradient(150deg, var(--e4l-clay), var(--e4l-clay-deep) 75%);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 10px 30px -8px rgba(126, 78, 45, 0.45);
  z-index: 999998; border: none; transition: transform 0.15s ease;
}
#e4l-launcher:hover { transform: scale(1.06); }
#e4l-launcher svg { width: 26px; height: 26px; }

#e4l-panel {
  position: fixed; bottom: 96px; right: 24px; width: 380px; height: 560px;
  /* Fits small screens (2026-10-13): at a fixed 380px it ran off the left
     edge of any screen narrower than about 404px, i.e. most phones. */
  max-width: calc(100vw - 24px); max-height: calc(100vh - 112px); max-height: calc(100dvh - 112px);
  background: var(--e4l-cream); border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 70px -24px rgba(30, 22, 8, 0.45);
  display: none; flex-direction: column; z-index: 999999;
  font-family: var(--e4l-font-sans);
  color: var(--e4l-body-ink);
}
#e4l-panel.open { display: flex; }

#e4l-header {
  background: var(--e4l-ink);
  color: var(--e4l-cream); padding: 16px 18px; display: flex; align-items: center; justify-content: space-between;
}
#e4l-header .wordmark {
  font-family: var(--e4l-font-sans); font-weight: 800; font-size: 18px;
  letter-spacing: 0.02em; text-transform: uppercase;
}
#e4l-header .wordmark .four { color: var(--e4l-brass); }
#e4l-header .wordmark .tagline {
  font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 13px;
  color: rgba(247,243,234,0.6); margin-left: 6px;
}
#e4l-header .actions button {
  background: rgba(247,243,234,0.12); border: none; color: var(--e4l-cream); width: 28px; height: 28px;
  border-radius: 8px; cursor: pointer; margin-left: 6px; font-size: 16px; line-height: 1;
  transition: background 0.15s;
}
#e4l-header .actions button:hover { background: rgba(247,243,234,0.22); }

#e4l-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

#e4l-greeting h3 {
  font-family: var(--e4l-font-serif); font-weight: 600; letter-spacing: -0.01em;
  margin: 4px 0 2px; color: var(--e4l-charcoal); font-size: 25px;
}
#e4l-greeting p { margin: 0 0 14px; color: var(--e4l-slate); font-size: 16px; }

.e4l-tile-group { margin-bottom: 14px; }
.e4l-tile-label {
  font-size: 13px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--e4l-gold-deep); margin-bottom: 8px;
}
.e4l-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.e4l-tile {
  background: var(--e4l-cream-2); border: 1px solid var(--e4l-line); border-radius: 16px; padding: 12px 10px;
  text-align: center; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--e4l-charcoal);
  transition: border-color 0.15s;
}
.e4l-tile:hover { border-color: var(--e4l-accent); }
.e4l-tile .icon { display: block; margin: 0 auto 6px; color: var(--e4l-gold-deep); }
.e4l-tile .icon svg { width: 22px; height: 22px; }

.e4l-msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 16px; line-height: 1.5; white-space: pre-wrap; }
.e4l-msg.user { align-self: flex-end; background: var(--e4l-user-bubble); color: var(--e4l-accent-text); border-bottom-right-radius: 4px; }
.e4l-msg.bot { align-self: flex-start; background: var(--e4l-bot-bubble); color: var(--e4l-ink); border: 1px solid var(--e4l-line); border-bottom-left-radius: 4px; }
.e4l-msg.typing { align-self: flex-start; background: var(--e4l-bot-bubble); border: 1px solid var(--e4l-line); color: var(--e4l-stone); font-style: italic; }

#e4l-inputrow { display: flex; gap: 8px; padding: 12px; background: var(--e4l-cream-2); border-top: 1px solid var(--e4l-line); }
#e4l-input {
  flex: 1; border: 1px solid var(--e4l-line); border-radius: 999px; padding: 10px 16px;
  font-size: 16px; outline: none; font-family: inherit; background: var(--e4l-cream); color: var(--e4l-ink);
}
#e4l-input:focus { border-color: var(--e4l-accent); }
#e4l-send {
  width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--e4l-accent);
  color: var(--e4l-accent-text); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
#e4l-send:hover:not(:disabled) { background: var(--e4l-accent-hover); }
#e4l-send:disabled { opacity: 0.5; cursor: default; }

/* Phones (2026-10-13): the panel uses the whole width, with a small margin. */
@media (max-width: 480px) {
  #e4l-panel { left: 12px; right: 12px; width: auto; max-width: none; bottom: 88px; }
  #e4l-launcher { right: 16px; bottom: 16px; }
}
