/* Ask Alfred (2026-11-29): the floating button + panel on member pages, and the full page (ask-alfred.html).
   Every rule is scoped to .aa-w (the widget / page root) or an aa- class, so nothing leaks into the site's own styles.
   Palette = "The Briefing" colors Lynn picked (sample B). */
.aa-w, .aa-toast {
  --aa-paper: #f4f3ed; --aa-ink: #1e2420; --aa-ink-soft: #545e56; --aa-line: #dcdace; --aa-card: #fbfaf6;
  --aa-accent: #0e5a4f; --aa-on-accent: #fff;
  --aa-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --aa-sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --aa-mono: "SF Mono", ui-monospace, "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  --aa-fill: #0e5a4f;            /* filled buttons/bubbles (white text on it); = accent in light, deeper than it in dark */
  --aa-input: #fff; --aa-wash: rgba(14,90,79,.08); --aa-pmap-a: #fbfaf6; --aa-pmap-b: #f4f3ed;
  /* map (engine.js reads --land / --glow-col from the map's host element; keep them 6-digit hex) */
  --land: #e3e1d6; --land-hover: #d3d1c4; --border: #fbfaf6; --glow-col: #0e5a4f; --hit: #c9a25a; --flash: #b0761c;
  --aa-scan: #8fc2b5; --aa-searched: #a9d3c8;
}
/* Dark (2026-11-30, Lynn: follow the device everywhere): the site's own dark palette (site.css), Alfred's accents
   kept readable: text/links in a light teal, filled shapes in a deeper teal that still carries white text. */
@media (prefers-color-scheme: dark) {
  .aa-w, .aa-toast {
    --aa-paper: #12150f; --aa-ink: #eceadd; --aa-ink-soft: #a7ad9f; --aa-line: #2c3227; --aa-card: #1a1e16;
    --aa-accent: #6fd1ba; --aa-fill: #1d7a68; --aa-on-accent: #fff;
    --aa-input: #22271e; --aa-wash: rgba(86,195,170,.12); --aa-pmap-a: #1a1e16; --aa-pmap-b: #12150f;
    --land: #2b3126; --land-hover: #3a4232; --border: #1a1e16; --glow-col: #56c3aa; --hit: #d4ac62; --flash: #e8a33c;
    --aa-scan: #4f9a89; --aa-searched: #3f7468;
  }
}
.aa-w, .aa-w * { box-sizing: border-box; }
.aa-w { font-family: var(--aa-sans); color: var(--aa-ink); -webkit-font-smoothing: antialiased; line-height: normal; }

/* ---- map ---- */
.aa-w .aa-map { width: 100%; height: 100%; display: block; overflow: hidden; }
.aa-w .aa-map g.state path, .aa-w .aa-map g.state circle { fill: var(--land); transition: fill .5s, opacity .5s; cursor: pointer; }
.aa-w .aa-map g.state path:hover { fill: var(--land-hover); }
.aa-w .aa-map g.borders path, .aa-w .aa-map g.borders circle { stroke: var(--border); stroke-width: 1; fill: none; pointer-events: none; vector-effect: non-scaling-stroke; }
.aa-w .aa-map g.state path.aa-lit { fill: var(--lit); }
.aa-w .aa-map g.state path.aa-lit:hover { fill: var(--land-hover); }
.aa-w .aa-map path.aa-hit, .aa-w .aa-map circle.aa-hit { fill: var(--hit) !important; }
.aa-w .aa-map path.aa-flash { animation: aa-flash 1.4s ease-out; }
@keyframes aa-flash { 0% { fill: var(--flash); } 100% { } }
.aa-w .aa-fx { pointer-events: none; }
.aa-w .aa-map .dccircle, .aa-w .aa-map .separator1 { display: none; }
.aa-w .aa-ping { fill: none; stroke: var(--flash); stroke-width: 2.5; vector-effect: non-scaling-stroke; animation: aa-ping 1.5s ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes aa-ping { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(9); opacity: 0; } }
/* the thinking sweep (ask-alfred.js startSweep): each state glows briefly, west to east, until the answer arrives */
.aa-w .aa-map path.aa-scan { animation: aa-scan 1.3s ease-out; }
@keyframes aa-scan { 0% { fill: var(--aa-scan); } 100% { } }
/* layer 2: each state as Alfred actually searches it (aa-searched), gold where he found it (aa-hit, above) */
.aa-w .aa-map g.state path.aa-searched { fill: var(--aa-searched); transition: fill .4s; }
@media (prefers-reduced-motion: reduce) { .aa-w .aa-ping, .aa-w .aa-map path.aa-flash, .aa-w .aa-map path.aa-scan { animation: none; } }

/* ---- caption (the answer, word by word) ---- */
.aa-w .aa-caption span { transition: color .2s, opacity .2s; opacity: .38; }
.aa-w .aa-caption span.said { opacity: 1; }
.aa-w .aa-caption span.now { color: var(--aa-accent); }

/* ---- result cards ---- */
.aa-w .aa-card { display: block; text-decoration: none; color: inherit; background: var(--aa-card); border: 1px solid var(--aa-line); border-radius: 9px; padding: 11px 13px; transition: border-color .2s, transform .2s, box-shadow .2s; animation: aa-in .45s both; }
.aa-w .aa-card:hover { border-color: var(--aa-accent); transform: translateY(-2px); box-shadow: 0 8px 24px -14px rgba(0,0,0,.45); }
@keyframes aa-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.aa-w .aa-card-top { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--aa-ink-soft); margin-bottom: 6px; flex-wrap: wrap; }
.aa-w .aa-badge { background: var(--aa-fill); color: var(--aa-on-accent); font-weight: 700; border-radius: 4px; padding: 1px 6px; font-size: 11px; letter-spacing: .04em; }
.aa-w .aa-type { font-family: var(--aa-mono); font-size: 11px; }
.aa-w .aa-status { margin-left: auto; border: 1px solid var(--aa-line); border-radius: 99px; padding: 0 8px; }
.aa-w .aa-card-title { font-weight: 600; font-size: 14px; line-height: 1.3; margin-bottom: 5px; }
.aa-w .aa-card-sum { font-size: 12.5px; line-height: 1.45; color: var(--aa-ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.aa-w .aa-card-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--aa-ink-soft); margin-top: 8px; }
.aa-w .aa-open { color: var(--aa-accent); font-weight: 600; }

/* ---- chat ---- */
.aa-w .aa-log { overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.aa-w .aa-msg { max-width: 94%; line-height: 1.5; font-size: 14px; }
.aa-w .aa-me { align-self: flex-end; background: var(--aa-fill); color: var(--aa-on-accent); padding: 8px 12px; border-radius: 14px 14px 4px 14px; }
.aa-w .aa-al { align-self: flex-start; }
.aa-w .aa-bub { background: var(--aa-paper); border: 1px solid var(--aa-line); padding: 10px 12px; border-radius: 14px 14px 14px 4px; font-family: var(--aa-display); font-size: 15px; }
.aa-w .aa-cards { display: grid; gap: 8px; margin-top: 8px; }
.aa-w .aa-dots { display: inline-flex; gap: 4px; }
.aa-w .aa-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--aa-ink-soft); animation: aa-blink .9s infinite alternate; }
.aa-w .aa-dots i:nth-child(2) { animation-delay: .3s; } .aa-w .aa-dots i:nth-child(3) { animation-delay: .6s; }
@keyframes aa-blink { from { opacity: .2; } to { opacity: 1; } }
.aa-w .aa-replay { background: none; border: 0; color: var(--aa-accent); cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; padding: 5px 0 0; }

/* ---- controls, chips, ask bar, mic ---- */
.aa-w .aa-ctl { display: none; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12.5px; color: var(--aa-ink-soft); }
.aa-w .aa-ctl.on { display: flex; }
.aa-w .aa-ctl span { flex: 1; }
.aa-w .aa-ctl button { border: 1px solid var(--aa-accent); background: var(--aa-input); color: var(--aa-accent); border-radius: 99px; padding: 4px 11px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.aa-w .aa-ctl button:hover { background: var(--aa-fill); border-color: var(--aa-fill); color: #fff; }
.aa-w .aa-ctl.thinking .aa-pause { display: none; }
.aa-w .aa-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.aa-w .aa-chip { border: 1px solid var(--aa-line); background: transparent; color: var(--aa-ink); border-radius: 99px; padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; transition: border-color .2s, background .2s; }
.aa-w .aa-chip:hover { border-color: var(--aa-accent); background: var(--aa-wash); }
.aa-w .aa-askbar { display: flex; gap: 8px; align-items: center; background: var(--aa-input); border: 1px solid var(--aa-line); border-radius: 99px; padding: 4px 4px 4px 14px; margin: 0; }
.aa-w .aa-askbar input { flex: 1; border: 0; font: inherit; font-size: 14px; background: none; outline: none; color: var(--aa-ink); padding: 6px 0; min-width: 0; box-shadow: none; }
.aa-w .aa-mic { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--aa-fill); color: var(--aa-on-accent); cursor: pointer; display: grid; place-items: center; flex: none; position: relative; padding: 0; }
.aa-w .aa-mic.listening::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--aa-accent); animation: aa-ring 1.2s ease-out infinite; }
@keyframes aa-ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.aa-w .aa-note { font-size: 11.5px; color: var(--aa-ink-soft); margin-top: 6px; }
.aa-w .aa-note a { color: var(--aa-accent); }
.aa-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 8px; font: 14px var(--aa-sans); z-index: 400; max-width: 90vw; }

/* ---- floating button + panel (every member page) ---- */
.aa-w .aa-fab { position: fixed; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 10px; background: var(--aa-fill); color: #fff; border: 0; border-radius: 99px; padding: 8px 16px 8px 8px; font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; box-shadow: 0 12px 30px -10px rgba(14,90,79,.7); z-index: 80; }
.aa-w .aa-fab .aa-ring { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.14); display: grid; place-items: center; position: relative; font-family: var(--aa-display); font-size: 17px; }
.aa-w .aa-fab .aa-ring::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); animation: aa-ring 2.4s ease-out infinite; }
.aa-w .aa-fab.talk .aa-ring::after { border-color: #fff; animation-duration: 1.1s; }
.aa-w .aa-panel { position: fixed; right: 24px; bottom: 86px; width: 430px; max-width: calc(100vw - 24px); height: min(660px, calc(100vh - 120px)); height: min(660px, calc(100dvh - 120px)); background: var(--aa-card); border: 1px solid var(--aa-line); border-radius: 16px; box-shadow: 0 30px 60px -20px rgba(30,36,32,.45); display: grid; grid-template-rows: auto auto 1fr auto; overflow: hidden; transform-origin: bottom right; transform: scale(.9) translateY(10px); opacity: 0; pointer-events: none; transition: all .25s; z-index: 81; }
.aa-w .aa-panel.open { transform: none; opacity: 1; pointer-events: auto; }
.aa-w .aa-ph { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--aa-line); }
.aa-w .aa-ph b { font-family: var(--aa-display); font-size: 17px; font-weight: 400; flex: 1; }
.aa-w .aa-ph a, .aa-w .aa-ph button { background: none; border: 0; cursor: pointer; color: var(--aa-ink-soft); font: inherit; font-size: 12.5px; text-decoration: none; padding: 0; }
.aa-w .aa-ph button { font-size: 20px; line-height: 1; }
.aa-w .aa-ph a:hover { color: var(--aa-accent); }
.aa-w .aa-pmap { height: 160px; padding: 6px 14px 0; background: linear-gradient(var(--aa-pmap-a), var(--aa-pmap-b)); border-bottom: 1px solid var(--aa-line); }
.aa-w .aa-pf { padding: 10px 12px 12px; border-top: 1px solid var(--aa-line); }
@media (max-width: 520px) {
  .aa-w .aa-fab { right: 14px; bottom: 14px; }
  .aa-w .aa-panel { right: 12px; left: 12px; width: auto; bottom: 74px; top: max(12px, env(safe-area-inset-top)); height: auto; }  /* iPhone: 100vh is taller than the visible screen, so pin both edges */
  .aa-w .aa-pmap { height: 120px; }
}
@media print { .aa-w .aa-fab, .aa-w .aa-panel { display: none !important; } }
