/* =========================================================
   XJQ 导航 · 样式
   浅色 / 深色两套变量，其余组件只引用变量
   ========================================================= */

:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #0f1728;
  --muted: #5c6880;
  --faint: #8a94a8;
  --line: rgba(15, 23, 40, 0.08);
  --line-strong: rgba(15, 23, 40, 0.16);
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(79, 70, 229, 0.09);
  --star: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(15, 23, 40, 0.05);
  --shadow-md: 0 10px 30px -18px rgba(15, 23, 40, 0.28);
  --shadow-lg: 0 24px 50px -24px rgba(15, 23, 40, 0.35);
  --radius: 16px;
  --max: 1180px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #080b12;
  --panel: #111827;
  --text: #e9eef8;
  --muted: #93a0b8;
  --faint: #6b7891;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #8b90ff;
  --accent-ink: #0b0f19;
  --accent-soft: rgba(139, 144, 255, 0.14);
  --star: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px -18px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 24px 50px -24px rgba(0, 0, 0, 0.9);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 480px at 12% -8%, rgba(99, 102, 241, 0.12), transparent 62%),
    radial-gradient(760px 420px at 92% -4%, rgba(6, 182, 212, 0.09), transparent 60%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(900px 480px at 12% -8%, rgba(99, 102, 241, 0.18), transparent 62%),
    radial-gradient(760px 420px at 92% -4%, rgba(6, 182, 212, 0.12), transparent 60%);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { display: block; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  transition: top 0.2s ease;
}
.skip-link:focus-visible { top: 16px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- 顶栏 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 251, 0.78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

[data-theme="dark"] .site-header { background: rgba(8, 11, 18, 0.72); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(140deg, #6366f1, #06b6d4);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 16px -8px rgba(79, 70, 229, 0.9);
}

.logo-text {
  display: flex;
  flex-direction: column;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.logo-text small {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--faint);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-link {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}
.header-link:hover { color: var(--text); background: var(--accent-soft); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s, background 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.icon-btn .i-sun { display: none; }
[data-theme="dark"] .icon-btn .i-sun { display: block; }
[data-theme="dark"] .icon-btn .i-moon { display: none; }

/* ---------- 首屏 ---------- */

.hero {
  padding: 74px 24px 30px;
  text-align: center;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.nw { white-space: nowrap; }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}

.hero h1 {
  margin: 0 auto 18px;
  max-width: 720px;
  font-size: clamp(32px, 4.6vw, 56px);
  font-weight: 750;
  line-height: 1.14;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero-sub {
  margin: 0 auto 30px;
  max-width: 600px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--muted);
  text-wrap: pretty;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 620px;
  margin: 0 auto;
  padding: 0 14px 0 18px;
  height: 58px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-md);
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md);
}

.search-icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 15.5px;
  outline: none;
}
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-kbd {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

.hero-stats {
  margin: 18px 0 0;
  font-size: 12.5px;
  color: var(--faint);
}
.hero-stats strong { color: var(--muted); font-weight: 600; }

/* ---------- 筛选 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 26px;
  padding-bottom: 18px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s, background 0.18s, border-color 0.18s, transform 0.18s;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); transform: translateY(-1px); }

.chip[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.chip .chip-n {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
}

.chip--fav svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.chip--fav[aria-pressed="true"] svg { fill: var(--star); stroke: var(--star); }

.result-count {
  margin: 0;
  flex: none;
  font-size: 12.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- 卡片网格 ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 14px;
  padding-bottom: 12px;
}

.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 17px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 18ms);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s, border-color 0.22s;
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-lg);
  }
  .card:hover .card-icon { transform: scale(1.06) rotate(-3deg); }
  .card:hover .card-name::after { opacity: 1; transform: translate(0, 0); }
}

.card-link {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.card-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, hsl(var(--h, 240) 78% 62%), hsl(calc(var(--h, 240) + 28) 74% 46%));
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-top: 1px;
}

.card-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-name::after {
  content: "↗";
  font-size: 12px;
  color: var(--faint);
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity 0.2s, transform 0.2s;
}

.card-desc {
  font-size: 12.8px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-host {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.01em;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s, color 0.18s, background 0.18s, transform 0.18s;
}
.fav svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.fav:hover { color: var(--star); background: var(--accent-soft); }
.fav[aria-pressed="true"] { opacity: 1; color: var(--star); }
.fav[aria-pressed="true"] svg { fill: var(--star); stroke: var(--star); }

.card:hover .fav, .fav:focus-visible { opacity: 1; }

@media (hover: none) {
  .fav { opacity: 1; }
}

/* ---------- 空状态 ---------- */

.empty {
  padding: 72px 20px 88px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  background: var(--panel);
}

.empty-title { margin: 0 0 6px; font-size: 16px; font-weight: 650; }
.empty-sub { margin: 0 0 20px; font-size: 13.5px; color: var(--muted); }

.btn-ghost {
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- 关于 ---------- */

.about { padding-top: 56px; padding-bottom: 72px; }

.about-card {
  padding: 34px 36px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.about-card h2 {
  margin: 0 0 12px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.about-card p {
  margin: 0 0 10px;
  max-width: 76ch;
  font-size: 13.8px;
  line-height: 1.8;
  color: var(--muted);
}

.about-card code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--accent-soft);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

.about-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 34px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.about-facts li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--muted);
}

.about-facts span {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
}

/* ---------- 页脚 ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 26px 0 32px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.site-footer p { margin: 0; font-size: 12.5px; color: var(--faint); }
.site-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--text); }

/* ---------- 动画 ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 响应式 ---------- */

@media (max-width: 860px) {
  .hero { padding-top: 52px; }
  .toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .result-count { order: -1; }
  .about-card { padding: 26px 22px; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 18px; }
  .hero { padding: 42px 18px 22px; }
  .hero h1 { font-size: 30px; }
  .hero-sub { font-size: 14px; margin-bottom: 24px; }
  .search { height: 52px; padding-left: 14px; }
  .search-kbd { display: none; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 14px; }
  .chips { gap: 6px; }
  .chip { height: 31px; padding: 0 12px; font-size: 12.5px; }
  .about { padding-top: 40px; padding-bottom: 52px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 6px; }
}
