/* After an AI agent is saved: the install handoff that saves one for every sub-account, and the page that waits for
   ChatGPT or Claude and turns green once the grant arrives. It only loops while it asks; every change settles in a second. */

/* ---------- The hero ---------- */
.cn-hero { min-height: 0; padding: 24px 28px 30px; transition: box-shadow .6s var(--ease); }
.cn.is-connected .cn-hero { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stage-ok) 34%, transparent), var(--sh-card); }
.cn-hero-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; gap: 24px 40px; margin-top: 26px; }
.cn-copy { min-width: 0; }
.cn-lede { margin: 12px 0 0; max-width: 54ch; font-size: var(--fs-l); line-height: 1.55; color: var(--stage-muted); text-wrap: pretty; }
.cn-lede.cn-earlier { margin-top: 10px; font-size: var(--fs-s); color: var(--stage-ink); }

.cn-state { transition: background .5s var(--ease); }
.cn-state i { transition: background .5s var(--ease); }
.cn.is-connected .cn-state { background: color-mix(in srgb, var(--stage-ok) 18%, transparent); }
/* Back to the chat, or no longer asking: the status holds still. */
.cn.is-chat .cn-state i { background: var(--stage-flow); }
.cn.is-stale .cn-state i { background: var(--stage-muted); }

/* The system on the left, the assistant on the right, joined by the same beam as every hero. */
.cn-link { display: flex; align-items: center; justify-self: end; width: 100%; max-width: 470px; }
.cn-system { display: grid; justify-items: center; gap: 6px; flex: none; }
.cn-system .brandmark { width: 148px; height: 48px; padding: 0 14px; border: 0; border-radius: var(--r-l); }
.cn-system small { font-size: var(--fs-xs); color: var(--stage-muted); font-variant-numeric: tabular-nums; }
.cn-system .cn-hub { width: 148px; height: 48px; border-radius: var(--r-l); line-height: 1.15; text-align: center; }
.cn-beam { min-width: 36px; }
/* One dash per tile, so the dashes can drift while it waits without a seam. */
.cn-beam.off { background-size: 10px 100%; }
.cn-plate {
  position: relative; width: auto; min-width: 168px; height: 48px; padding: 0 18px; border-radius: var(--r-l); line-height: 1.15; text-align: center;
  transition: background .5s var(--ease), box-shadow .5s var(--ease);
}
.cn-plate > svg { flex: none; }
.cn.is-connected .cn-plate { background: color-mix(in srgb, var(--stage-ok) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stage-ok) 44%, transparent); }
.cn.is-connected .check-badge { transform: scale(1); }

/* ---------- Picking the assistant ---------- */
.tile.cn-pick { display: flex; flex-direction: column; min-height: 176px; }
.cn-pick .head-ic { margin-bottom: 16px; transition: transform .25s var(--ease); }
.cn-pick .tile-sub { max-width: 44ch; line-height: 1.5; }
.cn-pick.is-picked { border-color: var(--brand-line); box-shadow: var(--sh-hover), 0 0 0 4px color-mix(in srgb, var(--brand-text) 10%, transparent); }
.cn-pick-wait { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 16px; font-size: var(--fs-s); font-weight: 500; color: var(--brand-text); }
@media (hover: hover) and (pointer: fine) {
  .tile.cn-pick:hover .head-ic { transform: translateY(-2px); }
}
.cn-dots { display: inline-flex; gap: 4px; }
.cn-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35; }

/* ---------- What to try first ---------- */
.cn-next { display: flex; flex-direction: column; }
.cn-quote {
  margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel-2);
  color: var(--ink); font-size: var(--fs-m); line-height: 1.5; text-wrap: pretty; overflow-wrap: anywhere;
}
.cn-questions { display: flex; flex-direction: column; gap: 8px; }
.cn-question { display: flex; align-items: center; gap: 10px; }
.cn-question .cn-quote { flex: 1; min-width: 0; }
.cn-question .btn { flex: none; }
.cn-next .tile-sub { margin-top: 10px; }
.cn-next .tile-actions { margin-top: auto; padding-top: 16px; }

/* ---------- Switching it on ---------- */
.cn-switch { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; }
.cn-switch-lead { display: flex; align-items: flex-start; gap: 14px; flex: 1 1 420px; min-width: 0; }
.cn-switch-lead b { display: block; font-size: var(--fs-m); font-weight: 600; color: var(--ink); }
.cn-switch-lead span { display: block; margin-top: 3px; font-size: var(--fs-s); line-height: 1.5; color: var(--ink-3); text-wrap: pretty; }
.cn-switch-lead .cn-terms { margin-top: 6px; font-size: var(--fs-xs); color: var(--ink-4); white-space: pre-line; }
.cn-switch > form { flex: none; }
.cn-switch > .cn-free { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; flex: 1 1 100%; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: var(--fs-s); color: var(--ink-3); }

/* ---------- The way on ---------- */
.cn-more { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 4px 4px 0; }
.cn-more a:not(.btn) { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-s); font-weight: 500; color: var(--ink-3); }
.cn-more a:not(.btn):hover { color: var(--brand-text); }
.cn-more svg { width: 15px; height: 15px; }
.cn-more .cn-stale { flex-basis: 100%; font-size: var(--fs-s); color: var(--ink-3); }
.cn-more .cn-stale a { display: inline; color: var(--brand-text); }

/* ---------- The install handoff ---------- */
.cn-install { gap: 24px; }
.cn-install .cn-lede { max-width: 60ch; }
.cn-install-run { display: grid; gap: 10px; max-width: 460px; }
.cn-install-note { margin: 0; font-size: var(--fs-s); color: var(--stage-muted); font-variant-numeric: tabular-nums; white-space: pre-line; }
.cn-install-do { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
/* A page the claim started sets itself up, so its button only shows once that start was skipped or stopped. */
html.js .cn-install.is-auto .cn-install-do, .cn-install.is-running .cn-install-do, .cn-install.is-done .cn-install-do { display: none; }
.cn-install.is-done .cn-state { background: color-mix(in srgb, var(--stage-ok) 18%, transparent); }
.cn-install.is-done .cn-progress > span { background: var(--stage-ok); }
.cn-install.is-stopped .cn-state i { background: var(--stage-muted); }
.cn-install.is-stopped .cn-install-note { color: var(--stage-ink); }
.cn-progress { position: relative; height: 4px; overflow: hidden; border-radius: var(--r-full); background: color-mix(in srgb, var(--stage-flow) 22%, transparent); }
.cn-progress > span {
  position: absolute; inset: 0 auto 0 0; width: var(--done, 0%); border-radius: inherit; background: var(--stage-flow);
  transition: width .5s var(--ease), background .4s var(--ease);
}
/* Still reading claims no progress: a calm full track, which slides while motion is welcome. */
.cn-progress.is-reading > span { width: 100%; opacity: .4; }

/* What every agent of the install gets, before anything is saved. */
.cn-gets-list { display: grid; gap: 12px; margin: 0; }
.cn-gets-list > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: baseline; gap: 12px; }
.cn-gets-list dt { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--ink-4); }
.cn-gets-list dd { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; font-size: var(--fs-s); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js .cn > * { animation: cn-rise .5s var(--ease) backwards; }
  html.js .cn > :nth-child(2) { animation-delay: .06s; }
  html.js .cn > :nth-child(3) { animation-delay: .12s; }
  html.js .cn > :nth-child(4) { animation-delay: .18s; }
  html.js .cn > :nth-child(n+5) { animation-delay: .24s; }

  .cn.is-asking:not(.is-connected) .cn-state i { animation: cn-pulse 1.8s ease-out infinite; }
  .cn.is-asking .cn-beam.off { animation: cn-dash 1s linear infinite; }
  .cn-dots i { animation: cn-dot 1.2s ease-in-out infinite; }
  .cn-dots i:nth-child(2) { animation-delay: .15s; }
  .cn-dots i:nth-child(3) { animation-delay: .3s; }

  .cn.just-connected .cn-plate { animation: cn-ring 1s var(--ease) .1s 1; }
  .cn.just-connected .cn-copy [data-when="connected"] { animation: cn-swap .45s var(--ease) backwards; }
  .cn.just-connected .cn-copy p[data-when="connected"] { animation-delay: .08s; }
  .cn.just-connected [data-when="next"] { animation: cn-rise .5s var(--ease) .12s backwards; }

  .cn-install.is-running .cn-state i { animation: cn-pulse 1.8s ease-out infinite; }
  .cn-progress.is-reading > span { width: 34%; opacity: 1; animation: cn-slide 1.3s var(--ease) infinite; }
}

@keyframes cn-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes cn-swap { from { opacity: 0; transform: translateY(6px); } }
@keyframes cn-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--stage-flow) 60%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}
@keyframes cn-dash { to { background-position: 10px 0; } }
@keyframes cn-dot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes cn-ring {
  from { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stage-ok) 44%, transparent), 0 0 0 0 color-mix(in srgb, var(--stage-ok) 50%, transparent); }
  to { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stage-ok) 44%, transparent), 0 0 0 16px transparent; }
}
@keyframes cn-slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---------- Widths ---------- */
@media (max-width: 1100px) {
  .cn-hero-body { grid-template-columns: minmax(0, 1fr); }
  .cn-link { justify-self: start; }
}

@media (max-width: 760px) {
  .cn-hero { padding: 20px 20px 24px; }
  .cn-hero-body { margin-top: 20px; }
  .cn-system .brandmark, .cn-system .cn-hub { width: clamp(92px, 28vw, 148px); height: 42px; padding: 0 10px; }
  .cn-plate { min-width: 0; width: clamp(112px, 36vw, 168px); height: 42px; padding: 0 10px; }
  .cn-beam { min-width: 22px; }
  .tile.cn-pick { min-height: 0; }
  .cn-switch > form, .cn-switch > form .btn { width: 100%; }
  .cn-install-do .btn { width: 100%; }
}

@media (max-width: 480px) {
  .cn-plate > svg, .cn-hub > svg { display: none; }
  .cn-gets-list > div { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* The assistants by their logos: one per connected assistant on the plate, one on each pick. */
.cn-plate { width: auto; min-width: 120px; padding: 0 14px; }
.cn-logos { display: inline-flex; align-items: center; gap: 8px; }
.cn-logo { width: 30px; height: 30px; padding: 4px; border-radius: 9px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--paper-line); }
.cn-pick-logo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--paper-line); }
.cn-pick-logo img { width: 28px; height: 28px; }
