/* ------------------------------------
 * Bento Grid System (Modernized) + Typecho Theme
 * @update  2024
 * --------------------------------- */

/* ------------------
 * 1. Bento Grid 基础 (保留您提供的逻辑)
 * --------------- */
.container, .row > [class*="col-"] {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
.container {
  margin-left: auto;
  margin-right: auto;
  padding-left: 15px;
  padding-right: 15px;
  max-width: 1160px; /* 加宽容器，更大气 */
}
.row {
  margin-right: -15px;
  margin-left: -15px;
}
.row > [class*="col-"] {
  float: left;
  min-height: 1px;
  padding-right: 15px;
  padding-left: 15px;
}
.row:after {
  content: "";
  display: table;
  clear: both;
}

/* 响应式栅格 */
@media (min-width: 768px) {
  .col-tb-1 { width: 8.33333%; } .col-tb-2 { width: 16.66667%; } .col-tb-3 { width: 25%; }
  .col-tb-4 { width: 33.33333%; } .col-tb-5 { width: 41.66667%; } .col-tb-6 { width: 50%; }
  .col-tb-7 { width: 58.33333%; } .col-tb-8 { width: 66.66667%; } .col-tb-9 { width: 75%; }
  .col-tb-10 { width: 83.33333%; } .col-tb-11 { width: 91.66667%; } .col-tb-12 { width: 100%; }
}
@media (min-width: 992px) {
  .col-1 { width: 8.33333%; } .col-2 { width: 16.66667%; } .col-3 { width: 25%; }
  .col-4 { width: 33.33333%; } .col-5 { width: 41.66667%; } .col-6 { width: 50%; }
  .col-7 { width: 58.33333%; } .col-8 { width: 66.66667%; } .col-9 { width: 75%; }
  .col-10 { width: 83.33333%; } .col-11 { width: 91.66667%; } .col-12 { width: 100%; }
  
  /* 修复错位：确保主内容和侧边栏完美贴合 */
  .col-8 { width: calc(66.66667% - 15px); } 
  .col-4 { width: calc(33.33333% - 15px); }
}
@media (min-width: 1200px) {
  .container { max-width: 1160px; }
}

/* ------------------
 * 2. 全局现代重置
 * --------------- */
body {
  background-color: #f8fafc; /* 极浅灰底 */
  color: #334155;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

a {
  color: #3b82f6;
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover, a:active { color: #2563eb; }

h1, h2, h3, h4, h5, h6 { font-weight: 600; color: #0f172a; letter-spacing: -0.02em; }

pre, code {
  background: #f1f5f9; font-family: Menlo, Monaco, Consolas, monospace;
  font-size: .9em; border-radius: 6px;
}
code { padding: 2px 6px; color: #ef4444; }
pre { padding: 16px; overflow: auto; border: 1px solid #e2e8f0; }
pre code { padding: 0; color: #334155; background: transparent; }

blockquote {
  margin: 1.5em 0; padding: 12px 20px; border-left: 4px solid #3b82f6;
  background: #eff6ff; color: #475569; border-radius: 0 6px 6px 0;
}
table { border: 1px solid #e2e8f0; width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px 16px; border: 1px solid #e2e8f0; }
table th { background: #f8fafc; font-weight: 600; }

/* 输入框 */
input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea {
  padding: 10px 14px; border: 1px solid #cbd5e1; width: 100%;
  border-radius: 8px; box-sizing: border-box; background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]:focus, textarea:focus {
  outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ------------------
 * 3. Header 头部区域 (修复搜索框错位)
 * --------------- */
#header {
  padding: 30px 0 20px;
  background: #ffffff;
  margin-bottom: 30px;
  border-bottom: 1px solid #e2e8f0;
}
#logo { font-size: 2.2em; font-weight: 800; color: #0f172a; }
.description { margin: .5em 0 0; color: #64748b; font-size: 0.95em; }

/* 导航栏 - 用 flex 取代 float */
#nav-menu {
  margin: 20px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px;
}
#nav-menu a {
  display: inline-block; padding: 0 20px; height: 36px; line-height: 36px;
  color: #475569; border-radius: 18px; transition: all 0.3s ease;
  background: #f1f5f9; border: none;
}
#nav-menu a:hover, #nav-menu .current {
  background: #3b82f6; color: #ffffff; transform: translateY(-1px);
}

/* 搜索框 - 极简完美对齐 */
#search {
  display: flex; align-items: center; background: #ffffff;
  border: 1px solid #cbd5e1; border-radius: 30px; overflow: hidden;
  height: 40px; transition: border-color 0.3s, box-shadow 0.3s;
  margin-top: 15px;
}
#search label { display: none !important; } /* 彻底隐藏“搜索关键字”文字 */
#search input {
  flex: 1; border: none !important; background: transparent !important;
  padding: 0 16px; height: 100%; border-radius: 0; font-size: 14px;
}
#search input:focus { box-shadow: none !important; }
#search button {
  position: static !important; height: 100% !important; padding: 0 24px;
  border: none; background: #3b82f6; color: #fff; cursor: pointer;
  font-size: 14px; font-weight: 500; transition: background 0.3s; white-space: nowrap;
}
#search button:hover { background: #2563eb; }

/* ------------------
 * 4. Main 主内容区 (优雅的卡片)
 * --------------- */
.post {
  padding: 30px; background: #ffffff; border-radius: 12px; margin-bottom: 24px;
  border: 1px solid #e2e8f0; /* 细边框代替重阴影 */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02); /* 极微弱的柔光 */
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s, border-color 0.3s;
}
/* 鼠标悬浮互动 */
.post:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  border-color: #cbd5e1;
}

.post-title { margin: 0 0 12px 0; font-size: 1.5em; line-height: 1.4; }
.post-title a { color: #0f172a; }
.post-title a:hover { color: #3b82f6; }

.post-meta {
  margin: 0 0 16px 0; padding: 0; color: #64748b;
  font-size: .9em; display: flex; flex-wrap: wrap; gap: 16px;
}
.post-meta li { display: inline-block; margin: 0; padding: 0; border-left: none; }
.post-meta li a { color: #64748b; }
.post-meta li a:hover { color: #3b82f6; }

.post-content { line-height: 1.8; color: #334155; }
.post .tags { clear: both; }

.more { text-align: center; margin-top: 20px; }
.more a {
  display: inline-block; padding: 8px 24px; background: #eff6ff; color: #3b82f6;
  border-radius: 20px; transition: all 0.3s;
}
.more a:hover { background: #3b82f6; color: #fff; transform: scale(1.02); }

/* 分页器 */
.page-navigator { list-style: none; margin: 30px 0; padding: 0; text-align: center; }
.page-navigator li { display: inline-block; margin: 0 4px; }
.page-navigator a {
  display: inline-block; padding: 0 16px; height: 36px; line-height: 36px;
  border-radius: 8px; background: #fff; color: #475569;
  border: 1px solid #e2e8f0; transition: all 0.2s;
}
.page-navigator a:hover, .page-navigator .current a {
  background: #3b82f6; color: #fff; border-color: #3b82f6;
}

/* ------------------
 * 5. Secondary 侧边栏 (彻底解决错位和笨重)
 * --------------- */
#secondary { padding-top: 0; }
.widget {
  margin-bottom: 24px; background: #ffffff; padding: 24px;
  border-radius: 12px; border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: transform 0.3s, box-shadow 0.3s;
}
.widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -5px rgba(0, 0, 0, 0.05);
}
.widget-list { list-style: none; padding: 0; }
.widget-list li { margin: 10px 0; line-height: 1.6; }
.widget-list li ul { margin-left: 15px; }

/* ------------------
 * 6. Comments 评论区
 * --------------- */
.comment-list li {
  padding: 20px; margin-top: 16px; border: 1px solid #e2e8f0;
  border-radius: 12px; background: #fff; transition: border-color 0.3s;
}
.comment-list li:hover { border-color: #cbd5e1; }
.comment-list li.comment-by-author { background: #fffbeb; border-color: #fde68a; }
.comment-author .avatar {
  float: left; margin-right: 12px; border-radius: 50%; transition: transform 0.3s;
}
.comment-author .avatar:hover { transform: scale(1.05); }
#comment-form label { display: block; margin-bottom: 8px; font-weight: 500; color: #1e293b; }
#comment-form .required:after { content: " *"; color: #ef4444; }

/* ------------------
 * 7. Footer 底部
 * --------------- */
#footer {
  padding: 3em 0; text-align: center; color: #94a3b8;
  font-size: 0.9em; border-top: 1px solid #e2e8f0; margin-top: 40px;
}

/* 图片自适应与美化 */
.post-content img { max-width: 100%; border-radius: 8px; transition: transform 0.3s; }
.post-content img:hover { transform: scale(1.01); }
.post-content hr { margin: 2em auto; width: 80px; border: 2px solid #e2e8f0; border-width: 2px 0 0 0; }

/* ------------------
 * 8. 响应式适配
 * --------------- */
@media (max-width: 768px) {
  #header, .post-title, .post-meta { text-align: center; }
  #nav-menu { justify-content: center; }
  .post-meta { justify-content: center; }
  .comment-author .avatar { float: none; display: block; margin: 0 auto 10px; }
  .col-8, .col-4 { width: 100% !important; margin-left: 0 !important; } /* 移动端取消双栏 */
}