/* AI connection section — scoped from ai-modes-section-preview.html */

.aim-section {
  --accent: #6485ba;
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: center;
  background: transparent;
  color: var(--alt-fg);
  font-family: "Satoshi", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.aim-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--alt-fg) 8%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--alt-fg) 8%, transparent) 1px, transparent 1px);
  background-size: 80px 80px;
  -webkit-mask-image:
    linear-gradient(90deg, transparent 2%, #000 90%),
    linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, transparent 2%, #000 90%),
    linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  mask-composite: intersect;
  pointer-events: none;
}

.aim-section::after {
  content: "";
  position: absolute;
  width: 630px;
  height: 630px;
  right: 2%;
  top: 50%;
  transform: translateY(-50%);
  background: radial-gradient(ellipse, color-mix(in srgb, var(--accent) 16%, transparent), transparent 68%);
  pointer-events: none;
}

.aim-section button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.aim-section button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.aim-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 80rem);
  margin: auto;
  box-sizing: border-box;
  padding: var(--ml-section-y, 5rem) var(--ml-gutter, 1.5rem);
}

.aim-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 17px;
}

.aim-kicker {
  color: var(--alt-muted);
}

.aim-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  padding: 5px;
  width: 246px;
  border: 1px solid var(--alt-border);
  border-radius: 999px;
  background: var(--alt-elevated);
  box-shadow: inset 0 1px 3px color-mix(in srgb, var(--alt-fg) 8%, transparent);
}

.aim-toggle::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: calc(50% - 5px);
  height: calc(100% - 10px);
  background: var(--alt-card);
  border-radius: 999px;
  box-shadow: 0 2px 5px rgba(8, 14, 24, 0.12), 0 0 0 1px var(--alt-border);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.aim-section[data-mode="auto"] .aim-toggle::before {
  transform: translateX(100%);
}

.aim-toggle button {
  position: relative;
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  height: 39px;
  color: var(--alt-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.3s;
}

.aim-toggle button[aria-pressed="true"] {
  color: var(--alt-fg-strong);
}

.aim-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.aim-layout {
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: 15px;
  align-items: center;
  margin-top: 18px;
}

.aim-copy {
  padding: 0 0 28px;
  max-width: 465px;
}

.aim-eyebrow {
  display: flex;
}

.aim-copy-stack {
  display: grid;
  margin-top: 23px;
}

.aim-copy-panel {
  grid-area: 1 / 1;
  transition: opacity 0.35s, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0;
  transform: translateY(12px);
  visibility: hidden;
}

.aim-copy-panel.active {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.aim-section .aim-copy h2 {
  margin: 0 0 24px;
}

.aim-muted {
  color: var(--alt-muted);
}

.aim-section .aim-copy p {
  margin: 0;
  max-width: 400px;
}

.aim-details {
  display: flex;
  gap: 20px;
  margin-top: 30px;
  color: var(--alt-muted);
  font-size: 13px;
}

.aim-details span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.aim-check {
  color: var(--alt-fg-strong);
  font-size: 13px;
  font-weight: 500;
}

.aim-foot {
  font-size: 13px;
  color: var(--alt-muted);
  margin-top: 32px;
}

.aim-diagram {
  width: 100%;
  aspect-ratio: 680 / 550;
  position: relative;
  isolation: isolate;
}

.aim-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.aim-wire {
  fill: none;
  stroke: color-mix(in srgb, var(--alt-fg) 18%, transparent);
  stroke-width: 1.15;
  transition: stroke 0.5s, opacity 0.5s;
}

.aim-wire.active {
  stroke: #7f9fcf;
  stroke-width: 1.65;
}

.aim-flow {
  fill: none;
  stroke: #7496c9;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-dasharray: 1 55;
  opacity: 0;
  transition: opacity 0.6s;
  animation: aim-flow 3s linear infinite;
}

.aim-flow.active {
  opacity: 1;
}

@keyframes aim-flow {
  to {
    stroke-dashoffset: -112;
  }
}

.aim-cloud {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 53%;
  aspect-ratio: 1;
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  transition: opacity 0.8s, transform 1s;
}

.aim-cloud.two {
  width: 65%;
  border-style: solid;
  border-color: color-mix(in srgb, var(--accent) 18%, transparent);
}

.aim-section[data-mode="auto"] .aim-cloud {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.aim-provider {
  --x: 50;
  --y: 50;
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  transform: translate(-50%, -50%);
  padding: 0;
  z-index: 3;
  transition: left 1s cubic-bezier(0.22, 1, 0.36, 1), top 1s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.aim-tile {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  border: 1px solid var(--alt-border);
  box-shadow: 0 7px 18px rgba(8, 14, 24, 0.08), 0 2px 4px rgba(8, 14, 24, 0.05);
  background: var(--alt-card);
  display: grid;
  place-items: center;
  position: relative;
  transition: box-shadow 0.5s, border-color 0.5s, transform 0.5s;
}

.aim-tile img {
  width: 34px;
  height: 34px;
  max-width: none;
  object-fit: contain;
}

.aim-tile svg {
  width: 31px;
  height: 31px;
  stroke: var(--alt-fg);
  stroke-width: 1.6;
  fill: none;
}

.aim-name {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: var(--alt-muted);
  transition: color 0.5s;
}

.aim-provider:hover .aim-tile {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.aim-provider.aim-selected .aim-tile {
  border-color: color-mix(in srgb, var(--accent) 75%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent), 0 8px 20px rgba(8, 14, 24, 0.1);
}

.aim-provider.aim-selected .aim-name {
  color: var(--alt-fg-strong);
}

.aim-badge {
  position: absolute;
  right: -5px;
  top: -5px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid var(--alt-bg);
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.5);
  transition: 0.35s;
}

.aim-selected .aim-badge {
  opacity: 1;
  transform: scale(1);
}

html[data-theme="dark"] .aim-provider:not(.aim-claude):not(.aim-gemini) .aim-tile img {
  filter: invert(1) brightness(0.94);
}

.aim-claude img {
  filter: invert(52%) sepia(30%) saturate(806%) hue-rotate(334deg) brightness(95%);
}

.aim-gemini img {
  filter: invert(49%) sepia(62%) saturate(1457%) hue-rotate(192deg);
}

.aim-hub {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  z-index: 4;
  text-align: center;
}

.aim-emblem {
  position: relative;
  display: grid;
  place-items: center;
  width: 126px;
  height: 130px;
  background: var(--alt-card);
  border: 1px solid var(--alt-border);
  border-radius: 30px;
  box-shadow: 0 18px 36px rgba(8, 14, 24, 0.14), 0 3px 6px rgba(8, 14, 24, 0.06);
  transition: box-shadow 0.8s, border-color 0.8s;
}

.aim-emblem::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--alt-border);
  border-radius: 23px;
}

.aim-emblem img {
  height: 75px;
  width: 70px;
  max-width: none;
  filter: drop-shadow(0 5px 4px #1b314024);
  position: relative;
}

.aim-hub-label {
  position: absolute;
  top: calc(100% + 19px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--alt-fg);
  font-weight: 500;
}

.aim-hub-sub {
  position: absolute;
  top: calc(100% + 37px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  color: var(--alt-muted);
}

.aim-section.aim-scanning .aim-emblem {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 10%, transparent), 0 0 0 20px color-mix(in srgb, var(--accent) 5%, transparent), 0 18px 36px rgba(8, 14, 24, 0.14);
}

.aim-section.aim-scanning .aim-wire {
  stroke: color-mix(in srgb, var(--accent) 45%, transparent);
}

.aim-section.aim-scanning .aim-hub-sub {
  animation: aim-breathe 1s ease infinite;
}

@keyframes aim-breathe {
  50% {
    opacity: 0.4;
  }
}

.aim-task {
  position: absolute;
  left: 50%;
  top: 87%;
  transform: translate(-50%, -50%);
  width: 310px;
  padding: 15px 17px;
  border: 1px solid var(--alt-border);
  border-radius: 13px;
  background: var(--alt-card);
  box-shadow: 0 8px 25px rgba(8, 14, 24, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 4;
}

.aim-task-icon {
  width: 29px;
  height: 29px;
  border-radius: 8px;
  background: var(--alt-elevated);
  display: grid;
  place-items: center;
  color: var(--alt-muted);
  flex-shrink: 0;
}

.aim-task-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.aim-task-text {
  display: grid;
  gap: 4px;
}

.aim-task-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--alt-fg-strong);
}

.aim-task-status {
  font-size: 11px;
  color: var(--alt-muted);
}

.aim-task-dot {
  margin-left: auto;
  width: 5px;
  height: 5px;
  background: #93b3a1;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #93b3a115;
}

.aim-note {
  position: absolute;
  bottom: -4px;
  width: 100%;
  text-align: center;
  color: var(--alt-muted);
  font-size: 12px;
}

.aim-note span {
  color: var(--alt-fg);
}

.aim-section[data-mode="auto"] .aim-provider {
  cursor: default;
}

.aim-section[data-mode="auto"] .aim-provider.aim-unavailable,
.aim-section[data-mode="custom"] .aim-provider.aim-unavailable {
  opacity: 0;
  pointer-events: none;
}

.aim-wire.aim-unavailable {
  opacity: 0;
}

.aim-section[data-mode="auto"] .aim-provider:hover .aim-tile {
  transform: none;
}

@media (min-width: 1400px) {
  .aim-layout {
    margin-top: 30px;
  }
}

@media (max-width: 980px) {
  .aim-layout {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 42px;
  }

  .aim-copy {
    max-width: 650px;
    text-align: center;
    padding: 0;
    margin: auto;
  }

  .aim-eyebrow,
  .aim-details {
    justify-content: center;
  }

  .aim-section .aim-copy p {
    max-width: 490px;
    margin: auto;
  }

  .aim-foot {
    margin-top: 20px;
  }

  .aim-copy-stack {
    margin-top: 18px;
  }

  .aim-diagram {
    max-width: 620px;
    margin: auto;
  }

}

@media (max-width: 520px) {
  .aim-layout {
    margin-top: 32px;
    gap: 22px;
  }


  .aim-details {
    gap: 14px;
    font-size: 12px;
    margin-top: 24px;
  }

  .aim-foot {
    font-size: 12px;
  }

  .aim-tile {
    width: 52px;
    height: 52px;
    border-radius: 15px;
  }

  .aim-tile img {
    width: 25px;
    height: 25px;
  }

  .aim-tile svg {
    width: 25px;
    height: 25px;
  }

  .aim-provider {
    gap: 7px;
  }

  .aim-name {
    font-size: 10px;
  }

  .aim-emblem {
    width: 84px;
    height: 88px;
    border-radius: 22px;
  }

  .aim-emblem::before {
    inset: 6px;
    border-radius: 17px;
  }

  .aim-emblem img {
    width: 45px;
    height: 50px;
  }

  .aim-hub-label {
    top: calc(100% + 11px);
    font-size: 9px;
  }

  .aim-hub-sub {
    top: calc(100% + 26px);
    font-size: 10px;
  }

  .aim-task {
    width: 200px;
    padding: 10px 12px;
    gap: 8px;
  }

  .aim-section[data-mode="custom"] .aim-provider[data-provider="endpoint"] {
    --x: 88 !important;
    --y: 54 !important;
  }

  .aim-task-title {
    font-size: 12px;
  }

  .aim-task-status {
    font-size: 10px;
  }

  .aim-diagram {
    aspect-ratio: 680 / 610;
  }

  .aim-note {
    bottom: -12px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aim-section,
  .aim-section::before,
  .aim-section::after,
  .aim-section * {
    animation: none !important;
    transition: none !important;
  }
}
