/*
Theme Name: Lepage
Theme URI: https://example.com/lepage
Author: Your Name
Author URI: https://example.com
Description: 单栏轻量单页/博客主题，基于 Bootstrap 5，适用于首页文章列表、单页与单篇文章展示。
Version: 1.0.0
Requires at least: 5.9
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: lepage
*/

/* ========== 共用样式 ========== */

:root {
  --accent: #198754;
  --gradient-start: #0d6efd;
  --gradient-end: #20c997;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
/* 移动端触摸反馈 */
a, button, .nav-link, .page-link, .breadcrumb-item a {
  -webkit-tap-highlight-color: rgba(25, 135, 84, 0.15);
  tap-highlight-color: rgba(25, 135, 84, 0.15);
}

/* 顶部 Hero */
.hero {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  color: #fff;
  padding: 4rem 0 3rem;
}
.hero h1 {
  font-size: 2.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero .subtitle {
  opacity: .9;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}
.hero .nav-pills .nav-link {
  background: rgba(255, 255, 255, .25);
  color: #fff;
  border: none;
  margin: 0 .25rem;
  border-radius: .375rem;
}
.hero .nav-pills .nav-link:hover,
.hero .nav-pills .nav-link.active {
  background: rgba(255, 255, 255, .9);
  color: #212529;
}

/* 右上角搜索 */
.hero-search-wrap {
  z-index: 5;
}
.hero-search-btn {
  min-width: 44px;
  min-height: 44px;
  opacity: .9;
}
.hero-search-btn:hover {
  opacity: 1;
  color: #fff !important;
}
.hero-search-btn[aria-expanded="true"] {
  opacity: 1;
  background: rgba(255, 255, 255, .2);
}
.hero-search-inner .search-form {
  margin-bottom: 0;
}
.hero-search-inner .search-form input[type="search"] {
  border: 1px solid #dee2e6;
  padding: 0.5rem 0.75rem;
  border-radius: .375rem;
  font-size: 1rem;
}
.hero-search-inner .search-form input:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.15);
}
.hero-search-inner .search-form .btn {
  white-space: nowrap;
}

/* 区块标题（绿色竖线） */
.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-left: .75rem;
  border-left: 4px solid var(--accent);
}

/* 文章列表（page / single：标题+日期一行） */
.article-list .list-group-item {
  border-left: 0;
  border-right: 0;
  padding: .6rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.article-list .list-group-item:first-child {
  border-top: 0;
}
.article-list .text-muted {
  font-size: .85rem;
}

/* 文章列表带摘要（index：标题+日期+摘要） */
.article-list-with-excerpt .list-group-item {
  flex-direction: column;
  align-items: stretch;
  padding: 1rem 0;
}
.article-list-with-excerpt .list-group-item:not(:last-child) {
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.article-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .4rem;
}
.article-item-header > a {
  font-weight: 600 !important;
}
.article-excerpt {
  font-size: .9rem;
  color: #6c757d;
  line-height: 1.6;
  margin: 0;
}

/* 标签列表（page） */
.tag-list .badge {
  margin: .2rem;
  font-weight: 500;
  padding: .35em .65em;
}

/* ========== 单篇文章 ========== */

/* 面包屑 */
.breadcrumb-nav .breadcrumb {
  padding: 0;
  background: none;
  font-size: 0.9rem;
}
.breadcrumb-nav .breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: #6c757d;
}
.breadcrumb-nav .breadcrumb-item a {
  color: #6c757d;
  text-decoration: none;
}
.breadcrumb-nav .breadcrumb-item a:hover {
  color: var(--accent);
}
.breadcrumb-nav .breadcrumb-item.active .breadcrumb-current {
  color: #212529;
}

.entry-meta {
  font-size: .9rem;
  color: #6c757d;
  margin-bottom: 1.5rem;
}
.entry-meta .entry-category {
  color: #6c757d;
  text-decoration: none;
}
.entry-meta .entry-category:hover {
  color: var(--accent);
}

/* 上一篇/下一篇 */
.post-navigation .col-md-6 a {
  text-decoration: none;
  color: #212529;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-navigation .col-md-6 a:hover {
  color: var(--accent);
}
@media (min-width: 768px) {
  .post-navigation .col-md-6 a { white-space: normal; }
}

/* ========== 正文内容排版（.entry-content） ========== */
.entry-content {
  line-height: 1.85;
  color: #333;
  font-size: 1rem;
}
.entry-content p {
  margin-bottom: 1.15em;
}
.entry-content p:last-child {
  margin-bottom: 0;
}
.entry-content h1, .entry-content h2, .entry-content h3,
.entry-content h4, .entry-content h5, .entry-content h6 {
  margin-top: 1.5em;
  margin-bottom: 0.6em;
  font-weight: 600;
  line-height: 1.35;
  color: #212529;
}
.entry-content h1 { font-size: 1.5rem; }
.entry-content h2 { font-size: 1.35rem; }
.entry-content h3 { font-size: 1.2rem; }
.entry-content h4 { font-size: 1.1rem; }
.entry-content h5 { font-size: 1.05rem; }
.entry-content h6 { font-size: 1rem; }
.entry-content h1:first-child,
.entry-content h2:first-child,
.entry-content h3:first-child {
  margin-top: 0;
}
.entry-content ul, .entry-content ol {
  margin-bottom: 1.15em;
  padding-left: 1.5em;
}
.entry-content li {
  margin-bottom: 0.35em;
}
.entry-content ul ul, .entry-content ol ol, .entry-content ul ol, .entry-content ol ul {
  margin-top: 0.35em;
  margin-bottom: 0.35em;
}
.entry-content blockquote {
  margin: 1.5em 0;
  padding: 0.75em 1em 0.75em 1.25em;
  border-left: 4px solid var(--accent);
  background: rgba(0, 0, 0, .04);
  color: #555;
  font-style: italic;
}
.entry-content blockquote p:last-child {
  margin-bottom: 0;
}
.entry-content img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}
.entry-content .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.entry-content .alignleft { float: left; margin-right: 1em; margin-bottom: .5em; }
.entry-content .alignright { float: right; margin-left: 1em; margin-bottom: .5em; }
.entry-content figure {
  margin: 1.5em 0;
}
.entry-content figcaption {
  font-size: 0.9rem;
  color: #6c757d;
  margin-top: 0.5em;
  text-align: center;
}
.entry-content table {
  width: 100%;
  margin-bottom: 1.15em;
  border-collapse: collapse;
}
.entry-content th, .entry-content td {
  padding: 0.5em 0.75em;
  border: 1px solid #dee2e6;
  text-align: left;
}
.entry-content th {
  background: rgba(0, 0, 0, .05);
  font-weight: 600;
}
.entry-content code, .entry-content kbd {
  padding: 0.2em 0.4em;
  font-size: 0.9em;
  background: rgba(0, 0, 0, .06);
  border-radius: .25rem;
}
.entry-content pre, .entry-content pre code {
  display: block;
  padding: 1em;
  margin-bottom: 1.15em;
  overflow-x: auto;
  background: #f8f9fa;
  border: 1px solid #eee;
  border-radius: .25rem;
  font-size: 0.9rem;
  line-height: 1.5;
}
.entry-content pre code {
  padding: 0;
  margin: 0;
  background: none;
  border: none;
}
.entry-content a {
  color: var(--accent);
  text-decoration: none;
}
.entry-content a:hover {
  text-decoration: underline;
}
.entry-content hr {
  margin: 1.5em 0;
  border: 0;
  border-top: 1px solid #dee2e6;
}
.entry-content .wp-block-image img {
  display: block;
}
.entry-content embed, .entry-content iframe, .entry-content object {
  max-width: 100%;
}

/* 页脚 */
.footer-links a {
  color: #6c757d;
  margin: 0 .5rem;
  text-decoration: none !important;
}
.footer-links a:hover {
  color: var(--accent);
  text-decoration: none !important;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem 1rem;
}
.footer-nav li {
  display: inline-block;
}

/* ========== 评论区域 ========== */
.comments-area {
  margin-top: 2.5rem;
  padding-top: 2rem;
}
.comments-area .section-title {
  margin-bottom: 1.25rem;
}
.comment-list,
.comments-area ol.commentlist {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
.comment-list .comment,
.comment-list .pingback {
  margin-bottom: 0;
}
.comment-body {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.comment-list .children {
  list-style: none;
  padding-left: 2rem;
  margin-top: 0.75rem;
  margin-bottom: 0;
  border-left: 2px solid rgba(0, 0, 0, .08);
}
.comment-list .children .comment-body {
  padding-left: 1rem;
}
.comment-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.comment-meta .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}
.comment-meta .fn {
  font-weight: 600;
  font-style: normal;
}
.comment-meta .fn a {
  color: #212529;
  text-decoration: none;
}
.comment-meta .fn a:hover {
  color: var(--accent);
}
.comment-meta .comment-metadata {
  font-size: 0.85rem;
  color: #6c757d;
}
.comment-meta .comment-metadata a {
  color: #6c757d;
  text-decoration: none;
}
.comment-meta .comment-metadata a:hover {
  color: var(--accent);
}
.comment-content {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #444;
  margin-left: 0;
  padding-left: 0;
}
.comment-content p {
  margin-bottom: 0.5em;
}
.comment-content p:last-child {
  margin-bottom: 0;
}
.comment-content ul, .comment-content ol {
  margin: 0.5em 0 0.5em 1.25em;
}
.comment .reply {
  margin-top: 0.5rem;
}
.comment .reply a {
  font-size: 0.85rem;
  color: #6c757d;
  text-decoration: none;
}
.comment .reply a:hover {
  color: var(--accent);
}
/* 评论表单 */
.comment-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: #212529;
}
.comment-form .required {
  color: #dc3545;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  font-size: 1rem;
  line-height: 1.5;
}
.comment-form textarea {
  min-height: 120px;
  resize: vertical;
}
.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.15);
}
.comment-form .form-submit {
  margin-top: 0.5rem;
  margin-bottom: 0;
}
.comment-form .submit {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background-color: var(--accent);
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  text-decoration: none;
}
.comment-form .submit:hover {
  background-color: #157347;
  color: #fff;
}
.comment-notes {
  font-size: 0.9rem;
  color: #6c757d;
  margin-bottom: 1rem;
}
.comments-nav {
  margin-bottom: 1.5rem;
}
.comments-area .no-comments {
  margin-bottom: 1rem;
}

/* ========== 移动端与响应式 ========== */

/* 小屏通用：主内容区内边距、防止横向溢出 */
body {
  overflow-x: hidden;
}
@media (max-width: 767.98px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  main.container {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }
}

/* 顶部 Hero */
@media (max-width: 767.98px) {
  .hero {
    padding: 2.5rem 0 2rem;
  }
  .hero h1 {
    font-size: 1.6rem;
    line-height: 1.3;
  }
  .hero .subtitle {
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
  }
  .hero .nav-pills {
    gap: 0.35rem;
  }
  .hero .nav-pills .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
@media (max-width: 399px) {
  .hero h1 { font-size: 1.4rem; }
  .hero .nav-pills .nav-link {
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
  }
}

/* 区块标题 */
@media (max-width: 767.98px) {
  .section-title {
    font-size: 1rem;
    padding-left: 0.6rem;
    border-left-width: 3px;
  }
}

/* 文章列表（首页/归档：标题+摘要） */
@media (max-width: 767.98px) {
  .article-list-with-excerpt .list-group-item {
    padding: 0.85rem 0;
  }
  .article-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  .article-item-header .text-muted {
    font-size: 0.8rem;
  }
  .article-excerpt {
    font-size: 0.85rem;
  }
}

/* 文章列表（标题+日期一行）：小屏日期换行或缩小 */
@media (max-width: 575.98px) {
  .article-list .list-group-item {
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.75rem 0;
  }
  .article-list .list-group-item a {
    min-width: 0;
    flex: 1 1 auto;
  }
  .article-list .text-muted {
    flex-shrink: 0;
    font-size: 0.8rem;
  }
}

/* 面包屑 */
@media (max-width: 767.98px) {
  .breadcrumb-nav .breadcrumb {
    font-size: 0.8rem;
  }
  .breadcrumb-nav .breadcrumb-item {
    word-break: break-all;
  }
  .breadcrumb-nav .breadcrumb-item.active .breadcrumb-current {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* 单篇：元信息、上一篇下一篇 */
@media (max-width: 767.98px) {
  .entry-meta {
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
  }
  .entry-title.section-title {
    font-size: 1.15rem;
    word-break: break-word;
  }
  .post-navigation {
    padding-top: 0.85rem !important;
    padding-bottom: 0.85rem !important;
  }
  .post-navigation .row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .post-navigation .col-md-6 {
    text-align: left !important;
    max-width: 100%;
  }
  .post-navigation .col-md-6 a {
    white-space: normal;
    min-height: 44px;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }
}

/* 正文内容：小屏浮动清除、表格横向滚动、代码块 */
@media (max-width: 767.98px) {
  .entry-content {
    font-size: 0.95rem;
    word-break: break-word;
  }
  .entry-content h1 { font-size: 1.35rem; }
  .entry-content h2 { font-size: 1.2rem; }
  .entry-content h3 { font-size: 1.1rem; }
  .entry-content h4, .entry-content h5, .entry-content h6 { font-size: 1rem; }
  .entry-content .alignleft,
  .entry-content .alignright {
    float: none;
    display: block;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0.75em;
  }
  .entry-content .alignleft img,
  .entry-content .alignright img {
    width: 100%;
    max-width: 100%;
  }
  .entry-content-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.15em;
  }
  .entry-content table {
    min-width: 100%;
  }
  .entry-content th, .entry-content td {
    padding: 0.4em 0.5em;
    font-size: 0.9rem;
  }
  .entry-content pre, .entry-content pre code {
    padding: 0.75em;
    font-size: 0.8rem;
    margin-bottom: 1em;
  }
  .entry-content blockquote {
    padding: 0.6em 0.85em 0.6em 1em;
    margin: 1.25em 0;
  }
}

/* 分页 */
@media (max-width: 575.98px) {
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
  }
  .pagination .page-link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
  }
}
.navigation.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.navigation.pagination .nav-links a,
.navigation.pagination .nav-links .current {
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 评论区域 */
@media (max-width: 767.98px) {
  .comments-area {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
  }
  .comment-list .children {
    padding-left: 1rem;
  }
  .comment-list .children .comment-body {
    padding-left: 0.75rem;
  }
  .comment-meta .avatar {
    width: 36px;
    height: 36px;
  }
  .comment-form input[type="text"],
  .comment-form input[type="email"],
  .comment-form input[type="url"],
  .comment-form textarea {
    font-size: 16px; /* 避免 iOS 缩放 */
    padding: 0.6rem 0.75rem;
  }
  .comment-form .submit {
    min-height: 44px;
    padding: 0.6rem 1.5rem;
  }
}

/* 页脚 */
@media (max-width: 767.98px) {
  footer.border-top {
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
  }
  .footer-nav {
    gap: 0.35rem 0.75rem;
  }
  .footer-links a {
    margin: 0 0.35rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* 搜索表单 */
@media (max-width: 575.98px) {
  .search-form.d-flex {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .search-form input[type="search"],
  .search-form .form-control {
    max-width: none !important;
    min-height: 44px;
    font-size: 16px;
  }
  .search-form .btn {
    min-height: 44px;
  }
}

/* 404 / 单栏按钮 */
@media (max-width: 575.98px) {
  .btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }
}

/* 安全区域（刘海屏/底部横条） */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  footer.border-top {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important;
  }
}
