/*
 * Interactive figures for the "How my agent system works" post.
 * Loaded only by that post; uses the site's tokens from site.scss.
 */

.asys-fig {
  margin: 2rem 0 2.25rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #fff;
  padding: 1.1rem 1.1rem 0.9rem;
}
.asys-fig svg { display: block; width: 100%; height: auto; }
.asys-cap {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0.6rem 0 0;
  line-height: 1.5;
}
.asys-fig text { font-family: var(--font-body); }

/* Buttons shared by every figure */
.asys-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.4rem 0 0.8rem;
  font-size: var(--fs-sm);
}
.asys-btn {
  font: inherit;
  font-size: var(--fs-sm);
  border: 1px solid var(--rule);
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
}
.asys-btn:hover { border-color: var(--accent); }
.asys-btn[aria-pressed="true"], .asys-btn.is-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- 1. Architecture map ---------- */

.asys-map .node rect { fill: var(--bg-soft); stroke: var(--rule); stroke-width: 1.2; transition: fill .2s, stroke .2s; }
.asys-map .node text { font-size: 13px; fill: var(--ink); pointer-events: none; }
.asys-map .node .sub { font-size: 10.5px; fill: var(--muted); }
.asys-map .node { cursor: pointer; }
.asys-map .node:hover rect, .asys-map .node.is-on rect { fill: var(--accent-soft); stroke: var(--accent); }
.asys-map .group { fill: none; stroke: var(--rule); stroke-dasharray: 5 4; }
.asys-map .glabel { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; fill: var(--muted); }
.asys-map .edge { fill: none; stroke: #c9c5bc; stroke-width: 1.4; }
.asys-map .edge.is-on { stroke: var(--accent); stroke-width: 2; }
.asys-map .flow { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3 9; opacity: 0; }
.asys-map .flow.is-on { opacity: .9; animation: asys-dash 1.2s linear infinite; }
@keyframes asys-dash { to { stroke-dashoffset: -24; } }

.asys-panel {
  margin-top: 0.8rem;
  min-height: 5.5rem;
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0.9rem;
  background: var(--bg-soft);
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
}
.asys-panel strong { font-family: var(--font-display); font-size: 1.05rem; }
.asys-panel p { margin: 0.25rem 0 0; }

/* ---------- 2. Journey ---------- */

.asys-journey .stop circle { fill: #fff; stroke: #c9c5bc; stroke-width: 1.6; transition: all .25s; }
.asys-journey .stop text { font-size: 12px; fill: var(--muted); text-anchor: middle; transition: fill .25s; }
.asys-journey .stop .icon { font-size: 15px; fill: var(--ink); dominant-baseline: central; }
.asys-journey .stop.is-done circle { stroke: var(--accent); }
.asys-journey .stop.is-on circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.4; }
.asys-journey .stop.is-on text.lab { fill: var(--ink); font-weight: 600; }
.asys-journey .track { fill: none; stroke: var(--rule); stroke-width: 3; }
.asys-journey .track-done { fill: none; stroke: var(--accent); stroke-width: 3; }
.asys-journey .packet { fill: var(--accent); }
.asys-journey .zone { fill: var(--bg-soft); }
.asys-journey .zlabel { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; fill: var(--muted); }
.asys-step {
  min-height: 7.5rem;
  margin-top: 0.6rem;
  font-size: 0.95rem;
}
.asys-step .n { font-size: var(--fs-sm); color: var(--accent); font-weight: 600; }
.asys-step h4 { font-size: 1.05rem; margin: 0.1rem 0 0.3rem; }
.asys-step p { margin: 0; }
.asys-step code { font-size: 0.85em; }

/* ---------- 3. Prompt stack ---------- */

.asys-stack { display: flex; flex-direction: column; gap: 4px; }
.asys-layer {
  display: grid;
  grid-template-columns: 11.5rem 1fr;
  gap: 0.9rem;
  align-items: center;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  background: var(--bg-soft);
  border-left: 5px solid var(--c, var(--accent));
  font-size: 0.9rem;
  cursor: default;
  transition: transform .15s, background .15s;
}
.asys-layer:hover { transform: translateX(4px); background: var(--accent-soft); }
.asys-layer b { font-weight: 600; }
.asys-layer span { color: var(--muted); }
.asys-layer .who { font-size: var(--fs-sm); color: var(--ink); }
@media (max-width: 640px) {
  .asys-layer { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* ---------- 4. Delivery simulator ---------- */

.asys-day { position: relative; margin: 0.4rem 0 0.2rem; }
.asys-axis {
  position: relative; height: 1.4rem; margin: 0 0 0.3rem 8.5rem;
  font-size: 11px; color: var(--muted);
}
.asys-axis span { position: absolute; transform: translateX(-50%); }
.asys-row {
  display: grid; grid-template-columns: 8.5rem 1fr; align-items: center;
  height: 2.1rem; font-size: 0.85rem;
}
.asys-row .lab { padding-right: 0.6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asys-lane { position: relative; height: 100%; border-top: 1px solid var(--rule); }
.asys-hours { position: absolute; top: 0; bottom: 0; background: #eef3ea; }
.asys-quiet { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, #f1eeee, #f1eeee 4px, #fff 4px, #fff 8px); }
.asys-dot, .asys-sent {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%;
}
.asys-dot { border: 2px solid var(--muted); background: #fff; }
.asys-sent { background: var(--accent); transition: left .5s ease; }
.asys-wait { position: absolute; top: 50%; height: 2px; background: var(--accent); opacity: .35; transition: all .5s ease; }
.asys-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: var(--fs-sm); color: var(--muted); margin-top: 0.6rem; }
.asys-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.asys-range { display: inline-flex; align-items: center; gap: 0.4rem; }
.asys-range input { width: 6rem; accent-color: var(--accent); }
.asys-note { font-size: var(--fs-sm); color: var(--ink); margin-top: 0.5rem; min-height: 1.4rem; }

/* ---------- 5. Publishing lanes ---------- */

.asys-git .lane { stroke: var(--rule); stroke-width: 2; }
.asys-git .main { stroke: var(--ink); stroke-width: 3; }
.asys-git .lname { font-size: 12px; fill: var(--muted); }
.asys-git .commit { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.asys-git .edit { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.asys-git .lock rect { fill: var(--accent); }
.asys-git .lock text { fill: #fff; font-size: 11px; font-weight: 600; }
.asys-git .arrow { fill: none; stroke: var(--accent); stroke-width: 2; }
.asys-git .pi { font-size: 12px; fill: var(--ink); }

/* ---------- 6. Learning loop ---------- */

.asys-loop .ring { fill: none; stroke: var(--rule); stroke-width: 2; }
.asys-loop .orbit { fill: var(--accent); }
.asys-loop .st rect { fill: #fff; stroke: var(--rule); }
.asys-loop .st text { font-size: 12.5px; fill: var(--ink); text-anchor: middle; }
.asys-loop .st .sub { font-size: 10.5px; fill: var(--muted); }
.asys-loop .center { font-family: var(--font-display); font-size: 15px; fill: var(--ink); text-anchor: middle; }

@media (prefers-reduced-motion: reduce) {
  .asys-map .flow.is-on, .asys-loop .orbit animateMotion { animation: none; }
}

/* ---------- 7. Example chats ---------- */

.asys-chat {
  margin: 1.2rem 0 2rem;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: #f7f6f2;
  padding: 0.9rem 0.9rem 0.7rem;
  max-width: 34rem;
  font-size: 0.92rem;
}
.asys-chat .head {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: var(--fs-sm); color: var(--muted);
  border-bottom: 1px solid var(--rule); padding-bottom: 0.55rem; margin-bottom: 0.7rem;
}
.asys-chat .av {
  width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 0.85rem; background: linear-gradient(135deg, #8c2f1b, #c66a3d);
}
.asys-chat .head b { color: var(--ink); }
.asys-chat .msg {
  max-width: 85%; padding: 0.5rem 0.75rem; border-radius: 14px; margin: 0 0 0.5rem;
  line-height: 1.45; background: #fff; border: 1px solid var(--rule);
}
.asys-chat .me { margin-left: auto; background: var(--accent-soft); border-color: #ecd3ca; }
.asys-chat .steps {
  font-size: var(--fs-sm); color: var(--muted); margin: 0 0 0.5rem; padding-left: 0.2rem;
}
.asys-chat .steps::before { content: "▸ "; color: var(--accent); }
.asys-chat .receipt {
  display: inline-block; font-size: 0.78rem; color: var(--muted);
  border-top: 1px dashed var(--rule); margin-top: 0.4rem; padding-top: 0.3rem; width: 100%;
}
.asys-chat .card {
  background: #fff; border: 1px solid var(--accent); border-radius: 10px;
  padding: 0.55rem 0.75rem; margin: 0 0 0.5rem; max-width: 85%; font-size: 0.88rem;
}
.asys-chat .card .t { font-weight: 600; }
.asys-chat .card .btns { margin-top: 0.4rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.asys-chat .card .btns span {
  border: 1px solid var(--rule); border-radius: 999px; padding: 0.1rem 0.6rem;
  font-size: 0.8rem; background: var(--bg-soft);
}
.asys-chat .card .btns span:first-child { background: var(--accent); color: #fff; border-color: var(--accent); }
.asys-chat .sys { text-align: center; font-size: 0.78rem; color: var(--muted); margin: 0.2rem 0 0.6rem; }
@media (max-width: 640px) {
  .asys-axis { margin-left: 6rem; }
  .asys-row { grid-template-columns: 6rem 1fr; }
  .asys-axis .minor { display: none; }
}

/* Screenshots of the app at the top of the post */
.asys-shot { margin: 1.75rem 0 2rem; }
.asys-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}
.asys-phones .row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 720px;
  margin: 0 auto;
}
.asys-phones img { border-radius: 16px; }
.asys-shot figcaption {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0.6rem 0 0;
  line-height: 1.5;
}
@media (max-width: 600px) {
  .asys-phones .row { gap: 0.5rem; }
  .asys-phones img { border-radius: 10px; }
}
