/**
 * 功能页「一 Key 连接多模型」流程图 — 中英文共用
 * 在 brand-mark.css、marketing-responsive.css 之后引入
 */

.xlei-route {
  display: flex;
  justify-content: center;
  padding: clamp(0.5rem, 2vw, 1rem) clamp(1rem, 5vw, 5%) clamp(2.5rem, 6vw, 5rem);
  position: relative;
  overflow: hidden;
}

.xlei-route::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, rgba(59, 130, 246, 0.14) 0%, transparent 65%),
    linear-gradient(rgba(59, 130, 246, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.04) 1px, transparent 1px);
  background-size: auto, 48px 48px, 48px 48px;
  mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, #000 20%, transparent 75%);
  pointer-events: none;
}

.xlei-route__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(0.5rem, 3vw, 1.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.xlei-route__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: clamp(0.62rem, 1.6vw, 0.72rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  margin-bottom: 1rem;
  max-width: 100%;
}

.xlei-route__pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 12px #22d3ee;
  animation: xlei-route-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.xlei-route__title {
  font-size: clamp(1.5rem, 3.2vw, 2.35rem);
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  text-align: center;
  padding: 0 0.25rem;
  background: linear-gradient(135deg, #e0f2fe 0%, #93c5fd 45%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.xlei-route__lead {
  color: #94a3b8;
  font-size: clamp(0.88rem, 2.5vw, 1.02rem);
  line-height: 1.75;
  max-width: min(40rem, 100%);
  margin: 0 auto clamp(1.5rem, 4vw, 2.75rem);
  text-align: center;
  padding: 0 0.5rem;
}

.xlei-route__diagram {
  display: grid;
  grid-template-columns:
    minmax(0, 0.9fr)
    minmax(56px, 88px)
    minmax(0, 1.05fr)
    minmax(56px, 88px)
    minmax(0, 1.22fr);
  align-items: center;
  gap: 0.15rem;
  width: 100%;
  padding: clamp(1rem, 3vw, 2rem) clamp(0.75rem, 2vw, 1.25rem);
  border-radius: clamp(16px, 3vw, 24px);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.55));
  border: 1px solid rgba(59, 130, 246, 0.22);
  box-shadow: 0 0 80px rgba(37, 99, 235, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.xlei-route__node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.65rem;
  padding: 1.15rem 0.85rem;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(96, 165, 250, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  min-width: 0;
}

.xlei-route__node-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  width: 100%;
}

.xlei-route__node-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  background: linear-gradient(145deg, #1d4ed8, #7c3aed);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.45);
}

.xlei-route__node-label {
  font-size: clamp(0.78rem, 1.8vw, 0.82rem);
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.xlei-route__node-key {
  font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
  font-size: clamp(0.62rem, 1.8vw, 0.72rem);
  color: #38bdf8;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  max-width: 100%;
  word-break: break-all;
}

.xlei-route__beam {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 0.1rem;
  min-width: 0;
}

.xlei-route__beam svg {
  width: 100%;
  height: clamp(40px, 5vw, 48px);
  overflow: visible;
  display: block;
}

.xlei-route__beam-track {
  fill: none;
  stroke: rgba(56, 189, 248, 0.18);
  stroke-width: 2;
  stroke-linecap: round;
}

.xlei-route__beam-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 6 9;
  animation: xlei-route-flow 1.15s linear infinite;
}

.xlei-route__beam-packet {
  filter: drop-shadow(0 0 5px #22d3ee);
}

.xlei-route__hub {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.35rem 0.75rem;
  min-width: 0;
}

.xlei-route__hub-ring {
  position: absolute;
  width: 9rem;
  height: 9rem;
  border-radius: 50%;
  border: 1px dashed rgba(56, 189, 248, 0.35);
  animation: xlei-route-spin 24s linear infinite;
}

.xlei-route__hub-ring--2 {
  width: 11rem;
  height: 11rem;
  border-color: rgba(139, 92, 246, 0.25);
  animation-direction: reverse;
  animation-duration: 32s;
}

.xlei-route__hub-core {
  position: relative;
  z-index: 2;
  width: clamp(4.5rem, 10vw, 5.5rem);
  height: clamp(4.5rem, 10vw, 5.5rem);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1e40af 0%, #6d28d9 55%, #0891b2 100%);
  border: 2px solid rgba(125, 211, 252, 0.5);
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.55), 0 0 80px rgba(124, 58, 237, 0.25);
  animation: xlei-route-hub-glow 3s ease-in-out infinite;
}

.xlei-route__hub-core strong {
  font-size: clamp(0.78rem, 2vw, 0.95rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #fff;
}

.xlei-route__hub-core span {
  font-size: clamp(0.55rem, 1.5vw, 0.62rem);
  color: #bae6fd;
  letter-spacing: 0.06em;
  margin-top: 0.15rem;
}

.xlei-route__hub-scan {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
}

.xlei-route__hub-scan::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: xlei-route-scan 2.8s ease-in-out infinite;
}

.xlei-route__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  max-width: 15rem;
}

.xlei-route__chip {
  font-size: clamp(0.58rem, 1.6vw, 0.68rem);
  font-weight: 600;
  color: #cbd5e1;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  line-height: 1.35;
  text-align: center;
}

.xlei-route__chip--accent {
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(8, 145, 178, 0.15);
}

.xlei-route__models {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  min-width: 0;
}

.xlei-route__model {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.65rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.15);
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
  min-width: 0;
}

.xlei-route__model:hover {
  border-color: rgba(96, 165, 250, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
}

.xlei-route__model-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--model-accent, #4ade80);
  box-shadow: 0 0 8px var(--model-accent, #4ade80);
  animation: xlei-route-pulse 2.5s ease-in-out infinite;
}

.xlei-route__model-name {
  font-size: clamp(0.72rem, 1.8vw, 0.8rem);
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.xlei-route__model-version,
.xlei-route__model-vendor {
  font-size: clamp(0.58rem, 1.5vw, 0.65rem);
  color: #64748b;
  display: block;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

html:lang(en) .xlei-route__model-name {
  font-size: clamp(0.68rem, 1.7vw, 0.78rem);
}

html:lang(en) .xlei-route__model-version,
html:lang(en) .xlei-route__model-vendor {
  font-size: clamp(0.56rem, 1.4vw, 0.63rem);
}

.xlei-route__model--more .xlei-route__model-dot {
  background: #94a3b8;
  box-shadow: 0 0 8px #94a3b8;
}

.xlei-route__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.75rem;
  justify-content: center;
  width: 100%;
}

.xlei-route__badge {
  font-size: clamp(0.72rem, 1.8vw, 0.8rem);
  font-weight: 600;
  color: #94a3b8;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.15);
  text-align: center;
  line-height: 1.45;
}

.xlei-route__badge strong { color: #e2e8f0; }

/* —— 语言差异 —— */
html:lang(zh-CN) .xlei-route__pill {
  letter-spacing: 0.08em;
  text-transform: none;
}

html:lang(zh-CN) .xlei-route__title {
  letter-spacing: 0.02em;
}

html:lang(zh-CN) .xlei-route__chips {
  max-width: 16rem;
}

html:lang(en) .xlei-route__pill {
  letter-spacing: 0.06em;
}

html:lang(en) .xlei-route__chips {
  max-width: 17.5rem;
}

html:lang(en) .xlei-route__chip {
  padding: 0.28rem 0.45rem;
}

html:lang(en) .xlei-route__lead {
  max-width: min(42rem, 100%);
}

@keyframes xlei-route-flow { to { stroke-dashoffset: -30; } }
@keyframes xlei-route-pulse { 0%, 100% { opacity: 0.5; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1); } }
@keyframes xlei-route-spin { to { transform: rotate(360deg); } }
@keyframes xlei-route-hub-glow {
  0%, 100% { box-shadow: 0 0 40px rgba(59, 130, 246, 0.45), 0 0 80px rgba(124, 58, 237, 0.2); }
  50% { box-shadow: 0 0 56px rgba(34, 211, 238, 0.5), 0 0 100px rgba(124, 58, 237, 0.35); }
}
@keyframes xlei-route-scan { 0% { top: -40%; } 100% { top: 100%; } }

/* —— 宽屏略收紧 —— */
@media (max-width: 1180px) {
  .xlei-route__diagram {
    grid-template-columns:
      minmax(0, 0.85fr)
      minmax(48px, 72px)
      minmax(0, 1fr)
      minmax(48px, 72px)
      minmax(0, 1.15fr);
  }
}

/* —— 平板 / 窄桌面：纵向流程 —— */
@media (max-width: 1024px) {
  .xlei-route__diagram {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    padding: 1.25rem 1rem;
  }

  .xlei-route__beam {
    min-height: 48px;
    width: 100%;
    max-width: 3.25rem;
    margin: 0 auto;
  }

  .xlei-route__beam svg {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    transform: rotate(90deg);
  }

  .xlei-route__hub {
    padding: 1.15rem 0.5rem;
  }

  .xlei-route__hub-ring,
  .xlei-route__hub-ring--2 {
    display: none;
  }

  .xlei-route__models {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .xlei-route__node {
    width: 100%;
    max-width: 24rem;
    margin: 0 auto;
  }

  .xlei-route__chips {
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  .xlei-route__models {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  html:lang(en) .xlei-route__models {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* —— 手机 —— */
@media (max-width: 768px) {
  .xlei-route__pill {
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.75rem;
  }

  html:lang(zh-CN) .xlei-route__pill {
    letter-spacing: 0.04em;
  }

  .xlei-route__diagram {
    padding: 1.15rem 0.85rem;
    border-radius: 18px;
  }

  .xlei-route__node {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
    max-width: none;
  }

  .xlei-route__node-meta {
    align-items: flex-start;
    flex: 1;
  }

  .xlei-route__node-icon {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.25rem;
  }

  .xlei-route__models {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .xlei-route__model {
    padding: 0.7rem 0.9rem;
  }

  .xlei-route__badges {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }
}

@media (max-width: 480px) {
  .xlei-route__title {
    font-size: 1.4rem;
  }

  .xlei-route__lead {
    font-size: 0.88rem;
  }

  .xlei-route__beam svg {
    width: 40px;
    height: 40px;
  }

  .xlei-route__chip {
    flex: 1 1 calc(50% - 0.4rem);
    min-width: calc(50% - 0.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .xlei-route__pill::before,
  .xlei-route__beam-line,
  .xlei-route__beam-packet,
  .xlei-route__hub-ring,
  .xlei-route__hub-core,
  .xlei-route__hub-scan::after,
  .xlei-route__model-dot {
    animation: none !important;
  }

  .xlei-route__beam-packet {
    display: none;
  }
}
