/*
 Theme Name: 小张的个人博客
 Description: 活泼清新个人博客主题
 Version: 2.0.0
 Author: WorkBuddy
 License: GPL-2.0-or-later
 Text Domain: xiaozhang-blog
*/

:root {
  --bg: #ffffff;
  --surface: #f0f4ff;
  --surface-2: #e8edff;
  --text: #1a1d29;
  --muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #a5b4fc;
  --secondary: #ec4899;
  --secondary-hover: #db2777;
  --success: #10b981;
  --warning: #f59e0b;
  --border: #e2e8f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.1), 0 2px 4px -2px rgba(99, 102, 241, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(99, 102, 241, 0.15), 0 8px 10px -6px rgba(99, 102, 241, 0.15);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
  --maxw: 960px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
         "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-success: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.8;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image: 
    radial-gradient(at 40% 20%, rgba(99, 102, 241, 0.03) 0px, transparent 50%),
    radial-gradient(at 80% 0%, rgba(236, 72, 153, 0.03) 0px, transparent 50%),
    radial-gradient(at 0% 50%, rgba(99, 102, 241, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
}

a { 
  color: var(--accent); 
  text-decoration: none; 
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
a:hover { 
  color: var(--accent-hover);
  transform: translateY(-1px);
}
a:active {
  transform: translateY(0);
}

img { 
  max-width: 100%; 
  height: auto; 
  display: block;
  transition: transform 0.3s ease;
}
img:hover {
  transform: scale(1.02);
}

.container { 
  width: 100%; 
  max-width: var(--maxw); 
  margin: 0 auto; 
  padding: 0 24px; 
}
.container.narrow { max-width: 720px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.05);
  transition: all 0.3s ease;
}
.site-header:hover {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
}
.site-header .nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}
.brand {
  font-weight: 700;
  font-size: 20px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: .5px;
  transition: transform 0.2s ease;
}
.brand:hover { 
  transform: scale(1.05);
}
.nav-links { 
  display: flex; 
  gap: 28px;
}
.nav-links a {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  position: relative;
  padding: 8px 0;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--gradient-primary);
  transition: all 0.3s ease;
  transform: translateX(-50%);
  border-radius: 2px;
}
.nav-links a:hover { 
  color: var(--accent);
}
.nav-links a:hover::after {
  width: 100%;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 26px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}
.btn:hover::before {
  width: 300px;
  height: 300px;
}
.btn-primary { 
  background: var(--gradient-primary); 
  color: #fff;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.btn-primary:hover { 
  background: var(--gradient-primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}
.btn-secondary {
  background: var(--gradient-secondary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
}
.btn-secondary:hover {
  background: var(--gradient-secondary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(240, 147, 251, 0.5);
}
.btn-ghost { 
  background: var(--surface); 
  color: var(--text);
  border: 2px solid var(--border);
  font-weight: 700;
}
.btn-ghost:hover { 
  background: var(--surface-2); 
  color: var(--accent);
  border-color: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ---------- Hero ---------- */
.hero { 
  padding: 100px 0 70px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 20s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, -50px) scale(1.1); }
  66% { transform: translate(20px, -20px) scale(0.9); }
}
.hero-inner { 
  max-width: 640px;
  position: relative;
  z-index: 1;
}
.avatar {
  width: 88px; 
  height: 88px;
  border-radius: 24px;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 36px; 
  font-weight: 800;
  display: flex; 
  align-items: center; 
  justify-content: center;
  margin-bottom: 28px;
  box-shadow: var(--shadow-lg);
  animation: bounce 2s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}
.avatar::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
  animation: shine 3s ease-in-out infinite;
}
@keyframes shine {
  0% { transform: translateX(-100%) translateY(-100%); }
  100% { transform: translateX(100%) translateY(100%); }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.hero h1 {
  font-size: 44px;
  line-height: 1.2;
  margin: 0 0 18px;
  letter-spacing: -1px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.hero .lead {
  font-size: 20px;
  color: var(--muted);
  margin: 0 0 36px;
  line-height: 1.7;
  animation: fadeInUp 0.8s ease 0.2s backwards;
}
.hero-actions { 
  display: flex; 
  gap: 16px; 
  flex-wrap: wrap;
  animation: fadeInUp 0.8s ease 0.4s backwards;
}

/* ---------- Sections ---------- */
.section-title {
  font-size: 26px;
  margin: 0 0 28px;
  letter-spacing: -0.5px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  display: inline-block;
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60%;
  height: 4px;
  background: var(--gradient-secondary);
  border-radius: 2px;
}
.about { padding: 48px 0; }
.about-card {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: var(--muted);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.about-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: left 0.5s;
}
.about-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-light);
}
.about-card:hover::before {
  left: 100%;
}

/* ---------- Posts grid ---------- */
.posts { padding: 48px 0 80px; }
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}
.post-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.post-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-light);
}
.post-card:hover::before {
  transform: scaleX(1);
}
.post-card .thumb { 
  aspect-ratio: 16/9; 
  overflow: hidden; 
  background: var(--surface-2);
  position: relative;
}
.post-card .thumb img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover;
  transition: transform 0.5s ease;
}
.post-card:hover .thumb img {
  transform: scale(1.1);
}
.post-body { 
  padding: 22px 24px 24px; 
}
.post-body time { 
  font-size: 13px; 
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.post-body time::before {
  content: '📅';
  font-size: 14px;
}
.post-body h3 { 
  font-size: 20px; 
  margin: 10px 0 12px; 
  line-height: 1.4;
  font-weight: 700;
}
.post-body h3 a { 
  color: var(--text);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.3s ease;
}
.post-body h3 a:hover { 
  color: var(--accent);
  background-size: 100% 2px;
}
.post-body .excerpt { 
  color: var(--muted); 
  font-size: 15px;
  margin: 0 0 16px;
  line-height: 1.7;
}
.read-more { 
  font-size: 14px; 
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.3s ease;
}
.read-more:hover {
  gap: 12px;
}
.empty { 
  color: var(--muted);
  text-align: center;
  padding: 40px;
}
.posts-more { 
  margin-top: 36px;
  display: flex;
  justify-content: center;
}

/* ---------- Archive / list ---------- */
.archive { padding: 64px 0 80px; }
.post-list { 
  display: flex; 
  flex-direction: column; 
  gap: 8px;
}
.post-row {
  padding: 28px 0;
  border-bottom: 2px solid var(--border);
  transition: all 0.3s ease;
  position: relative;
}
.post-row::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--gradient-primary);
  border-radius: 50%;
  opacity: 0;
  transition: all 0.3s ease;
  transform: translateY(-50%);
}
.post-row:hover {
  padding-left: 20px;
  background: linear-gradient(90deg, var(--surface), transparent);
}
.post-row:hover::before {
  opacity: 1;
  left: 0;
}
.post-row time { 
  font-size: 13px; 
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.post-row time::before {
  content: '🕐';
  font-size: 14px;
}
.post-row h2 { 
  font-size: 22px; 
  margin: 10px 0 12px;
  font-weight: 700;
}
.post-row h2 a { 
  color: var(--text);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 3px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.3s ease;
}
.post-row h2 a:hover { 
  color: var(--accent);
  background-size: 100% 3px;
}
.post-row p { 
  color: var(--muted); 
  margin: 0;
  line-height: 1.7;
}

/* ---------- Single / page ---------- */
.single, .page { padding: 64px 0 88px; }
.single time, .page .container.narrow time { 
  font-size: 14px; 
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.single time::before, .page .container.narrow time::before {
  content: '';
  font-size: 14px;
}
.single h1, .page h1 {
  font-size: 36px; 
  line-height: 1.3; 
  margin: 16px 0 28px;
  letter-spacing: -1px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}
.content { 
  font-size: 17px; 
  color: #2b2f36;
  line-height: 1.9;
}
.content p { 
  margin: 0 0 22px;
}
.content h2, .content h3 { 
  margin: 36px 0 16px;
  font-weight: 700;
  position: relative;
  padding-left: 16px;
}
.content h2::before, .content h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 24px;
  background: var(--gradient-primary);
  border-radius: 3px;
}
.content a { 
  color: var(--accent);
  text-decoration: none;
  position: relative;
  padding: 2px 0;
  background-image: linear-gradient(var(--accent-light), var(--accent-light));
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.3s ease;
}
.content a:hover {
  background-size: 100% 4px;
}
.content pre {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: none;
  border-radius: 12px; 
  padding: 20px; 
  overflow: auto; 
  font-size: 14px;
  color: #e2e8f0;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.content pre::before {
  content: 'Code';
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}
.content code { 
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  padding: 3px 8px; 
  border-radius: 6px; 
  font-size: 14px;
  border: 1px solid var(--border);
  font-weight: 600;
  color: var(--accent);
}
.content blockquote {
  margin: 0 0 24px; 
  padding: 16px 22px; 
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border-radius: 0 12px 12px 0;
  color: var(--muted);
  font-style: italic;
  box-shadow: var(--shadow);
  position: relative;
}
.content blockquote::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 10px;
  font-size: 48px;
  color: var(--accent-light);
  opacity: 0.5;
  font-family: Georgia, serif;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 2px solid var(--border);
  padding: 32px 0;
  color: var(--muted);
  font-size: 14px;
  background: linear-gradient(180deg, var(--surface), var(--bg));
  text-align: center;
}
.site-footer::before {
  content: '✨';
  display: block;
  font-size: 24px;
  margin-bottom: 12px;
  animation: sparkle 2s ease-in-out infinite;
}
@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(1.2) rotate(180deg); opacity: 0.8; }
}

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .hero { padding: 70px 0 50px; }
  .hero h1 { font-size: 32px; }
  .hero .lead { font-size: 17px; }
  .post-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 14px; }
  .avatar { width: 72px; height: 72px; font-size: 30px; }
}

/* ---------- Content lists (added) ---------- */
.content ul, .content ol { 
  margin: 0 0 22px; 
  padding-left: 28px;
}
.content ul li { 
  list-style: disc;
  marker-color: var(--accent);
}
.content ol li { 
  list-style: decimal;
  marker-color: var(--accent);
}
.content li { 
  margin: 0 0 10px; 
  line-height: 1.8;
}
.content strong { 
  color: var(--text); 
  font-weight: 700;
  background: linear-gradient(120deg, var(--accent-light), var(--accent-light));
  background-repeat: no-repeat;
  background-size: 100% 40%;
  background-position: 0 88%;
}

/* ---------- Auth / submit forms (added) ---------- */
.auth, .submit { padding: 64px 0 88px; }
.auth h1, .submit h1 { 
  font-size: 32px; 
  margin: 0 0 12px; 
  letter-spacing: -1px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}
.xz-form { 
  display: flex; 
  flex-direction: column; 
  gap: 20px; 
  margin-top: 32px;
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}
.xz-form label {
  display: flex; 
  flex-direction: column; 
  gap: 8px;
  font-size: 14px; 
  color: var(--muted); 
  font-weight: 600;
}
.xz-form input[type="text"],
.xz-form input[type="password"],
.xz-form input[type="email"],
.xz-form textarea {
  width: 100%; 
  padding: 13px 16px;
  border: 2px solid var(--border); 
  border-radius: var(--radius-sm);
  font-size: 15px; 
  font-family: inherit; 
  color: var(--text);
  background: var(--bg); 
  transition: all .2s ease;
  font-weight: 500;
}
.xz-form textarea { 
  resize: vertical; 
  line-height: 1.8;
  min-height: 120px;
}
.xz-form input:focus, .xz-form textarea:focus {
  outline: none; 
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
}
.xz-form .checkbox { 
  flex-direction: row; 
  align-items: center; 
  gap: 10px; 
  font-weight: 500;
}
.xz-form .checkbox input { width: auto; }
.xz-form button { 
  align-self: flex-start; 
  margin-top: 8px;
  padding: 14px 32px;
}
.captcha-row { 
  display: flex; 
  align-items: center; 
  gap: 12px;
}
.captcha-row input { max-width: 140px; }
.form-error {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 2px solid #fecaca; 
  color: #b91c1c;
  padding: 14px 18px; 
  border-radius: var(--radius-sm); 
  font-size: 14.5px;
  margin-top: 24px;
  font-weight: 600;
  animation: shake 0.5s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}
.form-msg {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 2px solid var(--border); 
  color: var(--text);
  padding: 14px 18px; 
  border-radius: var(--radius-sm); 
  font-size: 14.5px;
  margin-top: 24px;
  font-weight: 600;
}
.form-tip { 
  margin-top: 24px; 
  font-size: 14.5px; 
  color: var(--muted);
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--accent);
}

/* ---------- Scroll animations ---------- */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Loading animation ---------- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ---------- Badge / Tag styles ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.badge-secondary {
  background: var(--gradient-secondary);
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3);
}
.badge-success {
  background: var(--gradient-success);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* ---------- Card hover effects ---------- */
.card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-light);
}
.card:hover::before {
  transform: scaleX(1);
}
