/* Tandem Agent — shared chat overlay + floating launcher styles (extracted from index.html) */
/* Chat-open triggers are no longer real links; keep the pointer cursor */
[data-ta-open] { cursor: pointer; }

/* ══ Tandem Agent overlay — styles ported from the standalone agent ══ */
#taOverlay {
  /* Scoped design tokens (won't leak into the site's own variables) */
  --ta-paper:        #f8f6f0;
  --ta-paper-glass:  rgba(248, 246, 240, 0.78);
  --ta-ink:          #141414;
  --ta-ink-dim:      #3c3a36;
  --ta-ink-muted:    #6e6a63;
  --ta-ink-faint:    #9b968d;
  --ta-border:       rgba(20, 20, 20, 0.12);
  --ta-border-soft:  rgba(20, 20, 20, 0.07);
  --ta-border-strong: rgba(20, 20, 20, 0.26);
  --ta-accent:       #ff3a00;
  --ta-accent-deep:  #e23300;
  --ta-accent-dim:   rgba(255, 58, 0, 0.10);
  --ta-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --ta-display: 'Space Grotesk', var(--ta-sans);
  --ta-mono:    'DM Mono', monospace;

  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  /* The real site sits behind, blurred — same treatment as the agent's wall */
  background: radial-gradient(95% 75% at 50% 48%, rgba(248,246,240,0.18) 30%, rgba(248,246,240,0.6) 100%);
  -webkit-backdrop-filter: blur(9px) saturate(0.96);
  backdrop-filter: blur(9px) saturate(0.96);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s ease, visibility 0.32s ease;
  font-family: var(--ta-sans);
  color: var(--ta-ink);
  -webkit-font-smoothing: antialiased;
}
#taOverlay.ta-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
html.ta-lock, html.ta-lock body { overflow: hidden; }

#taOverlay *, #taOverlay *::before, #taOverlay *::after { box-sizing: border-box; }

/* ── The glass panel (the chat container) ─────────────────────────────── */
.ta-panel {
  width: 100%;
  max-width: 760px;
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  display: flex;
  flex-direction: column;
  background: var(--ta-paper-glass);
  -webkit-backdrop-filter: blur(26px) saturate(1.15);
  backdrop-filter: blur(26px) saturate(1.15);
  border: 1px solid rgba(20, 20, 20, 0.1);
  border-radius: 22px;
  box-shadow: 0 30px 80px -30px rgba(20, 20, 20, 0.35);
  overflow: hidden;
  transform: translateY(18px);
  transition: transform 360ms cubic-bezier(0.2,0.7,0.2,1);
}
#taOverlay.ta-open .ta-panel { transform: translateY(0); }
.ta-panel.state-chat { height: min(78vh, 720px); }

/* ── Panel head: brand + actions ──────────────────────────────────────── */
.ta-panel-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 0 24px;
}
.ta-ph-brand { display: flex; align-items: center; gap: 9px; }
.ta-ph-brand svg { width: 28px; height: 24px; flex-shrink: 0; }
.ta-ph-brand span {
  font-family: var(--ta-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ta-accent);
}
.ta-ph-actions { display: flex; align-items: center; gap: 10px; }
.ta-pill-btn {
  display: none;
  align-items: center;
  gap: 7px;
  font-family: var(--ta-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--ta-accent);
  background: var(--ta-accent);
  color: #fff;
  cursor: pointer;
  transition: all 0.18s ease;
}
.state-chat .ta-pill-btn { display: inline-flex; }
.ta-pill-btn:hover { background: var(--ta-accent-deep); border-color: var(--ta-accent-deep); }
.ta-pill-btn .ta-btn-icon { width: 13px; height: 13px; flex-shrink: 0; }
.ta-close {
  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1px solid var(--ta-border);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ta-ink-dim);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}
/* ── Floating launcher (bottom right) ─────────────────────────────────── */
.ta-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 8990;       /* under the overlay (9000) */
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 56px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--tomato);
  background: var(--tomato);
  color: #F4F1EA;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(20, 20, 20, 0.18);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, gap 0.3s ease, opacity 0.25s ease, transform 0.25s ease;
}
.ta-launcher svg { width: 26px; height: 22px; flex-shrink: 0; }
.ta-launcher-label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.3s ease;
}
.ta-launcher:hover, .ta-launcher:focus-visible { background: #C42500; border-color: #C42500; gap: 10px; }
.ta-launcher:hover .ta-launcher-label,
.ta-launcher:focus-visible .ta-launcher-label { max-width: 120px; }
#taOverlay.ta-open ~ .ta-launcher { opacity: 0; transform: translateY(12px); pointer-events: none; }
@media (max-width: 800px) {
  .ta-launcher { right: 16px; bottom: 16px; height: 52px; padding: 0 13px; }
}
.ta-close:hover { border-color: var(--ta-border-strong); color: var(--ta-ink); }
.ta-close svg { width: 14px; height: 14px; }

/* ── State toggling within the panel ──────────────────────────────────── */
.ta-empty-state, .ta-chat-state { display: none; flex: 1; min-height: 0; }
.ta-panel.state-empty .ta-empty-state { display: flex; flex-direction: column; }
.ta-panel.state-chat  .ta-chat-state  { display: flex; flex-direction: column; }

/* ── EMPTY STATE ──────────────────────────────────────────────────────── */
.ta-empty-state {
  overflow-y: auto;
  padding: 18px 44px 30px;
  gap: 20px;
}
.ta-hero-eyebrow {
  font-family: var(--ta-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ta-ink-muted);
}
.ta-hero-eyebrow::before { content: "● "; color: var(--ta-accent); }
.ta-hero-greeting {
  font-family: var(--ta-display);
  font-weight: 700;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--ta-ink);
  margin: 6px 0 12px;
  text-wrap: balance;
}
.ta-hero-greeting .ta-stamp { font-style: italic; color: var(--ta-accent); }
.ta-hero-sub {
  font-size: clamp(15px, 1.6vw, 16.5px);
  line-height: 1.55;
  color: var(--ta-ink-dim);
  max-width: 54ch;
  text-wrap: pretty;
  margin: 0;
}
.ta-hero-input-wrap {
  position: relative;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--ta-border-strong);
  border-radius: 14px;
  padding: 4px 4px 4px 18px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ta-hero-input-wrap:focus-within {
  border-color: var(--ta-accent);
  box-shadow: 0 0 0 4px var(--ta-accent-dim);
}
#taHeroInput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ta-ink);
  font-family: var(--ta-sans);
  font-size: 1rem;
  line-height: 1.5;
  padding: 14px 0;
  resize: none;
  outline: none;
  min-height: 50px;
  max-height: 180px;
  overflow-y: auto;
}
#taHeroInput::placeholder { color: var(--ta-ink-faint); }
.ta-hero-send-btn {
  background: var(--ta-accent);
  border: none;
  color: #fff;
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-bottom: 4px;
}
.ta-hero-send-btn:hover:not(:disabled) { transform: translateY(-1px); background: var(--ta-accent-deep); }
.ta-hero-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ta-hero-send-btn svg { width: 18px; height: 18px; }

.ta-starters { display: flex; flex-wrap: wrap; gap: 8px; }
.ta-starter-btn {
  background: transparent;
  border: 1px solid var(--ta-border);
  color: var(--ta-ink-dim);
  padding: 9px 15px;
  border-radius: 999px;
  font-family: var(--ta-sans);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.ta-starter-btn:hover {
  border-color: var(--ta-accent);
  color: var(--ta-ink);
  background: var(--ta-accent-dim);
}
.ta-starter-btn.ta-primary {
  background: var(--ta-accent);
  border-color: var(--ta-accent);
  color: #fff;
  font-weight: 600;
}
.ta-starter-btn.ta-primary:hover {
  background: var(--ta-accent-deep);
  border-color: var(--ta-accent-deep);
  color: #fff;
}

/* ── CHAT STATE ───────────────────────────────────────────────────────── */
.ta-chat-state { overflow: hidden; }
#taMessages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ta-msg-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.ta-msg-row.ta-user { flex-direction: row-reverse; }
.ta-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.ta-avatar.ta-agent { background: var(--ta-accent); }
.ta-avatar.ta-agent svg { width: 20px; height: 17px; }
.ta-avatar.ta-user {
  background: var(--ta-ink);
  color: var(--ta-paper);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.ta-bubble {
  font-size: 0.96rem;
  line-height: 1.58;
  color: var(--ta-ink);
  max-width: calc(100% - 44px);
}
.ta-msg-row.ta-agent .ta-bubble {
  background: var(--ta-paper-glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  backdrop-filter: blur(20px) saturate(1.15);
  border: 1px solid rgba(20, 20, 20, 0.1);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 14px 40px -22px rgba(20, 20, 20, 0.35);
}
.ta-msg-row.ta-user .ta-bubble {
  background: var(--ta-ink);
  color: var(--ta-paper);
  border-radius: 14px;
  padding: 10px 14px;
}
.ta-bubble p { margin: 0 0 9px; }
.ta-bubble p:last-child { margin-bottom: 0; }
.ta-bubble strong { font-weight: 650; }
.ta-bubble a { color: var(--ta-accent); font-weight: 600; text-decoration: none; }
.ta-bubble a:hover { text-decoration: underline; }

.ta-typing { display: flex; gap: 4px; align-items: center; padding: 14px 0; }
.ta-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ta-ink-muted);
  animation: ta-typing-bounce 1.4s infinite ease-in-out;
}
.ta-typing span:nth-child(2) { animation-delay: 0.2s; }
.ta-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ta-typing-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}

/* Content cards inside agent replies */
.ta-cards-row { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.ta-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--ta-border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
.ta-card:hover { border-color: var(--ta-accent); transform: translateY(-1px); }
.ta-card.ta-book {
  border: 1px solid var(--ta-accent);
  background: linear-gradient(135deg, var(--ta-accent-dim), rgba(255,255,255,0.85) 70%);
}
.ta-card-mark {
  width: 56px; height: 56px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 2px;
  background: var(--ta-paper);
  border: 1px solid var(--ta-border);
  overflow: hidden;
}
.ta-card-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ta-card-mark .ta-rings { width: 32px; height: 27px; display: block; }
.ta-card.ta-book .ta-card-mark { background: var(--ta-accent); border-color: var(--ta-accent); }
.ta-card-mark .ta-mk {
  font-family: var(--ta-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--ta-accent);
}
.ta-card.ta-book .ta-card-mark .ta-mk { color: #fff; font-style: normal; }
.ta-card-body { flex: 1; min-width: 0; }
.ta-card-kicker {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--ta-ink-faint);
  margin-bottom: 3px;
}
.ta-card.ta-book .ta-card-kicker { color: var(--ta-accent); }
.ta-card-title {
  font-size: 0.94rem;
  font-weight: 650;
  color: var(--ta-ink);
  line-height: 1.3;
  margin-bottom: 3px;
}
.ta-card-meta { font-size: 0.78rem; color: var(--ta-ink-muted); }
.ta-card-go { flex-shrink: 0; color: var(--ta-accent); }
.ta-card-go svg { width: 16px; height: 16px; }

/* Chat input area */
.ta-input-area {
  flex-shrink: 0;
  padding: 12px 24px 16px;
  background: rgba(248, 246, 240, 0.92);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--ta-border-soft);
}
.ta-input-inner { max-width: 720px; margin: 0 auto; }
.ta-input-wrap {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--ta-border-strong);
  border-radius: 12px;
  padding: 4px 4px 4px 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ta-input-wrap:focus-within {
  border-color: var(--ta-accent);
  box-shadow: 0 0 0 4px var(--ta-accent-dim);
}
#taInput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ta-ink);
  font-family: var(--ta-sans);
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 10px 0;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 140px;
}
#taInput::placeholder { color: var(--ta-ink-faint); }
.ta-send-btn {
  background: var(--ta-accent);
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-bottom: 4px;
}
.ta-send-btn:hover:not(:disabled) { transform: translateY(-1px); background: var(--ta-accent-deep); }
.ta-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ta-send-btn svg { width: 16px; height: 16px; }
.ta-error-note {
  background: rgba(255, 58, 0, 0.07);
  border: 1px solid var(--ta-accent);
  color: var(--ta-accent-deep);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-top: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .ta-typing span { animation: none; }
  #taOverlay, .ta-panel { transition: opacity 200ms linear; }
}

/* Responsive */
@media (max-width: 640px) {
  #taOverlay { padding: 12px; }
  .ta-panel { border-radius: 18px; max-height: calc(100dvh - 24px); }
  .ta-panel.state-chat { height: calc(100dvh - 24px); }
  .ta-panel-head { padding: 12px 14px 0 18px; }
  .ta-empty-state { padding: 14px 20px 22px; gap: 18px; }
  .ta-hero-sub { font-size: 0.92rem; }
  #taMessages { padding: 14px 14px 8px; }
  .ta-input-area { padding: 10px 14px 14px; }
  .ta-msg-row.ta-agent .ta-bubble { padding: 12px 14px; }
}
