/*
Theme Name: 本质视界
Author: ziyuan
Description: 仿 1230.la 版式：热门排行、文章合集、热门标签、随便看看，珊瑚红主色
Version: 2.6
Text Domain: ziyuan
*/

/* ============ 全局 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --main: #ff5e52;   /* 珊瑚红主色 */
  --base: #333;
  --bg: #f3f3f3;
  --line: #f3f3f3;
  --gray: #999;
  --desc: #666;
  --white: #fff;
  --radius: 6px;
}

body {
  font-family: "Microsoft Yahei", "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--base);
  background: var(--bg);
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ============ 顶栏 ============ */
.header { background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.header-top {
  display: flex; align-items: center; height: 54px; gap: 18px;
  border-bottom: 1px solid var(--line);
}
.logo { font-size: 22px; font-weight: 700; color: var(--main); letter-spacing: 1px; white-space: nowrap; }
.slogan { font-size: 13px; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-form {
  margin-left: auto; display: flex; border: 1px solid var(--line);
  border-radius: 20px; overflow: hidden;
}
.search-form input { border: none; outline: none; padding: 5px 12px; width: 130px; font-size: 12px; }
.search-form button {
  border: none; background: var(--main); color: #fff; padding: 0 14px;
  cursor: pointer; font-size: 12px; transition: background 0.2s ease;
}
.search-form button:hover { background: #e04a3f; }

.nav { display: flex; align-items: center; height: 44px; }
.nav > li { position: relative; }
.nav > li > a {
  display: block; padding: 0 18px; line-height: 44px; font-size: 15px;
  color: var(--base); transition: color 0.2s ease;
}
.nav > li > a:hover, .nav > li > a.active { color: var(--main); }
.nav .sub {
  display: none; position: absolute; top: 44px; left: 0; background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.12); border-radius: 0 0 var(--radius) var(--radius);
  min-width: 120px; z-index: 30;
}
.nav li:hover .sub { display: block; }
.nav .sub a {
  display: block; padding: 9px 18px; font-size: 13px; color: var(--base);
  transition: color 0.2s ease, background 0.2s ease;
}
.nav .sub a:hover { color: var(--main); background: #fbfbfb; }

/* ============ 布局 ============ */
.wrap { display: flex; gap: 20px; padding: 20px 0 40px; align-items: flex-start; }
.main { flex: 1; min-width: 0; }
.sidebar { width: 300px; flex-shrink: 0; }

/* ============ 通用卡片 ============ */
.panel {
  position: relative; overflow: hidden; background: var(--white);
  padding: 22px 28px; border-radius: var(--radius); margin-bottom: 10px;
}
.panel-title {
  font-size: 16px; font-weight: 700; margin-bottom: 16px;
  padding-left: 10px; border-left: 3px solid var(--main);
}
.panel-title.no-margin { margin-bottom: 0; }

/* ============ 热门排行 ============ */
.most li {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin: 7px 0; position: relative; padding-left: 26px;
}
.most .label {
  width: 16px; height: 16px; line-height: 16px; font-size: 11px; text-align: center;
  position: absolute; top: 3px; left: 0; border-radius: 5px; color: #fff; background: var(--gray);
}
.most .label-1 { background: #ff5e52; }
.most .label-2 { background: #7fd75a; }
.most .label-3 { background: #60c4fd; }
.most a { color: var(--base); transition: color 0.2s ease; }
.most a:hover { color: var(--main); }
.most .like { float: right; font-size: 12px; color: #bbb; }

/* ============ 文章卡片 ============ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.excerpt {
  position: relative; overflow: hidden; background: var(--white);
  padding: 22px 28px; border-radius: var(--radius); margin-bottom: 10px;
  animation: fadeUp 0.4s ease both; transition: box-shadow 0.2s ease;
}
.excerpt:hover { box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.excerpt header { margin-bottom: 12px; overflow: hidden; }
.cat {
  position: relative; top: -2px; display: inline-block; margin-right: 15px;
  border-radius: var(--radius); padding: 3px 8px; color: #fff;
  background: var(--main); font-size: 12px;
}
.cat::after {
  content: ""; position: absolute; right: -5px; top: 50%; margin-top: -4px;
  width: 0; height: 0; border-top: 4px solid transparent;
  border-bottom: 4px solid transparent; border-left: 5px solid var(--main);
}
.excerpt h2 { display: inline; font-size: 20px; font-weight: 700; }
.excerpt h2 a { transition: color 0.2s ease; }
.excerpt h2 a:hover { color: var(--main); }
.desc { color: var(--desc); font-size: 15px; margin-bottom: 13px; line-height: 1.68; }
.info { clear: both; overflow: hidden; height: 22px; color: var(--gray); font-size: 13px; }
.info .post-views { float: left; }
.info .like-btn {
  float: right; color: var(--gray); cursor: pointer; font-size: 13px;
  font-family: inherit; transition: color 0.2s ease;
}
.info .like-btn:hover, .info .like-btn.liked { color: var(--main); }

/* ============ 图文列表（缩略图在左，仿 1230.la） ============ */
.excerpt-one { display: flex; align-items: flex-start; }
.excerpt-one .focus {
  flex-shrink: 0; width: 200px; height: 150px; margin-right: 20px;
  border-radius: var(--radius); overflow: hidden; background: #ffe9e6;
  display: flex; align-items: center; justify-content: center;
}
.excerpt-one .thumb { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.excerpt-one .focus:hover .thumb { transform: scale(1.05); }
.excerpt-one .thumb.noimg { width: auto; height: auto; font-size: 42px; }
.excerpt-one .excerpt-main { flex: 1; min-width: 0; }
.excerpt-one header { margin-bottom: 10px; }
.excerpt-one h2 { font-size: 17px; line-height: 1.5; }
.excerpt-one .desc {
  font-size: 14px; line-height: 1.7; margin-bottom: 12px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}

/* ============ 分页 ============ */
.pagination { margin-top: 24px; text-align: center; }
.pagination .nav-links { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pagination .page-numbers {
  display: inline-block; padding: 6px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; font-size: 14px; transition: all 0.2s ease;
}
.pagination .page-numbers.current { background: var(--main); border-color: var(--main); color: #fff; }
.pagination a.page-numbers:hover { border-color: var(--main); color: var(--main); }

/* 省略号可点击 */
.pagination .page-numbers.dots { cursor: pointer; }
.pagination .page-numbers.dots:hover { color: var(--main); border-color: var(--main); }

/* 分页跳转 */
.page-jump {
  margin-top: 14px; text-align: center; color: var(--gray); font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.page-jump input {
  width: 64px; padding: 5px 8px; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 13px; text-align: center; outline: none;
}
.page-jump input:focus { border-color: var(--main); }
.page-jump input::-webkit-outer-spin-button,
.page-jump input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.page-jump input { -moz-appearance: textfield; }
.page-jump button {
  border: none; background: var(--main); color: #fff; padding: 5px 14px;
  border-radius: var(--radius); cursor: pointer; font-size: 13px; transition: background 0.2s ease;
}
.page-jump button:hover { background: #e04a3f; }

/* ============ 侧栏 ============ */
.widget { background: var(--white); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 10px; }
.widget-title {
  font-size: 16px; font-weight: 700; margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line); position: relative;
}
.widget-title::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 34px; height: 2px; background: var(--main); }

/* 热门标签 */
.tags { overflow: hidden; margin: -5px -5px 0 0; }
.tags a { float: left; width: 33.333%; padding: 6px 5px; }
.tags a span {
  display: block; text-align: center; background: var(--bg); padding: 7px 4px;
  border-radius: var(--radius); color: #777; font-size: 13px;
  overflow: hidden; white-space: nowrap; height: 33px; transition: all 0.2s ease;
}
.tags a:hover span { color: #fff; background: var(--main); }

/* 随便看看 */
.rand a {
  display: block; border-bottom: 1px solid var(--line); padding: 10px 0;
  position: relative; min-height: 82px; padding-right: 92px; overflow: hidden;
}
.rand li:last-child a { border-bottom: none; }
.rand a.noimg { padding-right: 0; min-height: 0; }
.rand .thumb {
  position: absolute; right: 0; top: 10px; width: 80px; height: 62px;
  border-radius: 4px; overflow: hidden; background: #ffe9e6;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.rand .thumb img { width: 100%; height: 100%; object-fit: cover; }
.rand .text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; font-size: 14px; color: var(--base); transition: color 0.2s ease;
}
.rand a:hover .text { color: var(--main); }
.rand .info { font-size: 12px; color: var(--gray); margin-top: 6px; }

/* 友情链接 */
.links ul { list-style: none; margin: 0; padding: 0; }
.links li { display: inline-block; margin: 0 12px 8px 0; }
.links a { font-size: 13px; color: #777; transition: color 0.2s ease; display: inline-block; padding: 4px 0; position: relative; z-index: 2; }
.links a:hover { color: var(--main); }

/* ============ 文章详情 ============ */
.detail { background: var(--white); border-radius: var(--radius); padding: 28px 30px; animation: fadeUp 0.4s ease both; }
.detail .cat { margin-bottom: 12px; }
.detail-title { font-size: 24px; margin-bottom: 8px; }
.detail-meta { font-size: 13px; color: var(--gray); margin-bottom: 20px; }
.detail-content { font-size: 16px; line-height: 1.8; }
.detail-content p { margin: 0 0 16px; }
.detail-content h2, .detail-content h3, .detail-content h4 { margin: 24px 0 12px; line-height: 1.4; }
.detail-content h2 { font-size: 22px; }
.detail-content h3 { font-size: 19px; }
.detail-content img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 12px 0; }
.detail-content a { color: var(--main); }
.detail-content a:hover { text-decoration: underline; }
.detail-content blockquote {
  border-left: 3px solid var(--main); background: #fafafa; margin: 16px 0;
  padding: 12px 16px; color: var(--gray);
}
.detail-content ul, .detail-content ol { margin: 0 0 16px 24px; }
.detail-content code { background: #f0f1f3; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.detail-content pre { background: #333; color: #e5e7eb; padding: 16px; border-radius: var(--radius); overflow-x: auto; margin: 16px 0; }
.detail-content pre code { background: none; color: inherit; }

.back-link { display: inline-block; margin-top: 20px; font-size: 14px; color: var(--gray); transition: color 0.2s ease; }
.back-link:hover { color: var(--main); }
.empty { text-align: center; color: var(--gray); padding: 60px 0; }

/* ============ 页脚 ============ */
.footer {
  text-align: center; padding: 24px 20px; color: var(--gray); font-size: 12px;
  letter-spacing: 1px; background: var(--white); border-top: 1px solid var(--line);
}

/* ============ 手机适配 ============ */
@media (max-width: 820px) {
  .container { padding: 0 12px; }
  /* 手机端 main 与 sidebar 改为块级垂直堆叠，绕开旧浏览器 flex gap/column 兼容问题 */
  .wrap { display: block; padding: 12px 0 30px; }
  .main { width: 100%; }
  .sidebar { width: 100%; margin-top: 12px; }
  .slogan { display: none; }

  /* 顶栏：logo 一行，搜索框下方占满一行（始终可见） */
  .header-top { height: auto; padding: 10px 0; flex-wrap: wrap; }
  .logo { font-size: 19px; }
  .search-form { width: 100%; margin-left: 0; margin-top: 8px; }
  .search-form input { flex: 1; width: auto; min-width: 0; font-size: 13px; }

  /* 导航：横向滑动；子菜单用 fixed 浮层下拉（跟随点击位置），不平铺 */
  .nav { height: 44px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; align-items: center; }
  .nav::-webkit-scrollbar { display: none; }
  .nav > li { flex-shrink: 0; }
  .nav > li > a { padding: 0 14px; line-height: 44px; font-size: 14px; white-space: nowrap; }
  .nav .sub { position: fixed; top: 0; left: 0; background: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.18); border-radius: 8px; min-width: 130px; padding: 4px 0; z-index: 200; }
  .nav .sub a { display: block; padding: 10px 16px; font-size: 14px; white-space: nowrap; }
  .nav li:hover .sub { display: none; }

  /* 卡片与面板收紧内边距 */
  .panel { padding: 16px 14px; }
  .excerpt { padding: 16px 14px; }
  .excerpt-one .focus { width: 100px; height: 75px; margin-right: 12px; }
  .excerpt-one h2, .excerpt h2 { font-size: 16px; }
  .desc { font-size: 14px; }

  /* 侧栏 widget 收紧 */
  .widget { padding: 16px 14px; }

  /* 文章详情页 */
  .detail { padding: 18px 16px; }
  .detail-title { font-size: 20px; }
  .detail-content { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ===== 修复文章内容里长链接/长文本在手机上溢出 ===== */
.detail-content {
    word-break: break-all;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
.detail-content a {
    word-break: break-all;
    overflow-wrap: anywhere;
}

/* ============ 分享按钮 ============ */
.share-box{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:10px;margin:18px 0 0;padding:14px 16px;background:#f6f8fa;border-radius:8px;}
.share-box .share-label{font-size:14px;color:#666;margin-right:2px;}
.share-box .share-btn{display:inline-flex;align-items:center;justify-content:center;padding:7px 16px;border-radius:6px;font-size:14px;color:#fff;text-decoration:none;cursor:pointer;border:none;font-family:inherit;line-height:1;transition:opacity .15s;}
.share-box .share-btn:hover{opacity:.85;}
.share-wechat{background:#07c160;}
.share-weibo{background:#e6162d;}
.share-qzone{background:#f4a62a;}
.share-copy{background:#6c757d;}
.share-qr-mask{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:9999;}
.share-qr-panel{background:#fff;border-radius:10px;padding:20px 24px;text-align:center;max-width:280px;}
.share-qr-panel img{width:180px;height:180px;display:block;margin:0 auto 10px;}
.share-qr-panel p{font-size:13px;color:#666;margin:0 0 12px;}
.share-qr-panel .qr-actions{display:flex;gap:10px;justify-content:center;}
.share-qr-panel .qr-actions button{border:none;padding:8px 16px;border-radius:6px;font-size:14px;cursor:pointer;font-family:inherit;}
.qr-copy{background:#07c160;color:#fff;}
.qr-close{background:#eee;color:#333;}

/* ===== 文章详情页专用蓝色赞按钮（仅 single 页） ===== */
.detail-info { height: auto; text-align: center; }
.detail-info .like-btn {
  display: inline-block; float: none; margin: 0 auto;
  padding: 9px 34px; background: #1976d2; color: #fff;
  border-radius: 6px; cursor: pointer; font-size: 14px;
  font-family: inherit; transition: background 0.2s ease;
}
.detail-info .like-btn:hover, .detail-info .like-btn.liked { background: #1565c0; }
