/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9fafb;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Styles - Integrated with Hero */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: all 0.3s ease;
  background: transparent;
  backdrop-filter: blur(10px);
}

/* Header background that matches hero gradient */
.site-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(15, 15, 35, 0.9) 0%, rgba(26, 26, 46, 0.8) 50%, rgba(22, 33, 62, 0.9) 100%);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Show header background and border when scrolled */
.site-header.scrolled::before {
  opacity: 1;
}

.site-header.scrolled {
  border-bottom-color: rgba(255, 255, 255, 0.1); /* 滚动时显示边框 */
}

/* 在非首页时始终显示 header 背景和边框 */
body:not(.home-page) .site-header {
  background: rgba(15, 15, 35, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
}

/* Show header background when scrolled */
.site-header.scrolled::before {
  opacity: 1;
}

/* Navigation - 透明背景，滚动时变白 */
.navbar {
    background: transparent;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    transition: all 0.3s ease;
}

/* 滚动后的导航栏样式 */
.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4.5rem; /* 增加导航栏高度 */
}


/* 品牌区域 - 确保垂直居中 */
.nav-brand {
    display: flex;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* Picture 元素样式 - 移除背景，确保透明 */
.brand-link picture {
    display: flex;
    align-items: center;
    background: transparent !important;
    border: none;
    padding: 0;
    margin: 0;
    line-height: 1;
}

/* Logo 图片样式 - 基于原有样式调整 */
.brand-logo-img {
    height: 3rem; /* 进一步增加 logo 高度 */
    width: auto;
    transition: all 0.3s ease;
    filter: brightness(0) invert(1); /* 在透明背景时将 logo 变为白色 */
    opacity: 0.95;
    background: transparent !important; /* 强制移除背景 */
    border: none;
    padding: 0;
    margin: 0;
    vertical-align: middle;
    object-fit: contain;
}

/* 滚动后的 Logo 样式 */
.navbar.scrolled .brand-logo-img {
    filter: none; /* 滚动后恢复原始颜色 */
    opacity: 1;
}

/* Logo 悬停效果 */
.brand-link:hover .brand-logo-img {
    transform: scale(1.05);
    opacity: 1;
}

/* 备用文字 Logo 样式 - 确保透明背景 */
.brand-logo-fallback {
    height: 2rem;
    background: transparent !important; /* 移除渐变背景 */
    border-radius: 0;
    display: none; /* 默认隐藏，只在图片加载失败时显示 */
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.3s ease;
    box-shadow: none;
}

.brand-logo-fallback .logo-text {
    color: white; /* 在透明背景时使用白色文字 */
    font-weight: bold;
    font-size: 1.25rem; /* 增大字体以匹配 logo 尺寸 */
    display: block;
    background: transparent;
}

/* 滚动后的备用文字样式 */
.navbar.scrolled .brand-logo-fallback .logo-text {
    color: #2563eb; /* 滚动后使用品牌色 */
}

/* 新的 Logo 图片样式 */
.brand-logo-img {
    height: 3rem; /* 设置 logo 高度 */
    width: auto; /* 保持宽高比 */
    transition: all 0.3s ease;
    filter: brightness(0) invert(1); /* 在透明背景时将 logo 变为白色 */
    opacity: 0.95;
}

/* 滚动后的 Logo 样式 */
.navbar.scrolled .brand-logo-img {
    filter: none; /* 滚动后恢复原始颜色 */
    opacity: 1;
}

/* Logo 悬停效果 */
.brand-link:hover .brand-logo-img {
    transform: scale(1.05);
    opacity: 1;
}

/* 移除旧的 brand-logo 和 logo-text 样式 */
.brand-logo {
    display: none;
}

.logo-text {
    display: none;
}

.nav-menu {
    display: flex;
    gap: 2rem; /* 增大间距 */
    align-items: center;
}

/* 普通导航链接 - 在渐变背景上使用白色 */
.nav-link {
    color: white;
    text-decoration: none;
    font-family: 'Google Sans', sans-serif;
    font-weight: 500;
    font-size: 1.125rem; /* 增大字体 */
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    padding: 0.5rem 0; /* 增大内边距 */
    position: relative;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

/* 添加下划线悬停效果 */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: white;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* 特殊按钮样式 - GitHub 和 HuggingFace */
.nav-link-special {
    color: white !important;
    background: rgba(255, 255, 255, 0.12);
    padding: 0.4rem 0.75rem; /* 减小内边距 */
    border-radius: 0.375rem; /* 减小圆角 */
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: 'Google Sans', sans-serif;
    font-weight: 500; /* 减小字重 */
    font-size: 0.8rem; /* 减小字体 */
    text-shadow: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem; /* 减小图标和文字间距 */
    margin-left: 0.25rem;
}

.nav-link-special::after {
    display: none; /* 移除下划线效果 */
}

.nav-link-special:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: white !important;
}

/* 导航图标样式 */
.nav-icon {
    width: 0.875rem; /* 减小图标尺寸 */
    height: 0.875rem;
    transition: all 0.3s ease;
}

/* GitHub 图标颜色 */
.nav-icon-github {
    fill: #ffffff; /* 在透明背景时保持白色 */
}

/* HuggingFace 图标颜色 */
.nav-icon-huggingface {
    fill: #FFD21E; /* HuggingFace 品牌黄色 */
}

/* 导航文字 */
.nav-text {
    font-size: 0.8rem;
}

/* 滚动后的导航链接样式 */
.navbar.scrolled .nav-link {
    color: #6b7280;
    text-shadow: none;
    font-size: 1.125rem;
}

.navbar.scrolled .nav-link:hover {
    color: #374151;
    transform: translateY(-1px);
}

.navbar.scrolled .nav-link::after {
    background: #2563eb;
}

.navbar.scrolled .nav-link-special {
    color: #6b7280 !important;
    background: rgba(107, 114, 128, 0.08);
    border-color: rgba(107, 114, 128, 0.15);
    box-shadow: 0 1px 4px rgba(107, 114, 128, 0.1);
}

.navbar.scrolled .nav-link-special:hover {
    background: rgba(107, 114, 128, 0.12);
    border-color: rgba(107, 114, 128, 0.25);
    color: #374151 !important;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.15);
}

/* 滚动后的图标颜色 */
.navbar.scrolled .nav-icon-github {
    fill: #6b7280; /* 使用更淡的灰色 */
}

.navbar.scrolled .nav-icon-huggingface {
    fill: #fbbf24; /* 使用更柔和的黄色 */
}

/* 为页面内容添加顶部间距，避免被固定导航遮挡 */
.page-content {
    padding-top: 0;
    background: white;
}

/* Post Cards */
.posts-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.post-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.post-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.post-header {
    margin-bottom: 1rem;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tag {
    background: #f3f4f6;
    color: #374151;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.post-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.post-title a {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s;
}

.post-title a:hover {
    color: #2563eb;
}

.post-excerpt {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.meta-icon {
    width: 1rem;
    height: 1rem;
}

/* Article Styles */
.article-container {
    max-width: 48rem;
    margin: 0 auto;
    padding: 3rem 1rem;
}

.article {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 1rem;
}

.article-content {
    prose: true;
    max-width: none;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.article-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.article-content pre {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.article-content code {
    background: #f3f4f6;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.article-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination-link,
.pagination-current {
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    text-decoration: none;
}

.pagination-link {
    color: #2563eb;
    background: white;
    border: 1px solid #d1d5db;
}

.pagination-link:hover {
    background: #f3f4f6;
}

.pagination-current {
    background: #2563eb;
    color: white;
    border: 1px solid #2563eb;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid #e5e7eb;
    /* margin-top: 4rem; */
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    text-align: center;
    color: #6b7280;
}

.social-links {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.social-link {
    color: #6b7280;
    text-decoration: none;
}

.social-link:hover {
    color: #374151;
}

/* 移动端响应式 */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 0.5rem;
        height: 3rem; /* 移动端进一步减小高度 */
    }
    
    .brand-logo-img {
        height: 1.5rem; /* 移动端减小 logo 尺寸 */
    }
    
    .nav-menu {
        gap: 0.75rem;
    }
    
    .nav-link {
        font-size: 0.8rem;
    }
    
    .nav-link-special {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
        margin-left: 0.125rem;
        gap: 0.25rem;
    }
    
    .nav-icon {
        width: 0.75rem;
        height: 0.75rem;
    }
    
    .nav-text {
        font-size: 0.75rem;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .post-meta {
        gap: 1rem;
    }
    
    .article-nav {
        flex-direction: column;
        gap: 1rem;
    }
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
    .brand-logo-img {
        height: 2.25rem; /* 超小屏幕进一步减小 */
    }
    
    .nav-menu {
        gap: 0.5rem;
    }
    
    .nav-link {
        font-size: 0.75rem;
    }
    
    .nav-link-special {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        gap: 0.2rem;
    }
    
    .nav-icon {
        width: 0.7rem;
        height: 0.7rem;
    }
    
    .nav-text {
        font-size: 0.7rem;
    }
}

/* SVG Logo 样式 */
.brand-logo-svg {
    height: 2rem;
    width: auto;
    transition: all 0.3s ease;
}

.logo-svg {
    height: 100%;
    width: auto;
    filter: brightness(0) invert(1); /* 在透明背景时变为白色 */
    opacity: 0.95;
    transition: all 0.3s ease;
}

/* 滚动后的 SVG Logo 样式 */
.navbar.scrolled .logo-svg {
    filter: none; /* 滚动后恢复原始颜色 */
    opacity: 1;
}

/* SVG Logo 悬停效果 */
.brand-link:hover .logo-svg {
    transform: scale(1.05);
    opacity: 1;
}

/* 备用文字 Logo 样式 */
.brand-logo-fallback {
    height: 2rem;
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.brand-logo-fallback .logo-text {
    color: white;
    font-weight: bold;
    font-size: 0.875rem;
    display: block;
}

/* 移动端响应式 */
@media (max-width: 768px) {
    .brand-logo-svg {
        height: 1.5rem;
    }
    
    .brand-logo-fallback {
        height: 1.5rem;
        padding: 0 0.5rem;
    }
    
    .brand-logo-fallback .logo-text {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .brand-logo-svg {
        height: 1.25rem;
    }
    
    .brand-logo-fallback {
        height: 1.25rem;
        padding: 0 0.4rem;
    }
    
    .brand-logo-fallback .logo-text {
        font-size: 0.7rem;
    }
}

/* 移动端菜单按钮 */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background-color: currentColor;
    transition: all 0.3s ease;
    transform-origin: center;
}

.nav-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* 移动端响应式设计 */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 80px 2rem 2rem;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-link {
        width: 100%;
        padding: 1rem 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        text-align: left;
        font-size: 1.1rem;
        color: #333 !important; /* 修复颜色 */
        text-shadow: none;
    }
    
    .nav-link::after {
        display: none; /* 移除下划线效果 */
    }
    
    .nav-link:hover {
        color: #0066cc !important;
    }
    
    /* GitHub 和 HuggingFace 特殊样式修复 */
    .nav-link-special {
        color: #333 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        justify-content: flex-start;
        padding: 1rem 0 !important;
        border-radius: 0 !important;
        margin-left: 0 !important;
        gap: 0.75rem;
    }
    
    .nav-link-special:hover {
        color: #0066cc !important;
        background: rgba(0, 102, 204, 0.05) !important;
        transform: none;
    }
    
    /* 移动端图标颜色修复 */
    .nav-icon-github {
        fill: #333 !important;
    }
    
    .nav-icon-huggingface {
        fill: #333 !important;
    }
    
    .nav-link-special:hover .nav-icon-github,
    .nav-link-special:hover .nav-icon-huggingface {
        fill: #0066cc !important;
    }
    
    .nav-text {
        color: inherit;
        font-size: 1.1rem;
    }
    
    .nav-icon {
        width: 20px;
        height: 20px;
        margin-right: 0.75rem;
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    /* 防止页面滚动 */
    body.nav-open {
        overflow: hidden;
    }
}

/* 深色主题适配 - 修复颜色 */
@media (max-width: 768px) {
    .navbar.scrolled .nav-menu,
    .navbar:not(.transparent) .nav-menu {
        background: rgba(30, 41, 59, 0.95);
        color: white;
    }
    
    .navbar.scrolled .nav-link,
    .navbar:not(.transparent) .nav-link {
        color: white !important;
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .navbar.scrolled .nav-link:hover,
    .navbar:not(.transparent) .nav-link:hover {
        color: #60a5fa !important;
    }
    
    /* 深色主题下的特殊链接修复 */
    .navbar.scrolled .nav-link-special,
    .navbar:not(.transparent) .nav-link-special {
        color: white !important;
        background: transparent !important;
    }
    
    .navbar.scrolled .nav-link-special:hover,
    .navbar:not(.transparent) .nav-link-special:hover {
        color: #60a5fa !important;
        background: rgba(96, 165, 250, 0.1) !important;
    }
    
    /* 深色主题下的图标颜色 */
    .navbar.scrolled .nav-icon-github,
    .navbar:not(.transparent) .nav-icon-github {
        fill: white !important;
    }
    
    .navbar.scrolled .nav-icon-huggingface,
    .navbar:not(.transparent) .nav-icon-huggingface {
        fill: white !important;
    }
    
    .navbar.scrolled .nav-link-special:hover .nav-icon-github,
    .navbar:not(.transparent) .nav-link-special:hover .nav-icon-github,
    .navbar.scrolled .nav-link-special:hover .nav-icon-huggingface,
    .navbar:not(.transparent) .nav-link-special:hover .nav-icon-huggingface {
        fill: #60a5fa !important;
    }
}