/* Font declarations */
@font-face {
    font-family: 'ALKATIP Basma';
    src: url('../fonts/ALKATIP Basma.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'ALKATIP Basma Bold';
    src: url('../fonts/ALKATIP Basma Bold.TTF') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'ALKATIP Kitab';
    src: url('../fonts/ALKATIP Kitab.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'ALKATIP Yazma';
    src: url('../fonts/ALKATIP Yazma.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'ALKATIP Kitab', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #f8f8f8;
}

a {
    color: #3273dc;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #1a56b3;
}

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

/* Layout */
.site-wrapper {
    display: flex;
    flex-direction: row-reverse; /* This puts the nav on the right */
    min-height: 100vh;
}

.content-wrapper {
    flex: 1;
    padding: 2rem;
    width: calc(100% - 250px);
    box-sizing: border-box;
    overflow-x: hidden;
    margin-right: 250px; /* 添加右侧边距，与导航栏宽度相同 */
}

.vertical-nav {
    width: 250px;
    background-color: #fff;
    border-left: 1px solid #eee;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

/* Navigation styles */
.nav-header {
    margin-bottom: 2rem;
    text-align: center;
}

.site-logo {
    max-width: 150px;
    margin-bottom: 1rem;
}

.site-title {
    font-family: 'ALKATIP Basma Bold', sans-serif;
    font-size: 1.5rem;
    margin: 0 0 0.5rem;
}

.site-description {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.nav-search {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.gh-search.gh-icon-button {
    background-color: #3273dc;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 180px;
    height: 40px;
    transition: background-color 0.3s ease;
    font-family: 'ALKATIP Kitab', sans-serif;
    font-size: 1rem;
}

.gh-search.gh-icon-button:hover {
    background-color: #1a56b3;
}

.gh-search.gh-icon-button svg {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

.gh-search.gh-icon-button::after {
    content: 'ئىزدەش'; /* 添加“搜索”文字 */
    font-family: 'ALKATIP Kitab', sans-serif;
    direction: rtl;
}

.nav-section-title {
    font-family: 'ALKATIP Basma Bold', sans-serif;
    font-size: 1.2rem;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-item a {
    display: block;
    padding: 0.5rem;
    color: #333;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.nav-item a:hover {
    background-color: #f5f5f5;
}

.nav-footer {
    margin-top: auto;
    font-size: 0.8rem;
    color: #999;
    text-align: center;
}

/* Home page */
.home-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.home-header {
    margin-bottom: 3rem;
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.home-title {
    font-family: 'ALKATIP Basma Bold', sans-serif;
    font-size: 2.5rem;
    margin: 0 0 1rem;
}

.home-description {
    font-size: 1.1rem;
    font-family: 'ALKATIP Basma Bold', sans-serif;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

.no-posts {
    text-align: center;
    padding: 3rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.no-posts h2 {
    font-family: 'ALKATIP Basma Bold', sans-serif;
    font-size: 1.8rem;
    margin: 0 0 1rem;
}

.no-posts p {
    color: #666;
}

/* Post feed */
.post-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    direction: rtl; /* 从右到左的布局方向 */
}

.post-card {
    background-color: #fff;
    border-radius: 10px; /* 稍微减小圆角 */
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); /* 减少阴影 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: auto; /* 改为自适应高度 */
    min-height: 220px; /* 进一步减少最小高度 */
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.03); /* 浅色化边框 */
}

.post-card:hover {
    transform: translateY(-4px); /* 减少悬停时的上浮距离 */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1); /* 减少悬停时的阴影 */
    border-color: rgba(0, 0, 0, 0.01);
}

.post-card-link {
    display: block;
    color: inherit;
    height: 100%;
}

.post-card-image {
    height: 180px; /* 减少图片高度 */
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.02); /* 添加浅色分隔线 */
}

.post-card-content {
    padding: 1.5rem 1.5rem 1.2rem; /* 减少内边距，底部边距更小 */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* 在没有摘要的情况下，使标题和日期分布在两端 */
    direction: rtl; /* 从右到左的文本方向，适合维吾尔语 */
    position: relative;
    z-index: 1;
}

.post-card-title {
    font-family: 'ALKATIP Basma Bold', sans-serif;
    font-size: 1.35rem; /* 减小标题字体大小 */
    margin: 0 0 0.8rem; /* 减少底部边距 */
    line-height: 1.3; /* 减小行高 */
    direction: rtl; /* 从右到左的文本方向，适合维吾尔语 */
    text-align: right; /* 文本右对齐 */
    color: #222;
    letter-spacing: -0.01em; /* 稍微减少字间距 */
}

/* 文章卡片中的摘要已经移除，保留样式以便将来可能需要时使用 */
.post-card-excerpt {
    display: none; /* 隐藏摘要部分 */
    color: #555;
    margin-bottom: 1.2rem;
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 5; /* 显示行数调整为 5 行 */
    line-clamp: 5;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    max-height: none; /* 移除高度限制 */
    direction: rtl; /* 从右到左的文本方向，适合维吾尔语 */
    text-align: right; /* 文本右对齐 */
    font-size: 1.05rem;
    line-height: 1.6;
}

.post-card-meta {
    display: flex;
    justify-content: flex-end;
    font-size: 0.9rem; /* 减小字体大小 */
    color: #888; /* 浅色化 */
    direction: rtl; /* 从右到左的文本方向，适合维吾尔语 */
    font-family: 'ALKATIP Kitab', sans-serif;
    text-align: right;
    border-top: 1px solid rgba(0, 0, 0, 0.03); /* 浅色化分隔线 */
    padding-top: 0.8rem; /* 减少上边距 */
    margin-top: auto;
}

.post-card-date {
    display: block;
    text-align: right;
    direction: rtl;
    width: 100%;
    font-size: 0.8rem; /* 进一步减小字体 */
    color: #999; /* 更浅的颜色 */
    letter-spacing: 0.01em; /* 减少字间距 */
    white-space: nowrap;
}



/* Article styles */
.post-content, .page-content, .site-main {
    background-color: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.article {
    width: 100%;
    direction: rtl; /* 从右到左的文本方向，适合维吾尔语 */
    text-align: right; /* 文本右对齐 */
}

/* 英文内容保持从左到右的方向 */
.article pre,
.article code,
.article .kg-code-card,
.article .kg-embed-card,
.article [lang="en"],
.article .kg-bookmark-card,
.article blockquote,
.article table,
.article .kg-gallery-card,
.article .kg-image-card {
    direction: ltr;
    text-align: left;
}

/* 为 Markdown 内容添加特殊处理 */
.article-content pre,
.article-content code,
.article-content .kg-code-card,
.article-content .kg-embed-card,
.article-content .kg-bookmark-card,
.article-content .kg-gallery-card,
.article-content .kg-image-card,
.article-content blockquote,
.article-content table {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: isolate;
}

/* 代码块的特殊处理 */
.article-content pre {
    display: block;
    width: 100%;
    overflow-x: auto;
    background-color: #f5f5f5;
    border-radius: 5px;
    padding: 1rem;
    margin: 1.5rem 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre;
    position: relative;
    left: 0;
    right: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #007bff;
}

/* Markdown 代码块的特殊处理 */
.kg-code-card {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: isolate;
    margin: 1.5rem 0;
}

.kg-code-card pre {
    margin: 0 !important;
}

/* 行内代码 */
.article-content code {
    background-color: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: #d63384;
}

/* 代码块内的代码不需要颜色和背景 */
.article-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

/* 代码高亮样式 */
.article-content pre .keyword,
.article-content pre .function,
.article-content pre .class {
    color: #0076ff;
    font-weight: bold;
}

.article-content pre .string {
    color: #42b983;
}

.article-content pre .number {
    color: #ae81ff;
}

.article-content pre .comment {
    color: #999;
    font-style: italic;
}

/* 英文内容的特殊处理 */
.english-content {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: isolate;
}

/* 维吾尔语内容的特殊处理 */
.uyghur-content {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: isolate;
}

/* 维吾尔语内容中的代码块特殊处理 */
.uyghur-content pre,
.uyghur-content code,
.uyghur-content .kg-code-card,
.uyghur-content .kg-embed-card,
.uyghur-content blockquote,
.uyghur-content table {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: isolate;
}

.article-header {
    margin-bottom: 2rem;
}

.article-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-family: 'ALKATIP Basma Bold', sans-serif;
}

.article-content {
    font-family: 'ALKATIP Kitab', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    direction: rtl; /* 从右到左的文本方向，适合维吾尔语 */
    text-align: right; /* 文本右对齐 */
}

.article-header, .page-header {
    margin-bottom: 2rem;
}

.article-title, .page-title {
    font-family: 'ALKATIP Basma Bold', sans-serif;
    font-size: 2.5rem;
    margin: 0 0 1rem;
    line-height: 1.2;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 1.1rem;
    color: #666;
    justify-content: flex-end; /* 右对齐元素 */
    direction: rtl; /* 从右到左的文本方向 */
    font-family: 'ALKATIP Kitab', sans-serif;
}

.article-date {
    display: block;
    text-align: right;
    direction: rtl;
    width: 100%;
    font-size: 0.95rem;
    color: #777;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    white-space: nowrap;
}

/* 文章和页面的封面图片已在模板中移除，保留样式以便将来可能需要时使用 */
.article-image, .page-image {
    margin-bottom: 2rem;
    display: none; /* 隐藏封面图片 */
}

.article-image img, .page-image img {
    border-radius: 8px;
}

.article-body, .page-body {
    font-family: 'ALKATIP Kitab', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-body h1, .article-body h2, .article-body h3,
.article-body h4, .article-body h5, .article-body h6,
.page-body h1, .page-body h2, .page-body h3,
.page-body h4, .page-body h5, .page-body h6 {
    font-family: 'ALKATIP Basma Bold', sans-serif;
}

.article-body a, .page-body a {
    text-decoration: underline;
}

.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.article-tags {
    margin-bottom: 2rem;
    direction: rtl; /* 从右到左的文本方向 */
    text-align: right; /* 文本右对齐 */
}

.article-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end; /* 右对齐元素 */
}

.article-tag {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background-color: #f5f5f5;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #666;
}

.article-tag:hover {
    background-color: #eee;
    color: #333;
}

.article-author {
    margin-bottom: 2rem;
}

.author-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.author-profile-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 1rem;
}

.author-profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-name {
    font-family: 'ALKATIP Basma Bold', sans-serif;
    font-size: 1.2rem;
    margin: 0 0 0.5rem;
}

.author-bio {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}



.article-comments {
    margin-top: 3rem;
}

/* Related posts */
.related-posts {
    margin-top: 3rem;
}

.related-posts-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.related-post-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.related-post-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.related-post-image {
    height: 150px;
    background-size: cover;
    background-position: center;
}

.related-post-content {
    padding: 1rem;
}

.related-post-title {
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.related-post-date {
    font-size: 0.6rem;
    color: #999;
}

/* Author and tag pages */
.author-header, .tag-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 3rem;
    background-color: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.author-profile-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 2rem;
}

.author-profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-info {
    flex: 1;
}

.author-name, .tag-title {
    font-family: 'ALKATIP Basma Bold', sans-serif;
    font-size: 2.5rem;
    margin: 0 0 1rem;
    direction: rtl; /* 从右到左的文本方向 */
    text-align: center;
}

.author-bio, .tag-description {
    margin-bottom: 1.5rem;
    color: #333;
    direction: rtl; /* 从右到左的文本方向 */
    text-align: center;
    max-width: 700px;
    font-size: 1.5rem;
    font-family: 'ALKATIP Kitab', sans-serif;
    line-height: 1.6;
}

.author-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
}

.tag-header {
    flex-direction: column;
    align-items: center;
}

/* Search styles */
.search-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.search-header {
    margin-bottom: 3rem;
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.search-title {
    font-family: 'ALKATIP Basma Bold', sans-serif;
    font-size: 2rem;
    margin: 0 0 1rem;
    direction: rtl; /* 从右到左的文本方向 */
    text-align: center;
}

.no-results {
    text-align: center;
    padding: 3rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    direction: rtl; /* 从右到左的文本方向 */
}

.no-results h2 {
    font-family: 'ALKATIP Basma Bold', sans-serif;
    font-size: 1.8rem;
    margin: 0 0 1rem;
}

.no-results p {
    color: #666;
}

/* Ghost Editor Styles */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: 0 auto;
    transform: translateX(calc(50% - 50vw));
    max-width: 1040px;
}

.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.kg-gallery-container {
    display: flex;
    flex-direction: column;
    margin: 1.5em auto;
    max-width: 1040px;
    width: 100vw;
}

.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.kg-gallery-image img {
    display: block;
    margin: 0;
    width: 100%;
    height: 100%;
}

.kg-gallery-row:not(:first-of-type) {
    margin: 0.75em 0 0 0;
}

.kg-gallery-image:not(:first-of-type) {
    margin: 0 0 0 0.75em;
}

.kg-bookmark-card {
    width: 100%;
    position: relative;
    margin: 1.5em 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.kg-bookmark-container {
    display: flex;
    color: inherit;
    text-decoration: none;
}

.kg-bookmark-content {
    flex-grow: 1;
    padding: 20px;
}

.kg-bookmark-title {
    font-weight: 600;
    font-size: 1.2em;
    line-height: 1.3em;
}

.kg-bookmark-description {
    display: -webkit-box;
    overflow-y: hidden;
    margin-top: 12px;
    max-height: 48px;
    color: #666;
    font-size: 0.9em;
    line-height: 1.5em;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    margin-top: 14px;
    color: #666;
    font-size: 0.8em;
    font-weight: 500;
    line-height: 1.3em;
}

.kg-bookmark-icon {
    width: 20px;
    height: 20px;
    margin-right: 6px;
}

.kg-bookmark-author:after {
    content: "•";
    margin: 0 6px;
}

.kg-bookmark-thumbnail {
    position: relative;
    min-width: 140px;
    max-width: 180px;
}

.kg-bookmark-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0 3px 3px 0;
}

/* Responsive styles */
@media (max-width: 768px) {
    .site-wrapper {
        flex-direction: column;
    }

    .content-wrapper {
        max-width: 100%;
        padding: 1rem;
        margin-right: 0; /* Remove right margin on mobile */
        width: 100%;
    }

    .vertical-nav {
        width: 100%;
        position: relative;
        border-left: none;
        border-bottom: 1px solid #eee;
        padding: 1rem;
    }

    .post-feed {
        grid-template-columns: 1fr;
        gap: 1rem; /* Reduce gap on mobile */
    }

    .post-card {
        min-height: auto; /* Allow cards to be smaller on mobile */
        width: 100%;
    }

    .post-card-content {
        padding: 1rem 1rem 0.8rem; /* Reduce padding on mobile */
    }

    .post-card-title {
        font-size: 1.2rem; /* Smaller font size on mobile */
        margin: 0 0 0.5rem;
        line-height: 1.2;
    }

    .post-card-meta {
        padding-top: 0.5rem;
    }

    .post-card-date {
        font-size: 0.75rem;
    }

    .author-header {
        flex-direction: column;
        text-align: center;
    }

    .author-profile-image {
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .kg-width-wide,
    .kg-width-full {
        margin-left: -1rem;
        margin-right: -1rem;
        transform: none;
        width: auto;
    }

    .kg-bookmark-container {
        flex-direction: column;
    }

    .kg-bookmark-thumbnail {
        min-height: 160px;
        max-width: 100%;
    }

    /* Adjust article styles for mobile */
    .article-title {
        font-size: 1.8rem;
    }

    .post-content, .page-content, .site-main {
        padding: 1.5rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .post-card-image {
        height: 150px; /* Smaller image height on very small screens */
    }

    .post-card-content {
        padding: 0.8rem 0.8rem 0.6rem; /* Further reduce padding on very small screens */
    }

    .post-card-title {
        font-size: 1.1rem; /* Even smaller font size on very small screens */
    }

    .home-title {
        font-size: 2rem;
    }

    .home-description {
        font-size: 1rem;
    }
}
