/* ============================================================
   Tu Es Belle CE Academy — Assistant widget
   Uses the existing emerald / champagne-gold tokens from style.css.
   Works in both themes; WCAG AA contrast verified in light and dark.
   ============================================================ */

.ce-assistant {
  position: fixed;
  right: clamp(0.75rem, 2vw, 1.5rem);
  bottom: clamp(0.75rem, 2vw, 1.5rem);
  z-index: 900;
  font-family: var(--font-body);
}

/* ---------- Launcher ---------- */
/* Two completely separate pieces (fix 11b, the owner's order): TOP — Belle the Fairy's
   emblem on its own deep-emerald disc with a fine gold ring; BELOW — the
   "Ask Belle" pill on its own emerald bar, with clear open space between
   them. The button itself is transparent, so no single bar sits behind
   both pieces, nothing overlaps, and the old overlapping sparkle is gone. */
.ce-launcher {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  font-family: var(--font-body);
  cursor: pointer;
}
.ce-launcher__disc {
  display: block;
  width: 4rem;
  height: 4rem;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: linear-gradient(160deg, var(--emerald-700), var(--emerald-950));
  box-shadow: 0 10px 30px rgba(2, 25, 18, 0.38);
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.ce-launcher__avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  /* Fix 157: the avatar is the square Academy logo; zoom to the gold TB
     monogram + Texas outline so they fill the round disc (the logo's
     wordmark third is illegible at this size). */
  transform: scale(1.8);
  transform-origin: 45% 20%;
}
.ce-launcher__pill {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.05rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: linear-gradient(160deg, var(--emerald-700), var(--emerald-950));
  color: var(--gold-soft);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 30px rgba(2, 25, 18, 0.38);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), color 0.3s ease;
}
.ce-launcher:hover .ce-launcher__disc,
.ce-launcher:hover .ce-launcher__pill { transform: translateY(-2px); }
.ce-launcher:hover .ce-launcher__pill { color: #FFF6E3; box-shadow: 0 14px 36px rgba(2, 25, 18, 0.46); }
.ce-launcher:focus-visible { outline: none; }
.ce-launcher:focus-visible .ce-launcher__pill { outline: 2px solid var(--gold); outline-offset: 3px; }
.ce-launcher__label { white-space: nowrap; }

.ce-assistant.is-open .ce-launcher { opacity: 0; pointer-events: none; }

@media (max-width: 480px) {
  .ce-launcher { gap: 0.6rem; }
  .ce-launcher__disc { width: 3.5rem; height: 3.5rem; }
  .ce-launcher__pill { padding: 0.45rem 0.8rem; font-size: 0.78rem; }
}

/* ---------- Panel ---------- */
.ce-panel {
  position: fixed;
  right: clamp(0.75rem, 2vw, 1.5rem);
  bottom: clamp(0.75rem, 2vw, 1.5rem);
  width: min(24.5rem, calc(100vw - 1.5rem));
  max-height: min(38rem, calc(100vh - 2rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 24px 70px rgba(2, 25, 18, 0.5);
}
[data-theme='light'] .ce-panel { box-shadow: 0 24px 60px rgba(11, 44, 35, 0.22); }
.ce-panel[hidden] { display: none; }

.ce-panel__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(160deg, var(--emerald-800), var(--emerald-950));
  color: #F3EFE4;
}
.ce-panel__mark { width: 1.75rem; height: 1.75rem; flex: none; color: var(--gold); }
.ce-panel__mark { border-radius: 50%; overflow: hidden; }
.ce-panel__fairy { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.8); transform-origin: 45% 20%; }
.ce-panel__mark svg { width: 100%; height: 100%; }
.ce-panel__mark .ce-sparkle { display: none; }
.ce-panel__titles { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.ce-panel__title { font-family: var(--font-display); font-size: 1.125rem; line-height: 1.15; color: #FBF6E9; }
.ce-panel__who { font-size: 0.6875rem; letter-spacing: 0.02em; line-height: 1.3; color: var(--gold-soft); }
.ce-panel__micro { font-size: 0.625rem; letter-spacing: 0.03em; line-height: 1.3; text-transform: uppercase; color: rgba(243, 239, 228, 0.78); }

.ce-close {
  margin-left: auto;
  flex: none;
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(200, 169, 106, 0.5);
  border-radius: 2px;
  background: transparent;
  color: var(--gold-soft);
  cursor: pointer;
}
.ce-close svg { width: 1rem; height: 1rem; }
.ce-close:hover { background: rgba(200, 169, 106, 0.16); color: #FFF6E3; }
.ce-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Message log ---------- */
.ce-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  font-size: 0.9375rem;
  line-height: 1.55;
  scrollbar-width: thin;
}
.ce-log:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.ce-msg { display: flex; flex-direction: column; gap: 0.25rem; max-width: 100%; }
.ce-msg__who {
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ce-msg__body { border-radius: 3px; padding: 0.7rem 0.85rem; border: 1px solid var(--line-soft); }
.ce-msg__body > p { margin: 0 0 0.55rem; }
.ce-msg__body > p:last-child { margin-bottom: 0; }

.ce-msg--bot .ce-msg__body { background: var(--surface); }
.ce-msg--user { align-items: flex-end; }
.ce-msg--user .ce-msg__body {
  background: rgba(200, 169, 106, 0.14);
  border-color: var(--line);
  max-width: 90%;
}
[data-theme='light'] .ce-msg--bot .ce-msg__body { background: #FFFFFF; }
[data-theme='light'] .ce-msg--user .ce-msg__body { background: #F1EADA; }

.ce-aside {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.02rem;
  color: var(--accent);
}
.ce-outro { color: var(--text-muted); font-size: 0.875rem; }
.ce-fine { color: var(--text-muted); font-size: 0.8125rem; }

.ce-src { list-style: none; margin: 0.5rem 0 0; padding: 0.55rem 0 0; border-top: 1px solid var(--line-soft); }
.ce-src li { margin: 0 0 0.3rem; font-size: 0.8125rem; }
.ce-src a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.ce-src a:hover { color: var(--accent-strong); }

.ce-actionrow { margin-top: 0.65rem; }

/* Typing indicator */
.ce-dots { display: inline-flex; gap: 0.28rem; padding: 0.15rem 0; }
.ce-dots i {
  width: 0.4rem; height: 0.4rem; border-radius: 50%;
  background: var(--accent);
  animation: ce-bounce 1.1s infinite ease-in-out;
}
.ce-dots i:nth-child(2) { animation-delay: 0.15s; }
.ce-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ce-bounce { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Chips ---------- */
.ce-chips { padding: 0 var(--space-4) var(--space-3); border-top: 1px solid var(--line-soft); padding-top: var(--space-3); }
.ce-chips__intro {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.ce-chips__row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ce-chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}
.ce-chip:hover { background: rgba(200, 169, 106, 0.16); }
.ce-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ce-chip--gold { border-color: var(--gold); color: var(--accent); font-weight: 500; }

/* ---------- Form ---------- */
.ce-form { padding: 0 var(--space-4) var(--space-3); }
.ce-label {
  display: block;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.35rem;
}
.ce-inputrow { display: flex; gap: 0.4rem; }
.ce-input {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  padding: 0.6rem 0.7rem;
}
.ce-input::placeholder { color: var(--text-faint); }
.ce-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ce-send {
  flex: none;
  width: 2.6rem;
  border: 1px solid var(--gold);
  border-radius: 2px;
  background: var(--gold);
  color: var(--btn-text-on-gold);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.ce-send svg { width: 1.15rem; height: 1.15rem; }
.ce-send:hover { background: var(--gold-soft); }
.ce-send:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Honeypot — visually hidden, never announced, never tabbed to */
.ce-hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ce-foot {
  margin: 0;
  padding: 0.6rem var(--space-4) 0.8rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted);
  background: var(--bg-alt);
}

/* ---------- Mobile: full-height sheet ---------- */
@media (max-width: 560px) {
  .ce-panel {
    right: 0; left: 0; bottom: 0; top: 0;
    width: 100%;
    max-height: 100%;
    height: 100%;
    height: 100dvh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .ce-log { padding: var(--space-3); }
  .ce-form { padding-bottom: max(var(--space-3), env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .ce-launcher, .ce-chip, .ce-msg__body { transition: none; }
  .ce-dots i { animation: none; }
}

/* Belle's internal deep link to the page an answer comes from */
.ce-deeplink { margin-top: 0.5rem; font-size: 0.8125rem; }
.ce-deeplink a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.ce-deeplink a:hover { color: var(--accent-strong); border-bottom-color: var(--accent); }

/* ---------- Fix 193 — gold borders site-wide (Rozmin's item 66, Nov 6, 2026) ----------
   Belle everywhere: every border inside the assistant is the Academy
   gold #C8A96A, and the launcher medallion + the "Ask Belle" pill wear
   the homepage trial's true 2px gold (the pill was 1px). Borders only. */
.ce-assistant, .ce-assistant *, .ce-assistant *::before, .ce-assistant *::after,
.ce-launcher, .ce-launcher *, .ce-launcher *::before, .ce-launcher *::after { border-color: #C8A96A !important; }
.ce-launcher__disc { border: 2px solid #C8A96A !important; }
.ce-launcher__pill { border: 2px solid #C8A96A !important; }
/* ============ Fix 201 — the business number stays together (Rozmin's order, Nov 6, 2026) ============
   (346) 812-7727 must never split across lines. The number's own links
   (text/call) render on one line, and .keep-together wraps every
   plain-text printing of the number site-wide. */
a[href^="tel:"], a[href^="sms:"] { white-space: nowrap; }
.keep-together { white-space: nowrap; }
