/* Reflective Data website agent widget.
   Token adapter: map your site's colours to the --rd-* variables below (these defaults suit Starlight and fall back to a neutral palette). */
:root {
  --rd-bg: var(--sl-color-bg, #ffffff);
  --rd-surface: var(--sl-color-bg-nav, var(--sl-color-bg, #ffffff));
  --rd-surface-2: var(--sl-color-gray-6, #f3f4f6);
  --rd-border: var(--sl-color-hairline, var(--sl-color-gray-5, #d9dde3));
  --rd-fg: var(--sl-color-white, #14181d);
  --rd-muted: var(--sl-color-gray-3, #566069);
  --rd-accent: var(--sl-color-text-accent, #1456d6);
  --rd-accent-fg: var(--sl-color-black, #ffffff);
  --rd-red: #c5221f;
}

/* ---- website agent: docked command bar + welcome paths. Unlayered on purpose. ---- */
.rda { position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70; width: min(40rem, calc(100vw - 1.5rem)); font-family: Inter, system-ui, sans-serif; }
.rda * { box-sizing: border-box; }
.rda-bar { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem .45rem .9rem; border: 1px solid var(--rd-border); border-radius: 14px; background: var(--rd-surface); box-shadow: 0 10px 40px rgba(0,0,0,.28); transition: border-color .15s; }
.rda[data-open="true"] .rda-bar, .rda-bar:focus-within { border-color: var(--rd-accent); }
.rda-glyph { color: var(--rd-accent); font: 600 .95rem "JetBrains Mono", ui-monospace, Menlo, monospace; }
.rda-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--rd-fg); font: .875rem "JetBrains Mono", ui-monospace, Menlo, monospace; padding: .45rem 0; }
.rda-input::placeholder { color: var(--rd-muted); }
.rda-kbd { padding: .15rem .45rem; border: 1px solid var(--rd-border); border-radius: 5px; background: var(--rd-surface-2); color: var(--rd-muted); font: .65rem "JetBrains Mono", ui-monospace, Menlo, monospace; }
.rda[data-open="true"] .rda-kbd { display: none; }
.rda-send { width: 2rem; height: 2rem; border: 0; border-radius: 8px; background: var(--rd-accent); color: var(--rd-accent-fg); font: 600 .85rem "JetBrains Mono", ui-monospace, Menlo, monospace; cursor: pointer; }
.rda-busy .rda-send { opacity: .5; pointer-events: none; }
.rda-panel { position: absolute; left: 0; right: 0; bottom: calc(100% + .5rem); display: flex; flex-direction: column; max-height: min(32rem, calc(100vh - 7rem)); border: 1px solid var(--rd-border); border-radius: 14px; background: var(--rd-surface); box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; animation: rda-in .18s ease-out; }
.rda-panel[hidden] { display: none; }
@keyframes rda-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rda-panel, .rdw-card { animation: none; } }
.rda-head { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-bottom: 1px solid var(--rd-border); background: var(--rd-surface-2); }
.rda-title { flex: 1; font: 600 .75rem "JetBrains Mono", ui-monospace, Menlo, monospace; color: var(--rd-fg); } .rda-title b { color: var(--rd-accent); }
.rda-badge { padding: .05rem .4rem; border: 1px solid var(--rd-accent); border-radius: 4px; color: var(--rd-accent); font: 600 .6rem "JetBrains Mono", ui-monospace, Menlo, monospace; }
.rda-head button { border: 0; background: transparent; color: var(--rd-muted); font-size: .85rem; cursor: pointer; padding: .15rem .35rem; border-radius: 4px; } .rda-head button:hover { color: var(--rd-fg); background: var(--rd-surface); }
.rda-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .8rem; min-height: 9rem; }
.rda-hello-t { margin: 0; font: 600 .95rem/1.4 "JetBrains Mono", ui-monospace, Menlo, monospace; color: var(--rd-fg); } .rda-hello-s { margin: .35rem 0 0; font-size: .8rem; color: var(--rd-muted); }
.rda-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; }
.rda-chip { padding: .4rem .7rem; border: 1px solid var(--rd-border); border-radius: 999px; background: var(--rd-bg); color: var(--rd-fg); font: .75rem "JetBrains Mono", ui-monospace, Menlo, monospace; cursor: pointer; text-align: left; } .rda-chip:hover { border-color: var(--rd-accent); color: var(--rd-accent); }
.rda-msg { display: flex; gap: .6rem; align-items: flex-start; } .rda-user { justify-content: flex-end; }
.rda-ava { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; border: 1px solid var(--rd-border); border-radius: 7px; background: var(--rd-surface-2); color: var(--rd-accent); font: 600 .62rem "JetBrains Mono", ui-monospace, Menlo, monospace; }
.rda-bubble { min-width: 0; max-width: 92%; font-size: .85rem; line-height: 1.55; color: var(--rd-fg); }
.rda-bubble p { margin: 0 0 .5rem; } .rda-bubble p:last-child { margin-bottom: 0; }
.rda-bubble ul, .rda-bubble ol { margin: .3rem 0 .5rem; padding-left: 1.1rem; } .rda-bubble li { margin: .15rem 0; }
.rda-bubble a { color: var(--rd-accent); text-decoration: underline; text-underline-offset: 3px; }
.rda-bubble code { padding: .05rem .3rem; border-radius: 4px; background: var(--rd-surface-2); font: .78rem "JetBrains Mono", ui-monospace, Menlo, monospace; }
.rda-user .rda-bubble { padding: .5rem .8rem; border-radius: 14px; background: var(--rd-accent); color: var(--rd-accent-fg); max-width: 85%; } .rda-user .rda-bubble p { margin: 0; }
.rda-sources { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.rda-bubble a.rda-source { padding: .15rem .55rem; border: 1px solid var(--rd-border); border-radius: 999px; background: var(--rd-bg); color: var(--rd-muted); font: .68rem "JetBrains Mono", ui-monospace, Menlo, monospace; text-decoration: none; } .rda-bubble a.rda-source:hover { border-color: var(--rd-accent); color: var(--rd-accent); }
.rda-err { color: var(--rd-red); font-size: .8rem; }
.rda-dots { display: inline-flex; gap: .25rem; padding: .3rem 0; } .rda-dots i { width: .35rem; height: .35rem; border-radius: 50%; background: var(--rd-muted); animation: rda-b 1s infinite ease-in-out; } .rda-dots i:nth-child(2) { animation-delay: .15s; } .rda-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes rda-b { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.rda-note { margin: 0; padding: .5rem .9rem; border-top: 1px solid var(--rd-border); font-size: .65rem; line-height: 1.4; color: var(--rd-muted); } .rda-note a { color: var(--rd-muted); text-decoration: underline; }
.rda-ts { position: fixed; left: 50%; bottom: 5rem; transform: translateX(-50%); z-index: 80; }
@media (max-width: 640px) { .rda { width: calc(100vw - 1rem); } .rda-kbd { display: none; } .rda-panel { max-height: calc(100vh - 6rem); } }
/* agent: expanded chat once the visitor types (wider, from just below the top nav to the bottom) */
.rda { transition: width .2s ease; }
.rda[data-size="large"] { width: min(50rem, calc(100vw - 1.5rem)); }
.rda[data-size="large"] .rda-panel { height: calc(100vh - 9.25rem); height: calc(100dvh - 9.25rem); max-height: none; }
/* agent: clearly active input + meeting CTA under answers */
.rda-input { color: var(--rd-fg); caret-color: var(--rd-accent); }
.rda-input::placeholder { color: var(--rd-muted); opacity: 1; }
.rda[data-open="true"] .rda-bar, .rda-bar:focus-within { box-shadow: 0 10px 40px rgba(0,0,0,.28), 0 0 0 3px color-mix(in srgb, var(--rd-accent) 20%, transparent); }
.rda-bubble button.rda-cta { display: inline-block; margin-top: .7rem; padding: .45rem .9rem; border: 1px solid var(--rd-accent); border-radius: 8px; background: var(--rd-accent); color: var(--rd-accent-fg); font: 600 .75rem "JetBrains Mono", ui-monospace, Menlo, monospace; cursor: pointer; }
.rda-bubble button.rda-cta:hover { filter: brightness(1.08); }

/* agent: lists keep their bullets (the base reset removes them) */
.rda-bubble ul { list-style: disc outside; padding-left: 1.25rem; margin: .35rem 0 .6rem; }
.rda-bubble ol { list-style: decimal outside; padding-left: 1.4rem; margin: .35rem 0 .6rem; }
.rda-bubble li { display: list-item; margin: .2rem 0; padding-left: .1rem; }
.rda-bubble li::marker { color: var(--rd-accent); }
/* agent: an accent border runs around the bar on every page load, then fades back to normal */
@property --rda-a { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
.rda-bar, .rda-fab { position: relative; }
.rda-fab { position: fixed; }
.rda-bar::after, .rda-fab::after { content: ""; position: absolute; inset: -2px; border-radius: inherit; padding: 2px; pointer-events: none; opacity: 0;
  background: conic-gradient(from 0deg, var(--rd-accent) var(--rda-a), transparent var(--rda-a));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.rda-bar.rda-pulse::after, .rda-fab.rda-pulse::after { animation: rda-run 2.4s ease-in-out forwards; }
@keyframes rda-run { 0% { --rda-a: 0%; opacity: 1; } 62% { --rda-a: 100%; opacity: 1; } 82% { --rda-a: 100%; opacity: 1; } 100% { --rda-a: 100%; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rda-bar::after, .rda-fab::after { display: none; } }

/* agent: code blocks */
.rda-code { margin: .55rem 0; border: 1px solid var(--rd-border); border-radius: 8px; background: var(--rd-surface-2); overflow: hidden; }
.rda-code-head { display: flex; align-items: center; justify-content: space-between; padding: .25rem .6rem; border-bottom: 1px solid var(--rd-border); font: .65rem "JetBrains Mono", ui-monospace, Menlo, monospace; color: var(--rd-muted); }
.rda-copy { border: 1px solid var(--rd-border); border-radius: 5px; background: var(--rd-surface); color: var(--rd-muted); font: .65rem "JetBrains Mono", ui-monospace, Menlo, monospace; padding: .1rem .5rem; cursor: pointer; } .rda-copy:hover { color: var(--rd-accent); border-color: var(--rd-accent); }
.rda-bubble .rda-code pre { margin: 0; padding: .65rem .8rem; overflow-x: auto; white-space: pre; background: transparent; }
.rda-bubble .rda-code code { display: block; padding: 0; background: transparent; font: .76rem/1.6 "JetBrains Mono", ui-monospace, Menlo, monospace; color: var(--rd-fg); white-space: pre; }

/* agent: the rest of the page is dimmed while the chat is open */
.rda-backdrop { position: fixed; inset: 0; z-index: 65; background: rgba(8, 10, 13, .34); opacity: 0; transition: opacity .2s ease; cursor: pointer; }
.rda-backdrop[hidden] { display: none; }
.rda-backdrop.rda-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .rda-backdrop { transition: none; } }

/* agent: 16px inputs on touch screens so iOS and Android do not zoom the page when the field is focused */
@media (max-width: 900px), (pointer: coarse) { .rda-input { font-size: 16px; line-height: 1.3; } .rda-send { flex: none; } .rda-bar { padding-right: .4rem; } }

.rda-bubble p, .rda-bubble li, .rda-bubble strong { color: inherit; } .rda-bubble strong { font-weight: 600; }
