/* ============================================
   JunzeXu Portfolio Theme
   暗色作品集风格 - 全站样式
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg: #0a0a0b;
  --bg-secondary: rgba(255, 255, 255, 0.02);
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --accent: #f43f5e;
  --accent-2: #3b82f6;
  --accent-3: #10b981;
  --accent-purple: #8b5cf6;
  --gradient: linear-gradient(135deg, #f43f5e 0%, #7c3aed 50%, #3b82f6 100%);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', Consolas, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --max-width: 1100px;
  --header-h: 64px;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-2);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--text); }

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

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
}

/* --- Utility --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Header / Nav --- */
.site-header {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 2rem;
}

.site-logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
}
.site-logo:hover { color: var(--text); }

.site-nav {
  display: flex;
  gap: 2rem;
  list-style: none;
}
.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--text);
}

/* --- Hero Section --- */
.hero {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(244, 63, 94, 0.06) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.hero-tag {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  backdrop-filter: blur(10px);
  letter-spacing: 0.05em;
  position: relative;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  position: relative;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 500px;
  line-height: 1.7;
  margin-bottom: 2.5rem;
  position: relative;
}

.hero-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2.5rem;
  font-size: 1rem;
  color: var(--text-secondary);
  position: relative;
}

.hero-stats strong {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.hero-stats .divider {
  color: var(--border);
  font-weight: 300;
}

@media (max-width: 600px) {
  .hero-stats {
    font-size: 0.88rem;
    gap: 0.45rem;
  }
  .hero-stats strong {
    font-size: 0.95rem;
  }
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 2.2rem;
  background: var(--gradient);
  color: white;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(244, 63, 94, 0.3);
  color: white;
}

/* --- Section --- */
.section {
  padding: 5rem 0;
}
.section-header {
  text-align: center;
  margin-bottom: 3rem;
}
.section-header h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.section-header p {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --- Ability Cards --- */
.abilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.ability-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: transform 0.3s, border-color 0.3s;
}
.ability-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
}
.ability-card .icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}
.ability-card:nth-child(1) .icon { background: rgba(244, 63, 94, 0.1); }
.ability-card:nth-child(2) .icon { background: rgba(59, 130, 246, 0.1); }
.ability-card:nth-child(3) .icon { background: rgba(16, 185, 129, 0.1); }
.ability-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.ability-card .desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}
.ability-card .flow {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* --- Skills --- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}
.skill-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s;
}
.skill-item:hover { border-color: var(--border-hover); }
.skill-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}
.skill-name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
}
.skill-level {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.skill-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}
.skill-bar-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 2px;
  transition: width 1s ease;
}

/* --- Projects Grid --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.3s, border-color 0.3s;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
}
.project-cover {
  height: 140px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.project-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.15), transparent);
}
.project-cover .emoji {
  font-size: 2.8rem;
  position: relative;
  z-index: 1;
}
.project-info { padding: 1.5rem; }
.project-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent);
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.project-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.project-info .desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.project-tech {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* --- Blog Post List (Cards) --- */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}
.post-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.post-card h3 a {
  color: var(--text);
  text-decoration: none;
}
.post-card h3 a:hover { color: var(--accent-2); }
.post-card .excerpt {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  flex: 1;
}
.post-card .meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.post-card .meta .cat {
  color: var(--accent);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
}
.pagination a, .pagination span {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.pagination a:hover {
  border-color: var(--accent);
  color: var(--text);
}
.pagination .active {
  background: var(--gradient);
  border-color: transparent;
  color: white;
}

/* --- Article / Post Detail --- */
.article {
  max-width: 750px;
  margin: 0 auto;
  padding: 3rem 2rem;
}
.article-header {
  margin-bottom: 3rem;
  text-align: center;
}
.article-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 1rem;
}
.article-meta {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

.article-content {
  font-size: 1rem;
  line-height: 1.9;
}
.article-content p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}
.article-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.article-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}
.article-content ul, .article-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}
.article-content li {
  margin-bottom: 0.4rem;
  line-height: 1.7;
}
.article-content strong { color: var(--text); }

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.5rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  background: rgba(244, 63, 94, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article-content code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.86em;
  font-family: var(--font-mono);
  color: var(--accent-purple);
}

/* --- Code Blocks --- */
.article-content pre {
  background: #1e1e2e;
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.7;
}
.article-content pre code {
  background: none;
  padding: 0;
  color: #cdd6f4;
  font-size: 0.85rem;
}

/* --- Tables --- */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.88rem;
}
.article-content th {
  text-align: left;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
}
.article-content td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

/* --- Contact --- */
.contact {
  text-align: center;
  padding: 5rem 2rem;
  border-top: 1px solid var(--border);
}
.contact h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.contact p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}
.contact-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.contact-links a {
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.contact-links a:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.site-footer a { color: var(--text-secondary); }
.site-footer a:hover { color: var(--text); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .container { padding: 0 1.25rem; }
  .hero { min-height: auto; padding: 3rem 1.25rem; }
  .section { padding: 3rem 0; }
  .site-nav { gap: 0.5rem; flex-wrap: nowrap; white-space: nowrap; }
  .site-nav a { font-size: 0.78rem; padding: 0.3rem 0; }
  .posts-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .abilities-grid { grid-template-columns: 1fr; }
  .article { padding: 2rem 1.25rem; }
  .article-header { text-align: left; }
  .article-meta { flex-wrap: wrap; gap: 0.75rem; }
  .contact { padding: 3rem 1.25rem; }
  /* Prevent content overflow on mobile */
  .article-content blockquote,
  .article-content pre,
  .article-content table { overflow-x: auto; }
  .article-content pre { -webkit-overflow-scrolling: touch; }
  .article-content table { display: block; }
  .skills-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 2rem; }
  .site-logo { font-size: 1.1rem; }
}

/* --- Scrollbar (optional, modern look) --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Home: Doc Hub Components --- */
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
}
.cta-btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.cta-btn.ghost:hover {
  border-color: var(--text);
  box-shadow: none;
  color: var(--text);
}

/* Category quick nav pills */
.cat-nav-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 3.5rem;
}
.cat-nav-card {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.55rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}
.cat-nav-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  color: var(--text);
}
.cat-nav-card .count,
.cat-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Category full listing */
.category-block {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.category-block:last-child {
  border-bottom: none;
}
.category-block h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.category-block h3 .cat-count {
  margin-left: 0.5rem;
}
.category-list {
  list-style: none;
  padding: 0;
}
.category-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.category-list li:last-child {
  border-bottom: none;
}
.category-list a {
  color: var(--text);
  font-size: 0.95rem;
  text-decoration: none;
}
.category-list a:hover {
  color: var(--accent-2);
}
.category-list .post-date {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  white-space: nowrap;
  margin-left: 1rem;
}

/* Wiki group cards */
.wiki-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.wiki-group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform 0.3s, border-color 0.3s;
}
.wiki-group-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
}
.wiki-group-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.group-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 1.25rem;
}
.wiki-group-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.chip {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s;
}
.chip:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* Home responsive tweaks */
@media (max-width: 768px) {
  .category-list li {
    flex-direction: column;
    gap: 0.15rem;
  }
  .category-list .post-date {
    margin-left: 0;
  }
  .wiki-groups-grid {
    grid-template-columns: 1fr;
  }
}
