/* The empty AI Agents page: a dark hero with an example conversation, the two packages and how it works.
   The conversation shows in full unless ai-start.js adds .plays; reveals fill backwards only, so tiles still lift. */

/* ---------- The hero ---------- */
.ai-start-hero {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(430px, 100%), 1fr)); align-items: center; gap: 34px;
  height: auto; min-height: 0; padding: 22px 22px 22px 34px;
}
.ai-start-copy { min-width: 0; }
.ai-start-hero h1 { margin-top: 18px; color: var(--stage-ink); font-size: 40px; font-weight: 600; line-height: 1.08; }
.ai-start-lead { margin: 12px 0 0; max-width: 52ch; font-size: var(--fs-l); line-height: 1.5; color: var(--stage-ink); text-wrap: pretty; }

/* The systems with a finished agent, joined by one bracket into the beam towards the assistant. */
.ai-start-flow { display: flex; align-items: center; max-width: 440px; margin-top: 22px; }
.ai-start-systems { position: relative; display: grid; flex: none; gap: 8px; padding-right: 16px; }
.ai-start-systems .brandmark { width: 124px; height: 38px; padding: 0 12px; border: 0; border-radius: var(--r-l); }
.ai-start-systems::after {
  content: ""; position: absolute; top: 19px; right: 0; bottom: 19px; width: 16px;
  border: 2px solid color-mix(in srgb, var(--stage-flow) 30%, transparent); border-left: 0; border-radius: 0 var(--r-m) var(--r-m) 0;
}
.ai-start-flow .deck-beam { min-width: 28px; margin-inline: 0; }
.ai-start-flow .deck-plate { flex: 0 1 auto; width: auto; min-width: 0; height: 46px; padding: 0 14px; border-radius: var(--r-l); line-height: 1.2; }
.ai-start-flow .deck-plate svg { flex: none; }

.ai-start-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 22px; }
.ai-start-actions .btn { min-height: var(--h-lg); padding: 0 18px; font-size: var(--fs-m); }
.ai-start-actions small { min-width: 0; font-size: var(--fs-s); color: var(--stage-muted); text-wrap: pretty; }

/* ---------- The example conversation ---------- */
.ai-chat {
  display: flex; flex-direction: column; justify-self: end; width: 100%; max-width: 720px; min-width: 0; margin: 0; overflow: hidden;
  border-radius: var(--r-xl); background: var(--panel); color: var(--ink);
  box-shadow: 0 0 0 1px var(--stage-rim), 0 24px 48px -20px var(--stage-shade);
}
.ai-chat-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: var(--fs-s); font-weight: 500; color: var(--ink-3); }
.ai-chat-head b { font-weight: 600; color: var(--ink); }
.ai-chat-body { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.ai-me { align-self: flex-end; max-width: 80%; margin: 0; padding: 9px 14px; border-radius: 16px 16px var(--r-xs) 16px; background: var(--brand); color: var(--on-brand); font-size: var(--fs-m); line-height: 1.4; }
.ai-reply { position: relative; display: flex; flex-direction: column; align-self: flex-start; gap: 10px; width: 92%; min-width: 0; font-size: var(--fs-m); line-height: 1.45; color: var(--ink); }
.ai-reply p { margin: 0; }
.ai-rows { margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-l); list-style: none; }
.ai-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 62px; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: var(--fs-s); }
.ai-row:first-child { border-top: 0; }
.ai-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.ai-row small { font-size: var(--fs-xs); text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ai-deal { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ai-deal i { flex: none; width: 8px; height: 8px; border-radius: 3px; background: var(--rt-deal); }
.ai-ready { padding: 10px 12px; border-radius: var(--r-l); background: var(--brand-soft); color: var(--ink); }
.ai-ready b { font-weight: 600; }
.ai-typing { display: none; }

/* The dark panel is lifted a step, or it sinks into the dark hero behind it; white text needs the deeper blue. */
:root[data-theme="dark"] .ai-chat { background: var(--panel-2); }
:root[data-theme="dark"] .ai-me { background: var(--stage-action); }

/* ---------- The tiles ---------- */
.ai-pack { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.ai-pack-ic { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: var(--r-m); background: var(--brand-soft); color: var(--brand-text); }
.ai-pack-ic svg { width: 16px; height: 16px; }
/* A button centres what it holds; a tile starts at the top, in line with the tiles next to it. */
.ai-start .tile-buy { display: flex; flex-direction: column; justify-content: flex-start; }
.ai-start-how { display: flex; flex-direction: column; }
.ai-start-how .tile-actions { margin-top: auto; padding-top: 16px; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Waiting to be seen. The delayed reveal is the way out when ai-start.js never runs; once it runs it marks .waits. */
  html.js .ai-chat:not(.plays) :is(.ai-me, .ai-step, .ai-ready) { opacity: 0; }
  html.js .ai-chat:not(.plays, .waits) :is(.ai-me, .ai-step, .ai-ready) { animation: ai-chat-show 0s 6s forwards; }

  .ai-chat.plays :is(.ai-me, .ai-step) { animation: ai-chat-in .45s var(--ease) var(--at, 0s) backwards; }
  .ai-chat.plays .ai-ready { animation: ai-chat-land .55s var(--ease) var(--at, 0s) backwards, ai-chat-ring 1.3s ease-out calc(var(--at, 0s) + .35s) 1; }

  .ai-typing {
    position: absolute; top: 0; left: 0; display: inline-flex; gap: 4px; padding: 10px 12px; border-radius: 14px 14px 14px var(--r-xs);
    background: var(--panel-3); opacity: 0;
  }
  .ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); }
  .ai-chat.plays .ai-typing { animation: ai-chat-typing var(--for, 1s) linear var(--at, 0s) backwards; }
  .ai-chat.plays .ai-typing i { animation: ai-chat-dot .6s ease-in-out var(--at, 0s) 2; }
  .ai-chat.plays .ai-typing i:nth-child(2) { animation-delay: calc(var(--at, 0s) + .12s); }
  .ai-chat.plays .ai-typing i:nth-child(3) { animation-delay: calc(var(--at, 0s) + .24s); }

  .ai-q1 { --at: .2s; }
  .ai-a1 .ai-typing { --at: .8s; --for: .95s; }
  .ai-a1 > p { --at: 1.75s; }
  .ai-rows { --at: 1.95s; }
  .ai-row:nth-child(1) { --at: 2.05s; }
  .ai-row:nth-child(2) { --at: 2.2s; }
  .ai-row:nth-child(3) { --at: 2.35s; }
  .ai-q2 { --at: 3.4s; }
  .ai-a2 .ai-typing { --at: 4s; --for: .85s; }
  .ai-ready { --at: 4.85s; }

  .ai-start > :not(.ai-start-hero) { animation: ai-chat-in .55s var(--ease) backwards; }
  .ai-start > :nth-child(3) { animation-delay: .08s; }
  .ai-start > :nth-child(4) { animation-delay: .16s; }
}

@keyframes ai-chat-show { to { opacity: 1; } }
@keyframes ai-chat-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes ai-chat-land { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes ai-chat-ring {
  from { box-shadow: 0 0 0 0 var(--brand-line); }
  to { box-shadow: 0 0 0 10px transparent; }
}
@keyframes ai-chat-typing {
  from, to { opacity: 0; }
  12%, 88% { opacity: 1; }
}
@keyframes ai-chat-dot { 50% { transform: translateY(-3px); } }

/* ---------- Smaller screens ---------- */
@media (max-width: 1280px) {
  .ai-chat { justify-self: stretch; max-width: none; }
}

@media (max-width: 1240px) {
  .ai-start > .ai-start-how { grid-column: span 12; }
  .ai-start-how .deck-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .ai-start-hero { gap: 22px; padding: 20px; }
  .ai-start-hero h1 { font-size: 30px; }
  .ai-start-how .deck-steps { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .ai-start-hero { padding: 18px 14px; }
  .ai-start-actions .btn { width: 100%; }
  .ai-start-systems .brandmark { width: 96px; height: 34px; padding: 0 9px; }
  .ai-start-systems { padding-right: 12px; }
  .ai-start-systems::after { top: 17px; bottom: 17px; width: 12px; }
  .ai-start-flow .deck-plate { padding: 0 10px; font-size: var(--fs-xs); }
  .ai-chat-body { padding: 14px 12px; }
  .ai-me { max-width: 88%; }
  .ai-reply { width: 100%; }
  .ai-row { grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; padding: 7px 10px; }
  .ai-row small { grid-column: 1; grid-row: 2; padding-left: 16px; text-align: left; }
}
