/* =============================================
   极简导航站 — 莫兰迪 · 毛玻璃 · 低饱和
   ============================================= */

/* --- Reset & Base --------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 莫兰迪色盘 */
  --bg-from:        #eef2f7;
  --bg-to:          #efe7e0;
  --bg-body:        #f2f3f5;
  --card-bg:        rgba(255, 255, 255, 0.50);
  --card-bg-hover:  rgba(255, 255, 255, 0.70);
  --card-border:    rgba(185, 192, 205, 0.35);
  --card-shadow:    0 2px 20px rgba(0,0,0,0.035);
  --card-shadow-hover: 0 8px 32px rgba(0,0,0,0.06);
  --text-primary:   #3b4252;
  --text-secondary: #7b8698;
  --text-muted:     #9aa3b1;
  --accent:         #8895ad;
  --accent-soft:    #b4bfce;
  --accent-warm:    #c8a882;
  --accent-cool:    #9aadc0;
  --radius-lg:      18px;
  --radius-md:      12px;
  --radius-sm:      8px;
  --font-sans:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg-from) 0%, #e9e4f0 30%, #f2ece3 70%, var(--bg-to) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- Container ----------------------------------- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Header -------------------------------------- */
.site-header {
  text-align: center;
  padding: 64px 24px 40px;
}

.site-title {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.site-desc {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

/* --- Search -------------------------------------- */
.search-wrap {
  max-width: 480px;
  margin: 0 auto 48px;
  padding: 0 24px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  padding: 10px 18px;
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
}

.search-box:focus-within {
  border-color: var(--accent-soft);
  box-shadow: var(--card-shadow-hover);
  background: var(--card-bg-hover);
}

.search-box i {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* --- Category Section ---------------------------- */
.category-section {
  margin-bottom: 56px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(180, 188, 200, 0.22);
}

.category-header i {
  color: var(--accent);
  opacity: 0.75;
}

.category-name {
  font-size: 1.15rem;
  font-weight: 580;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.category-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* --- Link Grid ----------------------------------- */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}

/* --- Link Card (毛玻璃) -------------------------- */
.link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 14px 18px;
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.link-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.link-card:hover {
  transform: translateY(-3px) scale(1.03);
  background: var(--card-bg-hover);
  box-shadow: var(--card-shadow-hover);
  border-color: rgba(160, 175, 195, 0.45);
}

.link-card:hover::before {
  opacity: 1;
}

.link-card:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

/* Icon wrapper */
.link-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(210, 218, 228, 0.35);
  color: var(--accent);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.link-card:hover .link-icon {
  background: rgba(180, 195, 210, 0.45);
  color: #5a6b7f;
}

/* Uploaded icon image */
.link-icon .icon-img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: contain;
}

/* Lucide icon: inherit parent color/size */
.link-icon .icon-lucide {
  width: 22px;
  height: 22px;
}

.link-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.link-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Uncategorized --------------------------------- */
.uncategorized .link-card {
  opacity: 0.85;
}

/* --- Empty State --------------------------------- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state i {
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9rem;
}

/* --- Footer -------------------------------------- */
.site-footer {
  text-align: center;
  padding: 40px 24px 48px;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

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

.anim-in {
  animation: fadeInUp 0.5s ease both;
}

/* Stagger children */
.category-section:nth-child(1) .link-card { animation-delay: 0.00s; }
.category-section:nth-child(2) .link-card { animation-delay: 0.08s; }
.category-section:nth-child(3) .link-card { animation-delay: 0.16s; }
.category-section:nth-child(4) .link-card { animation-delay: 0.24s; }
.category-section:nth-child(5) .link-card { animation-delay: 0.32s; }
.category-section:nth-child(6) .link-card { animation-delay: 0.40s; }

/* --- Skeleton ------------------------------------ */
.skeleton {
  background: linear-gradient(90deg, rgba(210,218,228,0.3) 25%, rgba(225,230,238,0.5) 50%, rgba(210,218,228,0.3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Back to top --------------------------------- */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 100;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--card-bg-hover);
  box-shadow: var(--card-shadow-hover);
  color: var(--accent);
}

/* --- Responsive ---------------------------------- */
@media (max-width: 768px) {
  .site-header { padding: 44px 20px 28px; }
  .site-title  { font-size: 1.6rem; }
  .search-wrap { margin-bottom: 36px; }
  .link-grid   { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .link-card   { padding: 18px 10px 14px; }
  .category-section { margin-bottom: 40px; }
}

@media (max-width: 480px) {
  .link-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .link-card { padding: 14px 6px 12px; border-radius: var(--radius-md); }
  .link-icon { width: 36px; height: 36px; }
  .link-title { font-size: 0.78rem; }
  .link-desc  { display: none; }
}
