/* Ask Kaf — private sandbox bubble. Uses Hub brand tokens when present. */
.ask-kaf {
  --ak-bg: var(--bg-elev, #0E100E);
  --ak-panel: var(--bg-panel, #141714);
  --ak-ink: var(--ink, #F2FFF1);
  --ak-muted: var(--text-muted, rgba(200, 222, 199, 0.72));
  --ak-accent: var(--accent, #B1FC03);
  --ak-cyan: var(--accent-2, #00E1FF);
  --ak-rule: var(--rule, rgba(200, 222, 199, 0.12));
  --ak-font: var(--font, "DM Sans", system-ui, sans-serif);
  --ak-display: var(--font-display, "Montserrat", "DM Sans", system-ui, sans-serif);
  --ak-radius: 16px;
  position: static;
}

.ask-kaf-launcher {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 240;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 4px 18px 4px 8px;
  border: 1px solid rgba(177, 252, 3, 0.35);
  border-radius: 999px;
  background: var(--ak-accent);
  color: #041004;
  font: 700 13px/1.2 var(--ak-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(177, 252, 3, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.25);
  transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.ask-kaf-launcher:hover {
  background: #C8FF3A;
  box-shadow: 0 10px 36px rgba(177, 252, 3, 0.4);
}
.ask-kaf-launcher:focus-visible {
  outline: 3px solid var(--ak-accent);
  outline-offset: 3px;
}
.ask-kaf-launcher img,
.ask-kaf-head {
  width: 52px;
  height: 58px;
  border-radius: 0;
  object-fit: contain;
  object-position: center 30%;
  background: transparent;
  flex: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.28));
}
.ask-kaf-launcher[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
}

.ask-kaf-panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 241;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 24px));
  height: min(720px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  background: transparent;
  color: var(--ak-ink);
  border: 0;
  box-shadow: none;
  overflow: visible;
  font-family: var(--ak-font);
  pointer-events: none;
}
.ask-kaf-panel[hidden] { display: none !important; }
.ask-kaf-panel:not([hidden]) {
  animation: ask-kaf-panel-in 320ms ease-out;
}
@keyframes ask-kaf-panel-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.ask-kaf-avatar {
  display: block;
  width: 150px;
  height: auto;
  align-self: center;
  margin: 0 0 -52px;
  position: relative;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.55));
  flex: none;
}

.ask-kaf-card {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(177, 252, 3, 0.08), transparent 55%),
    radial-gradient(380px 160px at 0% 0%, rgba(0, 225, 255, 0.08), transparent 50%),
    var(--ak-bg);
  border: 1px solid var(--ak-rule);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(177, 252, 3, 0.06);
  overflow: hidden;
}

.ask-kaf-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 50px 14px 12px 16px;
  border-bottom: 1px solid var(--ak-rule);
  background: rgba(5, 6, 5, 0.55);
}
.ask-kaf-heading { flex: 1; min-width: 0; }
.ask-kaf-heading h2 {
  margin: 0;
  font-family: var(--ak-display);
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--ak-ink);
}
.ask-kaf-sub {
  margin: 2px 0 0;
  color: var(--ak-accent);
  font-family: var(--ak-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ask-kaf-close {
  appearance: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--ak-rule);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ak-ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.ask-kaf-close:hover { border-color: var(--ak-accent); color: var(--ak-accent); }
.ask-kaf-close:focus-visible { outline: 3px solid var(--ak-accent); outline-offset: 2px; }

.ask-kaf-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.ask-kaf-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
  animation: ask-kaf-in 380ms ease-out;
}
.ask-kaf-row-kaf { align-self: flex-start; width: 100%; }
.ask-kaf-row-user { align-self: flex-end; justify-content: flex-end; }
.ask-kaf-msg-avatar {
  width: 40px;
  height: 46px;
  border-radius: 0;
  object-fit: contain;
  object-position: center 30%;
  flex: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.ask-kaf-msg {
  max-width: 17.5rem;
  padding: 10px 14px 12px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}
.ask-kaf-msg-user {
  background: rgba(0, 225, 255, 0.14);
  border: 1px solid rgba(0, 225, 255, 0.28);
  color: var(--ak-ink);
  border-bottom-right-radius: 5px;
}
.ask-kaf-msg-kaf {
  background: rgba(20, 23, 20, 0.96);
  border: 1px solid var(--ak-rule);
  border-bottom-left-radius: 6px;
}
.ask-kaf-msg-text { display: block; }
.ask-kaf-msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.ask-kaf-typing .ask-kaf-msg {
  padding: 14px 16px 12px;
  min-width: 64px;
}
.ask-kaf-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 14px;
  padding: 2px 0;
}
.ask-kaf-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ak-accent);
  opacity: 0.35;
  animation: ask-kaf-dot 1s ease-in-out infinite;
}
.ask-kaf-dots i:nth-child(2) { animation-delay: 0.15s; }
.ask-kaf-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ask-kaf-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
@keyframes ask-kaf-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ask-kaf-msg-name {
  font-family: var(--ak-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ak-accent);
}
.ask-kaf-draft {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(0, 225, 255, 0.4);
  background: rgba(0, 225, 255, 0.12);
  color: var(--ak-cyan);
  font-family: var(--ak-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ask-kaf-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.ask-kaf-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(177, 252, 3, 0.35);
  background: rgba(177, 252, 3, 0.08);
  color: var(--ak-accent);
  font-family: var(--ak-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}
.ask-kaf-link:hover { background: rgba(177, 252, 3, 0.18); color: #C8FF3A; }

.ask-kaf-suggest {
  padding: 0 14px 12px;
  border-top: 1px solid var(--ak-rule);
  background: rgba(5, 6, 5, 0.35);
}
.ask-kaf-suggest-label {
  margin: 10px 0 8px;
  color: var(--ak-muted);
  font-family: var(--ak-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.ask-kaf-chips,
.ask-kaf-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ask-kaf-chip,
.ask-kaf-qbtn {
  appearance: none;
  border: 1px solid var(--ak-rule);
  background: rgba(20, 23, 20, 0.9);
  color: var(--ak-ink);
  border-radius: 999px;
  min-height: 32px;
  padding: 5px 11px;
  font: 600 12px/1.2 var(--ak-font);
  cursor: pointer;
  text-align: left;
}
.ask-kaf-chip:hover,
.ask-kaf-qbtn:hover,
.ask-kaf-chip[aria-pressed="true"] {
  border-color: var(--ak-accent);
  color: var(--ak-accent);
  background: rgba(177, 252, 3, 0.08);
}
.ask-kaf-chip:focus-visible,
.ask-kaf-qbtn:focus-visible,
.ask-kaf-link:focus-visible {
  outline: 3px solid var(--ak-accent);
  outline-offset: 2px;
}
.ask-kaf-qbtn { max-width: 100%; }

.ask-kaf-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ak-rule);
  background: rgba(5, 6, 5, 0.7);
}
.ask-kaf-composer label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ask-kaf-input {
  width: 100%;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--ak-rule);
  background: var(--ak-panel);
  color: var(--ak-ink);
  font: 15px/1.4 var(--ak-font);
}
.ask-kaf-input:focus {
  outline: none;
  border-color: var(--ak-accent);
  box-shadow: 0 0 0 2px rgba(177, 252, 3, 0.35);
}
.ask-kaf-send {
  appearance: none;
  min-width: 72px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--ak-accent);
  color: #041004;
  font: 700 12px/1 var(--ak-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.ask-kaf-send:hover { background: #C8FF3A; }
.ask-kaf-send:focus-visible { outline: 3px solid var(--ak-accent); outline-offset: 2px; }
.ask-kaf-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ask-kaf-count {
  grid-column: 1 / -1;
  margin: -2px 2px 0;
  font-size: 11px;
  color: var(--ak-muted);
  text-align: right;
}
.ask-kaf-count-warn { color: #F5C16C; }

body.ask-kaf-open { overflow: hidden; }

@media (max-width: 600px) {
  .ask-kaf-launcher {
    padding: 6px 16px 6px 6px;
  }
  .ask-kaf-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100vw;
    height: min(94dvh, 760px);
    max-height: 94dvh;
    padding-top: 0;
  }
  .ask-kaf-avatar {
    width: 132px;
    margin-bottom: -52px;
  }
  .ask-kaf-card {
    border-radius: 22px 22px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ask-kaf-launcher,
  .ask-kaf-transcript { transition: none; scroll-behavior: auto; }
  .ask-kaf-row,
  .ask-kaf-panel:not([hidden]) { animation: none; }
  .ask-kaf-dots i { animation: none; opacity: 0.8; }
}

/* Ghost lime theme (Marco's pick, Nov 11 2026): calmer message box */
.ask-kaf-card .ask-kaf-msg-name,
.ask-kaf-card .ask-kaf-sub { color: rgba(200, 222, 199, 0.62); }
.ask-kaf-card .ask-kaf-input { border-color: rgba(177, 252, 3, 0.45); }
.ask-kaf-card .ask-kaf-input:focus { border-color: rgba(177, 252, 3, 0.45); box-shadow: none; }
.ask-kaf-card .ask-kaf-send {
  background: transparent;
  color: #B1FC03;
  border: 1px solid rgba(177, 252, 3, 0.55);
}
.ask-kaf-card .ask-kaf-send:hover { background: rgba(177, 252, 3, 0.08); }
.ask-kaf-card .ask-kaf-link {
  color: rgba(200, 222, 199, 0.62);
  border-color: rgba(177, 252, 3, 0.45);
  background: transparent;
}
.ask-kaf-input { box-sizing: border-box; min-width: 0; }
/* Launcher matches ghost lime / homepage soft white */
.ask-kaf-launcher {
  background: rgba(14, 16, 14, 0.92);
  color: #E6F0E5;
  border: 1px solid rgba(177, 252, 3, 0.4);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ask-kaf-launcher:hover { background: rgba(24, 28, 24, 0.95); box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5); }
/* Nov 11 2026 pass 2: no big head over the chat; tidy solid top */
.ask-kaf-avatar { display: none !important; }
.ask-kaf-header { padding: 16px 14px 14px 18px; background: rgba(5, 6, 5, 0.6); border-radius: 22px 22px 0 0; }
.ask-kaf-panel { height: min(640px, calc(100dvh - 32px)); }
@media (max-width: 600px) {
  .ask-kaf-panel { top: 0; bottom: 0; height: 100dvh; max-height: 100dvh; background: var(--ak-bg); }
  .ask-kaf-card { border-radius: 0; border-top: 0; }
  .ask-kaf-header { border-radius: 0; padding-top: calc(16px + env(safe-area-inset-top)); }
}
/* Launcher pill: black with lime outline, Kaf's head peeks over the edge */
.ask-kaf-launcher {
  background: #0A0C0A; color: #E6F0E5;
  border: 1.5px solid #B1FC03;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38);
  padding: 4px 20px 4px 6px; overflow: visible;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.ask-kaf-launcher:hover { background: #121512; border-color: #C6FF3A; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42); }
.ask-kaf-launcher img, .ask-kaf-launcher .ask-kaf-head {
  width: 60px; height: 66px; margin-top: -22px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}

/* Cleanup 2026-11-11: leave room at the bottom so the floating launcher doesn't cover the footer or last FAQ. */
body {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}


/* askkaf13: dismiss the floating pill, remember in localStorage, restore tab */
.ask-kaf-dock {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 240;
  display: inline-flex;
  align-items: flex-end;
}
.ask-kaf-dock[hidden] { display: none !important; }
.ask-kaf-dock .ask-kaf-launcher {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: auto;
}
.ask-kaf-dismiss {
  appearance: none;
  position: absolute;
  top: -10px;
  right: -8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid #B1FC03;
  background: #0A0C0A;
  color: #E6F0E5;
  font: 700 20px/1 var(--ak-display, "Montserrat", "DM Sans", system-ui, sans-serif);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.ask-kaf-dismiss span { display: block; margin-top: -1px; }
.ask-kaf-dismiss:hover { background: #121512; border-color: #C6FF3A; color: #C6FF3A; }
.ask-kaf-dismiss:focus-visible { outline: 3px solid #B1FC03; outline-offset: 2px; }
.ask-kaf-restore {
  appearance: none;
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 240;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid #B1FC03;
  background: #0A0C0A;
  color: #E6F0E5;
  font: 700 11px/1 var(--ak-display, "Montserrat", "DM Sans", system-ui, sans-serif);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.38);
}
.ask-kaf-restore:hover { background: #121512; border-color: #C6FF3A; }
.ask-kaf-restore:focus-visible { outline: 3px solid #B1FC03; outline-offset: 2px; }
.ask-kaf-restore[hidden] { display: none !important; }
body.ask-kaf-hidden {
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}
@media (prefers-reduced-motion: reduce) {
  .ask-kaf-dismiss, .ask-kaf-restore { transition: none; }
}

/* ===== Go live prep (Nov 17 2026, sandbox) ===== */
/* Rounded head (neck stub trimmed) sits a little lower so the fins do not poke far above the pill. */
.ask-kaf-launcher img, .ask-kaf-launcher .ask-kaf-head { margin-top: -16px; }
/* While the chat is open, hide the whole dock (pill and its X) so nothing peeks out behind the panel. */
body.ask-kaf-open .ask-kaf-dock { opacity: 0; visibility: hidden; pointer-events: none; }
.ask-kaf-dock { transition: transform .28s ease, opacity .2s ease; }
.ask-kaf-dock.is-tucked { transform: translateY(calc(100% + 28px)); opacity: 0; pointer-events: none; }
/* Smaller X with a full 44px invisible tap area. */
.ask-kaf-dismiss { width: 24px; height: 24px; min-width: 24px; min-height: 24px; top: -8px; right: -6px; font-size: 15px; border-width: 1px; }
.ask-kaf-dismiss::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; }
@media (max-width: 600px) {
  /* Compact pill on phones so it covers less of the page. */
  .ask-kaf-dock { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .ask-kaf-dock .ask-kaf-launcher { min-height: 46px; gap: 6px; padding: 2px 14px 2px 4px; font-size: 11.5px; letter-spacing: 0.05em; border-width: 1px; }
  .ask-kaf-dock .ask-kaf-launcher img, .ask-kaf-dock .ask-kaf-launcher .ask-kaf-head { width: 44px; height: 48px; margin-top: -12px; }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .ask-kaf-dock { transition: none; } }

/* ===== Go live fix (Nov 19 2026, sandbox): head inside the pill, no overlap, 44px tap targets ===== */
/* Head sits fully inside the pill: antennae no longer poke above it or past its left edge. */
.ask-kaf-dock .ask-kaf-launcher { min-height: 60px; padding: 5px 18px 5px 7px; overflow: hidden; }
.ask-kaf-dock .ask-kaf-launcher img,
.ask-kaf-dock .ask-kaf-launcher .ask-kaf-head { width: 46px; height: 50px; margin: 0; object-position: center; }
/* Popup chips: full 44px tap height. */
.ask-kaf-chip { min-height: 44px; }
/* Wide screens: the open chat docks beside the page instead of covering it. */
@media (min-width: 1200px) {
  body { transition: padding-right .28s ease; }
  body.ask-kaf-open { padding-right: calc(432px + env(safe-area-inset-right, 0px)); }
}
/* Phones: the dock becomes a round head button in the corner so it covers far less of the page.
   The text stays as the accessible name. The small hide X goes away here (the dock already tucks away
   while scrolling) so it can not steal taps from the button. */
@media (max-width: 600px) {
  .ask-kaf-dock .ask-kaf-launcher { width: 52px; height: 52px; min-height: 52px; padding: 0; gap: 0; justify-content: center; border-radius: 50%; }
  .ask-kaf-dock .ask-kaf-launcher > span { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
  .ask-kaf-dock .ask-kaf-launcher img,
  .ask-kaf-dock .ask-kaf-launcher .ask-kaf-head { width: 38px; height: 42px; margin: 0; }
  .ask-kaf-dock .ask-kaf-dismiss { display: none; }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { body { transition: none; } }
