/* ============ 基础与变量 ============ */
:root {
  --bg: #faf7f2;
  --bg-soft: #f3ede3;
  --ink: #2b2620;
  --ink-soft: #5c5347;
  --muted: #8a7f70;
  --accent: #8b4513;
  --accent-dark: #6b3410;
  --accent-soft: #c89968;
  --gold: #b8860b;
  --card: #ffffff;
  --border: #e6ddd0;
  --shadow-sm: 0 2px 8px rgba(60, 40, 20, 0.06);
  --shadow-md: 0 10px 30px rgba(60, 40, 20, 0.10);
  --shadow-lg: 0 20px 50px rgba(60, 40, 20, 0.16);
  --radius: 14px;
  --radius-lg: 20px;
  --serif: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  --sans: 'Noto Sans SC', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ============ 顶部导航 ============ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250, 247, 242, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap { display: flex; align-items: center; gap: 28px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; font-size: 20px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #fff; display: grid; place-items: center; font-size: 20px;
  box-shadow: var(--shadow-sm);
}
.logo-text { letter-spacing: 1px; }
.main-nav { display: flex; gap: 8px; flex: 1; }
.nav-link {
  padding: 8px 14px; border-radius: 999px; font-size: 15px; color: var(--ink-soft);
  transition: all .2s ease;
}
.nav-link:hover { background: var(--bg-soft); color: var(--ink); }
.search-box { display: flex; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 4px 4px 4px 16px; width: 280px; transition: border-color .2s, box-shadow .2s; }
.search-box:focus-within { border-color: var(--accent-soft); box-shadow: 0 0 0 4px rgba(200, 153, 104, .15); }
.search-box input { border: none; outline: none; background: transparent; flex: 1; font-size: 14px; color: var(--ink); }
.search-btn { border: none; background: var(--accent); color: #fff; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; transition: background .2s; }
.search-btn:hover { background: var(--accent-dark); }

/* ============ Hero ============ */
.hero { position: relative; overflow: hidden; padding: 72px 0 80px; background:
  radial-gradient(1000px 500px at 80% -10%, rgba(184,134,11,.12), transparent 60%),
  radial-gradient(800px 400px at -10% 10%, rgba(139,69,19,.10), transparent 60%),
  var(--bg);
}
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.hero-eyebrow { color: var(--accent); font-weight: 600; letter-spacing: 3px; font-size: 13px; margin: 0 0 14px; }
.hero-title { font-family: var(--serif); font-weight: 900; font-size: clamp(34px, 5vw, 58px); line-height: 1.2; margin: 0 0 18px; }
.hero-sub { color: var(--ink-soft); font-size: 17px; margin: 0 0 30px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 38px; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 13px 26px; border-radius: 999px; font-size: 15px; font-weight: 500; transition: all .2s ease; border: 1px solid transparent; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; box-shadow: 0 8px 20px rgba(139,69,19,.28); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(139,69,19,.34); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: #fff; border-color: var(--accent-soft); }
.hero-stats { display: flex; gap: 36px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat strong { font-family: var(--serif); font-size: 30px; color: var(--accent); line-height: 1; }
.stat span { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* 漂浮书本插画 */
.hero-art { display: grid; place-items: center; min-height: 360px; }
.book-stack { position: relative; width: 320px; height: 360px; }
.floating-book {
  position: absolute; border-radius: 6px 12px 12px 6px;
  box-shadow: var(--shadow-lg), inset -3px 0 6px rgba(0,0,0,.12);
}
.floating-book::before {
  content: ''; position: absolute; left: 8px; right: 14px; top: 8px; bottom: 8px;
  border-left: 2px solid rgba(255,255,255,.35); border-radius: 2px;
}
.book-1 { width: 150px; height: 210px; background: linear-gradient(135deg,#8b4513,#5a2d0c); top: 30px; left: 30px; transform: rotate(-12deg); animation: float1 6s ease-in-out infinite; }
.book-2 { width: 140px; height: 195px; background: linear-gradient(135deg,#2f5d3a,#1c3a24); top: 90px; left: 120px; transform: rotate(6deg); animation: float2 7s ease-in-out infinite; }
.book-3 { width: 130px; height: 180px; background: linear-gradient(135deg,#b8860b,#7a5a07); top: 150px; left: 60px; transform: rotate(-4deg); animation: float3 5.5s ease-in-out infinite; }
.book-4 { width: 120px; height: 170px; background: linear-gradient(135deg,#4a5568,#2d3748); top: 60px; right: 10px; transform: rotate(10deg); animation: float2 6.5s ease-in-out infinite; }
@keyframes float1 { 0%,100% { transform: rotate(-12deg) translateY(0); } 50% { transform: rotate(-10deg) translateY(-14px); } }
@keyframes float2 { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }
@keyframes float3 { 0%,100% { transform: rotate(-4deg) translateY(0); } 50% { transform: rotate(-6deg) translateY(-10px); } }

/* ============ 通用区块 ============ */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-soft); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 44px; }
.section-title { font-family: var(--serif); font-size: clamp(26px, 3.4vw, 38px); font-weight: 700; margin: 0 0 10px; }
.section-desc { color: var(--muted); font-size: 15px; margin: 0; }

/* ============ 精选卡片 ============ */
.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.featured-card {
  display: grid; grid-template-columns: 110px 1fr; gap: 18px;
  background: var(--card); border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  transition: transform .25s ease, box-shadow .25s ease; cursor: pointer;
}
.featured-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.cover {
  width: 110px; height: 155px; border-radius: 6px 8px 8px 6px;
  box-shadow: var(--shadow-md), inset -2px 0 5px rgba(0,0,0,.15);
  display: flex; flex-direction: column; justify-content: space-between; padding: 12px 10px;
  color: #fff; position: relative; overflow: hidden;
}
.cover::after { content:''; position:absolute; left:0; top:0; bottom:0; width:6px; background: rgba(0,0,0,.25); }
.cover .cv-title { font-family: var(--serif); font-weight: 700; font-size: 15px; line-height: 1.25; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.cover .cv-author { font-size: 11px; opacity: .9; }
.featured-info h3 { font-family: var(--serif); font-size: 19px; margin: 4px 0 4px; }
.featured-info .author { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.featured-info .rating { color: var(--gold); font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.featured-info .desc { color: var(--ink-soft); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 10px; }
.tag { display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--bg-soft); color: var(--ink-soft); }

/* ============ 分类标签 ============ */
.category-tabs { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.cat-chip {
  padding: 10px 22px; border-radius: 999px; background: #fff; border: 1px solid var(--border);
  font-size: 14px; color: var(--ink-soft); transition: all .2s; display: inline-flex; align-items: center; gap: 8px;
}
.cat-chip:hover { border-color: var(--accent-soft); color: var(--ink); }
.cat-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 6px 16px rgba(139,69,19,.25); }
.cat-chip .count { font-size: 11px; opacity: .8; background: rgba(0,0,0,.12); padding: 1px 7px; border-radius: 999px; }
.cat-chip.active .count { background: rgba(255,255,255,.22); }

/* ============ 书库工具栏 ============ */
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chips .cat-chip { padding: 7px 16px; font-size: 13px; }
.sort-wrap { display: flex; align-items: center; gap: 10px; }
.sort-label { font-size: 13px; color: var(--muted); }
.sort-select {
  border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 8px 14px;
  font-size: 13px; color: var(--ink); outline: none; cursor: pointer;
}
.sort-select:focus { border-color: var(--accent-soft); }

/* ============ 图书网格 ============ */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px; }
.book-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  transition: transform .25s ease, box-shadow .25s ease; cursor: pointer;
  display: flex; flex-direction: column;
}
.book-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.book-card .cover { width: 100%; height: 230px; border-radius: 0; }
.book-card .cover .cv-title { font-size: 17px; }
.book-meta { padding: 14px 16px 18px; flex: 1; display: flex; flex-direction: column; }
.book-meta h4 { font-family: var(--serif); font-size: 17px; margin: 0 0 4px; line-height: 1.3; }
.book-meta .bm-author { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.book-meta .bm-rating { color: var(--gold); font-size: 13px; font-weight: 600; margin-top: auto; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ============ 关于 ============ */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; }
.about-copy .section-title { text-align: left; }
.about-copy p { color: var(--ink-soft); font-size: 15px; margin: 0 0 14px; }
.about-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.about-tags span { padding: 7px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-size: 13px; color: var(--ink-soft); }
.about-card {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff; border-radius: var(--radius-lg); padding: 40px; box-shadow: var(--shadow-lg);
}
.about-card blockquote { font-family: var(--serif); font-size: 20px; line-height: 1.6; margin: 0 0 16px; font-weight: 500; }
.about-card cite { font-style: normal; font-size: 14px; opacity: .85; }

/* ============ 页脚 ============ */
.site-footer { background: #2b2620; color: #d6cdbf; padding: 44px 0; }
.footer-inner { text-align: center; }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 20px; color: #fff; margin-bottom: 8px; }
.footer-brand .logo-mark { background: linear-gradient(135deg, var(--accent-soft), var(--gold)); }
.footer-tag { font-size: 14px; opacity: .8; margin: 4px 0; }
.footer-copy { font-size: 12px; opacity: .55; margin: 8px 0 0; }

/* ============ 弹窗 ============ */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(20, 15, 10, .55); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; background: var(--card); border-radius: var(--radius-lg);
  max-width: 720px; width: 100%; max-height: 88vh; overflow: auto;
  box-shadow: var(--shadow-lg); animation: pop .25s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 14px; right: 16px; width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--bg-soft); color: var(--ink); font-size: 22px; line-height: 1;
  display: grid; place-items: center; z-index: 2;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 36px; }
.modal-top { display: grid; grid-template-columns: 150px 1fr; gap: 26px; margin-bottom: 24px; }
.modal-body .cover { width: 150px; height: 210px; }
.modal-title { font-family: var(--serif); font-size: 28px; margin: 4px 0 6px; line-height: 1.25; }
.modal-author { color: var(--muted); font-size: 15px; margin: 0 0 14px; }
.modal-rating { color: var(--gold); font-weight: 600; margin-bottom: 14px; }
.modal-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.modal-info { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 20px; background: var(--bg-soft); padding: 14px 18px; border-radius: var(--radius); font-size: 13px; }
.modal-info div span { color: var(--muted); margin-right: 6px; }
.modal-section h5 { font-family: var(--serif); font-size: 16px; margin: 22px 0 8px; }
.modal-section p { font-size: 14px; color: var(--ink-soft); margin: 0 0 8px; }

/* ============ 响应式 ============ */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { min-height: 280px; order: -1; }
  .featured-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .main-nav { display: none; }
}
@media (max-width: 600px) {
  .search-box { width: 100%; }
  .nav-wrap { flex-wrap: wrap; height: auto; padding: 12px 0; gap: 12px; }
  .modal-top { grid-template-columns: 1fr; }
  .modal-body { padding: 24px 18px; }
  .modal-info { grid-template-columns: 1fr; }
}
