.ai-operations {
  --ai-ops-rule: #c7b797;
  --ai-ops-forest: #173b30;
  --ai-ops-muted: #4e6056;
  --ai-ops-brass: #775923;
}

main .ai-operations > .ai-case-heading { margin-block-end: 12px; }

.ai-ops-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ai-ops-flow li {
  position: relative;
  min-inline-size: 0;
  padding: 6px clamp(9px, 1.2vw, 15px) 8px;
  border: 1px solid var(--ai-ops-rule);
  border-radius: 5px;
  background: #f9f4e8;
}

.ai-ops-flow li:not(:last-child)::after {
  position: absolute;
  inset-inline-start: 100%;
  inset-block-start: 50%;
  inline-size: 19px;
  block-size: 14px;
  transform: translateY(-50%);
  color: #805f2c;
  text-align: center;
  font: 600 14px/14px var(--sans);
  content: "→" / "";
}

.ai-ops-step-mark {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ai-ops-brass);
}

.ai-ops-step-mark svg { inline-size: 17px; block-size: 17px; }

.ai-ops-flow li::before {
  position: absolute;
  inset: -1px 0 auto;
  height: 2px;
  background: #8b6e37;
  content: "";
  opacity: 0;
  pointer-events: none;
}
.ai-ops-flow[data-sequence] li::before {
  animation: ai-ops-sequence .5s cubic-bezier(.17, .7, .27, 1) both;
  animation-delay: calc(var(--ai-ops-step, 0) * 150ms);
}
.ai-ops-flow li:nth-child(2) { --ai-ops-step: 1; }
.ai-ops-flow li:nth-child(3) { --ai-ops-step: 2; }
.ai-ops-flow li:nth-child(4) { --ai-ops-step: 3; }
.ai-ops-flow li:nth-child(5) { --ai-ops-step: 4; }

@keyframes ai-ops-sequence {
  from { clip-path: inset(0 100% 0 0); opacity: 0; }
  55% { opacity: 1; }
  to { clip-path: inset(0); opacity: .36; }
}

.ai-ops-step-number {
  display: block;
  color: var(--ai-ops-brass);
  font-size: .75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ai-ops-flow strong {
  display: block;
  margin: 4px 0 2px;
  color: var(--ai-ops-forest);
  font: 500 clamp(1.23rem, 2vw, 1.55rem)/1.05 var(--serif);
}
.ai-ops-step-description {
  display: block;
  color: var(--ai-ops-muted);
  font-size: .81rem;
  line-height: 1.35;
}
.ai-ops-flow .ai-ops-human { border-color: #b39353; background: #f2e0b4; }
.ai-ops-human .ai-ops-step-description { color: #694b1d; font-weight: 650; }
.ai-ops-external .ai-ops-step-description { color: var(--ai-ops-forest); font-weight: 600; }

.ai-ops-details {
  margin-block-start: 8px;
  border-block: 1px solid var(--ai-ops-rule);
}
.ai-ops-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 7px 3px;
  color: var(--ai-ops-forest);
  font-size: .875rem;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}
.ai-ops-details summary::-webkit-details-marker { display: none; }
.ai-ops-details summary span {
  position: relative;
  flex: 0 0 14px;
  height: 14px;
  color: var(--ai-ops-brass);
}
.ai-ops-details summary span::before,
.ai-ops-details summary span::after {
  position: absolute;
  inset: 6px 2px auto;
  border-block-start: 1px solid;
  content: "";
}
.ai-ops-details summary span::after { transform: rotate(90deg); }
.ai-ops-details[open] summary span::after { display: none; }
.ai-ops-details summary:focus-visible { outline: 2px solid var(--ai-ops-brass); outline-offset: 2px; }
.ai-ops-details-body {
  max-inline-size: 68ch;
  padding: 0 3px 14px;
  color: var(--ai-ops-muted);
  font-size: .9rem;
}
.ai-ops-details-body p + p { margin-block-start: 8px; }

@media (max-width: 740px) {
  .ai-ops-flow { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .ai-ops-flow li {
    display: grid;
    grid-template-columns: auto 5.4rem minmax(0, 1fr);
    gap: clamp(5px, 2vw, 12px);
    align-items: center;
    padding: 5px 8px;
  }
  .ai-ops-step-mark { gap: 4px; }
  .ai-ops-flow strong { margin: 0; font-size: 1.14rem; }
  .ai-ops-flow li:not(:last-child)::after {
    inset: 100% auto auto 50%;
    transform: translateX(-50%);
    block-size: 12px;
    font-size: 12px;
    line-height: 12px;
    content: "↓" / "";
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-ops-flow[data-sequence] li::before { animation: none; }
}
