/* ═══════════════════════════════════════════════════
   CDN Directory – 全球CDN厂商导航  ·  样式表
   ═══════════════════════════════════════════════════ */

/* ── 变量 (Light) ─────────────────────────────────── */
:root {
  --bg:           #f6f8fb;
  --bg-card:      #ffffff;
  --bg-hover:     #f0f3f8;
  --bg-alt:       #eef1f6;
  --border:       #e2e6ed;
  --text:         #1a1d2e;
  --text-2:       #5a5f72;
  --text-3:       #9ca3af;
  --accent:       #3b82f6;
  --accent-soft:  rgba(59,130,246,.07);
  --accent-hover: #2563eb;
  --accent-glow:  rgba(59,130,246,.2);
  --success:      #22c55e;
  --warn:         #f59e0b;
  --danger:       #ef4444;
  --shadow-xs:    0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:    0 1px 4px rgba(0,0,0,.06);
  --shadow-md:    0 4px 20px rgba(0,0,0,.07);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.1);
  --radius:       14px;
  --radius-sm:    10px;
  --radius-xs:    6px;
  --transition:   .22s ease;
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                  'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono:    'SF Mono', 'Fira Code', Consolas, monospace;
  --container:    1240px;
}

/* ── Dark ─────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0c0e16;
  --bg-card:      #161929;
  --bg-hover:     #1e2236;
  --bg-alt:       #111322;
  --border:       #252940;
  --text:         #e2e5f0;
  --text-2:       #8b90a8;
  --text-3:       #555a70;
  --accent:       #60a5fa;
  --accent-soft:  rgba(96,165,250,.08);
  --accent-hover: #93c5fd;
  --accent-glow:  rgba(96,165,250,.15);
  --shadow-xs:    0 1px 2px rgba(0,0,0,.15);
  --shadow-sm:    0 1px 4px rgba(0,0,0,.2);
  --shadow-md:    0 4px 20px rgba(0,0,0,.3);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.4);
}

/* ── Reset ────────────────────────────────────────── */
*,*::before,*::after { margin:0;padding:0;box-sizing:border-box; }
html { font-size:15px; scroll-behavior:smooth; scroll-padding-top:80px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width:100%; display:block; }

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

/* ═══ Header ════════════════════════════════════════ */
.header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
[data-theme="dark"] .header {
  background: rgba(12,14,22,.82);
}

.header-inner {
  height: 62px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.02em;
  flex-shrink: 0;
  text-decoration: none;
}
.logo:hover { color: var(--accent); }
.logo-icon { width:26px; height:26px; }

.nav { display:flex; gap:6px; }
.nav-link {
  padding: 6px 14px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}
.nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.header-actions { margin-left:auto; }
.theme-toggle {
  width:38px;height:38px;
  border:1px solid var(--border);
  background:var(--bg);
  border-radius:50%;
  cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition: all var(--transition);
}
.theme-toggle:hover { border-color:var(--accent); background:var(--accent-soft); }
.theme-toggle svg { width:17px;height:17px;color:var(--text-2); }
.icon-moon { display:none; }
[data-theme="dark"] .icon-sun  { display:none; }
[data-theme="dark"] .icon-moon { display:block; }

/* ═══ Hero ══════════════════════════════════════════ */
.hero {
  padding: 72px 0 48px;
  text-align: center;
  background: linear-gradient(180deg, var(--accent-soft) 0%, transparent 100%);
}

.hero-title {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
}

.hero-desc {
  font-size: 1.08rem;
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto 36px;
}

/* Hero 统计数字 */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-bottom: 40px;
}

.stat-item { text-align:center; }
.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: .82rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* 搜索栏 */
.search-bar {
  max-width: 680px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-3);
  pointer-events: none;
}

.search-bar {
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: .95rem;
  outline: none;
  transition: border-color var(--transition);
  position: relative;
}

.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  position: absolute;
  left: 34px;
  top: 29px;
  z-index: 2;
}

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

.tag {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-2);
  font-size: .82rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ═══ Section ═══════════════════════════════════════ */
.section {
  padding: 56px 0;
}
.section-alt {
  background: var(--bg-alt);
}
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 32px;
}
.section-title svg { width:24px;height:24px;color:var(--accent); }

/* ═══ Vendor Grid (九宫格) ══════════════════════════ */

/* 分页外层容器 */
.vendor-carousel {
  position: relative;
}

/* 翻页按钮 */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  z-index: 10;
}
.carousel-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.carousel-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
  pointer-events: none;
}
.carousel-btn svg { width: 20px; height: 20px; }
.carousel-prev { left: -22px; }
.carousel-next { right: -22px; }

/* 分页轨道（隐藏溢出，水平滚动） */
.vendor-track {
  overflow: hidden;
}
.vendor-slider {
  display: flex;
  transition: transform .45s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}
.vendor-page {
  flex: 0 0 100%;
  min-width: 100%;
}

/* 九宫格网格：3列 x 3行 */
.vendor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 16px;
  padding: 4px 0;
}

/* 分页指示器 */
.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}
.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
}
.carousel-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--accent);
}
.carousel-dot:hover:not(.active) {
  background: var(--text-3);
}

/* 页码文字 */
.carousel-info {
  text-align: center;
  margin-top: 8px;
  font-size: .8rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ═══ Vendor Card (卡片) ═══════════════════════════ */
.vendor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition);
  cursor: default;
  min-height: 0;
}
.vendor-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* 卡片头部：logo + 名称 */
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vendor-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 5px;
  flex-shrink: 0;
}
.vendor-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.logo-text {
  font-size: .55rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  line-height: 1.1;
}

.card-title-group {
  min-width: 0;
  flex: 1;
}

.vendor-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vendor-name a {
  font-weight: 700;
  font-size: .92rem;
  color: var(--text);
  text-decoration: none;
  transition: color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vendor-name a:hover { color: var(--accent); }

.region-badge {
  display: inline-flex;
  padding: 2px 10px;
  font-size: .68rem;
  font-weight: 600;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.vendor-url {
  margin-top: 2px;
  font-size: .72rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vendor-url a {
  color: var(--text-3);
  text-decoration: none;
}
.vendor-url a:hover { color: var(--accent); }

/* 卡片内容：描述 */
.card-body {
  flex: 1;
  min-height: 0;
}
.vendor-desc {
  font-size: .82rem;
  color: var(--text-2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 卡片标签 */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.card-tag {
  display: inline-block;
  padding: 2px 10px;
  font-size: .7rem;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-3);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* 卡片底部：访问按钮 */
.card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.visit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.visit-btn:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.visit-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-state svg { width:48px;height:48px;margin:0 auto 16px;display:block; }
.empty-state p { font-size:1rem; }

/* ═══ Stats ═════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.stats-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.stats-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.stats-badge {
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 600;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.stats-row {
  display: flex;
  gap: 24px;
}

.stats-metric { text-align:center; flex:1; }
.metric-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.metric-label {
  font-size: .78rem;
  color: var(--text-3);
  margin-top: 4px;
}

/* 访客信息 */
.visitor-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom:none; }
.info-label { font-size:.85rem; color:var(--text-3); }
.info-value { font-size:.85rem; font-weight:500; font-family:var(--font-mono); }

/* Chart */
.chart-container { padding: 8px 0; }

/* ═══ About ═════════════════════════════════════════ */
.about-content {
  max-width: 800px;
}
.about-content > p {
  font-size: .95rem;
  color: var(--text-2);
  margin-bottom: 16px;
}

.about-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 32px;
}

.feature-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: all var(--transition);
}
.feature-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}
.feature-item h4 {
  font-size: .95rem;
  margin-bottom: 8px;
}
.feature-item p {
  font-size: .82rem;
  color: var(--text-3);
}

/* ═══ Footer ════════════════════════════════════════ */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 24px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}
.footer-logo:hover { color:var(--accent); }
.footer-desc {
  font-size: .82rem;
  color: var(--text-3);
  margin-top: 4px;
}
.footer-right {
  font-size: .82rem;
  color: var(--text-3);
}

/* ICP 备案栏 */
.icp-bar {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 14px 0;
}

.icp-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--text-3);
}

.icp-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  text-decoration: none;
  transition: color var(--transition);
}
.icp-link:hover { color:var(--accent); }

.icp-icon {
  width: 16px;
  height: 16px;
  opacity: .6;
}

.icp-separator {
  color: var(--border);
  margin: 0 4px;
}

/* ═══ Back to Top ═══════════════════════════════════ */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--accent-glow);
  opacity: 0;
  transform: translateY(20px);
  transition: all .3s ease;
  z-index: 100;
  pointer-events: none;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}
.back-to-top svg { width:20px;height:20px; }

/* ═══ Animations ════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity:0; transform:translateY(16px); }
  to   { opacity:1; transform:translateY(0); }
}

.vendor-card {
  animation: fadeInUp .35s ease both;
}

/* stagger delay */
.vendor-card:nth-child(1)  { animation-delay: .02s; }
.vendor-card:nth-child(2)  { animation-delay: .04s; }
.vendor-card:nth-child(3)  { animation-delay: .06s; }
.vendor-card:nth-child(4)  { animation-delay: .08s; }
.vendor-card:nth-child(5)  { animation-delay: .10s; }
.vendor-card:nth-child(6)  { animation-delay: .12s; }
.vendor-card:nth-child(7)  { animation-delay: .14s; }
.vendor-card:nth-child(8)  { animation-delay: .16s; }
.vendor-card:nth-child(9)  { animation-delay: .18s; }

/* ═══ Responsive ════════════════════════════════════ */
@media (max-width: 768px) {
  html { font-size: 14px; }

  .header-inner { gap:12px; }
  .logo span { display:none; }
  .nav-link { padding:6px 10px; font-size:.82rem; }

  .hero { padding:48px 0 32px; }
  .hero-title { font-size:1.8rem; }
  .hero-stats { gap:24px; }
  .stat-num { font-size:1.5rem; }

  /* 九宫格降为 2 列 */
  .vendor-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* 翻页按钮缩小并贴边 */
  .carousel-prev { left: -8px; }
  .carousel-next { right: -8px; }
  .carousel-btn { width: 36px; height: 36px; }
  .carousel-btn svg { width: 16px; height: 16px; }

  .stats-grid { grid-template-columns:1fr; }
  .about-features { grid-template-columns:1fr; }

  .footer-inner { flex-direction:column; text-align:center; gap:12px; }
}

@media (max-width: 480px) {
  .search-bar { padding: 12px 14px; }
  .filter-tags { gap: 6px; }
  .tag { padding: 4px 10px; font-size:.75rem; }
  .hero-stats { flex-direction:column; gap:12px; }

  /* 九宫格降为 1 列 */
  .vendor-grid { grid-template-columns: 1fr; }

  .carousel-prev { left: -4px; }
  .carousel-next { right: -4px; }
  .carousel-btn { width: 32px; height: 32px; }
}
