/*
Theme Name: 123
*/

/* Global Styles */
:root {
    --primary-color: #4A6CF7;
    --primary-hover: #3959e3;
    --background-light: #F8FAFC;
    --text-dark: #334155;
    --border-light: #E2E8F0;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-dark);
    background-color: var(--background-light);
    line-height: 1.6;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Header & Navigation */
.site-header {
    background-color: #fff;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-logo img {
    max-height: 50px;
    width: auto;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.nav-link {
    color: var(--text-dark) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
    background-color: var(--background-light);
}

/* Cards */
.card {
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.08);
}

.card-img-top {
    position: relative;
    overflow: hidden;
    height: 200px;
    object-fit: cover;
}

.card-img-top::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.03) 100%);
    pointer-events: none;
}

/* Article Content */
.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    box-shadow: var(--shadow-sm);
    margin: 1.5rem 0;
}

.article-content img:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* Badges & Tags */
.badge {
    padding: 0.375rem 0.75rem;
    font-weight: 500;
    border-radius: 5px;
}

.badge-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.badge-light {
    background-color: var(--background-light);
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.badge-light:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* Sidebar */
.sidebar .card {
    margin-bottom: 1.5rem;
}

.tag-cloud a {
    display: inline-block;
    margin: 0.25rem;
}

/* Breadcrumb */
.breadcrumb {
    background-color: var(--background-light);
    padding: 0.75rem 0;
    margin-bottom: 2rem;
}

.breadcrumb-item+.breadcrumb-item::before {
    content: ">";
    color: var(--text-dark);
}

/* Pagination */
.pagination {
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.page-link {
    color: var(--primary-color);
    border-radius: 5px;
    margin: 0 0.25rem;
    border: 1px solid var(--border-light);
}

.page-link:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Footer */
.site-footer {
    background-color: #fff;
    border-top: 1px solid var(--border-light);
    margin-top: 4rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border: none;
    border-radius: 5px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Search Form */
.search-form {
    position: relative;
}

.search-form input {
    border: 1px solid var(--border-light);
    border-radius: 5px;
    padding: 0.5rem 3rem 0.5rem 1rem;
    width: 100%;
}

.search-form button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
}

/* Comments */
.comment-list {
    list-style: none;
    padding: 0;
}

.comment {
    padding: 1.5rem;
    margin-bottom: 1rem;
    background-color: #fff;
    border: 1px solid var(--border-light);
    border-radius: 5px;
}

/* Responsive */
@media (max-width: 575.98px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .article-content {
        font-size: 1rem;
    }

    .card-img-top {
        height: 150px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 1140px;
    }
}

/* Accessibility */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999999;
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.5rem 1rem;
    text-decoration: none;
}

.skip-link:focus {
    left: 6px;
    top: 7px;
}

.card-body>p.card-text {
    /* 设置行高，用于计算高度 */
    line-height: 1.5;

    /* 固定高度为3行文字的高度 */
    height: 4.5em;
    /* 3 * 1.5 = 4.5em */

    /* 限制最多显示3行 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;

    /* 超出部分隐藏 */
    overflow: hidden;

    /* 文字超出时显示省略号 */
    text-overflow: ellipsis;

    /* 确保文字换行 */
    word-wrap: break-word;
    word-break: break-word;
}

h2.card-title.h4 {
    /* 强制单行显示 */
    white-space: nowrap;

    /* 超出部分隐藏 */
    overflow: hidden;

    /* 显示省略号 */
    text-overflow: ellipsis;

    /* 移除文本装饰（如下划线） */
    text-decoration: none;
}

span.pseudo-H3 {
    /* 显示为块级元素 */
    display: block;

    /* 字体大小 - h3 的默认大小 */
    font-size: 1.17em;

    /* 字体粗细 */
    font-weight: bold;

    /* 外边距 - 匹配 h3 的默认边距 */
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;

    /* 行高 */
    line-height: normal;

    /* 继承字体 */
    font-family: inherit;

    /* 文本颜色继承 */
    color: inherit;
}

/* 当 pseudo-H3 是第一个子元素时，移除顶部边距 */
span.pseudo-H3:first-child {
    margin-top: 0;
}

/* 基础图片占位符样式 */
.image-placeholder {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    min-height: 100%;
    width: 100%;
    color: #6c757d;
    transition: all 0.3s ease;
}

figure.wp-block-image >img {
  max-width: 100%;
}

/* 平板设备 - 最小宽度768px */
@media (min-width: 768px) {
  figure.wp-block-image >img {
    max-width: 66%;
  }
}

/* 电脑设备 - 最小宽度992px */
@media (min-width: 992px) {
  figure.wp-block-image >img {
    max-width: 33%;
  }
}
