/* ============================================================
   书库首页 · books.cdeep.top
   编辑部风格：纸色底、衬线标题、克制的紫与金。
   ============================================================ */

:root {
  color-scheme: light;
  --paper:       #f7f5f0;
  --paper-soft:  #efece5;
  --card:        #fffdf9;
  --ink:         #1c1a24;
  --ink-2:       #4a4558;
  --ink-3:       #7a7488;
  --line:        #e4dfd6;
  --line-strong: #d3cdc1;
  --accent:      #5b21b6;
  --accent-ink:  #4c1d95;
  --btn-bg:      #5b21b6;
  --btn-bg-hover:#4c1d95;
  --btn-ink:     #ffffff;
  --gold:        #a16207;
  --shadow:      0 1px 2px rgba(28, 26, 36, .05),
                 0 18px 40px -22px rgba(28, 26, 36, .35);
  --shadow-lift: 0 2px 4px rgba(28, 26, 36, .06),
                 0 30px 60px -24px rgba(28, 26, 36, .45);
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC",
           "STSong", "SimSun", Georgia, "Times New Roman", serif;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC",
          "WenQuanYi Zen Hei", system-ui, -apple-system, sans-serif;
  --radius: 22px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper:       #121116;
    --paper-soft:  #17161c;
    --card:        #1b1a21;
    --ink:         #f1eee8;
    --ink-2:       #c8c2b8;
    --ink-3:       #928c86;
    --line:        #2c2a32;
    --line-strong: #3b3843;
    --accent:      #a78bfa;
    --accent-ink:  #c4b5fd;
    --btn-bg:      #a78bfa;
    --btn-bg-hover:#c4b5fd;
    --btn-ink:     #191322;
    --gold:        #e0a458;
    --shadow:      0 1px 2px rgba(0, 0, 0, .35),
                   0 18px 40px -22px rgba(0, 0, 0, .8);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .4),
                   0 30px 60px -24px rgba(0, 0, 0, .9);
  }
  ::selection { color: #191322; }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  background:
    radial-gradient(1100px 620px at 82% -10%, rgba(91, 33, 182, .09), transparent 60%),
    radial-gradient(900px 520px at 8% 8%, rgba(161, 98, 7, .06), transparent 58%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; }

img { display: block; max-width: 100%; }

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: top .2s ease;
}
.skip:focus { top: 16px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- 页眉 ---------- */

.masthead {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 26px clamp(20px, 4vw, 36px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--accent);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: none;
  filter: drop-shadow(0 6px 12px rgba(91, 33, 182, .28));
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.12rem;
  letter-spacing: .04em;
  color: var(--ink);
}
.brand-name em {
  font-style: normal;
  color: var(--ink-3);
  margin-left: .25em;
  font-size: .92em;
}

.nav { display: flex; gap: 22px; }
.nav a {
  font-size: .92rem;
  color: var(--ink-2);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.nav a:hover { color: var(--accent); border-color: currentColor; }

/* ---------- 主视觉 ---------- */

main { width: min(1180px, 100%); margin: 0 auto; padding: 0 clamp(20px, 4vw, 36px); }

.hero {
  padding: clamp(48px, 8vw, 96px) 0 clamp(36px, 5vw, 56px);
  max-width: 900px;
}

.eyebrow {
  margin: 0 0 22px;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.05rem, 5.2vw, 3.9rem);
  line-height: 1.22;
  letter-spacing: .01em;
  text-wrap: balance;
}

.lede {
  margin: 26px 0 0;
  max-width: 64ch;
  font-size: clamp(1rem, 1.5vw, 1.08rem);
  line-height: 1.95;
  color: var(--ink-2);
}

/* ---------- 书目 ---------- */

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr));
  gap: clamp(22px, 3vw, 30px);
  padding: 8px 0 clamp(64px, 8vw, 96px);
  align-items: stretch;
}

.book {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}
.book:hover {
  transform: translateY(-5px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
}

.book-cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0f0e13;
}
.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}
.book:hover .book-cover img { transform: scale(1.035); }

.book-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 9, 14, .18) 0%, transparent 34%, transparent 72%, rgba(10, 9, 14, .22) 100%);
  pointer-events: none;
}

.cover-tag {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  color: #fff;
  background: rgba(14, 13, 19, .58);
  border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.book-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: clamp(22px, 3vw, 30px);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  font-size: .78rem;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.meta-row span + span::before {
  content: "·";
  margin-right: 10px;
  color: var(--line-strong);
}

.book h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.1vw, 1.6rem);
  line-height: 1.35;
  letter-spacing: .01em;
}
.book h2 a { text-decoration: none; transition: color .18s ease; }
.book h2 a:hover { color: var(--accent); }

.book-sub {
  margin: 8px 0 0;
  font-size: .92rem;
  letter-spacing: .06em;
  color: var(--gold);
}

.book-desc {
  margin: 16px 0 0;
  font-size: .94rem;
  line-height: 1.9;
  color: var(--ink-2);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.btn:hover {
  border-color: var(--ink-3);
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  color: var(--btn-ink);
}
.btn-primary:hover {
  background: var(--btn-bg-hover);
  border-color: var(--btn-bg-hover);
  color: var(--btn-ink);
}

/* 待续书目 */

.book-upcoming {
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 190px;
  background: transparent;
  border-style: dashed;
  border-color: var(--line-strong);
  box-shadow: none;
}
.book-upcoming:hover { transform: none; box-shadow: none; border-color: var(--line-strong); }

.upcoming-inner {
  padding: 30px;
  text-align: center;
  color: var(--ink-3);
}
.upcoming-inner .plus {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--line-strong);
  margin-bottom: 14px;
}
.upcoming-inner h2 {
  color: var(--ink-2);
  font-size: 1.2rem;
}
.upcoming-inner p { margin: 10px 0 0; font-size: .9rem; }

/* ---------- 页脚 ---------- */

.footer {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px clamp(20px, 4vw, 36px) 46px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: .85rem;
  color: var(--ink-3);
}
.footer p { margin: 0; }
.footer a {
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}
.footer a:hover { color: var(--accent); border-color: currentColor; }
.footer-note { letter-spacing: .02em; }

/* ---------- 小屏 ---------- */

@media (max-width: 560px) {
  .masthead { padding-top: 20px; }
  .brand-name em { display: none; }
  .hero { padding-top: 36px; }
  .book-body { padding: 20px; }
  .actions { padding-top: 20px; }
  .btn { flex: 1 1 auto; justify-content: center; }
  .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
