/* ---------- Metric AI agents (home page) ----------
   Set like a technical document: hairline rules, columns and type, no cards. */
.agents { --cycle: 11s; background: var(--surface); border-top: 1px solid var(--line); scroll-margin-top: 72px; }
.agents-inner { max-width: 1240px; margin: 0 auto; padding: clamp(72px, 10vw, 128px) clamp(16px, 4vw, 56px); }
.agents-intro { max-width: 760px; }
.agents h2 { margin-top: 14px; font-size: clamp(30px, 3.6vw, 48px); line-height: 1.08; letter-spacing: -.03em; font-weight: 600; }
.agents-intro > p { margin-top: 18px; font-size: clamp(16px, 1.2vw, 18px); line-height: 1.6; color: var(--ink-2); }

.agents-body { margin-top: 56px; display: grid; grid-template-columns: 240px 1fr; gap: clamp(32px, 5vw, 72px); align-items: start; }

/* Index of agents: a ruled list, the active entry marked on the rule */
.agent-tabs { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.tab-group { margin: 22px 0 6px 18px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.tab-group:first-child { margin-top: 0; }
.agent-tab {
  position: relative; display: flex; align-items: baseline; gap: 12px;
  width: 100%; padding: 7px 0 7px 18px; border: 0; background: none;
  font: 400 15px var(--font); color: var(--ink-2); text-align: left; cursor: pointer;
  transition: color .2s;
}
.agent-tab:hover { color: var(--ink); }
.agent-tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.agent-tab[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.tab-code { min-width: 18px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.tab-progress { position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--ink); transform: scaleY(0); transform-origin: top; }
.agent-tab[aria-selected="true"] .tab-progress { transform: none; }
.agents.autoplay .agent-tab[aria-selected="true"] .tab-progress { animation: tabProgress var(--cycle) linear both; }
.agents.paused .tab-progress { animation-play-state: paused !important; }
@keyframes tabProgress { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Agent sheet */
.agent-stage { min-height: 500px; }
.agent:focus-visible { outline: 2px solid var(--ink); outline-offset: 8px; }
.agent-code { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.agent-head h3 { margin-top: 10px; font-size: clamp(24px, 2.2vw, 32px); line-height: 1.15; letter-spacing: -.025em; font-weight: 600; }
.agent-summary { margin-top: 12px; max-width: 640px; font-size: 17px; line-height: 1.55; color: var(--ink-2); }

/* Scenario: three columns under one rule; the rule fills as the scenario plays */
.scenario { position: relative; margin-top: 40px; display: grid; grid-template-columns: .9fr 1fr 1.15fr; }
.rail { position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--line); }
.rail i { position: absolute; inset: 0; background: var(--ink); transform: scaleX(1); transform-origin: left; }
.col { padding: 22px 24px 0; border-left: 1px solid var(--line); }
.col:first-of-type { padding-left: 0; border-left: 0; }
.col h4 { display: flex; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink); }
.step { color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }

.event-time { margin-top: 18px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.event-text { margin-top: 6px; font-size: 21px; line-height: 1.3; letter-spacing: -.015em; font-weight: 500; color: var(--ink); }
.event-detail { margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }

.col ul { list-style: none; margin-top: 14px; }
.col li { padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.5; color: var(--ink); }
.col li:first-child { border-top: 0; padding-top: 4px; }
.col-approve li { display: flex; flex-direction: column; gap: 6px; }
.meta { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.sys { color: var(--ink-3); }
.sys::after { content: "·"; margin-left: 10px; }
.state { position: relative; display: inline-grid; }
.state span { grid-area: 1 / 1; white-space: nowrap; }
.state .wait { color: var(--warn); }
.state .ok { color: var(--brand); font-weight: 600; opacity: 0; }

/* ---------- Run sequence: plays each time a panel becomes active ---------- */
.agent.run .rail i { animation: rail 4.6s .2s cubic-bezier(.4,0,.2,1) both; }
.agent.run .col-event > * { animation: rise .5s both; }
.agent.run .col-event h4 { animation-delay: .2s; }
.agent.run .event-time { animation-delay: .35s; }
.agent.run .event-text { animation-delay: .5s; }
.agent.run .event-detail { animation-delay: .7s; }
.agent.run .col-auto h4 { animation: rise .5s 1.3s both; }
.agent.run .col-auto li { animation: rise .45s both; }
.agent.run .col-auto li:nth-child(1) { animation-delay: 1.6s; }
.agent.run .col-auto li:nth-child(2) { animation-delay: 1.95s; }
.agent.run .col-auto li:nth-child(3) { animation-delay: 2.3s; }
.agent.run .col-approve h4 { animation: rise .5s 2.9s both; }
.agent.run .col-approve li { animation: rise .45s both; }
.agent.run .col-approve li:nth-child(1) { animation-delay: 3.2s; }
.agent.run .col-approve li:nth-child(2) { animation-delay: 3.55s; }
.agent.run .col-approve li:nth-child(3) { animation-delay: 3.9s; }
.agent.run .col-approve li:nth-child(4) { animation-delay: 4.25s; }
/* The first request gets approved: shows the human in the loop */
.agent.run .col-approve li:first-child .wait { animation: fadeOut .3s 6.2s both; }
.agent.run .col-approve li:first-child .ok { animation: fadeIn .3s 6.35s both; }

@keyframes rail { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes fadeIn { to { opacity: 1; } }

/* ---------- Narrower screens ---------- */
@media (max-width: 1100px) {
  .scenario { grid-template-columns: 1fr 1fr; }
  .col-event { grid-column: 1 / -1; padding-bottom: 24px; }
  .col-auto { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .col-approve { border-top: 1px solid var(--line); }
}
@media (max-width: 960px) {
  .agents-body { grid-template-columns: 1fr; gap: 28px; }
  .agent-tabs { flex-direction: row; overflow-x: auto; gap: 22px; border-left: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .agent-tabs::-webkit-scrollbar { display: none; }
  .tab-group { display: none; }
  .agent-tab { width: auto; flex: none; white-space: nowrap; padding: 10px 0 12px; }
  .tab-progress { left: 0; right: 0; top: auto; bottom: -1px; width: auto; height: 2px; transform: scaleX(0); transform-origin: left; }
  .agent-tab[aria-selected="true"] .tab-progress { transform: none; }
  .agent-stage { min-height: 0; }
}
@media (max-width: 640px) {
  .scenario { grid-template-columns: 1fr; }
  .col, .col-auto, .col-approve { padding-left: 0; padding-right: 0; border-left: 0; }
  .col-auto, .col-approve { margin-top: 8px; }
  .event-text { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .agent.run *, .agent.run .rail i { animation: none !important; }
  .agent.run .col-approve li:first-child .wait { opacity: 0; }
  .agent.run .col-approve li:first-child .ok { opacity: 1; }
}
