/* 从主站导入的样式 */
body {
    font-family: 'Inter', 'SimSun', '宋体', sans-serif;
}
html {
    scroll-behavior: smooth;
}

/* Animation styles */
@keyframes fade-in-down {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-down { animation: fade-in-down 0.8s ease-out forwards; }
.animate-fade-in-up { animation: fade-in-up 0.8s ease-out 0.3s forwards; opacity: 0; }

/* Grid and card layout styles */
.grid {
    align-items: stretch;
}
.grid > div.project-card {
     display: flex;
     flex-direction: column;
}
.grid .p-6 {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.grid .p-6 p:nth-of-type(1) {
    flex-grow: 1;
}
.grid .p-6 a {
    margin-top: auto;
    align-self: flex-start;
}

/* 博客特定样式 */
.prose {
    width: 80%;
    max-width: 65ch;
    color: #374151;
    line-height: 1.8;
    margin-left: auto;
    margin-right: auto;
}

.prose h1 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-size: 2.25em;
    font-weight: 700;
    line-height: 1.2;
}

.prose h2 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-size: 1.8em;
    font-weight: 600;
    line-height: 1.3;
}

.prose h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-size: 1.5em;
    font-weight: 600;
    line-height: 1.3;
}

.prose h4 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.4;
}

.prose p {
    margin-top: 1em;
    margin-bottom: 1em;
}

.prose strong {
    font-weight: 600;
}

.prose a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
}

.prose a:hover {
    color: #1d4ed8;
}

.prose blockquote {
    margin: 1.5em 0;
    padding-left: 1em;
    border-left: 4px solid #e5e7eb;
    font-style: italic;
    color: #6b7280;
}

.prose ul, .prose ol {
    margin: 1em 0;
    padding-left: 1.5em;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose li {
    margin: 0.5em 0;
}

.prose img {
    width: 70%;
    max-width: 100%;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-top: 1em;
    margin-bottom: 1em;
    border-radius: 0.375rem;
}

.prose code {
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
    background-color: #f3f4f6;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
}

.prose pre {
    margin: 1.5em 0;
    padding: 1em;
    background-color: #1f2937;
    border-radius: 0.375rem;
    overflow-x: auto;
}

.prose pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.9em;
    color: #e5e7eb;
}

/* 适配暗色模式的代码块 */
@media (prefers-color-scheme: dark) {
    .prose pre {
        background-color: #111827;
    }
    .prose pre code {
        color: #f3f4f6;
    }
}

/* 加载动画 */
.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid #3498db;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 隐藏滚动条但保留功能 */
.hide-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;     /* Firefox */
}
.hide-scrollbar::-webkit-scrollbar {
    display: none;             /* Chrome, Safari, Opera */
}

/* 最新文章卡片样式 */
.recent-post-card,
.blog-post-card {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    flex-shrink: 0;
    background: white;
    transition: all 0.3s ease;
}

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

.post-cover-image,
.blog-post-card .blog-cover-image {
    height: 160px;
    object-fit: cover;
    width: 100%;
}

.text-cover,
.blog-post-card .text-cover {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
    color: white;
    padding: 1rem;
}

.blog-post-card .text-cover h3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* demo/blog/blog-styles.css */

/* --- 表格基础样式 (优化 Tailwind Prose 的默认表格) --- */

/* 为 .prose 内的表格应用更细致和统一的样式 */
.prose table {
    width: 100%;                     /* 表格宽度占满其容器 */
    max-width: 100%;                 /* 确保不超过容器宽度 */
    margin-top: 1.5em;               /* 表格上方的外边距 */
    margin-bottom: 1.5em;            /* 表格下方的外边距 */
    border-collapse: collapse;       /* 边框合并，线条更清晰 */
    border-spacing: 0;               /* 移除单元格间距 (如果 border-collapse 不完全生效) */
    font-size: 0.9rem;               /* 可以调整表格内文字大小，相对于 prose 基础字体大小 */
    border: 1px solid #cbd5e0;       /* 表格外边框 (Tailwind gray-400) */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* 可选：添加一个非常细微的阴影 */
    overflow-wrap: break-word;       /* 允许长单词在单元格内换行 */
}

.prose thead {
    background-color: #f7fafc;       /* 表头背景色 (Tailwind gray-100) */
}

.prose th,
.prose td {
    border: 1px solid #e2e8f0;       /* 单元格边框 (Tailwind gray-300) */
    padding: 0.65em 0.9em;           /* 单元格内边距 (上下 左右) */
    text-align: left;                /* 默认文本左对齐 */
    vertical-align: top;             /* 内容顶部对齐 */
}

.prose th { /* 表头单元格特定样式 */
    font-weight: 600;                /* 表头字体加粗 (Tailwind semibold) */
    color: #2d3748;                 /* 表头文字颜色 (Tailwind gray-800) */
    white-space: nowrap;             /* 表头文字通常不换行，除非内容实在太长 */
}

/* 为表格主体行添加斑马条纹，提高可读性 */
.prose tbody tr:nth-child(even) {
    background-color: #f7fafc;       /* 偶数行背景色 (Tailwind gray-100 / gray-50) */
}

.prose tbody tr:hover {
    background-color: #edf2f7;       /* 鼠标悬停时行背景色 (Tailwind gray-200) */
}

/* 处理 Markdown 表格对齐 */
/* marked.js 会给对齐的单元格添加 style="text-align: center/right;" */
/* 以下规则是备用，或如果您希望通过类来控制（需要marked.js扩展或JS后处理） */
.prose td[align="center"], .prose th[align="center"] {
    text-align: center;
}
.prose td[align="right"], .prose th[align="right"] {
    text-align: right;
}

/* --- 表格响应式处理 --- */
/* 当屏幕宽度小于等于 768px (Tailwind 'md'断点) 时生效 */
@media (max-width: 768px) {
    .prose table {
        display: block;          /* 将表格变为块级元素，使其可以水平滚动 */
        overflow-x: auto;        /* 允许在x轴（水平方向）上滚动 */
        -webkit-overflow-scrolling: touch; /* 在iOS上提供更平滑的滚动体验 */
        white-space: nowrap;     /* 防止单元格内文本因父容器宽度限制而提前换行，保持表格原始列宽 */
    }

    .prose th,
    .prose td {
        white-space: nowrap;     /* 确保单元格内容在滚动时保持不换行，除非内容本身包含换行符 */
    }
    /* 可选：美化滚动条 (在支持的 Webkit 浏览器中) */
    .prose table::-webkit-scrollbar {
        height: 8px;
        background-color: #f7fafc; /* 滚动条轨道颜色 */
    }
    .prose table::-webkit-scrollbar-thumb {
        background-color: #a0aec0; /* 滚动条滑块颜色 (Tailwind gray-500) */
        border-radius: 4px;
    }
    .prose table::-webkit-scrollbar-thumb:hover {
        background-color: #718096; /* (Tailwind gray-600) */
    }
}