/**
 * Theme Name: xiaopiblog
 * Theme URL: http://www.ouxiaopi.com
 * Description: 长期支援版本。
 * Author: Xiao Pi Ou
 * Author URI: http://www.ouxiaopi.com
 * Version: 2.1 (重构版)
 */

/* ==================== 1. 全局重置与基础样式 ==================== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  color: rgba(0, 0, 0, 0.7);
  font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Open Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background-color: #f1f1f1;
  transition: opacity 0.3s ease;
}

/* 基础元素重置 */
body, input, button, textarea {
  -webkit-appearance: none;
  border-radius: 0;
  letter-spacing: 0.04em;
}

a {
  color: #333;
  text-decoration: none;
  position: relative;
  transition: color 0.2s ease;
}

a:hover {
  color: #1f1f1f;
}

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

ul, ol {
  list-style: none;
}

p {
  margin: 0 0 1em;
  color: #666;
}

strong, b {
  font-weight: bold;
}

em, i {
  font-style: italic;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* 清除浮动 */
.clearer {
  display: block;
  clear: both;
}

/* 容器 */
.container {
  padding: 10px 80px 0;
  max-width: 1200px;
  margin: 0 auto;
}

.left { float: left; }
.right { float: right; }

/* ==================== 2. 布局结构 ==================== */

#main {
  background: #fff;
  box-shadow: 0 3px 6px rgba(236, 236, 236, 0.86);
  width: 1024px;
  margin: 30px auto 0;
  border-radius: 10px;
  overflow: hidden;
}

/* ==================== 3. 页头 Header - 全新结构 ==================== */

#header {
  width: 100%;
  padding: 50px 80px 80px;
}

/* 新的头部容器 */
.header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background-color: #f3f3f3;
    border-radius: 35px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 1024px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* 左侧：网站标识（Logo + 描述） */
.site-branding {
  flex: 0 0 20%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.site-branding .logo-circle {
  width: 40px;
  height: 40px;
  background-color: #e5e7eb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.site-branding .logo-circle .iconfont {
  color: #9c27b0;
  font-size: 24px;
}

.site-title {
  font-size: 18px;
  font-weight: bold;
  color: #5f5f5f;
  margin: 0;
}

.site-description {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

/* ==================== 中间：主导航 - 响应式单行 + 动态下划线 ==================== */

.main-navigation {
  flex: 0 0 40%;
  display: flex;
  justify-content: center;
}

.main-navigation .menu {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap; /* 禁止换行 */
  width: 100%;
  justify-content: center;
}

.main-navigation .menu a {
  color: #5f5f5f;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  transition: color 0.2s ease, font-size 0.3s ease;
  position: relative;
  /* 响应式字体：从 15px 到 13px 平滑缩放 */
  font-size: clamp(13px, 2.5vw, 15px);
}

/* 悬停时显示下划线（滑入效果） */
.main-navigation .menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: currentColor;
  transform: translateY(4px); /* 初始位置在下方 */
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 悬停时：下划线滑入 */
.main-navigation .menu a:hover::after {
  transform: translateY(0);
  opacity: 1;
}

/* 当前页面菜单项：始终显示下划线 */
.main-navigation .menu .current-menu-item > a::after,
.main-navigation .menu .current_page_item > a::after {
  transform: translateY(0);
  opacity: 1;
}

/* 右侧：社交图标 + 作者信息 */
.social-links {
  flex: 0 0 20%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.social-links .social-icons {
  display: flex;
  gap: 12px;
  font-size: 16px;
}

.social-links .social-icons a {
  color: #5f5f5f;
  transition: color 0.2s ease;
}

.social-links .social-icons a:hover {
  color: #000;
}

.social-links .author-bio {
  font-size: 13px;
  color: #888;
  text-align: right;
  white-space: nowrap;
}

/* ==================== 4. 响应式断点 ==================== */

/* 平板 (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .header-wrapper {
    padding: 40px 60px 120px;
    gap: 15px;
  }
  .site-branding { flex: 0 0 22%; }
  .main-navigation { flex: 0 0 56%; }
  .social-links { flex: 0 0 22%; }

  .site-title { font-size: 16px; }
  .site-description, .author-bio { font-size: 12px; }
  .main-navigation .menu a { font-size: 14px; padding: 4px 8px; gap: 15px; }
  .social-links .social-icons a { font-size: 14px; }
  .site-branding .logo-circle { width: 36px; height: 36px; }
  .site-branding .logo-circle .iconfont { font-size: 20px; }
}

/* 手机 (< 768px) */
@media (max-width: 767px) {
  .header-wrapper {
    padding: 30px 20px 100px;
    border-radius: 20px;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .site-branding {
    width: 100%;
    align-items: center;
    margin-bottom: 20px;
  }

  .site-description {
    display: none;
  }

  .main-navigation {
    width: 100%;
    margin-bottom: 20px;
  }

  .main-navigation .menu {
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .main-navigation .menu a {
    font-size: 14px;
    padding: 4px 6px;
  }

  .social-links {
    display: none;
  }
}

/* 极小屏幕 */
@media (max-width: 480px) {
  .header-wrapper { padding: 20px 15px 80px; }
  .main-navigation .menu a { font-size: 13px; padding: 3px 5px; }
  .site-branding .logo-circle { width: 32px; height: 32px; }
  .site-branding .logo-circle .iconfont { font-size: 18px; }
}

/* ==================== 5. 文章列表与内容样式 ==================== */

.post-list {
  margin: 0 0 5%;
}

.post-list h2.title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #1f1f1f;
  padding-bottom: 16px;
  letter-spacing: 1px;
}

h2.title a {
  color: #1f1f1f;
  text-decoration: none;
}

.p_time,
.p_time a {
  font-size: 12px;
  color: #bbbbbb;
  padding-top: 20px;
}

.post-list p {
  color: #666;
  line-height: 1.9em;
  letter-spacing: 0.2px;
}

.post-list.post {
  border-bottom: 1px solid #f1f1f1;
  padding: 10px 0 40px;
}

/* 单篇文章 */
.single {
  padding-top: 20px;
}

.single h1, .single h2, .single h3, .single h4 {
  margin: 1.5em 0 1em;
  line-height: 1.4;
}

.single h1 { font-size: 24px; }
.single h2 { font-size: 20px; }
.single h3 {
  font-weight: bold;
  color: #000;
  font-size: 18px;
  position: relative;
}
.single h3::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 0.6em;
  background-color: #9333ea;
  opacity: 0.3;
  z-index: -1;
  border-radius: 2px;
}
.single h4 { font-size: 16px; }

/* 引用块 */
.single blockquote {
  padding: 20px;
  border-radius: 5px;
  background-color: #fafafa;
  font-size: 14px;
  margin: 20px 0;
  background-image: linear-gradient(135deg, transparent 43%, #f3f3f3 44%, #f3f3f3 54%, transparent 55%);
  background-size: 6px 6px;
}

/* 列表 */
.single ol, .single ul {
  margin: 10px 0;
  padding-left: 20px;
}
.single ol li { list-style: decimal; }
.single ul li { list-style: square; }

/* 链接高亮 */
.single a {
  box-shadow: inset 0 -2px 0 #fcdae9;
  transition: all 0.35s cubic-bezier(0.7, 0, 0.3, 1);
  color: #424242;
}
.single a:hover {
  box-shadow: inset 0 -25px 0 #fcdae9;
}

/* 代码样式 */
.single code {
  padding: 2px 4px;
  background: #fafafa;
  border-radius: 3px;
}
.single pre {
  margin: 20px 1%;
  padding: 17px;
  border: 1px solid #eee;
  background: #f8f8f8;
  font: 14px/22px 'Courier New', monospace;
  border-radius: 4px;
  overflow: auto;
  white-space: pre-wrap;
}
.single pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* ==================== 6. 其他组件 ==================== */

/* 赏赐按钮 */
.reward {
  position: absolute;
  left: 66px;
  top: 14px;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 100px;
  background: #fccd60;
  border: 1px solid #f1b60e;
  color: #fff;
  cursor: pointer;
}
.reward ul {
  display: none;
  position: absolute;
  top: -60px;
  right: -280px;
  width: 260px;
  height: 150px;
  padding: 6px;
  background: #fff;
  border: 1px solid #e6e6e6;
  box-shadow: 0 1px 1px 1px #efefef;
  z-index: 1;
}
.reward:hover ul {
  display: block;
}

/* 返回顶部 */
#gotop {
  position: fixed;
  bottom: 25px;
  right: 10%;
  width: 41px;
  height: 41px;
  background: #fff;
  border-radius: 50px;
  text-align: center;
  line-height: 41px;
  font-size: 25px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  z-index: 100;
}
#gotop:hover { color: #ccc; }

@media (max-width: 1200px) {
  #gotop { display: none; }
}

/* 分割线 */
.vanhua-fengexian {
  height: 6px;
  background: linear-gradient(135deg, transparent 43%, #c3c3c3 44%, #c3c3c3 54%, transparent 55%);
  background-size: 6px 6px;
}

/* 字体图标 */
@font-face {
  font-family: 'iconfont';
  src: url('//at.alicdn.com/t/c/font_1338101_3ed9tby669t.woff2') format('woff2'),
       url('//at.alicdn.com/t/c/font_1338101_3ed9tby669t.woff') format('woff'),
       url('//at.alicdn.com/t/c/font_1338101_3ed9tby669t.ttf') format('truetype');
}

.iconfont {
  font-family: "iconfont" !important;
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 视频自适应 */
.van-video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}
.van-video iframe,
.van-video object,
.van-video embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ==================== 7. 页脚 Footer ==================== */

#footer {
  color: #ccc;
  padding: 20px 0;
  text-align: center;
  font-size: 12px;
}
#footer a {
  color: #a6a6a6;
  margin: 0 5px;
}
#footer a:hover {
  color: #1f1f1f;
}
#footer .heart {
  font-family: kaiti;
  font-size: 24px;
  color: #444;
  font-weight: bold;
}

/* ==================== 8. 动画与加载 ==================== */

@keyframes ball-beat {
  50% { opacity: 0; transform: scale(0.75); }
  100% { opacity: 1; transform: scale(1); }
}

.is-loading div,
.load .load_comments div {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 5px;
  background: #1f1f1f;
  animation: ball-beat 0.7s infinite linear;
}
.is-loading div:nth-child(odd) {
  animation-delay: 0.35s;
}

.load body {
  opacity: 0.3;
}

.load:before {
  content: "";
  position: fixed;
  top: 0;
  left: -100%;
  width: 100%;
  height: 1px;
  background: #1f1f1f;
  animation: load 1s 0.1s ease-in-out infinite;
}

@keyframes load {
  to { left: 100%; }
}

/* ==================== 9. 滚动条样式 ==================== */

::-webkit-scrollbar {
  width: 10px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #e8ecef;
}
::-webkit-scrollbar-thumb {
  background: #999;
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b3b3b;
}

/* ==================== 10. 选择高亮 ==================== */

::selection {
  background: #87d283;
}
::-moz-selection {
  background: #50be4b;
}