/* =====================
   Fonts（必须最先）
   ===================== */

@font-face {
  font-family: "BookSerif";
  src: url("fonts/SourceHanSerifSC-Regular.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* =====================
   桌面 / 全局
   ===================== */

body {
  margin: 0;
  padding: clamp(28px, 6vw, 72px);
  background: #f6f6f6; /* 桌面灰，不是纸 */
  color: #111;

  /* ⚠️ 真正生效的宋体方案 */
  font-family:
    "BookSerif",
    "Noto Serif SC",
    "STSong",
    serif;
}

/* =====================
   分类区块（桌面）
   ===================== */

section {
  margin-bottom: 120px;
}

h2 {
  font-size: 18px;
  font-weight: normal;
  margin: 0 0 36px;
}

/* =====================
   书架（桌面：网格）
   ===================== */

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 64px 56px;
}

/* =====================
   单本书
   ===================== */

.book {
  text-decoration: none;
  color: inherit;
}

/* =====================
   封面（电子书 · 印刷感）
   ===================== */

.cover {
  position: relative;
  width: 100%;

  /* A5 比例 */
  aspect-ratio: 148 / 210;

  overflow: hidden;
  border-radius: 3px;

  box-shadow:
    0 6px 12px rgba(0,0,0,0.22),
    0 1px 3px rgba(0,0,0,0.12);

  transition:
    transform .25s ease,
    box-shadow .25s ease;
}

/* ===== 左侧假书脊（压痕） ===== */

.cover::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;

  background: linear-gradient(
    to right,
    rgba(0,0,0,0.30),
    rgba(0,0,0,0.14),
    rgba(0,0,0,0.02)
  );

  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;

  z-index: 2;
  pointer-events: none;
}

/* ===== 彩印封面高光（极轻） ===== */

.cover::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 22%;

  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.18),
    rgba(255,255,255,0)
  );

  z-index: 3;
  pointer-events: none;
}

/* ===== 封面图片 ===== */

.cover img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* 图片自带白边 = 纸 */
  display: block;
  background: transparent;
}

/* =====================
   hover（桌面）
   ===================== */

.book:hover .cover {
  transform: translateY(-2px);
  box-shadow:
    0 30px 60px rgba(0,0,0,0.30),
    0 8px 18px rgba(0,0,0,0.16);
}

/* =====================
   文字信息（桌面）
   ===================== */

.meta {
  margin-top: 24px; /* 拉开阴影，画面更干净 */
  font-size: 13px;
  color: #666;
}

.date {
  margin-top: 4px;
  font-size: 12px;
  color: #999;
}

.title {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.75;
}

/* =========================================================
   手机端：横向书架 · 一屏两本 · 更小更安静
   ========================================================= */

@media (max-width: 768px) {

  body {
    padding: 20px 16px 40px;
  }

  /* 分类之间距离收紧 */
  section {
    margin-bottom: 56px;
  }

  h2 {
    margin-bottom: 18px;
    font-size: 16px;
  }

  /* 横向滑动书架 */
  .shelf {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 6px;

    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  /* 一屏两本，但再小一档 */
  .book {
    flex: 0 0 auto;
    width: calc((100vw - 48px) / 2);
    scroll-snap-align: start;
  }

  /* 手机端文字整体压一档 */
  .meta {
    margin-top: 20px;
    font-size: 11px;
  }

  .date {
    font-size: 10px;
  }

  .title {
    font-size: 13px;
    line-height: 1.55;
  }
}

@media (max-width: 768px) {

  .cover {
    box-shadow:
      0 4px 8px rgba(0,0,0,0.14),
      0 1px 2px rgba(0,0,0,0.08);
  }

}
