/* domains/ai/foundations.css */
/* AI 目录卡片：详情视觉统一放在 concept-visuals.css。 */

.ai-preview {
  width: min(390px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--text);
}

.ai-preview > strong { font-size: 17px; font-weight: 680; }
.ai-preview > div { width: 100%; display: flex; align-items: stretch; justify-content: center; gap: 5px; }
.ai-preview > div span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-2);
  background: var(--bg);
  font-size: 10px;
}
.ai-preview > div span i {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 5px;
  color: var(--brand);
  background: var(--brand-light);
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}
.ai-preview > div > b { align-self: center; color: var(--text-3); font-size: 10px; font-weight: 400; }

/* domains/ai/agent-skill.css */
/* Skill 术语页：沿用站内文件树、聊天窗口、编辑器与对照场景。 */

.agent-skill-guide {
  display: grid;
  gap: 86px;
  margin-top: 72px;
}

/* ConceptVisual 会把文件行增强成可点击按钮；在 AI 样式包中保证按钮延续文件树样式。 */
.skill-tree > button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--text-3);
  background: transparent;
  font: 550 12px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: left;
  cursor: pointer;
}

.skill-tree > button:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.skill-tree > button.active {
  color: var(--brand);
  background: var(--brand-light);
}

.skill-tree > button b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-tree > button em {
  flex: none;
  padding: 2px 5px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-3);
  background: var(--bg);
  font: 650 10px/1.35 var(--font-sans);
  font-style: normal;
}

.skill-tree > button.active em {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 26%, var(--border));
}

.asg-section {
  min-width: 0;
  scroll-margin-top: 110px;
}

.asg-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.asg-heading > span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .04em;
}

.asg-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -.045em;
  line-height: 1.15;
}

.asg-heading p {
  max-width: 760px;
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.75;
}

.asg-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}

.asg-controls button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text-2);
  background: transparent;
  font: 650 13px/1.25 inherit;
  cursor: pointer;
}

.asg-controls button:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.asg-controls button.is-active {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 20%, var(--border));
  background: var(--brand-light);
}

.asg-controls button:focus-visible,
.asg-copy:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.asg-controls button span {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--text-3);
  background: var(--bg-soft);
  font-size: 11px;
}

.asg-controls button.is-active span {
  color: #fff;
  background: var(--brand);
}

.asg-chat-window {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--text) 5%, transparent);
}

.asg-chat-window > header {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-soft);
}

.asg-chat-window > header strong {
  min-width: 0;
  flex: 1;
  font-size: 13px;
}

.asg-chat-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--brand);
  background: var(--brand-light);
  font-size: 12px;
  font-weight: 760;
}

.asg-chat-window pre {
  min-height: 116px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  color: var(--text);
  background: var(--bg);
  font: 560 14px/1.8 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.asg-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-2);
  background: var(--bg);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.asg-copy:hover {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 28%, var(--border));
}

/* 安装与使用 */
.asg-install-scene {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 42px minmax(220px, .65fr);
  align-items: center;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(color-mix(in srgb, var(--text) 2.2%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 2.2%, transparent) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
}

.asg-install-arrow,
.asg-create-arrow {
  color: var(--brand);
  font-size: 27px;
  font-weight: 650;
  text-align: center;
}

.asg-installed-folder {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px 4px;
}

.asg-installed-folder > i {
  color: var(--brand);
  font-size: 48px;
}

.asg-installed-folder > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.asg-installed-folder small,
.asg-installed-folder em {
  color: var(--text-3);
  font-size: 12px;
  font-style: normal;
}

.asg-installed-folder strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font: 720 14px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.asg-source-line {
  margin: 14px 0 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.7;
}

.asg-source-line strong {
  color: var(--text);
}

.asg-use-example {
  display: grid;
  grid-template-columns: minmax(190px, .7fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 28px;
  margin-top: 28px;
  padding: 24px 26px;
  border-radius: 14px;
  background: var(--bg-soft);
}

.asg-use-example > div:first-child {
  display: grid;
  gap: 5px;
}

.asg-use-example small {
  color: var(--brand);
  font-size: 12px;
  font-weight: 740;
}

.asg-use-example strong {
  font-size: 17px;
}

.asg-use-example p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}

.asg-use-example .asg-chat-window pre {
  min-height: 86px;
}

.asg-boundary-line {
  max-width: 820px;
  margin: 16px 0 0;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.7;
}

/* 作用 */
.asg-value-scene {
  position: relative;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 110px minmax(210px, 1fr);
  align-items: center;
  gap: 34px;
  min-height: 280px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(color-mix(in srgb, var(--text) 2.2%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 2.2%, transparent) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
}

.asg-workflow-sheet,
.asg-knowledge-files {
  min-height: 178px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--text) 5%, transparent);
}

.asg-workflow-sheet > span,
.asg-knowledge-files > span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.asg-workflow-sheet > span i,
.asg-knowledge-files > span i {
  color: var(--brand);
  font-size: 19px;
}

.asg-workflow-sheet ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}

.asg-knowledge-files code {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font: 540 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.asg-knowledge-files code i {
  color: var(--text-3);
}

.asg-skill-core {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--brand);
}

.asg-skill-core::before,
.asg-skill-core::after {
  content: "";
  position: absolute;
  top: 35px;
  width: 40px;
  height: 2px;
  background: color-mix(in srgb, var(--brand) 42%, var(--border));
}

.asg-skill-core::before { right: calc(100% + 4px); }
.asg-skill-core::after { left: calc(100% + 4px); }

.asg-skill-core i {
  font-size: 56px;
}

.asg-skill-core strong {
  font-size: 15px;
}

.asg-value-labels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  margin-top: 16px;
}

.asg-value-labels > span {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 2px 10px;
  align-items: center;
  padding: 8px 0;
}

.asg-value-labels b {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  font-size: 12px;
}

.asg-value-labels strong {
  font-size: 14px;
}

.asg-value-labels small {
  color: var(--text-3);
  font-size: 12px;
}

/* 创建 */
.asg-create-scene {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 42px minmax(220px, .75fr);
  align-items: center;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
}

.asg-created-skill {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
}

.asg-created-skill > i {
  color: var(--brand);
  font-size: 48px;
}

.asg-created-skill > span {
  display: grid;
  gap: 5px;
}

.asg-created-skill strong {
  margin-bottom: 3px;
  font: 720 14px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.asg-created-skill code {
  color: var(--text-3);
  font: 540 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.asg-create-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.asg-create-steps li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.asg-create-steps span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--brand);
  background: var(--brand-light);
  font-size: 12px;
  font-weight: 750;
}

.asg-create-steps p {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
}

/* 测试 */
.asg-test-task {
  display: grid;
  justify-items: center;
  gap: 5px;
  margin-bottom: 18px;
  text-align: center;
}

.asg-test-task small {
  color: var(--brand);
  font-size: 12px;
  font-weight: 740;
}

.asg-test-task strong {
  font-size: 16px;
}

.asg-test-lanes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.asg-test-lanes article {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--bg-soft);
}

.asg-test-lanes article:last-child {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--border));
  background: color-mix(in srgb, var(--brand-light) 40%, var(--bg));
}

.asg-test-lanes header {
  display: flex;
  align-items: center;
  gap: 9px;
}

.asg-test-lanes header i {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--text-2);
  background: var(--bg);
  font-size: 18px;
}

.asg-test-lanes article:last-child header i {
  color: var(--brand);
}

.asg-test-lanes header strong {
  font-size: 14px;
}

.asg-test-lanes article > p {
  min-height: 44px;
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}

.asg-test-output {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
}

.asg-test-output i {
  height: 7px;
  border-radius: 4px;
  background: var(--border);
}

.asg-test-output i:nth-child(2) {
  width: 66%;
}

.asg-test-output span {
  grid-column: 1 / -1;
  color: var(--text-3);
  font-size: 12px;
}

.asg-test-output.is-ready {
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}

.asg-test-output.is-ready i {
  background: color-mix(in srgb, var(--brand) 30%, var(--border));
}

.asg-test-output.is-ready span {
  color: var(--brand);
}

.asg-test-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-top: 16px;
}

.asg-test-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-size: 13px;
}

.asg-test-metrics i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

/* 最佳实践 */
.asg-practice-stage {
  min-height: 270px;
  display: grid;
  place-items: center;
  padding: 30px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(color-mix(in srgb, var(--text) 2.2%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 2.2%, transparent) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
}

.asg-practice-stage > * {
  width: min(680px, 100%);
}

.asg-skill-editor {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--text) 5%, transparent);
}

.asg-skill-editor header {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-soft);
}

.asg-skill-editor header i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.asg-skill-editor header b {
  margin-left: 5px;
  color: var(--text-3);
  font: 620 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.asg-skill-editor code {
  display: block;
  padding: 8px 16px;
  color: var(--text-2);
  font: 540 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.asg-skill-editor code:first-of-type {
  padding-top: 16px;
}

.asg-skill-editor code:last-of-type {
  padding-bottom: 16px;
}

.asg-skill-editor code.is-highlighted {
  color: var(--brand);
  background: var(--brand-light);
}

.asg-skill-editor em {
  color: var(--brand);
  font-style: normal;
}

.asg-script-evidence {
  display: grid;
  grid-template-columns: minmax(210px, .8fr) minmax(0, 1.2fr);
  gap: 20px;
  align-items: stretch;
}

.asg-script-evidence > div {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
  text-align: center;
}

.asg-script-evidence > div i {
  color: var(--brand);
  font-size: 34px;
}

.asg-script-evidence > div strong {
  font: 700 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.asg-script-evidence > div span {
  color: var(--text-3);
  font-size: 12px;
}

.asg-script-evidence pre {
  min-height: 168px;
  margin: 0;
  padding: 20px;
  border-radius: 11px;
  color: #e5e7eb;
  background: #15181e;
  font: 540 13px/1.8 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

.asg-concise-evidence {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(170px, .7fr);
  align-items: center;
  gap: 24px;
}

.asg-concise-evidence > p {
  display: grid;
  gap: 5px;
  margin: 0;
}

.asg-concise-evidence > p strong {
  font-size: 16px;
  line-height: 1.45;
}

.asg-concise-evidence > p span {
  color: var(--text-3);
  font-size: 13px;
}

.asg-result-note {
  margin: 14px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
}

.asg-result-note strong {
  color: var(--text);
}

@media (max-width: 820px) {
  .agent-skill-guide {
    gap: 70px;
    margin-top: 62px;
  }

  .asg-install-scene,
  .asg-create-scene,
  .asg-value-scene {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .asg-install-arrow,
  .asg-create-arrow {
    transform: rotate(90deg);
  }

  .asg-installed-folder,
  .asg-created-skill {
    justify-content: center;
  }

  .asg-skill-core::before,
  .asg-skill-core::after {
    display: none;
  }

  .asg-value-labels,
  .asg-use-example,
  .asg-test-lanes,
  .asg-script-evidence,
  .asg-concise-evidence {
    grid-template-columns: minmax(0, 1fr);
  }

  .asg-create-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
}

@media (max-width: 560px) {
  .agent-skill-guide {
    gap: 58px;
    margin-top: 52px;
  }

  .asg-heading {
    margin-bottom: 18px;
  }

  .asg-heading h2 {
    font-size: 28px;
  }

  .asg-heading p {
    font-size: 14px;
  }

  .asg-controls {
    flex-wrap: nowrap;
    margin-right: -20px;
    padding-right: 20px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .asg-controls::-webkit-scrollbar {
    display: none;
  }

  .asg-controls button {
    flex: 0 0 auto;
  }

  .asg-install-scene,
  .asg-create-scene,
  .asg-value-scene,
  .asg-practice-stage {
    padding: 18px;
  }

  .asg-chat-window pre {
    padding: 15px;
    font-size: 12px;
  }

  .asg-use-example {
    gap: 16px;
    padding: 20px 18px;
  }

  .asg-test-lanes article {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-skill-guide *,
  .agent-skill-guide *::before,
  .agent-skill-guide *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation: none !important;
  }
}
