/*!
 * 「墨韵」— 博客主题
 * 修复Pico CSS优先级问题，使用更高优先级选择器
 */

/* ============================================
   一、强制覆盖Pico CSS变量（最高优先级）
   ============================================ */
:root[data-theme="customize"] {
  --pico-primary: #1A1A2E;
  --pico-background-color: #FAFAF7;
  --pico-color: #1A1A2E;
  --pico-line-height: 1.85;
  --pico-font-size: 112.5%;
  --pico-font-family: 'Inter', 'Noto Sans SC', 'PingFang SC', system-ui, sans-serif;
  --pico-spacing: 1rem;
  --pico-box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  --pico-text-selection-color: rgba(232, 69, 60, 0.2);
}

/* ============================================
   二、全局基础 — 强制覆盖
   ============================================ */
:root[data-theme="customize"] body,
:root[data-theme="customize"] body {
  background-color: #FAFAF7 !important;
  color: #1A1A2E !important;
  font-family: 'Inter', 'Noto Sans SC', 'PingFang SC', system-ui, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

:root[data-theme="customize"] ::selection {
  background: #E8453C !important;
  color: #fff !important;
}

/* ============================================
   三、导航栏
   ============================================ */
:root[data-theme="customize"] .site-navbar {
  background: #1A1A2E !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

:root[data-theme="customize"] .site-navbar nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

:root[data-theme="customize"] .site-navbar .brand {
  font-family: 'Georgia', 'Noto Serif SC', serif !important;
  font-size: 1.3rem !important;
  font-weight: 700 !important;
  color: #fff !important;
  letter-spacing: 0.02em;
}

:root[data-theme="customize"] .site-navbar .desc {
  color: rgba(255, 255, 255, 0.35) !important;
  font-size: 0.8rem !important;
}

:root[data-theme="customize"] .site-navbar a,
:root[data-theme="customize"] .site-navbar .nav-toggler-btn {
  color: rgba(255, 255, 255, 0.75) !important;
  transition: color 0.3s ease;
}

:root[data-theme="customize"] .site-navbar a:hover,
:root[data-theme="customize"] .site-navbar .nav-toggler-btn:hover {
  color: #fff !important;
}

:root[data-theme="customize"] .site-navbar .nav-menu a.active {
  color: #E8453C !important;
  font-weight: 500;
}

/* ============================================
   四、主内容区
   ============================================ */
:root[data-theme="customize"] main.container {
  padding-top: 3rem;
  padding-bottom: 5rem;
  min-height: 60vh;
}

:root[data-theme="customize"] .container-thin {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.2rem;
}

/* ============================================
   五、文章卡片
   ============================================ */
:root[data-theme="customize"] article.post {
  background: #fff !important;
  border-radius: 12px;
  padding: 3rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="customize"] article.post::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #E8453C 0%, #1A1A2E 50%, transparent 100%);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="customize"] article.post:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-2px);
  border-color: rgba(0, 0, 0, 0.15);
}

:root[data-theme="customize"] article.post:hover::before {
  opacity: 1;
  transform: scaleX(1);
}

/* ============================================
   六、文章标题
   ============================================ */
:root[data-theme="customize"] .entry-header {
  margin-bottom: 2rem;
  text-align: center;
}

:root[data-theme="customize"] .entry-title {
  font-family: 'Georgia', 'Noto Serif SC', serif !important;
  font-size: clamp(2rem, 5vw, 3.2rem) !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  margin: 0 0 1rem 0 !important;
  letter-spacing: -0.03em !important;
  color: #1A1A2E !important;
}

:root[data-theme="customize"] .entry-title a {
  color: inherit !important;
  text-decoration: none !important;
  background-image: linear-gradient(#E8453C, #E8453C);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 2px;
  transition: background-size 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: 2px;
}

:root[data-theme="customize"] .entry-title a:hover {
  background-size: 100% 2px;
  color: #1A1A2E !important;
}

/* ============================================
   七、文章元信息
   ============================================ */
:root[data-theme="customize"] .entry-meta {
  list-style: none !important;
  display: flex !important;
  justify-content: center !important;
  gap: 1.5rem !important;
  flex-wrap: wrap !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 0.8rem !important;
  color: #9A9AAE !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase;
}

:root[data-theme="customize"] .entry-meta li {
  display: flex !important;
  align-items: center !important;
  gap: 0.35rem;
}

:root[data-theme="customize"] .entry-meta a {
  color: #5A5A6E !important;
  text-decoration: none !important;
  transition: color 0.3s ease;
}

:root[data-theme="customize"] .entry-meta a:hover {
  color: #E8453C !important;
}

/* ============================================
   八、文章内容 — 极致排版
   ============================================ */
:root[data-theme="customize"] .entry-content {
  font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif !important;
  font-size: 1rem !important;
  line-height: 1.85 !important;
  color: #1A1A2E !important;
  letter-spacing: 0.015em;
  word-break: break-word;
}

:root[data-theme="customize"] .entry-content p {
  margin: 0 0 1.6rem 0 !important;
}

/* 链接 */
:root[data-theme="customize"] .entry-content a {
  color: #1A1A2E !important;
  text-decoration: none !important;
  background-image: linear-gradient(#E8453C, #E8453C);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 100% 1px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="customize"] .entry-content a:hover {
  background-size: 100% 2px !important;
  color: #E8453C !important;
}

/* 图片 */
:root[data-theme="customize"] .entry-content img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: 8px !important;
  margin: 1.5rem 0 !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
}

/* 引用块 */
:root[data-theme="customize"] .entry-content blockquote {
  border-left: none !important;
  margin: 2rem -2rem !important;
  padding: 1.5rem 2rem !important;
  background: linear-gradient(135deg, rgba(232, 69, 60, 0.04) 0%, rgba(26, 26, 46, 0.02) 100%) !important;
  border-radius: 12px !important;
  font-style: italic !important;
  color: #5A5A6E !important;
  position: relative;
}

:root[data-theme="customize"] .entry-content blockquote::before {
  content: '\201C';
  position: absolute;
  top: -0.15em;
  left: 0.3em;
  font-family: 'Georgia', serif;
  font-size: 3.5rem;
  font-weight: 700;
  color: #E8453C;
  opacity: 0.2;
  line-height: 1;
}

:root[data-theme="customize"] .entry-content blockquote p {
  margin: 0 !important;
  padding-left: 1.5rem;
}

:root[data-theme="customize"] .entry-content blockquote p:last-child {
  margin-bottom: 0 !important;
}

/* 代码 */
:root[data-theme="customize"] .entry-content code {
  background: rgba(26, 26, 46, 0.05) !important;
  padding: 0.15em 0.4em !important;
  border-radius: 4px !important;
  font-size: 0.88em !important;
  color: #E8453C !important;
  font-family: 'SF Mono', 'JetBrains Mono', monospace !important;
}

:root[data-theme="customize"] .entry-content pre {
  background: #1A1A2E !important;
  color: #E8E6E3 !important;
  padding: 1.5rem 2rem !important;
  border-radius: 12px !important;
  overflow-x: auto !important;
  font-size: 0.88rem !important;
  line-height: 1.75 !important;
  margin: 2rem 0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
}

:root[data-theme="customize"] .entry-content pre code {
  background: transparent !important;
  padding: 0 !important;
  color: inherit !important;
}

/* 标题 */
:root[data-theme="customize"] .entry-content h2,
:root[data-theme="customize"] .entry-content h3,
:root[data-theme="customize"] .entry-content h4 {
  font-family: 'Georgia', 'Noto Serif SC', serif !important;
  margin-top: 2.5rem !important;
  margin-bottom: 1rem !important;
  font-weight: 700 !important;
  color: #1A1A2E !important;
  letter-spacing: -0.02em !important;
  line-height: 1.3 !important;
}

:root[data-theme="customize"] .entry-content h2 {
  font-size: 1.4rem !important;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

:root[data-theme="customize"] .entry-content h3 {
  font-size: 1.15rem !important;
}

:root[data-theme="customize"] .entry-content hr {
  border: none !important;
  height: 1px !important;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.12), transparent) !important;
  margin: 3rem 0 !important;
}

/* 列表 */
:root[data-theme="customize"] .entry-content ul,
:root[data-theme="customize"] .entry-content ol {
  padding-left: 1.2rem !important;
  margin: 1rem 0 !important;
}

:root[data-theme="customize"] .entry-content li {
  margin-bottom: 0.5rem !important;
}

:root[data-theme="customize"] .entry-content li::marker {
  color: #E8453C !important;
}

/* 表格 */
:root[data-theme="customize"] .entry-content table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 1.5rem 0 !important;
  font-size: 0.9rem !important;
}

:root[data-theme="customize"] .entry-content th {
  background: #F5F3EE !important;
  font-weight: 600 !important;
  text-align: left !important;
  padding: 0.7rem 1rem !important;
  border-bottom: 2px solid rgba(0, 0, 0, 0.06) !important;
  font-size: 0.8rem !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5A5A6E !important;
}

:root[data-theme="customize"] .entry-content td {
  padding: 0.65rem 1rem !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

:root[data-theme="customize"] .entry-content tr:hover td {
  background: #F5F3EE !important;
}

/* ============================================
   九、文章分割线
   ============================================ */
:root[data-theme="customize"] hr.post-separator {
  display: none !important;
}

/* ============================================
   十、分页导航
   ============================================ */
:root[data-theme="customize"] nav ul {
  justify-content: center !important;
  gap: 0.4rem !important;
  margin-top: 2rem !important;
  list-style: none !important;
}

:root[data-theme="customize"] nav ul li a {
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  border-radius: 8px !important;
  padding: 0.55rem 1.1rem !important;
  color: #5A5A6E !important;
  text-decoration: none !important;
  font-size: 0.9rem !important;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="customize"] nav ul li a:hover {
  background: #1A1A2E !important;
  color: #fff !important;
  border-color: #1A1A2E !important;
  box-shadow: 0 4px 12px rgba(26, 26, 46, 0.2) !important;
  transform: translateY(-1px);
}

/* ============================================
   十一、文章导航 (上一篇/下一篇)
   ============================================ */
:root[data-theme="customize"] .post-nav {
  margin: 2rem 0;
}

:root[data-theme="customize"] .post-nav ul.page-navigator {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 1rem !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

:root[data-theme="customize"] .post-nav ul.page-navigator li {
  flex: none !important;
}

:root[data-theme="customize"] .post-nav ul.page-navigator li a {
  display: flex !important;
  flex-direction: column !important;
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  border-radius: 12px !important;
  padding: 1rem 1.5rem !important;
  text-decoration: none !important;
  color: #5A5A6E !important;
  font-size: 0.9rem !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  height: 100% !important;
}

:root[data-theme="customize"] .post-nav ul.page-navigator li a:hover {
  border-color: #1A1A2E !important;
  color: #1A1A2E !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
  transform: translateY(-2px);
}

:root[data-theme="customize"] .post-nav ul.page-navigator .prev {
  text-align: left !important;
}

:root[data-theme="customize"] .post-nav ul.page-navigator .next {
  text-align: right !important;
}

:root[data-theme="customize"] .post-nav ul.page-navigator .next a {
  align-items: flex-end !important;
  text-align: right !important;
}

/* ============================================
   十二、评论区域
   ============================================ */
:root[data-theme="customize"] #comments {
  margin-top: 2rem !important;
  background: #fff !important;
  border-radius: 12px !important;
  padding: 3rem !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
}

:root[data-theme="customize"] #comments h2 {
  font-family: 'Georgia', 'Noto Serif SC', serif !important;
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  margin-bottom: 2rem !important;
  padding-bottom: 1rem !important;
  border-bottom: 2px solid rgba(0, 0, 0, 0.06) !important;
  color: #1A1A2E !important;
}

:root[data-theme="customize"] .comment-list li {
  padding: 1.5rem 0 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

:root[data-theme="customize"] .comment-list li:last-child {
  border-bottom: none !important;
}

:root[data-theme="customize"] .comment-meta {
  display: flex !important;
  align-items: center !important;
  gap: 0.8rem !important;
  margin-bottom: 0.8rem !important;
}

:root[data-theme="customize"] .comment-meta img {
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  border: 2px solid #F5F3EE !important;
}

:root[data-theme="customize"] .comment-author {
  font-weight: 600 !important;
  color: #1A1A2E !important;
  font-size: 0.9rem !important;
}

:root[data-theme="customize"] .comment-date {
  font-size: 0.8rem !important;
  color: #9A9AAE !important;
}

:root[data-theme="customize"] .comment-body {
  color: #5A5A6E !important;
  line-height: 1.85 !important;
  font-size: 0.9rem !important;
  padding-left: 3.2rem !important;
}

/* 评论表单 */
:root[data-theme="customize"] .respond {
  margin-top: 2rem !important;
  padding-top: 2rem !important;
  border-top: 2px solid rgba(0, 0, 0, 0.06) !important;
}

:root[data-theme="customize"] .respond h5 {
  font-family: 'Georgia', 'Noto Serif SC', serif !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  margin-bottom: 1rem !important;
  color: #1A1A2E !important;
}

:root[data-theme="customize"] .respond .grid {
  display: grid !important;
  gap: 0.8rem !important;
  margin-bottom: 1rem !important;
}

:root[data-theme="customize"] .respond textarea,
:root[data-theme="customize"] .respond input[type="text"],
:root[data-theme="customize"] .respond input[type="email"],
:root[data-theme="customize"] .respond input[type="url"] {
  width: 100% !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 8px !important;
  padding: 0.85rem 1.1rem !important;
  font-size: 1rem !important;
  color: #1A1A2E !important;
  background: #F5F3EE !important;
  transition: all 0.3s ease !important;
  font-family: 'Inter', system-ui, sans-serif !important;
}

:root[data-theme="customize"] .respond textarea:focus,
:root[data-theme="customize"] .respond input[type="text"]:focus,
:root[data-theme="customize"] .respond input[type="email"]:focus,
:root[data-theme="customize"] .respond input[type="url"]:focus {
  border-color: #1A1A2E !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.08) !important;
  background: #fff !important;
}

:root[data-theme="customize"] .respond textarea {
  min-height: 140px !important;
  resize: vertical !important;
  line-height: 1.7 !important;
}

:root[data-theme="customize"] .respond button[type="submit"] {
  background: #1A1A2E !important;
  color: #fff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 0.85rem 2.5rem !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  margin-top: 0.5rem !important;
}

:root[data-theme="customize"] .respond button[type="submit"]:hover {
  background: #E8453C !important;
  box-shadow: 0 4px 16px rgba(232, 69, 60, 0.25) !important;
  transform: translateY(-1px);
}

:root[data-theme="customize"] .cancel-comment-reply a {
  color: #9A9AAE !important;
  text-decoration: none !important;
  font-size: 0.8rem !important;
  transition: color 0.3s ease;
}

:root[data-theme="customize"] .cancel-comment-reply a:hover {
  color: #E8453C !important;
}

/* ============================================
   十三、搜索页面
   ============================================ */
:root[data-theme="customize"] h1.text-center {
  font-family: 'Georgia', 'Noto Serif SC', serif !important;
  font-size: clamp(1.8rem, 4vw, 2.5rem) !important;
  font-weight: 700 !important;
  color: #1A1A2E !important;
  margin-bottom: 2rem !important;
  letter-spacing: -0.02em !important;
}

:root[data-theme="customize"] .container-thin > input[type="search"],
:root[data-theme="customize"] .container-thin > form > input[type="search"] {
  width: 100% !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 12px !important;
  padding: 1rem 1.4rem !important;
  font-size: 1rem !important;
  color: #1A1A2E !important;
  background: #fff !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

:root[data-theme="customize"] .container-thin > input[type="search"]:focus,
:root[data-theme="customize"] .container-thin > form > input[type="search"]:focus {
  border-color: #1A1A2E !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.08), 0 4px 16px rgba(0, 0, 0, 0.06) !important;
}

/* ============================================
   十四、标签/分类列表
   ============================================ */
:root[data-theme="customize"] .list-inline {
  list-style: none !important;
  padding: 0 !important;
  margin: 1.5rem 0 !important;
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 0.5rem !important;
}

:root[data-theme="customize"] .list-inline li {
  display: inline-block !important;
}

:root[data-theme="customize"] .list-inline li a {
  display: inline-block !important;
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  border-radius: 20px !important;
  padding: 0.35rem 1rem !important;
  font-size: 0.8rem !important;
  color: #5A5A6E !important;
  text-decoration: none !important;
  transition: all 0.3s ease !important;
}

:root[data-theme="customize"] .list-inline li a:hover {
  background: #1A1A2E !important;
  color: #fff !important;
  border-color: #1A1A2E !important;
  transform: translateY(-1px);
}

/* ============================================
   十五、页脚
   ============================================ */
:root[data-theme="customize"] .site-footer {
  background: #fff !important;
  border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
  padding: 2.5rem 0 !important;
  font-size: 0.8rem !important;
  color: #9A9AAE !important;
}

:root[data-theme="customize"] .site-footer .d-flex {
  max-width: 680px !important;
  margin: 0 auto !important;
  padding: 0 1.2rem !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 0.8rem !important;
}

:root[data-theme="customize"] .site-footer a {
  color: #5A5A6E !important;
  text-decoration: none !important;
  transition: color 0.3s ease;
  position: relative;
}

:root[data-theme="customize"] .site-footer a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: #E8453C;
  transition: width 0.3s ease;
}

:root[data-theme="customize"] .site-footer a:hover {
  color: #E8453C !important;
}

:root[data-theme="customize"] .site-footer a:hover::after {
  width: 100%;
}

/* ============================================
   十六、搜索高亮
   ============================================ */
:root[data-theme="customize"] mark {
  background: rgba(232, 69, 60, 0.1) !important;
  color: #E8453C !important;
  padding: 0.1rem 0.35rem !important;
  border-radius: 3px !important;
  font-weight: 500 !important;
}

/* ============================================
   十七、响应式
   ============================================ */
@media (max-width: 768px) {
  :root[data-theme="customize"] .entry-title {
    font-size: clamp(1.6rem, 6vw, 2.2rem) !important;
  }

  :root[data-theme="customize"] article.post {
    padding: 2rem 1.5rem !important;
    margin-bottom: 1rem !important;
    border-radius: 10px !important;
  }

  :root[data-theme="customize"] .entry-meta {
    gap: 0.8rem !important;
  }

  :root[data-theme="customize"] .entry-content blockquote {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 1rem 1.5rem !important;
  }

  :root[data-theme="customize"] #comments {
    padding: 2rem 1.5rem !important;
  }

  :root[data-theme="customize"] .post-nav ul.page-navigator {
    grid-template-columns: 1fr !important;
  }

  :root[data-theme="customize"] .site-footer .d-flex {
    flex-direction: column !important;
    text-align: center !important;
  }
}

@media (max-width: 480px) {
  :root[data-theme="customize"] main.container {
    padding-top: 2rem !important;
  }

  :root[data-theme="customize"] article.post {
    padding: 1.5rem 1rem !important;
  }

  :root[data-theme="customize"] #comments {
    padding: 1.5rem 1rem !important;
  }
}

/* ============================================
   十八、打印
   ============================================ */
@media print {
  :root[data-theme="customize"] .site-navbar,
  :root[data-theme="customize"] .site-footer,
  :root[data-theme="customize"] .post-nav,
  :root[data-theme="customize"] #comments {
    display: none !important;
  }

  :root[data-theme="customize"] article.post {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  :root[data-theme="customize"] body {
    background: #fff !important;
    color: #000 !important;
  }

  :root[data-theme="customize"] .entry-content a {
    color: #000 !important;
    text-decoration: underline !important;
  }
}
