/*
Theme Name: MonkeyNav
Theme URI: https://monkeycode-ai.online
Description: 专业的网址导航主题，支持网站分类导航和资讯板块
Version: 2.8.0
Author: MonkeyCode AI
Author URI: https://monkeycode-ai.online
License: GPL v2 or later
Text Domain: monkeynav
*/

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 12px rgba(99, 102, 241, 0.15);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: 0.22s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 32px;
}

/* Header */
.site-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 32px;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 19px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.site-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  padding: 9px 18px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.main-nav a:hover {
  background: var(--bg);
  color: var(--text);
}

.main-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.header-search {
  position: relative;
}

.header-search input {
  width: 260px;
  padding: 10px 42px 10px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  background: var(--bg);
  transition: all 0.2s ease;
}

.header-search input:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.header-search button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Hero */
.hero {
  background: var(--bg);
  padding: 48px 0;
  text-align: center;
}

.hero h1 {
  font-size: 34px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.hero p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.hero-search {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  gap: 10px;
}

.hero-search input {
  flex: 1;
  padding: 14px 22px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  outline: none;
  background: var(--bg-card);
}

.hero-search input:focus {
  border-color: var(--primary);
}

.hero-search button {
  padding: 14px 32px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.hero-search button:hover {
  background: var(--primary-dark);
}

/* Category Filter */
.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 28px 0 20px;
}

.filter-tag {
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.filter-tag:hover,
.filter-tag.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-light);
}

/* News Section */
.news-section {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  padding: 40px 32px;
  margin: 0 -32px 40px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  position: relative;
  padding-left: 16px;
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 2px;
}

.section-more {
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: gap var(--transition);
}

.section-more:hover {
  gap: 8px;
}

.section-more span {
  font-size: 16px;
  line-height: 1;
}

/* Nav Grid - Rectangle Cards */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding-bottom: 44px;
}

.nav-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 18px;
  border: 1px solid var(--border);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 220px;
}

.nav-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.nav-card-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.nav-card-icon img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  object-fit: cover;
}

.nav-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 10px;
}

.nav-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

/* News Grid */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  padding-bottom: 44px;
}

.news-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.news-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.news-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
  transform: translateY(-4px);
}

.news-card-cover {
  height: 160px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.news-card-cover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.1) 100%);
}

.news-card-cover-letter {
  font-size: 72px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
}

.news-card-cover-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 1;
}

.news-card-body {
  padding: 22px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.news-card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition);
}

.news-card:hover .news-card-title {
  color: var(--primary);
}

.news-card-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
  flex-grow: 1;
}

.news-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
}

.news-card-date {
  color: var(--text-muted);
  font-weight: 500;
}

.news-card-read-more {
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--transition);
}

.news-card-read-more span {
  transition: transform var(--transition);
}

.news-card:hover .news-card-read-more span {
  transform: translateX(4px);
}

.news-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.news-card:hover {
  box-shadow: var(--shadow-hover);
}

.news-card-cover {
  height: 150px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-card-cover-letter {
  font-size: 56px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.2);
}

.news-card-body {
  padding: 18px;
}

.news-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.news-card-tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.news-card-date {
  font-size: 13px;
  color: var(--text-muted);
}

.news-card-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.4;
}

.news-card-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Single Post */
.single-main {
  max-width: 800px;
  margin: 44px auto;
  padding: 0 24px;
}

.single-article {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  border: 1px solid var(--border);
}

.single-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 20px;
}

.single-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 24px;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--border-light);
  font-size: 14px;
  color: var(--text-muted);
}

.article-content {
  font-size: 16px;
  line-height: 1.8;
}

.article-content h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 40px 0 16px;
}

.article-content h3 {
  font-size: 19px;
  font-weight: 600;
  margin: 32px 0 12px;
}

.article-content p {
  margin-bottom: 20px;
}

.article-content img {
  border-radius: var(--radius);
  margin: 24px 0;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 48px 0;
  margin-top: 24px;
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  text-decoration: none;
}

.pagination .page-numbers:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.pagination .page-numbers.current {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.pagination .page-numbers.dots {
  border-color: transparent;
  cursor: default;
}

.pagination .page-numbers.dots:hover {
  transform: none;
  box-shadow: none;
}

/* News Archive Header */
.news-archive-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 60px 0;
  margin-bottom: 40px;
}

.news-archive-title {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  text-align: center;
}

.news-archive-desc {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

/* 404 */
.error-404 {
  text-align: center;
  padding: 80px 20px;
}

.error-404 h1 {
  font-size: 80px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}

/* Sidebar */
.content-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 36px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px 24px;
}

.sidebar-widget {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
}

.sidebar-widget h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.sidebar-posts li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-posts a:hover {
  color: var(--primary);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-cloud a {
  padding: 5px 12px;
  background: var(--primary-light);
  border-radius: 14px;
  font-size: 13px;
  color: var(--primary);
}

.tag-cloud a:hover {
  background: var(--primary);
  color: #fff;
}

/* Responsive */
/* Large tablets / small laptops */
@media (max-width: 1024px) {
  .container {
    padding: 0 24px;
  }

  .header-inner {
    padding: 0 24px;
    height: 60px;
  }

  .site-title {
    font-size: 18px;
  }

  .site-logo {
    width: 36px;
    height: 36px;
    font-size: 17px;
  }

  /* Mobile menu - trigger below 1024px to avoid nav squeezing */
  .nav-toggle {
    display: flex;
  }

  .main-nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 32px rgba(2, 8, 20, 0.12);
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
  }

  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .main-nav a {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 10px;
    color: var(--text-secondary);
  }

  .main-nav a:hover,
  .main-nav a.active {
    background: var(--primary-light);
    color: var(--primary);
  }

  /* Header search - hide on small screens, use hero search instead */
  .header-search {
    display: none;
  }

  .news-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  .news-archive-title {
    font-size: 32px;
  }
}

/* Tablets & mobile */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    padding: 0 16px;
  }

  .hero {
    padding: 40px 0;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero-search {
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
  }

  .hero-search button {
    width: 100%;
  }

  /* Nav cards */
  .nav-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .nav-card {
    min-height: 180px;
    padding: 20px 12px;
  }

  .nav-card-icon {
    width: 56px;
    height: 56px;
    font-size: 24px;
    margin-bottom: 12px;
  }

  .nav-card-title {
    font-size: 14px;
  }

  .nav-card-desc {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }

  /* News */
  .news-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .news-section {
    padding: 24px 16px;
    margin: 0 -16px 32px;
  }

  .section-title {
    font-size: 19px;
  }

  .news-archive-header {
    padding: 44px 0;
    margin-bottom: 28px;
  }

  .news-archive-title {
    font-size: 26px;
  }

  .news-archive-desc {
    font-size: 14px;
  }

  /* Single site */
  .single-site-card {
    padding: 28px 20px;
  }

  .single-site-icon {
    width: 88px;
    height: 88px;
    font-size: 32px;
  }

  .single-site-title {
    font-size: 22px;
  }

  /* Single article */
  .single-main {
    margin: 24px auto;
    padding: 0 16px;
  }

  .single-article {
    padding: 24px 20px;
  }

  .single-title {
    font-size: 22px;
  }

  .content-with-sidebar {
    grid-template-columns: 1fr;
  }

  .pagination .page-numbers {
    min-width: 38px;
    height: 38px;
  }

  .back-to-top {
    right: 16px;
    bottom: 16px;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .nav-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .nav-card {
    min-height: 160px;
    padding: 16px 10px;
  }

  .nav-card-icon {
    width: 48px;
    height: 48px;
    font-size: 20px;
    margin-bottom: 10px;
  }

  .nav-card-desc {
    display: none;
  }

  .hero {
    padding: 32px 0;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero p {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .category-filter {
    padding: 20px 0 16px;
    gap: 6px;
  }

  .filter-tag {
    padding: 7px 14px;
    font-size: 13px;
  }

  .section-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
  }

  .section-title {
    font-size: 18px;
  }

  .news-card-cover {
    height: 130px;
  }

  .news-card-body {
    padding: 16px;
  }

  .news-card-title {
    font-size: 16px;
  }

  .pagination {
    gap: 6px;
    padding: 32px 0;
  }

  .pagination .page-numbers {
    min-width: 34px;
    height: 34px;
    font-size: 13px;
    padding: 0 10px;
  }

  .news-archive-header {
    padding: 36px 0;
  }

  .news-archive-title {
    font-size: 22px;
  }

  .single-site-visit-btn {
    width: 100%;
    justify-content: center;
  }
}
