/* agent.css —— agent 架构入口页自己的样式。
   挂载顺序：site.css → system.css → hub.css → 本页 → navigation.css。
   这一页的壳（页头、侧栏、目录树、首屏的文案区、页框与载入提示）全用共用的那几份：侧栏、目录树与首屏文案区套件在 hub.css，页框与载入提示在 system.css。
   这里有三样：右边那一块的滚动层、首屏的轨道图、页框怎么装。模板的元素（带 hub- 的类）这里一条规则都不碰。
   这一栏讲的内容（每一页的字、图、表、卡片）都从 agent 架构设计页切出来、连它自己的样式一起装在页框里，这里不为它写任何一条。 */

/* 右边那一块：一个滚动层 —— 先是首屏，下面是装切出来的页的视图。滚动条照框架页一族的细滚动条 */
.agent-scroll {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #aeb8c6 transparent;
}

/* 右边的视图：只有一个页框，高恰好是滚动层看得见的那一块，超出这一块的部分裁掉 */
.agent-view {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #fff;
}

.agent-view .system-frame-shell {
  position: absolute;
  inset: 0;
}

/* 页框有两种装法（哪一页用哪一种写在节点名册里，页面脚本照它给 data-fit）。
   缺省：页框只占右边这一块（system.css 给的宽高各 100%）——「变更历史」那张版本台账是照页框排的，这样装。
   window：切出来的页是照「整个窗口」排版的（设计页的样式里用了按窗口宽高算的尺寸与按窗口宽度换的排法），
   页框里的页拿到的「窗口」是页框自己 —— 所以把页框开成整个窗口那么大、往左上挪到与窗口对齐：
   视图滚到滚动层顶上时，露在这一块里的正好是那一页的内容区，排出来与设计页单独打开时是同一个样子。
   挪多少是这一块的左沿与滚动层的上沿在窗口里的位置，由页面脚本量好写进这两个变量
   （同一组数也告诉页框里的那一页：它在左上留出同样大的空，右边再让出滚动层竖滚动条的宽）。 */
.agent-view[data-fit="window"] iframe {
  position: absolute;
  top: calc(-1 * var(--agent-frame-y, 0px));
  left: calc(-1 * var(--agent-frame-x, 0px));
  width: 100vw;
  height: 100vh;
}

/* 两种装法之间换的那一下：新的一页载入之前先藏起页框，免得旧的那一页按新的装法闪一下 */
.agent-view.is-swapping iframe { visibility: hidden; }

/* ── 首屏插图：轨道图 ─────────────────────────────────────────────────────────
   X大脑 在正中，两类会话在里圈，执行体五类在下面一道弧上，一圈青色虚线是机器把关的边界（机器的牌子挂在圈上），
   BOSS 在圈外顶上、只连 X大脑，四类架构在圈外底下。画法照首屏插图这一族：圆角、同色浅底、柔和阴影，颜色照角色色。
   插图最宽 820；那一格宽于 760 时排成一圈（线由背后一张 SVG 画，坐标写在 800 × 700 的画布上），窄了排成上下一列，仍由一圈青色虚线包着 */
.agh {
  position: relative;
  width: min(820px, 100%);
  min-width: 0;
  margin: 0;
  justify-self: center;
  container: agh / inline-size;
  color: #07142b;
  font-family: var(--font-ui);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* 角色色：BOSS 金、X大脑 蓝、产品经理与执行体 墨、常驻四位 灰（项目栏目里同一个灰是运维经理）、机器 青；四类架构用 agent 设计页的那一对蓝灰 */
.agh-r-boss { --c: #d48806; --c-soft: #fff7e6; --c-ink: #ad6800; --g: rgba(212, 136, 6, .30); }
.agh-r-brain { --c: #1261e8; --c-soft: #e8f1ff; --c-ink: #1261e8; --g: rgba(18, 97, 232, .30); }
.agh-r-work { --c: #07142b; --c-soft: #f5f8fc; --c-ink: #07142b; --g: rgba(7, 20, 43, .16); }
.agh-r-deploy { --c: #aeb9ca; --c-soft: #fff; --c-ink: #4e5c74; --g: rgba(78, 92, 116, .18); }
.agh-r-machine { --c: #00a88f; --c-soft: #e6f8f3; --c-ink: #007f6c; --g: rgba(0, 168, 143, .30); }
.agh-r-arch { --c: #6d88b0; --c-soft: #fff; --c-ink: #365d97; --g: rgba(54, 93, 151, .20); }

/* 顶上：图例与图注 */
.agh-top { display: grid; gap: 10px; margin-bottom: 18px; }
.agh-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: #5b6b83; font-size: 12px; line-height: 1.5; }
.agh-legend span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.agh-legend span::before { content: ""; width: 18px; height: 3px; border-radius: 2px; background: var(--c); }
.agh-legend .is-dash::before { height: 0; border-top: 2px dashed var(--c); border-radius: 0; background: none; }
.agh-cap { display: block; color: #5b6b83; font-size: 12px; line-height: 1.6; text-wrap: pretty; }
.agh-nb { white-space: nowrap; }

/* 卡：圆角 14、同色浅底、柔和阴影；图标、英文小标签、名字、一句说明 */
.agh-card {
  display: grid;
  grid-template-columns: auto minmax(0, auto);
  align-items: center;
  column-gap: 10px;
  row-gap: 1px;
  padding: 9px 14px 10px;
  border: 1.5px solid var(--c);
  border-radius: 14px;
  background: var(--c-soft);
  box-shadow: 0 1px 2px rgba(7, 20, 43, .05), 0 6px 14px -8px var(--g), 0 16px 30px -16px var(--g);
  text-align: left;
}
.agh-card > svg { grid-row: 1 / span 3; width: 22px; height: 22px; color: var(--c-ink); }
.agh-card small { grid-column: 2; color: var(--c-ink); font: 700 12px/1.3 var(--font-mono); letter-spacing: .08em; }
.agh-card b { grid-column: 2; color: #142038; font-size: 15px; font-weight: 800; line-height: 1.35; }
.agh-card > span { grid-column: 2; color: #5b6b83; font-size: 12.5px; line-height: 1.5; }
.agh-badge { border-style: dashed; }
.agh-arch { grid-template-columns: minmax(0, 1fr); }
.agh-arch small,
.agh-arch b,
.agh-arch > span { grid-column: 1; }
.agh-arch b { font-size: 14px; }
.agh-arch > span { font-size: 12px; }

/* 执行体五类：白底圆角小牌，人数是一颗墨色小圆牌 */
.agh-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 12px; border: 1.5px solid #07142b; border-radius: 999px; background: #fff; box-shadow: 0 3px 10px -6px rgba(7, 20, 43, .35); white-space: nowrap; }
.agh-chip b { color: #142038; font-size: 13px; font-weight: 800; line-height: 1.4; }
.agh-chip i { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #07142b; color: #fff; font: 700 12px/1 var(--font-mono); font-style: normal; }

/* 联动：白底圆角小牌，高写死 26（上下一列时连线的长短按它算） */
.agh-pill { display: inline-block; height: 26px; padding: 0 11px; border: 1.5px solid var(--c); border-radius: 999px; background: #fff; box-shadow: 0 3px 10px rgba(7, 20, 43, .08); color: var(--c-ink); font-size: 12px; font-weight: 700; line-height: 23px; white-space: nowrap; }
.agh-foot { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; color: #1261e8; font-size: 12px; font-weight: 800; line-height: 1.5; }
.agh-foot::before { content: ""; width: 8px; height: 8px; margin: -4px 2px 0 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }

/* 窄于 760：上下一列，一圈青色虚线包着 X大脑、会话、机器与执行体。
   连线都是各部件自己的伪元素画的竖线：从自己的边框里头起（边框 1.5、与线同色，看不出接缝），长度 = 两个部件之间的空 + 1.5，正好接到下一个部件的边上 */
.agh-stage { position: relative; display: grid; justify-items: center; }
.agh-lines { display: none; }
.agh-n { position: relative; }
.agh-boss { z-index: 3; max-width: min(100%, 460px); }
.agh-boss > svg { grid-row: 1 / span 2; }
.agh-boss::after { content: ""; position: absolute; top: 100%; left: 50%; height: 71.5px; margin-left: -1px; border-left: 2px solid #d48806; }   /* 圈的上外边距 34 + 虚线 2 + 上内边距 34，再加自己的边框 1.5：正好落到 X大脑 卡顶 */
.agh-ring { position: relative; display: grid; justify-items: center; width: 100%; margin-top: 34px; padding: 34px 14px 42px; border: 2px dashed #00a88f; border-radius: 28px; background: color-mix(in srgb, #00a88f 3.5%, #fff); }
.agh-ring .agh-card { max-width: 100%; }
.agh-p1,
.agh-p2 { margin: 14px 0; }
.agh-pill::before,
.agh-pill::after { content: ""; position: absolute; left: 50%; height: 15.5px; margin-left: -1px; border-left: 2px solid var(--c); }
.agh-pill::before { bottom: 100%; }
.agh-pill::after { top: 100%; }
.agh-sessions { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; }
.agh-sessions .agh-card { width: 100%; }
.agh-badge { margin-top: 16px; }
.agh-badge::before { content: ""; position: absolute; bottom: 100%; left: 50%; height: 17.5px; margin-left: -1px; border-left: 2px solid #5b6b83; }
.agh-teams { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.agh-p3 { position: absolute; bottom: 0; left: 50%; margin: 0; transform: translate(-50%, 50%); }   /* 小牌的中线压在圈的下边上 */
.agh-p3::before { height: 30.5px; }   /* 往上：圈的下内边距 42 − 小牌半高 13 + 边框 1.5，接到执行体五类那一排的底 */
.agh-archs { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: 100%; margin-top: 34px; }

/* 两张会话卡并排时（插图宽 560–759）：「握手派工」往下那根落到会话卡上方一道横线，横线两头各一根短线下到两张卡；
   机器往上那根落到会话卡下方一道横线，两张卡各一根短线下到它。横线从左卡中线到右卡中线（两栏等宽、中间空 12） */
.agh-p1::after { height: 9.5px; }   /* 14 + 1.5 − 6：落到横线的下沿 */
.agh-sessions::before,
.agh-sessions::after { content: ""; position: absolute; left: calc((100% - 12px) / 4 - 1px); right: calc((100% - 12px) / 4 - 1px); border-top: 2px solid; }
.agh-sessions::before { top: -8px; border-top-color: #1261e8; }      /* 上方那道：卡顶上 6–8 */
.agh-sessions::after { bottom: -9px; border-top-color: #5b6b83; }    /* 下方那道：卡底下 7–9 */
.agh-sessions .agh-card::before,
.agh-sessions .agh-card::after { content: ""; position: absolute; left: 50%; margin-left: -1px; border-left: 2px solid; }
.agh-sessions .agh-card::before { bottom: 100%; height: 9.5px; border-left-color: #1261e8; }   /* 边框 1.5 + 8：接到上方那道的上沿 */
.agh-sessions .agh-card::after { top: 100%; height: 10.5px; border-left-color: #5b6b83; }      /* 边框 1.5 + 9：接到下方那道的下沿 */
.agh-badge::before { height: 10.5px; }   /* 16 + 1.5 − 7：落到下方那道的上沿 */

/* 四张架构卡一排时（插图宽 560–759）：「层层关联」往下那根落到卡顶上方一道横线，四张卡各一根短线上到它。横线从第一张卡中线到第四张卡中线（四栏等宽、空 10） */
.agh-p3::after { height: 13.5px; }   /* 从小牌的边框里头（中线下 11.5）起，往下到横线的下沿（中线下 25 = 虚线 2 + 架构卡上外边距 34 − 11） */
.agh-archs::before { content: ""; position: absolute; top: -13px; left: calc((100% - 30px) / 8 - 1px); right: calc((100% - 30px) / 8 - 1px); border-top: 2px solid #6d88b0; }
.agh-arch::before { content: ""; position: absolute; bottom: 100%; left: 50%; height: 14.5px; margin-left: -1px; border-left: 2px solid #6d88b0; }   /* 边框 1.5 + 13：接到横线的上沿 */

@container agh (max-width: 559px) {
  /* 会话卡上下叠：两道横线与短线都不要，「握手派工」那根直接落到产品经理卡顶，机器那根直接接到常驻四位卡底 */
  .agh-sessions { grid-template-columns: minmax(0, 1fr); }
  .agh-sessions::before,
  .agh-sessions::after,
  .agh-sessions .agh-card::before,
  .agh-sessions .agh-card::after { display: none; }
  .agh-p1::after { height: 15.5px; }
  .agh-badge::before { height: 17.5px; }
  /* 四张架构卡两两一排：「层层关联」那根接着往下，成为两栏中间的一根竖线，到第二排卡的半腰；每张卡各一根短横线接到它 */
  .agh-archs { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 26px; }
  .agh-archs::before { display: none; }
  .agh-p3::after { height: 24.5px; }   /* 从小牌的边框里头（中线下 11.5）起，往下到架构卡顶那一线（中线下 36 = 虚线 2 + 上外边距 34） */
  .agh-arch::before,
  .agh-arch::after { content: ""; position: absolute; border-color: #6d88b0; border-style: solid; border-width: 0; }
  .agh-a1::before { top: -1.5px; bottom: -11.5px; left: calc(100% + 1.5px + 12px); height: auto; margin-left: 0; border-left-width: 2px; }   /* 竖线：从第一排卡顶到第二排卡顶（行间空 10） */
  .agh-a3::before { top: -1.5px; bottom: auto; left: calc(100% + 1.5px + 12px); height: calc(50% + 2.5px); margin-left: 0; border-left-width: 2px; }   /* 竖线：从第二排卡顶到它的半腰 */
  .agh-a2::before,
  .agh-a4::before { display: none; }
  .agh-a1::after,
  .agh-a3::after { top: 50%; left: 100%; width: 15.5px; margin-top: -1px; border-top-width: 2px; }   /* 短横线：从卡的右边线到两栏中间那根竖线（边框 1.5 + 空的一半 13 + 1） */
  .agh-a2::after,
  .agh-a4::after { top: 50%; right: 100%; width: 15.5px; margin-top: -1px; border-top-width: 2px; }
}

/* 宽于 760：排成一圈。坐标写在 800 × 700 的画布上（背后那张 SVG 同一个画布），每张卡按自己的中心放，四类架构按上边放 */
@container agh (min-width: 560px) { .agh-legend { justify-content: flex-end; } }
@container agh (min-width: 760px) {
  .agh-stage { display: block; aspect-ratio: 800 / 700; }
  .agh-lines { display: block; position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .agh-ring,
  .agh-sessions,
  .agh-teams,
  .agh-archs { display: contents; }
  /* 上下一列时那几根伪元素画的连线：排成一圈时线都由背后那张 SVG 画（部件拆成 display: contents 后伪元素照样会出来，所以一一收起） */
  .agh-boss::after,
  .agh-badge::before,
  .agh-pill::before,
  .agh-pill::after,
  .agh-sessions::before,
  .agh-sessions::after,
  .agh-sessions .agh-card::before,
  .agh-sessions .agh-card::after,
  .agh-archs::before,
  .agh-arch::before { display: none; }
  .agh-n { position: absolute; z-index: 2; width: max-content; margin: 0; left: calc(var(--x) / 800 * 100%); top: calc(var(--y) / 700 * 100%); transform: translate(-50%, -50%); white-space: nowrap; }   /* 宽照自己的字：按左沿定位的卡越靠右、能用的宽越窄，不写死会被挤窄 */
  .agh-boss { --x: 400; --y: 40; grid-template-columns: auto auto auto; column-gap: 12px; max-width: none; }
  .agh-boss > svg { grid-row: 1; }
  .agh-boss b,
  .agh-boss > span { grid-column: auto; }
  .agh-core { --x: 400; --y: 240; }
  .agh-p1 { --x: 400; --y: 298; }
  .agh-work { --x: 210; --y: 336; }
  .agh-deploy { --x: 597; --y: 336; }   /* 常驻四位这张牌比左边的产品经理牌宽 16：中线往右挪 7，左沿仍在 484，「握手派工」往右那根箭头的尖离牌的距离和左边一样 */
  .agh-sessions .agh-card { width: max-content; }
  .agh-badge { --x: 632; --y: 162; width: 32.5%; white-space: normal; }   /* 说明那一句在牌里折成两行：一行排不下，会伸出牌、伸出图 */
  .agh-badge b { white-space: nowrap; }
  .agh-p2 { --x: 400; --y: 372; }
  .agh-exec { --x: 400; --y: 428; }
  .agh-t1 { --x: 172; --y: 436; }
  .agh-t2 { --x: 268; --y: 484; }
  .agh-t3 { --x: 400; --y: 500; }
  .agh-t4 { --x: 532; --y: 484; }
  .agh-t5 { --x: 628; --y: 436; }
  .agh-p3 { --x: 400; --y: 540; bottom: auto; }
  .agh-arch { width: 21.5%; white-space: normal; transform: translate(-50%, 0); }   /* 按上边放：四张卡的字数不一样、高矮不一样，上边齐了，四个箭头才都正好落在卡顶 */
  .agh-a1 { --x: 125; --y: 578; }
  .agh-a2 { --x: 308; --y: 578; }
  .agh-a3 { --x: 492; --y: 578; }
  .agh-a4 { --x: 675; --y: 578; }
}

/* 背后那张 SVG：机器那一圈、各条联动线（线宽不随画布缩放）；箭头那几个小三角在 marker 里，颜色写在下面 */
.agh-lines > path { fill: none; vector-effect: non-scaling-stroke; }
.agl-ring { fill: rgba(0, 168, 143, .035); stroke: #00a88f; stroke-width: 2; stroke-dasharray: 7 6; vector-effect: non-scaling-stroke; }
.agl-spoke { stroke: #b4bfd0; stroke-width: 1.5; }
.agl-boss { stroke: #d48806; stroke-width: 2; }
.agl-brain { stroke: #1261e8; stroke-width: 1.8; }
.agl-ink { stroke: #5b6b83; stroke-width: 1.8; }
.agl-arch { stroke: #6d88b0; stroke-width: 1.6; }
.agh-lines marker path { stroke: none; }
.agm-amber { fill: #d48806; }
.agm-blue { fill: #1261e8; }
.agm-ink { fill: #5b6b83; }
.agm-arch { fill: #6d88b0; }
