/* 友情链接页面样式 */

.links-page {
  --links-ink: #0f172a;
  --links-muted: #475569;
  --links-soft: #94a3b8;
  --links-accent: #0f766e;
  --links-accent-strong: #0d9488;
  --links-warm: #f59e0b;
  --links-surface: rgba(255, 255, 255, 0.9);
  --links-surface-strong: #ffffff;
  --links-border: rgba(15, 23, 42, 0.08);
  --links-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  background: linear-gradient(135deg, #fff7ed 0%, #f1f5f9 55%, #e0f2fe 100%);
  color: var(--links-ink);
  font-family: "Noto Sans SC", sans-serif;
  position: relative;
  overflow-x: hidden;
}

.links-page::before,
.links-page::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

.links-page::before {
  width: 420px;
  height: 420px;
  top: -140px;
  right: -120px;
  background: radial-gradient(circle, rgba(14, 116, 144, 0.35) 0%, rgba(14, 116, 144, 0) 70%);
}

.links-page::after {
  width: 520px;
  height: 520px;
  bottom: -220px;
  left: -160px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.3) 0%, rgba(245, 158, 11, 0) 70%);
}

.links-page .main-content {
  margin-left: 0;
  width: 100%;
  background: transparent;
  position: relative;
  z-index: 1;
  min-height: 100vh;
}


/* ========== 链接区域 ========== */
.links-section {
  padding: 10px 20px 44px;
  background: transparent;
}

.links-section-alt {
  background: rgba(255, 255, 255, 0.5);
  padding: 12px 20px 44px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.links-container {
  max-width: 1200px;
  margin: 0 auto;
}

.links-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 28px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  position: sticky;
  top: 12px;
  z-index: 5;
  backdrop-filter: blur(10px);
}

.links-filter .filter-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--links-muted);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
}

.links-filter .filter-btn:hover {
  background: rgba(15, 118, 110, 0.12);
  color: var(--links-accent);
}

.links-filter .filter-btn.active {
  background: var(--links-accent);
  color: #fff;
  border-color: var(--links-accent);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.25);
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 26px;
  margin: 0;
}

/* ========== 链接卡片 ========== */
.link-card {
  background: var(--links-surface);
  border-radius: 18px;
  border: 1px solid var(--links-border);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  animation: cardIn 0.6s ease both;
}

.link-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--links-shadow);
  border-color: rgba(15, 118, 110, 0.35);
}

.link-card-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #f8fafc;
  overflow: hidden;
}

.link-card-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0) 20%, rgba(15, 23, 42, 0.35) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.link-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.link-card-preview .preview-static {
  display: block;
}

.link-card-preview .preview-gif {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* 悬停时显示 GIF */
.link-card:hover .link-card-preview .preview-static {
  display: none;
}

.link-card:hover .link-card-preview .preview-gif {
  display: block;
}

.link-card:hover .link-card-preview img {
  transform: scale(1.04);
}

.link-card:hover .link-card-preview::after {
  opacity: 1;
}

/* 占位图 */
.link-card-preview .placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: #f0f0f0;
  color: #999;
}

.link-card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.link-card-title {
  font-family: "ZCOOL XiaoWei", "Noto Sans SC", sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--links-ink);
  margin: 0 0 8px;
  line-height: 1.4;
}

.link-card-description {
  font-size: 14px;
  color: var(--links-muted);
  line-height: 1.6;
  margin: 0 0 16px;
  flex: 1;
}

.link-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.link-tag {
  padding: 3px 8px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--links-accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.link-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  margin-top: auto;
}

.link-card-url {
  font-size: 13px;
  color: var(--links-soft);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 12px;
}

.link-visit-btn {
  padding: 8px 16px;
  background: var(--links-accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.link-visit-btn:hover {
  background: var(--links-accent-strong);
  transform: scale(1.02);
}

/* 加载状态 */
.loading-placeholder {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--links-soft);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(148, 163, 184, 0.35);
  border-top-color: var(--links-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 12px;
  font-size: 14px;
}

/* 空状态 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--links-soft);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 16px;
}

/* 页脚 */
.footer-back-home {
  margin-left: 16px;
  color: var(--links-accent);
  text-decoration: none;
  font-weight: 500;
}

.footer-back-home:hover {
  text-decoration: underline;
}

/* 响应式 */
@media (max-width: 768px) {
  .links-filter {
    position: static;
  }

  .links-section {
    padding: 16px;
  }

  .links-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .link-card-content {
    padding: 16px;
  }

  .link-card-preview {
    aspect-ratio: 16 / 9;
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .link-card {
    animation: none;
  }

  .link-card,
  .link-card-preview img,
  .links-filter .filter-btn {
    transition: none;
  }
}
