/* 自定义样式文件 */

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 1s ease-out;
}

/* 滚动渐显效果 */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 博客卡片悬停效果 */
.blog-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
    transform: translateY(-5px);
}

/* 导航栏滚动效果 */
.navbar-scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 文本截断（用于博客简介） */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 图片懒加载优化 */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 响应式图片 */
img {
    max-width: 100%;
    height: auto;
}

/* 移动端优化 */
@media (max-width: 640px) {
    /* 移动端字体大小调整 */
    #home h1 {
        font-size: 2rem;
    }
    
    #home p {
        font-size: 1rem;
    }
    
    /* 移动端间距调整 */
    section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
}

/* 加载动画优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 博客标签页样式 */
.blog-tab {
    color: #6b7280;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.blog-tab:hover {
    color: #2563eb;
    background: #f3f4f6;
}

/* 激活状态的标签样式 - 确保视觉上有明显区分 */
.blog-tab.active {
    color: #2563eb;
    background: #eff6ff;
    border-color: #3b82f6;
    font-weight: 600;
}

/* 封面图输入方式切换标签 */
.cover-tab {
    color: #6b7280;
    background: transparent;
}

.cover-tab.active {
    color: #2563eb;
    background: #eff6ff;
}

/* 编辑器样式 */
#blog-content {
    font-family: 'Courier New', monospace;
    line-height: 1.6;
}

/* 模态框动画 */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#login-modal > div {
    animation: modalFadeIn 0.2s ease-out;
}

/* 提示框动画 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#success-toast {
    animation: slideIn 0.3s ease-out;
}

/* 确保按钮可点击 */
button:not(:disabled) {
    cursor: pointer;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* 首页描述单行显示样式 */
#hero-quote {
    overflow: hidden !important;
    white-space: nowrap !important;
    position: relative;
}

/* 文本元素样式 */
#hero-quote-text {
    display: inline-block;
    white-space: nowrap;
    width: auto;
}

/* 横向自动滚动动画 - 从容器右边缘内侧到左边缘内侧 */
@keyframes scroll-horizontal {
    0% {
        transform: translateX(var(--start-position, 0));
    }
    100% {
        transform: translateX(var(--end-position, 0));
    }
}

/* 当内容超出时启用自动滚动 */
#hero-quote.auto-scroll #hero-quote-text {
    animation: scroll-horizontal var(--scroll-duration, 12s) linear infinite;
}

/* 移动端优化：确保在小屏幕上也能正常显示 */
@media (max-width: 640px) {
    #hero-quote {
        overflow: hidden !important;
        white-space: nowrap !important;
        padding: 0 1rem; /* 添加左右内边距，确保内容不会贴边 */
    }
}

/* Markdown 内容样式 */
.markdown-content {
    line-height: 1.8;
}

/* 标题样式 - 自动加粗 */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-weight: 700 !important;
    margin-top: 1.5em !important;
    margin-bottom: 0.75em !important;
    color: #1f2937 !important;
}

.markdown-content h1 {
    font-size: 2.25em;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.3em;
}

.markdown-content h2 {
    font-size: 1.875em;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.3em;
}

.markdown-content h3 {
    font-size: 1.5em;
}

.markdown-content h4 {
    font-size: 1.25em;
}

.markdown-content h5 {
    font-size: 1.125em;
}

.markdown-content h6 {
    font-size: 1em;
    color: #6b7280;
}

/* 段落样式 */
.markdown-content p {
    margin-bottom: 1em;
    line-height: 1.8;
}

/* 列表样式 */
.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.markdown-content li {
    margin-bottom: 0.5em;
    line-height: 1.8;
}

.markdown-content ul li {
    list-style-type: disc;
}

.markdown-content ol li {
    list-style-type: decimal;
}

/* 代码块样式 */
.markdown-content pre {
    background-color: #f6f8fa !important;
    border: 1px solid #e1e4e8 !important;
    border-radius: 6px !important;
    padding: 16px !important;
    overflow-x: auto !important;
    margin: 1.5em 0 !important;
    font-size: 0.875em !important;
    line-height: 1.45 !important;
    display: block !important;
}

.markdown-content pre code {
    background: transparent;
    border: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
    word-break: normal;
    white-space: pre;
    overflow-wrap: normal;
    display: block;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

/* 行内代码样式 */
.markdown-content code {
    background-color: rgba(175, 184, 193, 0.2);
    border-radius: 3px;
    padding: 0.2em 0.4em;
    font-size: 0.85em;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    color: #e83e8c;
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* 引用样式 */
.markdown-content blockquote {
    border-left: 4px solid #dfe2e5;
    padding-left: 1em;
    margin: 1em 0;
    color: #6a737d;
    font-style: italic;
}

/* 链接样式 */
.markdown-content a {
    color: #0366d6;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

/* 粗体和斜体 */
.markdown-content strong {
    font-weight: 700;
    color: #24292e;
}

.markdown-content em {
    font-style: italic;
}

/* 表格样式 */
.markdown-content table {
    border-collapse: collapse;
    margin: 1.5em 0;
    width: 100%;
}

.markdown-content table th,
.markdown-content table td {
    border: 1px solid #dfe2e5;
    padding: 0.5em 1em;
}

.markdown-content table th {
    background-color: #f6f8fa;
    font-weight: 600;
}

/* 水平线 */
.markdown-content hr {
    border: none;
    border-top: 2px solid #e1e4e8;
    margin: 2em 0;
}

/* 图片样式 */
.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1em 0;
}


