/* The swarm stage (public/swarm.js): agents, each a coloured dart cursor, building an app in a window, then asking
   the person. Used by /hyper (ten agents) and /how-it-works (Anticode's five). Shared by every page that shows
   agents: the graphite tokens and the agents' colours live here.

   Tokens (contrast against --g0 #08090a):
     ink   #f7f8f8 19.2:1 · body #d0d6e0 14.0:1 · muted #8a8f98 6.3:1 · faint #62666d 3.4:1 (large text and marks only)
     agents: warm and pastel, never blue, cyan, teal or indigo (the owner, 2026-11-07). Mint means done, amber means
     "needs you"; only Hyper's Deploy wears amber, because it is the agent that asks. No outlines: surfaces are told
     apart by fill. No pulsing or glowing dots: what is working is a word or the Anticode mark. */
:is(.hy, .swarm, .swarm-sec) {
  --g0: #08090a; --g1: #0e0f10; --g2: #131416; --g3: #191a1d; --g4: #212226; --g5: #2a2b30;
  --ink: #f7f8f8; --body: #d0d6e0; --muted: #8a8f98; --faint: #62666d;
  --done: #3ddc97; --need: #f5c451;
  --a-cream: #f3ead8; --a-rose: #ff8fb1; --a-coral: #ff7a6b; --a-peach: #ffb38a; --a-sand: #e9d8a6;
  --a-lime: #c6f36b; --a-orchid: #d59bf6; --a-red: #ff5d5d; --a-pist: #a8e6a1; --a-amber: #f5c451;
  --ease-move: cubic-bezier(0.65, 0, 0.35, 1); --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
:where(.swarm) :where(button) { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.swarm :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.swarm { color: var(--ink); }
/* a dart: an agent's cursor, filled with its colour and edged in the ground so it reads on any fill */
:is(.hy, .swarm, .swarm-sec) svg.dt { flex: none; width: 16px; height: 16px; fill: var(--c); stroke: var(--g0); stroke-width: 1.4; }
.sg-need svg { flex: none; }
.swarm-fallback { margin: 0; padding: 40px 24px; border-radius: 22px; background: var(--g2); text-align: center; color: var(--muted); }
/* its place on a content page: the full width of the column, under the page's heading */
.swarm-sec { margin: 0 0 var(--s-8, 64px); }
/* on the homepage: under the five agents' cards in "From one sentence to a live product" */
.home-swarm { margin: clamp(40px, 6vw, 72px) 0 0; }
.swarm-note { margin: 16px auto 0; max-width: 70ch; text-align: center; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.sg-win { position: relative; border-radius: 22px; background: var(--g2); overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 60px 140px -50px rgba(0, 0, 0, 0.9), 0 30px 60px -30px rgba(0, 0, 0, 0.6); }
.sg-bar { display: flex; align-items: center; gap: 14px; height: 48px; padding: 0 10px 0 18px; background: var(--g1); }
.sg-lights { display: flex; gap: 7px; }
.sg-lights i { width: 11px; height: 11px; border-radius: 50%; background: var(--g4); }
.sg-title { font-size: 13.5px; font-weight: 600; color: var(--body); }
.sg-clock { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sg-pause { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--g4); font-size: 13px; font-weight: 500; color: var(--body); transition: background-color 120ms ease-out; }
.sg-pause:hover { background: var(--g5); color: var(--ink); }
.sg-pause[hidden] { display: none; }
.sg-body { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: clamp(520px, 62vh, 640px); }

/* who is working: the crew, live */
.sg-crew { padding: 14px 10px; background: var(--g1); }
.sg-crew ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sg-crew li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: 10px;
  font-size: 13.5px; color: var(--muted); transition: background-color 200ms ease-out, color 200ms ease-out; }
.sg-crew li b { font-weight: 550; color: var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-crew li em { font-style: normal; font-size: 12px; color: var(--faint); white-space: nowrap; }
.sg-crew li.on { background: var(--g3); }
.sg-crew li.on b { color: var(--ink); }
.sg-crew li.on em { color: var(--c); }
.sg-crew li.done em { color: var(--done); }
.sg-crew li.wait em { color: var(--need); }

/* the canvas the app is drawn on */
.sg-canvas { position: relative; padding: 22px clamp(16px, 2.4vw, 32px) 26px; overflow: hidden;
  background: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 1.2px) 0 0 / 22px 22px, var(--g2); }
.sg-prompt { display: flex; align-items: baseline; gap: 12px; min-height: 44px; width: min(640px, 100%); margin: 0 auto 20px; padding: 11px 18px; border-radius: 999px; background: var(--g4);
  font-size: 15px; color: var(--ink); }
.sg-prompt-by { flex: none; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sg-prompt-text { min-height: 1.4em; }
.sg-prompt-text .car { display: inline-block; width: 2px; height: 1.05em; margin-left: 1px; vertical-align: -0.15em; background: var(--ink); }

/* the app: six blocks, each drawn by one agent */
.sg-app { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "nav nav nav" "hero hero cal" "p1 p2 cal" "data data data"; gap: 12px; }
.ap { --c: var(--ink); position: relative; display: grid; align-content: start; gap: 8px; min-width: 0; padding: 14px 16px; border-radius: 14px; background: var(--g3);
  opacity: 0; transform: translateY(8px) scale(0.985); transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out), background-color 300ms ease-out, box-shadow 300ms ease-out; }
.ap > * { opacity: 0; transition: opacity 360ms ease-out; }
.ap[data-b="nav"] { grid-area: nav; display: flex; align-items: center; gap: 16px; padding-block: 10px; }
.ap[data-b="hero"] { grid-area: hero; min-height: 132px; align-content: center; }
.ap[data-b="cal"] { grid-area: cal; }
.ap[data-b="p1"] { grid-area: p1; } .ap[data-b="p2"] { grid-area: p2; }
.ap[data-b="data"] { grid-area: data; }
/* planned: the Architect's ghost of where the block goes */
.ap[data-s] { opacity: 1; transform: none; }
.ap[data-s="plan"] { background: color-mix(in srgb, var(--c) 7%, var(--g2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent); }
/* being built: the agent's colour, its name on a tag, the content filling in */
.ap[data-s="work"] { background: color-mix(in srgb, var(--c) 13%, var(--g3)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); }
.ap[data-s="work"] > *, .ap[data-s="done"] > *, .ap[data-s="flag"] > *, .ap[data-s="ok"] > *, .ap[data-s="live"] > * { opacity: 1; }
.ap[data-s="flag"] { background: color-mix(in srgb, var(--c) 12%, var(--g3)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent); animation: ap-nudge 420ms var(--ease-move); }
.ap[data-s="ok"] { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--done) 40%, transparent); }
/* the cursor carries the agent's name; a block only gets a tag when it goes live */
.ap::after { content: ""; position: absolute; top: -10px; right: 12px; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--c); color: var(--g0);
  font-size: 11px; font-weight: 650; line-height: 20px; white-space: nowrap; opacity: 0; transform: translateY(3px); transition: opacity 260ms ease-out, transform 260ms ease-out; pointer-events: none; }
@keyframes ap-nudge { 25% { transform: translateX(-5px); } 60% { transform: translateX(4px); } }

/* what the blocks show */
.ap-nav b { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.ap-nav span { width: 44px; height: 7px; border-radius: 4px; background: var(--g5); }
.ap-nav span:first-of-type { margin-left: auto; }
.ap-nav em, .ap-hero em { font-style: normal; display: inline-flex; align-items: center; height: 28px; padding: 0 13px; border-radius: 999px; background: var(--ink); color: var(--g0); font-size: 12.5px; font-weight: 600; }
.ap-hero strong { font-size: clamp(22px, 2.3vw, 32px); font-weight: 650; letter-spacing: -0.03em; line-height: 1.05; }
.ap-hero span { font-size: 13px; color: var(--muted); }
.ap-hero em { justify-self: start; margin-top: 6px; }
.ap b { font-size: 12.5px; font-weight: 600; color: var(--body); }
.ap-days, .ap-slots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.ap-slots { grid-template-columns: 1fr; gap: 6px; margin-top: 4px; }
.ap-days i { aspect-ratio: 1; border-radius: 8px; background: var(--g4); }
.ap-slots i { height: 26px; border-radius: 8px; background: var(--g4); }
.ap-days i.on, .ap-slots i.on { background: var(--ink); }
.ap-price strong { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ap-price span { height: 7px; width: 70%; border-radius: 4px; background: var(--g5); }
.ap-rows { display: grid; gap: 6px; }
.ap-rows i { height: 10px; border-radius: 4px; background: var(--g4); }
.ap-rows i:nth-child(2) { width: 82%; } .ap-rows i:nth-child(3) { width: 64%; }
/* live: shipped */
.sg-app.live .ap { box-shadow: none; background: var(--g3); }
.sg-app.live .ap[data-b="nav"]::after { content: "Live on quill.anticode.dev"; background: var(--done); opacity: 1; transform: none; }

/* the cursors: one dart per agent, moved by hyper.js with a long eased glide */
.sg-cursors { position: absolute; inset: 0; pointer-events: none; }
.cur { position: absolute; left: 0; top: 0; display: flex; align-items: flex-start; gap: 2px; will-change: transform;
  transition: transform var(--glide, 900ms) var(--ease-move), opacity 300ms ease-out; opacity: 0; }
.cur.in { opacity: 1; }
.cur svg { width: 22px; height: 22px; fill: var(--c); stroke: var(--g0); stroke-width: 1.4; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); transition: transform 140ms ease-out; }
.cur.click svg { transform: scale(0.82); }
.cur span { margin-top: 16px; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--c); color: var(--g0); font-size: 11px; font-weight: 650; line-height: 20px; white-space: nowrap; }

/* the moment it stops and asks */
.sg-ask, .tl-ask { display: grid; gap: 8px; width: min(400px, calc(100% - 32px)); padding: 22px 22px 20px; border-radius: 18px; background: var(--g4);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--need) 40%, transparent), 0 40px 90px -30px rgba(0, 0, 0, 0.9); }
.sg-ask { position: absolute; z-index: 3; left: 50%; top: 50%; translate: -50% -50%; animation: ask-in 460ms var(--ease-out) both; }
.sg-ask[hidden] { display: none; }
.sg-canvas.asking .sg-app { filter: saturate(0.6) brightness(0.55); transition: filter 400ms ease-out; }
@keyframes ask-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.sg-need { justify-self: start; display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border-radius: 999px; background: color-mix(in srgb, var(--need) 16%, transparent);
  color: var(--need); font-size: 12.5px; font-weight: 650; }
.sg-need svg { width: 10px; height: 11px; fill: currentColor; }
.sg-ask strong, .tl-ask strong { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; margin-top: 2px; }
.sg-meta { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sg-btns { justify-self: end; display: flex; gap: 8px; margin-top: 12px; }
.sg-btns button { min-height: 40px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--g5); color: var(--ink); transition: background-color 120ms ease-out, scale 120ms ease-out; }
.sg-btns button:hover { background: #34353b; }
.sg-btns .sg-go { background: var(--ink); color: var(--g0); }
.sg-btns .sg-go:hover { background: #ffffff; }
.sg-btns button:active { scale: 0.97; }

/* the log: one line per thing that happened */
.sg-log { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px; background: var(--g1); font-size: 13.5px; color: var(--body); overflow: hidden; white-space: nowrap; }
.sg-log .dt { width: 14px; height: 14px; }
.sg-log .ln { display: inline-flex; align-items: center; gap: 9px; min-width: 0; animation: log-in 320ms var(--ease-out) both; }
.sg-log .ln span { overflow: hidden; text-overflow: ellipsis; }
.sg-log .ln b { font-weight: 600; color: var(--ink); }
@keyframes log-in { from { opacity: 0; transform: translateY(8px); } }


@media (prefers-reduced-motion: reduce) {
  .cur, .ap, .ap > * { transition: none; }
  .sg-ask, .ap[data-s="flag"], .sg-log .ln { animation: none; }
}
@media (prefers-contrast: more) {
  :is(.hy, .swarm, .swarm-sec) { --muted: #b4b9c2; --faint: #8a8f98; }
  .ap { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }
}
@media (max-width: 860px) {
  .sg-body { grid-template-columns: minmax(0, 1fr); }
  .sg-crew { display: none; }
}
@media (max-width: 560px) {
  .sg-app { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "nav nav" "hero hero" "cal cal" "p1 p2" "data data"; }
  .ap-nav span { display: none; }
  .ap-nav em { margin-left: auto; }
  .sg-title { font-size: 12.5px; }
  .sg-clock { display: none; }
  .sg-pause { margin-left: auto; }
  .cur span { display: none; }
}
