/* ChiAha site guide (chat). Fleet shape: right-pane docked panel on desktop
   (page reflows via padding-right), overlay under 900px. Launcher is the "Ask"
   button in the header nav. Markup is built by /js/site-guide.js.
   Colours are literal brand values with token fallbacks, so the panel looks
   the same on pages that don't link brand.css (privacy, license). */

:root {
  --sg-w: 400px;
  --sg-ground: #0A1A25;
  --sg-surface: #0E2230;
  --sg-card: #1F4560;
  --sg-line: rgba(44,89,119,0.9);
  --sg-text: #EAF3F8;
  --sg-muted: rgba(234,243,248,0.72);
  --sg-sky: #70CEEF;
  --sg-action: #B43F3F;
  --sg-action-hover: #CC4E4E;
}

/* ── Launcher ── */
.sg-ask {
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--sg-text); background: transparent; border: 1px solid rgba(112,206,239,0.45);
  border-radius: 4px; padding: 7px 12px; cursor: pointer; line-height: 1; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.sg-ask:hover, .sg-ask[aria-expanded="true"] { border-color: var(--sg-sky); color: var(--sg-sky); }
.sg-ask svg { width: 12px; height: 12px; flex: none; }
.nav-links li.sg-ask-li { display: flex; align-items: center; }
.nav-links li.sg-ask-li .sg-ask { margin-top: -8px; margin-bottom: -8px; }
.sg-ask-mobile { display: none; }
@media (max-width: 900px) {
  .nav-links li.sg-ask-li { display: none !important; }
  .sg-ask-mobile { display: inline-flex; margin-left: auto; margin-right: 10px; padding: 9px 12px; }
  .sg-ask-mobile + .nav-mobile-toggle { margin-left: 0 !important; }
}
/* Phones: the header also carries the logo, "Schedule a call" and the menu
   button, so the launcher drops its label and keeps the chat icon. */
@media (max-width: 520px) {
  .sg-ask-mobile { padding: 8px 9px; margin-right: 8px; }
  .sg-ask-mobile span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sg-ask-mobile svg { width: 18px; height: 18px; }
}
/* Pages with their own small header (privacy, license) */
.nav .sg-ask-plain { margin-left: auto; }

/* ── Panel ── */
.sg-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--sg-w); max-width: 100vw;
  z-index: 10000; display: none; flex-direction: column;
  background: var(--sg-ground); color: var(--sg-text);
  border-left: 1px solid var(--sg-line); box-shadow: -8px 0 24px rgba(0,0,0,0.45);
  font-family: 'DM Sans', system-ui, sans-serif; font-size: 14px; line-height: 1.5;
}
.sg-panel.open { display: flex; }
.sg-panel *, .sg-panel *::before, .sg-panel *::after { box-sizing: border-box; }
.sg-panel a { color: var(--sg-sky); text-decoration: underline; text-underline-offset: 2px; }
.sg-panel a:hover { color: #A8E0F5; }

/* Floating (not docked) between 900 and 1200px: fixed width, page untouched. */
@media (min-width: 901px) { html.sg-overlay .sg-panel { width: 420px; } }
/* Docking is decided by the script (viewport >= 1200px, so the page keeps at
   least 800px); between 900 and 1200 the panel floats over the page. */
@media (min-width: 901px) {
  html.sg-docked body { padding-right: var(--sg-w); }
  html.sg-docked nav { right: var(--sg-w) !important; }
  html.sg-docked .cc-bar { right: var(--sg-w) !important; }
  body { transition: padding-right 0.2s ease; }
  html.sg-resizing body { transition: none; }
  /* Headlines sized in vw would keep their full-window size while the page
     column is narrower, so size them from the remaining width instead. */
  html.sg-docked .hero .hero-headline { font-size: clamp(34px, calc((100vw - var(--sg-w)) * 0.042), 60px); white-space: normal; }
  html.sg-docked .page-hero h1 { font-size: clamp(32px, calc((100vw - var(--sg-w)) * 0.05), 64px); }
  html.sg-docked .cta-headline { font-size: clamp(30px, calc((100vw - var(--sg-w)) * 0.05), 68px); }
  /* The nav keeps its full desktop layout in a narrower column. */
  html.sg-docked nav { padding-left: 28px !important; padding-right: 28px !important; gap: 16px; }
  html.sg-docked .nav-brand { flex: none; }
  html.sg-docked .nav-links { gap: 22px; }
  html.sg-docked .nav-links a { letter-spacing: 1px; }
  html.sg-docked .nav-cta { white-space: nowrap; padding: 10px 14px; letter-spacing: 1px; }
}
@media (max-width: 900px) {
  .sg-panel { width: 100vw; border-left: none; box-shadow: none; }
  html.sg-overlay, html.sg-overlay body { overflow: hidden; }
}

.sg-resize { position: absolute; top: 0; bottom: 0; left: 0; width: 7px; cursor: col-resize; z-index: 2; display: none; }
html.sg-docked .sg-resize { display: block; }
.sg-resize::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: transparent; transition: background 0.15s; }
.sg-resize:hover::before, .sg-resize.dragging::before { background: var(--sg-sky); }

.sg-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--sg-line); background: var(--sg-surface); flex: none; }
.sg-head-title { font-family: 'Nunito', system-ui, sans-serif; font-weight: 800; font-size: 17px; color: var(--sg-text); }
.sg-head-sub { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 0.06em; color: var(--sg-muted); margin-top: 1px; }
.sg-close { margin-left: auto; background: none; border: 1px solid transparent; color: var(--sg-muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 9px; border-radius: 4px; }
.sg-close:hover { color: var(--sg-text); border-color: var(--sg-line); }

/* Body scrolls as one column: transcript, chips, input, disclosure, rpanels */
.sg-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sg-transcript { flex: 1; min-height: 140px; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 12px; }

.sg-msg { display: flex; gap: 9px; align-items: flex-start; max-width: 100%; }
.sg-msg.user { flex-direction: row-reverse; }
.sg-av { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: 'DM Mono', monospace; font-size: 9.5px; letter-spacing: 0.04em; }
.sg-msg.bot .sg-av { background: var(--sg-surface); border: 1px solid var(--sg-line); }
.sg-msg.bot .sg-av svg { width: 15px; height: 11px; }
.sg-msg.user .sg-av { background: #2C5977; color: var(--sg-text); }
.sg-bub { min-width: 0; max-width: calc(100% - 40px); padding: 9px 12px; border-radius: 12px; overflow-wrap: anywhere; }
.sg-msg.bot .sg-bub { background: var(--sg-card); border-top-left-radius: 4px; }
.sg-msg.user .sg-bub { background: #2C5977; border-top-right-radius: 4px; }
.sg-bub p { margin: 0 0 6px; }
.sg-bub p:last-child { margin-bottom: 0; }
.sg-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.sg-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--sg-muted); animation: sg-dot 1.1s infinite ease-in-out; }
.sg-typing i:nth-child(2) { animation-delay: 0.15s; }
.sg-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes sg-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sg-typing i { animation: none; opacity: 0.7; } body { transition: none !important; } }

.sg-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 10px; flex: none; }
.sg-chips:empty { display: none; }
.sg-chip { font-family: 'DM Sans', system-ui, sans-serif; font-size: 13px; color: var(--sg-text); background: var(--sg-surface); border: 1px solid var(--sg-line); border-radius: 14px; padding: 5px 11px; cursor: pointer; text-align: left; max-width: 100%; }
.sg-chip:hover { border-color: var(--sg-sky); color: var(--sg-sky); }

.sg-input-row { display: flex; gap: 8px; padding: 0 16px; flex: none; }
.sg-input { flex: 1; min-width: 0; resize: none; font: inherit; font-size: 16px; color: var(--sg-text); background: var(--sg-surface); border: 1px solid var(--sg-line); border-radius: 8px; padding: 9px 11px; max-height: 120px; }
.sg-input::placeholder { color: var(--sg-muted); }
.sg-input:focus { outline: 2px solid var(--sg-sky); outline-offset: 0; border-color: transparent; }
.sg-send { flex: none; font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: #fff; background: var(--sg-action); border: none; border-radius: 8px; padding: 0 14px; cursor: pointer; font-weight: 500; }
.sg-send:hover { background: var(--sg-action-hover); }
.sg-send:disabled { opacity: 0.55; cursor: default; }
.sg-disclose { padding: 7px 16px 12px; font-size: 12px; color: var(--sg-muted); flex: none; }
.sg-disclose a { color: var(--sg-muted); }

.sg-rpanels { flex: none; max-height: 38vh; overflow-y: auto; border-top: 1px solid var(--sg-line); }
.sg-panel details.rpanel { border-bottom: 1px solid var(--sg-line); }
.sg-panel details.rpanel > summary { list-style: none; cursor: pointer; padding: 11px 18px; font-family: 'DM Mono', monospace; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sg-muted); display: flex; justify-content: space-between; }
.sg-panel details.rpanel > summary::-webkit-details-marker { display: none; }
.sg-panel details.rpanel > summary::after { content: '+'; color: var(--sg-muted); }
.sg-panel details.rpanel[open] > summary::after { content: '\2212'; }
.sg-panel details.rpanel > summary:hover { color: var(--sg-text); }
.sg-panel .rpanel-body { padding: 0 18px 14px; color: var(--sg-muted); font-size: 13.5px; }
.sg-panel .rpanel-body p { margin: 0 0 8px; }
.sg-panel .rpanel-body ul { margin: 0; padding-left: 18px; }
.sg-panel .rpanel-body li { margin-bottom: 5px; }
.sg-panel .rpanel:has(> div:empty) { display: none; }
.sg-cta { display: inline-block; margin: 4px 0 10px; font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: #fff !important; background: var(--sg-action); padding: 9px 14px; border-radius: 4px; text-decoration: none !important; }
.sg-cta:hover { background: var(--sg-action-hover); }
/* Home keeps "Schedule a call" in the phone header; tighten it so it stays on
   one line next to the Ask icon and the menu button. */
@media (max-width: 520px) {
  nav .nav-right .nav-cta { padding: 10px 11px; letter-spacing: 0.8px; font-size: 11px; white-space: nowrap; }
}
