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

:root {
  --primary: #264653;
  --primary-dark: #1a333d;
  --secondary: #2a9d8f;
  --secondary-light: #e8f5f3;
  --accent: #e76f51;
  --accent-light: #fdf0ec;
  --sand: #f4a261;
  --sand-light: #fef7ed;
  --bg: #fefcf5;
  --card-bg: #ffffff;
  --text: #264653;
  --text-light: #6b8a8a;
  --text-muted: #a8c0c0;
  --border: #e8e0d5;
  --border-light: #f0ebe3;
  --radius: 4px;
  --radius-lg: 8px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Lora", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --max-width: 1000px;
  --content-width: 700px;
  --header-h: 72px;
  --transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--secondary);
  color: #fff;
}

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

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

/* ===== Header ===== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.site-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary);
}
.site-title a {
  color: var(--primary);
}
.site-title a:hover {
  color: var(--secondary);
}
.site-title .title-accent {
  color: var(--accent);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.main-nav a {
  color: var(--text-light);
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  position: relative;
  transition: var(--transition);
}
.main-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: calc(100% - 36px);
  height: 2px;
  background: var(--accent);
  transition: transform 0.3s ease;
}
.main-nav a:hover::after,
.main-nav a.active::after {
  transform: translateX(-50%) scaleX(1);
}
.main-nav a:hover {
  color: var(--primary);
}
.main-nav a.active {
  color: var(--primary);
  font-weight: 600;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

/* ===== Main Container ===== */
.main-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 28px 56px;
  min-height: calc(100vh - var(--header-h) - 160px);
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 40px 0 48px;
  margin-bottom: 32px;
  border-bottom: 2px solid var(--border-light);
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
  margin-bottom: 14px;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero p {
  font-size: 1.05rem;
  color: var(--text-light);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ===== Featured Post ===== */
.featured-post {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 48px;
  transition: var(--transition);
}
.featured-post:hover {
  border-color: var(--secondary);
}
.featured-post-image {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
}
.featured-post-content {
  padding: 24px 32px 24px 0;
}
.featured-post .post-tag {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 20px;
  margin-bottom: 12px;
}
.featured-post h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 12px;
}
.featured-post h2 a {
  color: var(--primary);
}
.featured-post h2 a:hover {
  color: var(--accent);
}
.featured-post .post-excerpt {
  color: var(--text-light);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 16px;
}
.featured-post .post-meta-sm {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== Post Grid ===== */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.post-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  border-color: var(--border);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(38, 70, 83, 0.06);
}

.post-card-header {
  height: 6px;
  flex-shrink: 0;
}

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

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.post-card-meta .tag {
  background: var(--secondary-light);
  color: var(--secondary);
  padding: 1px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.post-card-title {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 10px;
}
.post-card-title a {
  color: inherit;
}
.post-card-title a:hover {
  color: var(--accent);
}

.post-card-excerpt {
  color: var(--text-light);
  font-size: 0.88rem;
  line-height: 1.7;
  flex: 1;
  margin-bottom: 14px;
}

.post-card-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.post-card-link:hover {
  color: var(--accent);
  gap: 8px;
}

/* ===== Article Page ===== */
.article-container {
  max-width: var(--content-width);
  margin: 0 auto;
}

.article-header {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 40px;
}
.article-header .article-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.article-header .article-meta .tag {
  background: var(--secondary-light);
  color: var(--secondary);
  padding: 2px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}
.article-header h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.35;
}

.article-content {
  font-size: 1.02rem;
  line-height: 1.95;
  color: var(--text);
}
.article-content p {
  margin-bottom: 1.6em;
}
.article-content h2 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 2em 0 0.8em;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--sand-light);
}
.article-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 1.6em 0 0.6em;
}
.article-content ul, .article-content ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}
.article-content li {
  margin-bottom: 0.4em;
}
.article-content blockquote {
  border-left: 4px solid var(--sand);
  background: var(--sand-light);
  padding: 18px 22px;
  margin: 1.5em 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-light);
  font-size: 1rem;
}
.article-content strong {
  color: var(--primary-dark);
  font-weight: 700;
}
.article-content hr {
  border: none;
  height: 1px;
  background: var(--border-light);
  margin: 2.5em 0;
}

/* ===== Article Footer Nav ===== */
.article-footer-nav {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.article-footer-nav a {
  font-size: 0.9rem;
  padding: 10px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.article-footer-nav a:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  background: var(--secondary-light);
}

/* ===== About Page ===== */
.about-page {
  max-width: var(--content-width);
  margin: 0 auto;
}

.about-header {
  text-align: center;
  padding: 20px 0 40px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 40px;
}

.about-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--secondary-light);
  border: 3px solid var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: var(--secondary);
  margin: 0 auto 20px;
  font-weight: 700;
  font-family: var(--font-serif);
}

.about-header h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.about-header .about-sub {
  color: var(--text-light);
  font-size: 1rem;
}

.about-section {
  margin-bottom: 32px;
  padding-left: 4px;
}
.about-section h2 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.about-section p {
  color: var(--text-light);
  line-height: 1.85;
  font-size: 0.95rem;
  margin-bottom: 0.8em;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.65);
  text-align: center;
  padding: 36px 28px 32px;
  font-size: 0.85rem;
  line-height: 1.8;
}
.site-footer .footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.site-footer .footer-links a {
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
}
.site-footer .footer-links a:hover {
  color: var(--sand);
}
.site-footer .footer-divider {
  width: 40px;
  height: 1px;
  background: rgba(255,255,255,0.2);
  margin: 0 auto 14px;
}
.site-footer .icp {
  color: rgba(255,255,255,0.4);
  font-size: 0.78rem;
}
.site-footer .icp a {
  color: rgba(255,255,255,0.4);
}
.site-footer .icp a:hover {
  color: var(--sand);
}

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 42px;
  height: 42px;
  background: var(--card-bg);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 99;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
  transform: translateY(-3px);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--primary);
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
  z-index: 200;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .featured-post {
    grid-template-columns: 1fr;
  }
  .featured-post-image {
    min-height: 200px;
  }
  .featured-post-content {
    padding: 0 28px 28px;
  }
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
  .main-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 12px 20px;
    gap: 2px;
    border-bottom: 1px solid var(--border-light);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }
  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .main-nav a {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius);
  }
  .main-nav a::after {
    display: none;
  }
  .main-nav a:hover,
  .main-nav a.active {
    background: var(--secondary-light);
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .featured-post-image {
    min-height: 180px;
    font-size: 3.5rem;
  }
  .featured-post h2 {
    font-size: 1.3rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .article-header h1 {
    font-size: 1.5rem;
  }
  .article-content {
    font-size: 0.95rem;
  }

  .main-container {
    padding: 28px 18px 40px;
  }
  .header-inner {
    padding: 0 18px;
    height: 64px;
  }
  :root {
    --header-h: 64px;
  }

  .about-header h1 {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
  }
  .featured-post-image {
    min-height: 140px;
    font-size: 2.8rem;
  }
}
