/* ============================================================
   components.css — 跨板块复用的通用组件
   新板块优先复用这里的类，不要重复造轮子。
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text-hi);
  --btn-line: var(--line-hi);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: 1px solid var(--btn-line);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-14);
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: transform 0.28s var(--ease-out), box-shadow 0.28s var(--ease-out),
              border-color 0.28s, background 0.28s, color 0.28s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn__arrow { transition: transform 0.28s var(--ease-out); }
.btn:hover .btn__arrow { transform: translateX(4px); }

.btn--primary {
  --btn-fg: #05101c;
  border-color: transparent;
  background: var(--grad-brand);
  font-weight: 600;
  box-shadow: 0 10px 34px -12px rgba(56, 225, 255, 0.6);
}
.btn--primary:hover { box-shadow: 0 16px 44px -12px rgba(120, 120, 255, 0.7); }

.btn--ghost { --btn-bg: rgba(255, 255, 255, 0.03); }
.btn--ghost:hover { --btn-line: var(--brand-blue); --btn-fg: #fff; }

.btn--sm { padding: 8px 16px; font-size: var(--fs-13); }

/* ---------- 卡片 ---------- */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--sh-card);
  overflow: hidden;
  transition: transform 0.4s var(--ease-out), border-color 0.4s, box-shadow 0.4s;
}
.card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(420px 220px at var(--mx, 50%) var(--my, 0%), rgba(56, 225, 255, 0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-6px);
  border-color: var(--line-hi);
  box-shadow: 0 26px 60px -26px rgba(0, 0, 0, 0.95);
}
.card:hover::before { opacity: 1; }

/* ---------- 标签 / 芯片 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
  font-size: var(--fs-12);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.chip {
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-dim);
  font-size: var(--fs-13);
  white-space: nowrap;
  transition: all 0.25s var(--ease);
}
.chip:hover { color: var(--text-hi); border-color: var(--line-hi); }
.chip.is-active {
  color: #05101c;
  border-color: transparent;
  background: var(--grad-brand);
  font-weight: 600;
}

/* ---------- 面板 ---------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  backdrop-filter: blur(12px);
}

/* ---------- 抽屉（知识库详情用，通用） ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  display: grid;
  grid-template-columns: 1fr min(720px, 100%);
  gap: 0;
  visibility: hidden;
  pointer-events: none;
}
.drawer.is-open { visibility: visible; pointer-events: auto; }
.drawer__scrim {
  background: rgba(2, 4, 10, 0.7);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer__panel {
  transform: translateX(40px);
  opacity: 0;
  transition: transform 0.42s var(--ease-out), opacity 0.42s var(--ease);
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, #070c17, #05080f);
  box-shadow: -30px 0 80px -30px rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
}
.drawer.is-open .drawer__panel { transform: none; opacity: 1; }
.drawer__body { overflow-y: auto; padding: clamp(24px, 4vw, 44px); }
.drawer__close {
  position: absolute; top: 18px; right: 18px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 18px;
  transition: all 0.25s var(--ease);
}
.drawer__close:hover { background: rgba(255, 95, 109, 0.16); color: #fff; transform: rotate(90deg); }

.prose { color: var(--text); font-size: var(--fs-15); }
.prose h4 {
  margin: var(--sp-5) 0 var(--sp-2);
  font-size: var(--fs-18);
  color: var(--text-hi);
}
.prose h4::before {
  content: "";
  display: inline-block;
  width: 3px; height: 14px;
  margin-right: 9px;
  vertical-align: -1px;
  border-radius: 2px;
  background: var(--grad-brand);
}
.prose p { margin-bottom: var(--sp-3); }
.prose ul { margin: 0 0 var(--sp-4); }
.prose li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 7px;
  color: var(--text);
}
.prose li::before {
  content: "";
  position: absolute; left: 4px; top: 11px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--brand-blue);
  box-shadow: 0 0 8px var(--brand-blue);
}
.prose code, .prose .code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(56, 225, 255, 0.08);
  color: #b6ecff;
}
mark.hit {
  background: rgba(255, 176, 58, 0.24);
  color: #ffe3b0;
  border-radius: 3px;
  padding: 0 2px;
}

@media (max-width: 720px) {
  .drawer { grid-template-columns: 1fr; }
  .drawer__scrim { display: none; }
  .drawer__panel {
    margin-top: 8vh;
    border-left: none;
    border-top: 1px solid var(--line);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(40px);
  }
}
