/* ============================================================
   Books 电子书主题 · 清新卡片风
   ============================================================ */

:root {
  --bg: #f3f6f4;
  --card: #ffffff;
  --ink: #1f2d3d;
  --muted: #8a97a3;
  --line: #e6ebe8;
  --accent: #0aa06e;
  --accent-dark: #08855a;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(31, 45, 61, 0.06);
  --shadow-hover: 0 8px 22px rgba(31, 45, 61, 0.12);
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
}

.site-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.site-title a:hover { color: var(--accent); }

.site-nav { flex: 1; }

.site-nav ul { list-style: none; display: flex; gap: 6px; }

.site-nav li a {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 15px;
}

.site-nav li a:hover,
.site-nav li a.on {
  background: rgba(10, 160, 110, 0.1);
  color: var(--accent);
}

.search-form {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 4px 2px 14px;
  flex-shrink: 0;
}

.search-form input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 150px;
  font-size: 14px;
  color: var(--ink);
}

.search-form button {
  border: 0;
  background: var(--accent);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-form button:hover { background: var(--accent-dark); }

.nav-toggle {
  display: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

/* ---------- 精选轮播 ---------- */
.hero { margin: 20px auto 8px; }

.hero-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: 16px;
  scrollbar-width: none;
  box-shadow: var(--shadow);
}

.hero-track::-webkit-scrollbar { display: none; }

.hero-slide {
  position: relative;
  flex: 0 0 100%;
  min-height: 300px;
  background: linear-gradient(115deg, #0e2a22 0%, #123a2e 45%, #1c5c46 100%);
  scroll-snap-align: start;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-blur {
  position: absolute;
  inset: -36px;
  background: center / cover no-repeat;
  filter: blur(26px) brightness(0.95) saturate(1.3);
  transform: scale(1.12);
}

.hero-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 22, 17, 0.72) 0%, rgba(8, 22, 17, 0.32) 52%, rgba(8, 22, 17, 0.08) 78%);
}

.hero-cover {
  position: absolute;
  right: 6%;
  bottom: 0;
  height: 86%;
  width: auto;
  object-fit: cover;
  border-radius: 10px 10px 0 0;
  box-shadow: -10px 4px 30px rgba(0, 0, 0, 0.45);
}

.hero-slide .chip {
  position: absolute;
  top: 18px;
  left: 22px;
}

.hero-text {
  position: relative;
  padding: 26px 28px;
  color: #fff;
  max-width: 62%;
}

.hero-title {
  display: block;
  font-size: 24px;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  margin-bottom: 6px;
}

.hero-desc {
  display: block;
  font-size: 14px;
  opacity: 0.88;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.hero-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5cf;
  cursor: pointer;
  transition: all 0.25s;
}

.hero-dots .dot.on {
  background: var(--accent);
  width: 20px;
  border-radius: 999px;
}

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  margin: 24px auto 40px;
  align-items: start;
}

/* ---------- 分类标签 & 徽章 ---------- */
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.8;
  color: #fff;
  cursor: pointer;
}

.chip:hover { opacity: 0.85; }

.cat-0 { background: #0aa06e; }
.cat-1 { background: #3b82f6; }
.cat-2 { background: #8b5cf6; }
.cat-3 { background: #f59e0b; }
.cat-4 { background: #ef5350; }
.cat-5 { background: #14b8a6; }

.format-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(15, 30, 25, 0.72);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

/* 详情页格式徽章（静态，不悬浮在封面上） */
.format-tag {
  display: inline-block;
  background: rgba(15, 30, 25, 0.72);
  color: #fff;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.chiprow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.dl-hint {
  font-size: 12px;
  color: var(--accent);
  background: rgba(10, 160, 110, 0.1);
  border-radius: 999px;
  padding: 1px 8px;
}

/* ---------- 图书卡片 ---------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 18px;
}

.book-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.book-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--bg);
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-info {
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 6px;
}

.book-title a {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-title a:hover { color: var(--accent); }

.book-intro {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: auto;
}

/* ---------- 列表头 / 空状态 / 分页 ---------- */
.list-head {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px;
  margin-bottom: 18px;
}

.list-head h2 { font-size: 18px; }

.list-head h2 small {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 10px;
}

.empty {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.nf-code {
  font-size: 64px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 4px;
}

.nf-search {
  margin: 18px auto;
  max-width: 320px;
}

.nf-search input { width: auto; flex: 1; }

.nf-search button {
  width: auto;
  border-radius: 999px;
  padding: 0 16px;
  height: 30px;
}

.pagebar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 26px 0 4px;
}

.pagebar .page {
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: var(--card);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.pagebar .page:hover { color: var(--accent); }

.pagebar .now {
  background: var(--accent);
  color: #fff;
}

/* ---------- 侧栏 ---------- */
.sidebar { display: flex; flex-direction: column; gap: 18px; }

.side-mod {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.side-title {
  font-size: 15px;
  font-weight: 600;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  margin-bottom: 10px;
  line-height: 1.4;
}

.side-body { font-size: 14px; }

.side-body ul { list-style: none; }

/* 注意：ZBP 部分模块（网站分类/文章归档/网站收藏等）输出裸 <li>，无 <ul> 包裹 */
.side-body li {
  list-style: none;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}

.side-body li:last-child { border-bottom: 0; }

.side-body a:hover { color: var(--accent); }

.side-body .side-tagcloud a {
  display: inline-block;
  margin: 0 6px 6px 0;
}

/* 侧栏搜索模块（输入框占满整行，按钮叠放其右） */
.side-body form {
  position: relative;
}

.side-body form label {
  display: block;
}

.side-body input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 72px 5px 10px;
  font-size: 13px;
  outline: 0;
  background: var(--bg);
}

.side-body input[type="text"]:focus { border-color: var(--accent); }

.side-body input[type="submit"] {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
}

/* 日历模块 */
.side-body table {
  width: 100%;
  border-collapse: collapse;
}

#tbCalendar caption {
  font-weight: 600;
  text-align: center;
  margin-bottom: 4px;
}

#tbCalendar caption a { color: var(--ink); }

#tbCalendar caption a:hover { color: var(--accent); }

#tbCalendar th,
#tbCalendar td {
  text-align: center;
  padding: 3px 0;
  font-size: 13px;
}

#tbCalendar th {
  color: var(--muted);
  font-weight: 400;
}

#tbCalendar td { color: var(--ink); }

#tbCalendar td a { color: var(--accent); }

/* ---------- 详情页 ---------- */
.book-detail,
.single-page {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.detail-head {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.detail-cover {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.detail-cover img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }

.detail-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
  margin: 8px 0 14px;
}

.detail-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.detail-table th {
  width: 88px;
  text-align: left;
  color: var(--muted);
  font-weight: 400;
  padding: 5px 0;
  vertical-align: top;
}

.detail-table td { padding: 5px 0; }

/* 下载框 */
.dl-box {
  margin-top: 16px;
  background: rgba(10, 160, 110, 0.06);
  border: 1px dashed rgba(10, 160, 110, 0.45);
  border-radius: 10px;
  padding: 16px;
}

.btn-dl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 22px;
  border-radius: 999px;
  transition: background 0.2s;
}

.btn-dl:hover { background: var(--accent-dark); }

.dl-code {
  margin-top: 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dl-code code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--accent-dark);
}

.btn-copy {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  padding: 2px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.btn-copy:hover { background: var(--accent); color: #fff; }

.dl-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.dl-empty {
  color: var(--muted);
  text-align: center;
  background: var(--bg);
  border-color: var(--line);
}

/* 详情正文 */
.detail-content {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  overflow-wrap: break-word;
}

.detail-content h2 {
  font-size: 17px;
  margin-bottom: 12px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  line-height: 1.4;
}

.detail-content p { margin-bottom: 12px; }

.detail-content img { border-radius: 8px; margin: 8px 0; }

.detail-tags { margin-top: 16px; }

.detail-tags .tag {
  display: inline-block;
  font-size: 13px;
  color: var(--accent);
  background: rgba(10, 160, 110, 0.08);
  border-radius: 999px;
  padding: 3px 12px;
  margin: 0 8px 8px 0;
}

.single-page .detail-title {
  margin-top: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

/* ---------- 评论 ---------- */
.comments {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-top: 24px;
}

.comments-title {
  font-size: 16px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  margin-bottom: 14px;
  line-height: 1.4;
}

.msg { list-style: none; margin-bottom: 14px; }

.msgname { font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.msgname .avatar { display: inline-block; vertical-align: middle; border-radius: 50%; margin-right: 6px; }

.msgname .commentname a { color: var(--ink); font-weight: 600; }

.msgname .revertcomment { margin-left: 10px; }

.msgname .revertcomment a { color: var(--accent); }

.msgarticle {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
}

.msg .msg { margin-top: 10px; }

.commentpost { margin-top: 20px; }

.commentpost .posttop { font-size: 14px; margin-bottom: 10px; }

.commentpost p { margin-bottom: 8px; }

.commentpost .text {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: 0;
  background: var(--bg);
}

.commentpost .text:focus { border-color: var(--accent); }

.commentpost textarea.text { resize: vertical; }

.commentpost .button {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  padding: 8px 26px;
  border-radius: 999px;
  cursor: pointer;
}

.commentpost .button:hover { background: var(--accent-dark); }

#cancel-reply { color: var(--accent); margin-left: 10px; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 22px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer p { margin: 2px 0; }

.site-footer a { color: var(--muted); }

.site-footer a:hover { color: var(--accent); }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }

  .detail-head { grid-template-columns: 170px minmax(0, 1fr); gap: 18px; }

  .detail-title { font-size: 20px; }
}

@media (max-width: 640px) {
  .header-inner { gap: 10px; }

  .site-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 10px 16px;
  }

  .site-nav.open { display: block; }

  .site-nav ul { flex-direction: column; gap: 2px; }

  .search-form { flex: 1; }

  .search-form input { width: 100%; min-width: 0; }

  .nav-toggle { display: flex; }

  .site-title { font-size: 19px; }

  .hero-slide { min-height: 220px; }

  .hero-title { font-size: 18px; }

  .hero-text { max-width: 92%; padding: 18px; }

  .hero-cover { display: none; }

  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

  .detail-head { grid-template-columns: minmax(0, 1fr); }

  .detail-cover { max-width: 200px; }

  .book-detail, .single-page, .comments { padding: 16px; }
}
