/* =========================================================
   高交互层：命令面板 / 系统拓扑 / 微交互
   ========================================================= */

/* ---------- 命令面板触发按钮 ---------- */
.cmd-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 38px;
  height: 38px;
  padding: 0;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.74rem;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.cmd-trigger svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.cmd-trigger span,
.cmd-trigger kbd {
  display: none;
}

.cmd-trigger kbd {
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 2px;
  font-family: var(--font-en);
  font-size: 0.56rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
}

.cmd-trigger:hover {
  border-color: rgba(242, 107, 33, 0.5);
  color: #fff;
  background: rgba(242, 107, 33, 0.1);
}

.site-header.is-scrolled .cmd-trigger {
  color: var(--body);
  border-color: var(--line);
  background: #fff;
}

.site-header.is-scrolled .cmd-trigger kbd {
  border-color: var(--line);
  color: var(--muted);
}

@media (min-width: 1680px) {
  .cmd-trigger {
    width: auto;
    padding: 0 10px;
  }
  .cmd-trigger span {
    display: inline;
  }
  .cmd-trigger kbd {
    display: inline;
  }
}

/* ---------- 命令面板 ---------- */
.cmd-overlay {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(60px, 11vh, 130px) 18px 24px;
  background: rgba(5, 4, 3, 0.68);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}

.cmd-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.cmd-dialog {
  width: min(680px, 100%);
  border: 1px solid rgba(214, 154, 110, 0.3);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #1b1511, #12100d);
  box-shadow: 0 50px 120px -40px #000, inset 0 1px 0 rgba(255, 255, 255, 0.07);
  overflow: hidden;
  transform: translateY(-12px) scale(0.985);
  transition: transform 0.3s var(--ease);
}

.cmd-overlay.is-open .cmd-dialog {
  transform: none;
}

.cmd-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.cmd-search svg {
  width: 19px;
  height: 19px;
  color: var(--orange-soft);
  flex: none;
}

.cmd-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: #fff;
  font-size: 1rem;
}

.cmd-search input::placeholder {
  color: rgba(232, 223, 213, 0.36);
}

.cmd-search kbd {
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  font-family: var(--font-en);
  font-size: 0.6rem;
  color: rgba(232, 223, 213, 0.48);
  flex: none;
}

.cmd-results {
  max-height: min(52vh, 430px);
  overflow-y: auto;
  padding: 8px;
}

.cmd-group-label {
  padding: 12px 12px 6px;
  font-family: var(--font-en);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: rgba(232, 223, 213, 0.36);
  text-transform: uppercase;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: rgba(232, 223, 213, 0.78);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.cmd-item svg {
  width: 16px;
  height: 16px;
  color: var(--copper, #d69a6e);
  opacity: 0.75;
  flex: none;
}

.cmd-item small {
  margin-left: auto;
  font-family: var(--font-en);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: rgba(232, 223, 213, 0.32);
  white-space: nowrap;
}

.cmd-item.is-active,
.cmd-item:hover {
  background: rgba(242, 107, 33, 0.12);
  color: #fff;
}

.cmd-item.is-active svg,
.cmd-item:hover svg {
  color: var(--orange);
  opacity: 1;
}

.cmd-empty {
  padding: 36px 20px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(232, 223, 213, 0.45);
}

.cmd-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 11px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.66rem;
  color: rgba(232, 223, 213, 0.4);
}

.cmd-foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cmd-foot kbd {
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 2px;
  font-family: var(--font-en);
  font-size: 0.58rem;
}

/* ---------- 首页系统拓扑 ---------- */
.topo-section {
  position: relative;
  overflow: hidden;
}

.topo-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    700px 400px at 84% 20%,
    rgba(242, 107, 33, 0.07),
    transparent 62%
  );
  pointer-events: none;
}

.topo-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(36px, 6vw, 80px);
  align-items: center;
}

.topo-copy .section-sub {
  max-width: 520px;
}

.topo-detail {
  margin-top: 30px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  min-height: 176px;
}

.topo-kicker {
  display: block;
  font-family: var(--font-en);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--orange-strong);
  text-transform: uppercase;
}

.topo-detail h3 {
  margin-top: 8px;
  font-size: 1.22rem;
}

.topo-detail p {
  margin-top: 8px;
  font-size: 0.86rem;
  line-height: 1.8;
  color: var(--body);
}

.topo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.topo-tags span {
  padding: 4px 9px;
  border-radius: 2px;
  background: var(--bg);
  font-size: 0.7rem;
  color: var(--muted);
}

.topo-stage {
  position: relative;
  aspect-ratio: 1.02;
  border: 1px solid rgba(214, 154, 110, 0.22);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(480px 360px at 50% 48%, rgba(242, 107, 33, 0.1), transparent 66%),
    linear-gradient(145deg, #191410, #0c0907 72%);
  overflow: hidden;
  box-shadow: 0 40px 80px -50px rgba(10, 8, 7, 0.8);
}

.topo-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(201, 224, 214, 0.14) 1px, transparent 1.4px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at center, #000 30%, transparent 82%);
  -webkit-mask-image: radial-gradient(circle at center, #000 30%, transparent 82%);
  opacity: 0.5;
  pointer-events: none;
}

.topo-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.topo-line {
  stroke: rgba(201, 224, 214, 0.14);
  stroke-width: 1;
  fill: none;
  transition: stroke 0.35s, stroke-width 0.35s;
}

.topo-line.is-active {
  stroke: rgba(242, 107, 33, 0.72);
  stroke-width: 1.4;
}

.topo-node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(201, 224, 214, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(17, 13, 10, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: rgba(232, 223, 213, 0.75);
  font-size: 0.74rem;
  line-height: 1.2;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: color 0.25s, border-color 0.25s, background 0.25s,
    transform 0.3s var(--ease), box-shadow 0.3s;
}

.topo-node svg {
  width: 16px;
  height: 16px;
  color: var(--cyan-soft);
  flex: none;
}

.topo-node:hover,
.topo-node:focus-visible,
.topo-node.is-active {
  color: #fff;
  border-color: rgba(242, 107, 33, 0.62);
  background: rgba(34, 24, 17, 0.92);
  box-shadow: 0 0 26px -6px rgba(242, 107, 33, 0.45);
  transform: translate(-50%, -50%) scale(1.05);
}

.topo-node.is-active svg {
  color: var(--orange);
}

.topo-node--hub {
  padding: 14px 16px;
  border-color: rgba(242, 107, 33, 0.4);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(242, 107, 33, 0.12);
}

.topo-node--hub svg {
  color: var(--orange-soft);
}

.topo-node--hub::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(242, 107, 33, 0.18);
  border-radius: calc(var(--radius-sm) + 4px);
  animation: topoPulse 3.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes topoPulse {
  50% {
    inset: -12px;
    opacity: 0.25;
  }
}

.topo-hint {
  position: absolute;
  left: 18px;
  bottom: 14px;
  z-index: 2;
  font-family: var(--font-en);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  color: rgba(232, 223, 213, 0.32);
  text-transform: uppercase;
  pointer-events: none;
}

/* ---------- 按钮点击微交互 ---------- */
.btn {
  position: relative;
}

.btn-ripple {
  position: absolute;
  left: var(--rx, 50%);
  top: var(--ry, 50%);
  z-index: 2;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transform: translate(-50%, -50%) scale(0);
  animation: btnRipple 0.65s ease-out forwards;
  pointer-events: none;
}

@keyframes btnRipple {
  to {
    transform: translate(-50%, -50%) scale(32);
    opacity: 0;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .topo-layout {
    grid-template-columns: 1fr;
  }
  .topo-stage {
    max-width: 560px;
    width: 100%;
    margin-inline: auto;
    aspect-ratio: 1.06;
  }
  .cmd-trigger {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  .topo-stage {
    aspect-ratio: 1.08;
  }
  .topo-node {
    padding: 6px 8px;
    font-size: 0.66rem;
    gap: 6px;
  }
  .topo-node svg {
    width: 13px;
    height: 13px;
  }
  .topo-node--hub {
    padding: 9px 11px;
  }
  .topo-hint {
    display: none;
  }
  .cmd-dialog {
    width: 100%;
  }
  .cmd-search {
    padding: 14px 16px;
  }
  .cmd-search input {
    font-size: 0.92rem;
  }
  .cmd-results {
    max-height: 56vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topo-node--hub::after {
    animation: none;
  }
  .btn-ripple {
    display: none;
  }
}
