/*
Theme Name: 123
*/

:root {
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --background-color: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --white: #ffffff;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --border-radius: 0.375rem;
    --transition: all 0.15s ease-in-out;
}

/* ==========================================================================
   全局样式
   ========================================================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   导航栏样式
   ========================================================================== */
.navbar {
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-primary) !important;
}

.navbar-nav .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: var(--transition);
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--primary-color) !important;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* ==========================================================================
   主体内容区域
   ========================================================================== */
.site-content {
    min-height: calc(100vh - 140px);
    padding-bottom: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ==========================================================================
   文章卡片样式
   ========================================================================== */
.post-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.post-card:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.post-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.post-title a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.post-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.post-category {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
}

.post-category:hover {
    background-color: var(--primary-hover);
    color: var(--white);
    text-decoration: none;
}

.post-excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: auto;
}

/* ==========================================================================
   单篇文章样式
   ========================================================================== */
.single-post {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
}

.entry-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.entry-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.entry-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.entry-content p {
    margin-bottom: 1.5rem;
}

.entry-content img {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin: 1.5rem 0;
}

.entry-content blockquote {
    background: var(--background-color);
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* ==========================================================================
   侧边栏样式
   ========================================================================== */
.sidebar {
    padding-left: 1.5rem;
}

.widget {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.widget-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.category-cloud a,
.tag-cloud a {
    display: inline-block;
    background: var(--background-color);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    margin: 0.25rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--transition);
}

.category-cloud a:hover,
.tag-cloud a:hover {
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
}

.recent-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-posts-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.recent-posts-list li:last-child {
    border-bottom: none;
}

.recent-posts-list a {
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
    display: block;
    transition: var(--transition);
}

.recent-posts-list a:hover {
    color: var(--primary-color);
    text-decoration: none;
    padding-left: 0.5rem;
}

/* ==========================================================================
   面包屑导航
   ========================================================================== */
.breadcrumb {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 1.5rem;
    margin: 0;
}

.breadcrumb-item {
    font-size: 0.875rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: var(--text-muted);
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* ==========================================================================
   文章导航
   ========================================================================== */
.post-navigation {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-top: 2rem;
}

.post-navigation .nav-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-navigation a {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.post-navigation a:hover {
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
}

/* ==========================================================================
   页脚样式
   ========================================================================== */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
}

.footer-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-info a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   分页样式
   ========================================================================== */
.pagination {
    margin: 2rem 0;
    justify-content: center;
}

.page-numbers {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    margin: 0 0.25rem;
    color: var(--primary-color);
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.page-numbers:hover,
.page-numbers.current {
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
}

/* ==========================================================================
   响应式设计
   ========================================================================== */
@media (max-width: 991.98px) {
    .sidebar {
        padding-left: 0;
        margin-top: 2rem;
    }
    
    .post-grid .col-md-6 {
        margin-bottom: 1.5rem;
    }
    
    .entry-title {
        font-size: 2rem;
    }
    
    .single-post {
        padding: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    .navbar {
        padding: 0.5rem 0;
        margin-bottom: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .entry-title {
        font-size: 1.75rem;
    }
    
    .post-content {
        padding: 1rem;
    }
    
    .single-post {
        padding: 1rem;
    }
    
    .widget {
        padding: 1rem;
    }
    
    .post-navigation .nav-links {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 575.98px) {
    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .entry-content {
        font-size: 1rem;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ==========================================================================
   打印样式
   ========================================================================== */
@media print {
    .navbar,
    .sidebar,
    .post-navigation,
    .site-footer {
        display: none !important;
    }
    
    .container {
        max-width: none !important;
    }
    
    .single-post {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    a {
        text-decoration: underline !important;
    }
}

/* ==========================================================================
   工具类
   ========================================================================== */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.gap-4 {
    gap: 1.5rem !important;
}

.h5 {
    font-size: 1.125rem;
}

/* ==========================================================================
   动画效果
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card,
.widget,
.single-post {
    animation: fadeIn 0.6s ease-out;
}

/* 延迟动画效果 */
.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.3s; }
.post-card:nth-child(4) { animation-delay: 0.4s; }

/* 默认手机样式 - 最大宽度100% */
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%;
  }
}

div.post-excerpt {
  /* 设置行高，用于计算高度 */
  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.post-title {
  /* 强制单行显示 */
  white-space: nowrap;

  /* 超出部分隐藏 */
  overflow: hidden;

  /* 显示省略号 */
  text-overflow: ellipsis;

  /* 移除文本装饰（如下划线） */
  text-decoration: none;
}
