/* Agent Architecture page. The shared parts come from ../styles.css (colour tokens and the dark / light themes, fonts, body, page width, the
   title) and ../theme.js (the theme toggle), like the other pages. This file is the diagram: its layout, positions and hover
   logic, with the State block. Everything is fixed pixel geometry. */

/* the page's column is the other pages' (the shared main rule's 1240px less 28px padding each side), so the title sits in the same place; it is also
   the size container the diagram below is scaled to */
main.wide { min-height: 100vh; box-sizing: border-box; container-type: inline-size; }

/* the diagram: Human > [ AGENT: harness (reasoning below it) > action ] with state below the action block, outside the box.
   Its fixed-pixel geometry is 1248px wide (Human 320 + link 120 + AGENT box 808), wider than the column, so the whole of it is scaled by one
   factor, the column's width over 1248px, which makes it fill the column exactly, left edge on the title's left edge. zoom scales everything
   inside it alike (positions, sizes, spacing, borders, text), so every proportion is as it was; the 1184 / 1248 first is for a browser that cannot
   divide two lengths (it is the factor at the full column width). No vertical auto margin: the diagram starts right under the title, at the shared title gap,
   wherever the window is tall (an auto margin centred it in the page, which moved it with the window height). */
.agent-diagram { position: relative; margin: 0 auto; padding-bottom: 280px; display: flex; align-items: flex-start; font-size: 17px; zoom: .9487; zoom: calc(100cqw / 1248px); }
.agent-diagram .arr { stroke: var(--mid-border); fill: none; stroke-width: 2; transition: stroke .2s; }

/* a block (the reference's .stage look, as the diagram uses it): thin border, 320 x 160, name in bold, one line or a dashed inner box under it */
.agent-diagram .stage { position: relative; text-align: center; border: 1px solid var(--dim-border); color: var(--dim-text); letter-spacing: .04em; }
.agent-diagram .node { position: relative; width: 320px; min-width: 0; height: 160px; box-sizing: border-box; background: var(--bg); padding: 24px; text-align: left; display: flex; flex-direction: column; transition: transform .2s, color .2s, border-color .2s, box-shadow .2s; }
.agent-diagram .head { color: var(--bright); font-weight: 700; font-size: 21px; line-height: 1.5; }
.agent-diagram .line { margin-top: 10px; }   /* wraps (the reference's blocks only hold one short line; the State block holds a longer one) */
.agent-diagram .inner { position: relative; margin: auto 0; border: 1px dashed var(--mid-border); padding: 14px 4px 10px; text-align: center; }   /* may wrap onto a second line (the reference had no wrapping: its text was one short word, ours, "e.g. Claude Code, OpenCode", is wider than the box) */
.agent-diagram .tag { position: absolute; top: -7px; right: 8px; background: var(--bg); padding: 0 5px; line-height: 1; font-size: .78em; color: var(--mid-text); }

/* the AGENT box */
.agent-diagram .frame { position: relative; display: flex; align-items: center; background: var(--line); padding: 48px 24px 24px; }
.agent-diagram .frame-title { position: absolute; left: 24px; top: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--bright); }

/* links and their labels */
.agent-diagram .mlbl, .agent-diagram .link-h { font-size: 13px; letter-spacing: .04em; color: var(--dim-text); }
.agent-diagram .human, .agent-diagram > .link-h { margin-top: 48px; }
.agent-diagram .link-h { position: relative; width: 120px; height: 160px; box-sizing: border-box; padding: 0 24px; display: flex; align-items: center; white-space: nowrap; }
.agent-diagram .link-h svg { width: 72px; height: 10px; }
.agent-diagram .link-h .t { position: absolute; left: 0; right: 0; bottom: calc(50% + 8px); text-align: center; }

/* a column: a block with another block hanging 144px below it, joined by an arrow. Reasoning hangs under the harness; State hangs under the action block,
   the same size and in line, outside the AGENT box (the box ends 24px under the first row) */
.agent-diagram .col { position: relative; }
.agent-diagram .col .si, .agent-diagram .col2 .st { position: absolute; left: 0; top: calc(100% + 144px); }
.agent-diagram .col > svg { position: absolute; left: 50%; top: calc(100% + 48px); transform: translateX(-50%); }
.agent-diagram .col > .mlbl { position: absolute; left: calc(50% + 14px); top: calc(100% + 84px); transform: translateY(-50%); }

/* harness to state: a diagonal arrow drawn on the frame's own coordinates. Its label stays horizontal, on the baseline of "model calls" (centred
   on y 292 in the frame, as that one is), 14px to the right of the arrow's right-most point under the label (x 412 at the label's bottom, y 300) */
.agent-diagram .elbow { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.agent-diagram .frame > .rw { position: absolute; left: 426px; top: 292px; transform: translateY(-50%); }

/* the one-line texts of the action and State blocks break only between items: each item is kept whole and carries its separator dot at the
   end, so a line can end in a dot but never start with one */
.agent-diagram .it { white-space: nowrap; }

/* hover: the block lifts and glows */
.agent-diagram .node:hover { transform: translateY(-4px); color: var(--bright); border-color: var(--bright); box-shadow: 0 0 24px 2px var(--glow); }

/* hover a block: its caption appears under the diagram and every arrow that touches it (data-c) flows */
.agent-diagram .cap { position: absolute; left: 50%; transform: translateX(-50%); width: 520px; top: calc(100% + 16px); text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s; color: var(--mid-text); }
.agent-diagram .cap b { display: block; color: var(--bright); }
.agent-diagram:has(.hr:hover) .cap.c1, .agent-diagram:has(.ag:hover) .cap.c2, .agent-diagram:has(.si:hover) .cap.c3, .agent-diagram:has(.st:hover) .cap.c4 { opacity: 1; }
.agent-diagram:has(.hr:hover) .arr[data-c~="hr"], .agent-diagram:has(.ag:hover) .arr[data-c~="ag"], .agent-diagram:has(.si:hover) .arr[data-c~="si"], .agent-diagram:has(.st:hover) .arr[data-c~="st"] { stroke: var(--bright); stroke-dasharray: 5 5; animation: agent-flow .6s linear infinite; }
@keyframes agent-flow { to { stroke-dashoffset: -10; } }
@media (prefers-reduced-motion: reduce) { .agent-diagram .arr { animation: none !important; } }
