/**
 * Copyright (c) 2026 KDTech
 * Author: david@KDTech
 * All rights reserved.
 *
 * Tilefold website — product window: agent panel and command palette
 *
 * The overlay pieces of the hero's live window: the agent panel (plan
 * checklist traced by the aurora, approval step card with a risk label) and
 * the glass command palette that opens on the demo's simulated ⌘K.
 */

/* ---------- Agent panel ---------- */

.aw-agent {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-inline-start: 1px solid var(--aw-line);
  background: var(--aw-panel);
  overflow: hidden;
}

.agent-head {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #eef0f8;
  font-weight: 600;
}

.agent-head .avatar {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--aurora);
  box-shadow: 0 0 16px rgb(124 92 255 / 0.5);
}

.agent-head small {
  margin-inline-start: auto;
  color: #6e7590;
  font-weight: 500;
  font-size: 11px;
}

.agent-plan {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #8d93aa;
  font-size: 12px;
}

.agent-plan li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  transition:
    color 300ms,
    background 300ms;
}

.agent-plan li::before {
  content: "";
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border: 1.5px solid #4a5068;
  border-radius: 4px;
}

.agent-plan li.is-active {
  color: #f4f5fb;
  background: rgb(255 255 255 / 0.04);
}

/* The aurora traces the active step. */
.agent-plan li.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  padding: 1px;
  background: var(--aurora);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.agent-plan li.is-active::before {
  border-color: var(--cyan);
  animation: spin 1.2s linear infinite;
  border-radius: 50%;
  border-inline-end-color: transparent;
}

.agent-plan li.is-done {
  color: #6e7590;
}

.agent-plan li.is-done::before {
  content: "✓";
  display: grid;
  place-items: center;
  border-color: var(--ok);
  background: var(--ok);
  color: #0a0b10;
  font-size: 9px;
  font-weight: 800;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.step-card {
  padding: 12px;
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 12px;
  background: rgb(255 255 255 / 0.03);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition:
    opacity 300ms var(--ease-out),
    transform 300ms var(--ease-out);
}

.step-card.is-shown {
  opacity: 1;
  transform: none;
}

.step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #8d93aa;
  font-size: 11px;
}

.risk {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgb(34 211 238 / 0.12);
  color: var(--cyan);
  font-size: 10.5px;
  font-weight: 600;
}

.risk.is-write {
  background: rgb(245 180 81 / 0.14);
  color: var(--amber);
}

.step-code {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #090a0f;
  color: #e6e8f2;
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: pre-wrap;
}

.step-why {
  margin: 0;
  color: #9aa0b8;
  font-size: 12px;
  line-height: 1.5;
}

.step-actions {
  display: flex;
  gap: 6px;
  margin-block-start: 10px;
}

.step-actions > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 7px;
  background: rgb(255 255 255 / 0.05);
  color: #b6bbd0;
  font-size: 11.5px;
  transition:
    background 200ms,
    color 200ms,
    transform 200ms;
}

.step-actions .approve {
  background: #f4f5fb;
  color: #0a0b10;
  font-weight: 600;
}

.step-actions .approve .kbd {
  border-color: rgb(10 11 16 / 0.25);
  color: #0a0b10;
}

.step-actions .approve.is-pressed {
  transform: scale(0.94);
  background: var(--ok);
}

/* ---------- Command palette ---------- */

.aw-palette {
  position: absolute;
  left: 50%;
  top: 56px;
  z-index: 5;
  width: min(460px, 86%);
  translate: -50% 0;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 16px;
  background: rgb(20 22 32 / 0.78);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.8);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}

.aw-palette.is-open {
  opacity: 1;
  transform: none;
}

.pal-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-block-end: 1px solid rgb(255 255 255 / 0.08);
  color: #f4f5fb;
  font-size: 15px;
}

.pal-input .q {
  white-space: pre;
}

.pal-list {
  margin: 0;
  padding: 6px;
  list-style: none;
}

.pal-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: #b6bbd0;
}

.pal-list li.is-sel {
  background: rgb(124 92 255 / 0.18);
  color: #f4f5fb;
}

.pal-list .ico {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: rgb(255 255 255 / 0.08);
}

.pal-list li.is-sel .ico {
  background: var(--aurora);
}

.pal-list .cat {
  margin-inline-start: auto;
  color: #6e7590;
  font-size: 11px;
}

/* The agent panel steps aside on narrow screens; the terminal keeps the room. */
@media (max-width: 980px) {
  .aw-agent {
    display: none;
  }
}
