/* Agent mode, connected (AgentLive.astro, client/agent-live.js). Copied into the build only when the
   site config turns the agent on. Colors only from the dark surface roles (onDark, mutedOnDark, accent). */
.wg-agent-live {
  position: fixed;
  inset: var(--wg-mode-top, 0) 0 0 0;
  z-index: 35;
  background: var(--wg-dark);
  color: var(--wg-on-dark);
}
.wg-agent-live[hidden] {
  display: none;
}
.wg-agent-live-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-3);
  padding-block: var(--wg-space-4) var(--wg-space-4);
}
.wg-agent-live-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--wg-space-4);
}
.wg-agent-live-label {
  display: flex;
  align-items: center;
  gap: var(--wg-space-3);
  font-weight: 600;
  color: var(--wg-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--wg-text-sm);
}
.wg-agent-live-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--wg-radius-pill);
  border: 2px solid var(--wg-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wg-agent-live-avatar img {
  height: 22px;
  width: auto;
}
.wg-agent-live-notice {
  /* under the input, always in view (Mani, 22 Nov 2026) */
  flex-shrink: 0;
  margin-top: calc(-1 * var(--wg-space-2));
  font-size: var(--wg-text-xs);
  color: var(--wg-muted-on-dark);
}
.wg-agent-live-notice a {
  display: inline-block;
  min-height: 24px;
  line-height: 24px;
}
.wg-agent-live-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--wg-space-5);
}
.wg-agent-live-chat,
.wg-agent-live-panel {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.wg-agent-live-chat {
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-4);
  padding-right: var(--wg-space-2);
}
.wg-agent-live-log {
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-4);
}
.wg-agent-live-log:focus {
  outline: none;
}
.wg-agent-live-intro {
  color: var(--wg-muted-on-dark);
  font-size: var(--wg-text-lg);
  max-width: var(--wg-text-width);
}
.wg-agent-live-msg {
  max-width: var(--wg-text-width);
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-2);
}
.wg-agent-live-you {
  align-self: flex-end;
  background: var(--wg-dark-raised-2);
  border-radius: var(--wg-radius-lg) var(--wg-radius-lg) 4px var(--wg-radius-lg);
  padding: var(--wg-space-3) var(--wg-space-4);
  max-width: min(85%, var(--wg-text-width));
}
.wg-agent-live-agent {
  border-left: 3px solid var(--wg-accent);
  padding-left: var(--wg-space-4);
}
.wg-agent-live-who,
.wg-agent-live-small {
  font-size: var(--wg-text-xs);
  color: var(--wg-muted-on-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.wg-agent-live-text {
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-2);
  overflow-wrap: anywhere;
}
.wg-agent-live-thinking {
  color: var(--wg-muted-on-dark);
}
.wg-agent-live-thinking::after {
  content: '';
  display: inline-block;
  width: 1.5em;
  text-align: left;
  animation: wg-agent-live-dots 1.2s steps(4, end) infinite;
}
@keyframes wg-agent-live-dots {
  0% {
    content: '';
  }
  25% {
    content: '.';
  }
  50% {
    content: '..';
  }
  75% {
    content: '...';
  }
}
.wg-agent-live-sources ul,
.wg-agent-live-list {
  list-style: none;
  padding: 0;
  margin: var(--wg-space-1) 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wg-agent-live-sources a,
.wg-agent-live-list a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  font-size: var(--wg-text-sm);
}
.wg-agent-live-jump {
  display: none;
}
.wg-agent-live-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wg-space-2);
  margin-top: var(--wg-space-1);
}
.wg-agent-live .wg-agent-live-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--wg-space-4);
  border: 1px solid var(--wg-muted-on-dark);
  border-radius: var(--wg-radius-pill);
  background: transparent;
  color: var(--wg-on-dark);
  font-size: var(--wg-text-sm);
  text-decoration: none;
  cursor: pointer;
}
.wg-agent-live .wg-agent-live-chip:hover {
  border-color: var(--wg-accent);
  background: var(--wg-dark-raised);
}
.wg-agent-live-rate {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--wg-space-2);
}
.wg-agent-live-rate-btn {
  min-height: 32px;
  min-width: 48px;
  padding: 0 var(--wg-space-3);
  border: 1px solid var(--wg-muted-on-dark);
  border-radius: var(--wg-radius-pill);
  background: transparent;
  color: var(--wg-on-dark);
  font-size: var(--wg-text-sm);
  cursor: pointer;
}
.wg-agent-live-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wg-space-2);
}
.wg-agent-live .wg-btn-primary {
  color: var(--wg-on-accent);
}

/* Hand-off form */
.wg-agent-live-handoff {
  max-width: var(--wg-text-width);
  background: var(--wg-dark-raised);
  border-radius: var(--wg-radius-lg);
  padding: var(--wg-space-4) var(--wg-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-3);
}
.wg-agent-live-handoff[hidden] {
  display: none;
}
.wg-agent-live-handoff h3 {
  font-size: var(--wg-text-lg);
}
.wg-agent-live-handoff-intro {
  color: var(--wg-muted-on-dark);
  font-size: var(--wg-text-sm);
}
.wg-agent-live-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--wg-space-3);
}
.wg-agent-live-fields label {
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-1);
  font-size: var(--wg-text-sm);
}
.wg-agent-live-fields input,
.wg-agent-live-form input {
  min-width: 0;
  font-size: 16px;
  padding: 10px 14px;
  border-radius: var(--wg-radius-md);
  border: 1px solid var(--wg-muted-on-dark);
  background: var(--wg-dark);
  color: var(--wg-on-dark);
}
.wg-agent-live-fields input[aria-invalid='true'] {
  border-color: var(--wg-accent);
}
.wg-agent-live-booking {
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-2);
  font-size: var(--wg-text-sm);
}
.wg-agent-live-window {
  color: var(--wg-on-dark);
}
.wg-agent-live-local {
  color: var(--wg-muted-on-dark);
}
.wg-agent-live-time {
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-1);
  max-width: 20em;
}
.wg-agent-live-time input {
  min-width: 0;
  min-height: 44px;
  font-size: 16px;
  padding: 10px 14px;
  border-radius: var(--wg-radius-md);
  border: 1px solid var(--wg-muted-on-dark);
  background: var(--wg-dark);
  color: var(--wg-on-dark);
  color-scheme: dark;
}
.wg-agent-live-time input:focus-visible {
  outline: 3px solid var(--wg-accent);
  outline-offset: 1px;
}
.wg-agent-live-consent {
  display: flex;
  align-items: flex-start;
  gap: var(--wg-space-3);
  font-size: var(--wg-text-sm);
  cursor: pointer;
  min-height: 24px;
}
.wg-agent-live-consent input {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--wg-accent);
}
.wg-agent-live-handoff-error {
  color: var(--wg-accent);
  font-size: var(--wg-text-sm);
}
.wg-agent-live-handoff-error:empty {
  display: none;
}
.wg-agent-live-handoff .wg-btn {
  align-self: flex-start;
}

/* Evidence panel */
.wg-agent-live-panel {
  background: var(--wg-dark-raised);
  border-radius: var(--wg-radius-lg);
  padding: var(--wg-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-3);
}
.wg-agent-live-panel > h3 {
  font-size: var(--wg-text-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wg-accent);
}
.wg-agent-live-empty {
  color: var(--wg-muted-on-dark);
  font-size: var(--wg-text-sm);
}
.wg-agent-live-empty[hidden] {
  display: none;
}
.wg-agent-live-cards {
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-3);
}
.wg-agent-live-card {
  background: var(--wg-dark);
  border-radius: var(--wg-radius-md);
  padding: var(--wg-space-3) var(--wg-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-2);
}
.wg-agent-live-card h4 {
  font-size: var(--wg-text-sm);
  font-weight: 600;
}
/* The excerpt keeps its height while it loads, so the cards below it never move */
.wg-agent-live-excerpt {
  font-size: var(--wg-text-sm);
  color: var(--wg-muted-on-dark);
  line-height: 1.5;
  height: 6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.wg-agent-live-tablebox {
  min-height: 10em;
  overflow-x: auto;
}
.wg-agent-live-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--wg-text-xs);
}
.wg-agent-live-table th,
.wg-agent-live-table td {
  text-align: left;
  padding: var(--wg-space-1) var(--wg-space-2);
  border-bottom: 1px solid var(--wg-dark-raised-2);
  color: var(--wg-on-dark);
}
.wg-agent-live-table th {
  color: var(--wg-muted-on-dark);
  font-weight: 600;
}
.wg-agent-live-table tr.wg-agent-live-hit td {
  box-shadow: inset 3px 0 0 var(--wg-accent);
  font-weight: 600;
}
.wg-agent-live-open {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  font-size: var(--wg-text-sm);
  font-weight: 600;
}
.wg-agent-live-draft {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px var(--wg-space-3);
  font-size: var(--wg-text-sm);
}
.wg-agent-live-draft dt {
  color: var(--wg-muted-on-dark);
  text-transform: capitalize;
}

/* Evidence and the live project brief: two tabs in the panel (Mani, 22 Nov 2026) */
.wg-agent-live-tabs {
  display: flex;
  gap: var(--wg-space-2);
  border-bottom: 1px solid var(--wg-dark-raised-2);
}
.wg-agent-live-tabs [role='tab'] {
  position: relative;
  min-height: 36px;
  padding: 0 var(--wg-space-3);
  font-size: var(--wg-text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wg-muted-on-dark);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -1px;
  cursor: pointer;
}
.wg-agent-live-tabs [role='tab'][aria-selected='true'] {
  color: var(--wg-accent);
  border-bottom-color: var(--wg-accent);
}
.wg-agent-live-tabs [role='tab']:focus-visible {
  outline: 3px solid var(--wg-accent);
  outline-offset: 1px;
}
.wg-agent-live-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: var(--wg-space-1);
  border-radius: var(--wg-radius-pill);
  background: var(--wg-accent);
  vertical-align: middle;
}
.wg-agent-live-badge[hidden],
.wg-agent-live-pane[hidden] {
  display: none;
}
.wg-agent-live-pane {
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-3);
}
.wg-agent-live-brief-empty,
.wg-agent-live-brief-note {
  color: var(--wg-muted-on-dark);
  font-size: var(--wg-text-sm);
}
.wg-agent-live-brief-empty[hidden] {
  display: none;
}
.wg-agent-live-brief {
  display: flex;
  flex-direction: column;
  gap: var(--wg-space-3);
}
/* The brief reads as label over answer, so long answers wrap at any width */
.wg-agent-live-brief .wg-agent-live-draft {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
.wg-agent-live-brief .wg-agent-live-draft dt {
  text-transform: none;
  font-size: var(--wg-text-xs);
  margin-top: var(--wg-space-2);
}
.wg-agent-live-brief .wg-agent-live-draft dt:first-child {
  margin-top: 0;
}
.wg-agent-live-brief .wg-agent-live-draft dd {
  margin: 0;
}
.wg-agent-live-brief dd.wg-agent-live-missing {
  color: var(--wg-muted-on-dark);
  font-style: italic;
}
.wg-agent-live-brief-send {
  align-self: flex-start;
}
.wg-agent-live-brief-send[hidden] {
  display: none;
}

/* Composer */
.wg-agent-live-form {
  display: flex;
  gap: var(--wg-space-3);
  align-items: center;
}
.wg-agent-live-form input {
  flex: 1 1 auto;
  padding: 13px 18px;
  border-radius: var(--wg-radius-pill);
  background: var(--wg-dark-raised);
}
.wg-agent-live-form input:focus-visible,
.wg-agent-live-fields input:focus-visible {
  outline: 3px solid var(--wg-accent);
  outline-offset: 1px;
}
.wg-agent-live-form input::placeholder {
  color: var(--wg-muted-on-dark);
  opacity: 1;
}
.wg-agent-live-remaining {
  font-size: var(--wg-text-xs);
  color: var(--wg-muted-on-dark);
}
.wg-agent-live-remaining[hidden] {
  display: none;
}

/* "Continue your conversation" on the strip (AgentStrip.astro renders the button) */
.wg-agent-continue {
  pointer-events: auto;
  margin-bottom: var(--wg-space-3);
  min-height: 40px;
  padding: 0 var(--wg-space-5);
  border: 2px solid var(--wg-accent);
  border-radius: var(--wg-radius-pill);
  background: var(--wg-bg);
  color: var(--wg-text);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--wg-text) 16%, transparent);
}
.wg-agent-continue[hidden] {
  display: none;
}

@media (max-width: 899px) {
  .wg-agent-live-grid {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    gap: var(--wg-space-4);
  }
  .wg-agent-live-chat,
  .wg-agent-live-panel {
    overflow: visible;
    flex: 0 0 auto;
  }
  .wg-agent-live-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .wg-agent-live .wg-agent-live-jump {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    min-height: 36px;
    padding: 0 var(--wg-space-4);
    border: 1px solid var(--wg-accent);
    border-radius: var(--wg-radius-pill);
    background: transparent;
    color: var(--wg-accent);
    font-size: var(--wg-text-sm);
    cursor: pointer;
  }
}
@media (max-width: 640px) {
  .wg-agent-live-inner {
    padding-inline: var(--wg-gutter-mobile);
    gap: var(--wg-space-2);
  }
  .wg-agent-live-label span:last-child {
    font-size: var(--wg-text-xs);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .wg-agent-live-msg {
    animation: wg-agent-live-in 0.25s ease-out both;
  }
}
@keyframes wg-agent-live-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wg-agent-live-thinking::after {
    animation: none;
    content: '...';
  }
}
