/* UGO — the floating button, the mobile menu and the "Ask UGO" chat panel (js/ugo-fab.js builds them).
 *
 * The button is green and sits at the bottom right of every public page:
 *   phone in a browser   -> hamburger at 50% opacity; it opens the menu (which has the AI assistant in it)
 *   desktop              -> AI sparkle at full opacity; it opens the chat panel
 *   installed app (PWA)  -> AI sparkle only, on every screen size
 * Layers: the product pages' bottom bar is z-index 800 and its "More" sheet 815-820; the button is 810; the menu and the chat panel
 * sit above everything but toasts while they are open. Light or dark follows the page (js/ugo-fab.js sets data-ugo-theme). */
#ugo-fab-root {
  --uf-surface: #1e1a16; --uf-surface-2: #2a2520; --uf-text: #e9e1da; --uf-muted: #b9aea5; --uf-line: rgba(255,255,255,.11);
  --uf-accent: #ffb4a2; --uf-bot-bg: #2a2520; --uf-user-bg: #e17053; --uf-user-ink: #2b0f08; --uf-focus: #8dcef9;
  --uf-backdrop: rgba(10,8,6,.62); --uf-shadow: 0 -12px 40px rgba(0,0,0,.45);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--uf-text);
}
#ugo-fab-root[data-ugo-theme="light"] {
  --uf-surface: #fff8f5; --uf-surface-2: #f6e4de; --uf-text: #231917; --uf-muted: #5d4d49; --uf-line: rgba(35,25,23,.14);
  --uf-accent: #962f19; --uf-bot-bg: #f6e4de; --uf-user-bg: #962f19; --uf-user-ink: #ffffff; --uf-focus: #005f85;
  --uf-backdrop: rgba(35,25,23,.45); --uf-shadow: 0 -12px 40px rgba(90,40,25,.22);
}
#ugo-fab-root *, #ugo-fab-root *::before, #ugo-fab-root *::after { box-sizing: border-box; }
#ugo-fab-root [hidden] { display: none !important; }

/* ── the button ─────────────────────────────────────────────────────────────────────────────── */
#ugo-fab {
  position: fixed; right: calc(24px + env(safe-area-inset-right, 0px)); bottom: var(--ugo-fab-b, 24px);
  width: 45px; height: 45px; padding: 0; border: 0; border-radius: 50%;       /* 20% smaller than the first version (56px) */
  display: grid; place-items: center; cursor: pointer;
  background: #d4664a; color: #611200;                /* the primary colour and label of every primary button (css/ugo-primary.css) */
  box-shadow: 0 6px 18px rgba(212,102,74,.35), inset 0 1px 0 rgba(255,255,255,.22);
  z-index: 810; -webkit-tap-highlight-color: transparent;
  transition: opacity .2s ease, transform .2s ease, bottom .25s ease, background-color .2s ease;
}
#ugo-fab:hover { filter: brightness(.94); }
#ugo-fab:active { transform: scale(.94); }
#ugo-fab:focus-visible { outline: 3px solid var(--uf-focus); outline-offset: 3px; }
#ugo-fab svg { grid-area: 1 / 1; width: 21px; height: 21px; transition: opacity .18s ease, transform .22s ease; }
/* one icon at a time */
#ugo-fab .i-menu, #ugo-fab .i-ai, #ugo-fab .i-close { opacity: 0; transform: rotate(-45deg) scale(.6); }
#ugo-fab[data-mode="menu"] .i-menu { opacity: 1; transform: none; }
#ugo-fab[data-mode="ai"] .i-ai { opacity: 1; transform: none; }
#ugo-fab.is-open .i-menu, #ugo-fab.is-open .i-ai { opacity: 0; transform: rotate(45deg) scale(.6); }
#ugo-fab.is-open .i-close { opacity: 1; transform: none; }
/* the hamburger is at half opacity on a phone, until it is open, focused or pressed */
#ugo-fab[data-mode="menu"]:not(.is-open):not(:focus-visible):not(:active) { opacity: .5; }
@media (hover: hover) { #ugo-fab[data-mode="menu"]:hover { opacity: 1; } }
/* the full-screen chat on a phone has its own close button */
#ugo-fab.is-away { opacity: 0; pointer-events: none; transform: scale(.7); }
@media (max-width: 768px) {
  #ugo-fab { right: calc(16px + env(safe-area-inset-right, 0px)); width: 42px; height: 42px; }
  #ugo-fab svg { width: 19px; height: 19px; }
}
#ugo-fab.is-open { z-index: 2100; }

/* ── menu (a sheet that rises from the bottom) ──────────────────────────────────────────────── */
#ugo-menu { position: fixed; inset: 0; z-index: 2050; }
.ugo-menu__backdrop { position: absolute; inset: 0; background: var(--uf-backdrop); opacity: 0; transition: opacity .22s ease; }
.ugo-menu__sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: min(86vh, 680px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--uf-surface); color: var(--uf-text); border-radius: 22px 22px 0 0; box-shadow: var(--uf-shadow);
  padding: 8px 8px calc(72px + env(safe-area-inset-bottom, 0px));
  transform: translateY(102%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
}
#ugo-menu.is-in .ugo-menu__backdrop { opacity: 1; }
#ugo-menu.is-in .ugo-menu__sheet { transform: none; }
.ugo-menu__sheet:focus { outline: none; }
.ugo-menu__grab { width: 40px; height: 4px; border-radius: 4px; background: var(--uf-line); margin: 4px auto 10px; }
.ugo-menu__head { display: flex; align-items: center; gap: 10px; padding: 2px 14px 10px; font-weight: 700; font-size: 1.05rem; }
.ugo-menu__head .ugo-mark { font-size: 30px; color: var(--uf-text); }
.ugo-menu__label { margin: 14px 14px 4px; font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--uf-muted); }
.ugo-menu__item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 14px; margin: 0;
  border: 0; border-radius: 12px; background: transparent; color: var(--uf-text); font: inherit; font-weight: 600; text-align: left;
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ugo-menu__item:hover { background: var(--uf-surface-2); }
.ugo-menu__item:focus-visible { outline: 3px solid var(--uf-focus); outline-offset: -3px; }
.ugo-menu__item[aria-current="page"] { background: var(--uf-surface-2); color: var(--uf-accent); }
.ugo-menu__item .chev { margin-left: auto; width: 16px; height: 16px; color: var(--uf-muted); flex: none; }
.ugo-menu__item small { display: block; font-weight: 500; font-size: .8rem; color: var(--uf-muted); }
.ugo-menu__item svg.lead { width: 22px; height: 22px; flex: none; color: var(--uf-accent); }
.ugo-menu__ai { background: var(--uf-surface-2); margin-bottom: 6px; }
.ugo-menu__wa svg.lead { color: #3ea271; }

/* ── chat panel ─────────────────────────────────────────────────────────────────────────────── */
#ugo-ai {
  position: fixed; right: calc(24px + env(safe-area-inset-right, 0px)); bottom: calc(var(--ugo-fab-b, 24px) + 57px);
  width: min(390px, calc(100vw - 32px)); height: min(580px, calc(100vh - var(--ugo-fab-b, 24px) - 96px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--uf-surface); color: var(--uf-text); border: 1px solid var(--uf-line); border-radius: 18px;
  box-shadow: 0 18px 54px rgba(0,0,0,.4); z-index: 2050;
  opacity: 0; transform: translateY(14px) scale(.98); transform-origin: 100% 100%; transition: opacity .2s ease, transform .22s ease;
}
#ugo-ai.is-in { opacity: 1; transform: none; }
.ugo-ai__head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--uf-line); }
.ugo-ai__orb { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #d4664a; color: #611200; flex: none; }
.ugo-ai__orb svg { width: 18px; height: 18px; }
.ugo-ai__title { font-weight: 700; line-height: 1.15; }
.ugo-ai__sub { font-size: .75rem; color: var(--uf-muted); }
.ugo-ai__spacer { flex: 1; }
.ugo-ai__btn {
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--uf-muted); display: grid; place-items: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ugo-ai__btn:hover { background: var(--uf-surface-2); color: var(--uf-text); }
.ugo-ai__btn:focus-visible { outline: 3px solid var(--uf-focus); outline-offset: -3px; }
.ugo-ai__btn svg { width: 20px; height: 20px; }
.ugo-ai__log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; }
.ugo-ai__msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; }
.ugo-ai__msg p { margin: 0 0 8px; } .ugo-ai__msg p:last-child { margin-bottom: 0; }
.ugo-ai__msg ul { margin: 0 0 8px; padding-left: 20px; list-style: disc; } .ugo-ai__msg ul:last-child { margin-bottom: 0; } .ugo-ai__msg li { margin: 2px 0; }
.ugo-ai__msg a { color: var(--uf-accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ugo-ai__msg.bot { align-self: flex-start; background: var(--uf-bot-bg); border-bottom-left-radius: 5px; }
.ugo-ai__msg.me { align-self: flex-end; background: var(--uf-user-bg); color: var(--uf-user-ink); border-bottom-right-radius: 5px; white-space: pre-wrap; }
.ugo-ai__msg.err { align-self: flex-start; background: transparent; border: 1px solid var(--uf-line); }
.ugo-ai__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ugo-ai__act {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--uf-line);
  background: var(--uf-surface); color: var(--uf-text); font: inherit; font-size: .85rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.ugo-ai__act:hover { background: var(--uf-surface-2); }
.ugo-ai__act:focus-visible { outline: 3px solid var(--uf-focus); outline-offset: 2px; }
.ugo-ai__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 14px 10px; }
.ugo-ai__typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.ugo-ai__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--uf-muted); animation: ugoAiDot 1.1s infinite ease-in-out; }
.ugo-ai__typing i:nth-child(2) { animation-delay: .15s; } .ugo-ai__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ugoAiDot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ugo-ai__form { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px 6px; border-top: 1px solid var(--uf-line); }
.ugo-ai__input {
  flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 11px 13px; border-radius: 14px; border: 1px solid var(--uf-line);
  background: var(--uf-surface-2); color: var(--uf-text); font: inherit; font-size: 16px; line-height: 1.35;
}
.ugo-ai__input::placeholder { color: var(--uf-muted); }
.ugo-ai__input:focus-visible { outline: 3px solid var(--uf-focus); outline-offset: 1px; }
.ugo-ai__send {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: #d4664a; color: #611200; display: grid; place-items: center; cursor: pointer;
}
.ugo-ai__send:disabled { opacity: .4; cursor: default; }
.ugo-ai__send:focus-visible { outline: 3px solid var(--uf-focus); outline-offset: 2px; }
.ugo-ai__send svg { width: 20px; height: 20px; }
.ugo-ai__note { padding: 0 14px 10px; font-size: .72rem; color: var(--uf-muted); }
.ugo-ai__note a { color: inherit; text-decoration: underline; }

/* the chat is the whole screen on a phone; it follows the visible area, so the keyboard does not hide the box */
@media (max-width: 768px) {
  #ugo-ai { left: 0; right: 0; top: var(--ugo-vv-top, 0px); bottom: auto; width: auto; height: var(--ugo-vv-h, 100dvh); border: 0; border-radius: 0; transform: translateY(24px); }
  #ugo-ai.is-in { transform: none; }
  .ugo-ai__head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .ugo-ai__note { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
}
/* ── the product pages' bottom bar ──────────────────────────────────────────────────────────────
   The six-item quick-links bar (and its "More" sheet) that js/components.js adds to the Signage, Link, Order, Dev, Preach and Blog pages is
   gone on a phone in a browser tab: the floating button's menu is the navigation there. The page also stops reserving room for it
   (css/styles.css gives the body 70px of bottom padding, 66px on the smallest phones).
   `display-mode: browser` is only true in a normal browser tab. In an installed app (standalone / fullscreen / minimal-ui) the button is the
   AI icon only and has no menu, so the bar stays there as the way to move around. */
@media (max-width: 768px) and (display-mode: browser) {
  #mobileBottomNav, .bnav-more-menu, .bnav-more-overlay { display: none !important; }
  body:has(> #mobileBottomNav) { padding-bottom: 0 !important; }
}

/* the page behind a full-screen chat or the open menu does not scroll */
html.ugo-lock, html.ugo-lock body { overflow: hidden !important; }

@media (prefers-reduced-motion: reduce) {
  #ugo-fab, #ugo-fab svg, .ugo-menu__backdrop, .ugo-menu__sheet, #ugo-ai { transition: none !important; }
  .ugo-ai__typing i { animation: none; opacity: .6; }
}
@media print { #ugo-fab-root { display: none !important; } }
