:root {
  --ink: #0f2744;
  --ink-soft: #1a3a5c;
  --forest: #1f6f5b;
  --forest-deep: #155446;
  --gold: #c4a35a;
  --paper: #f7f4ec;
  --paper-2: #efe8da;
  --line: rgba(15, 39, 68, 0.12);
  --text: #1c2430;
  --muted: #5c6775;
  --font-display: "Fraunces", "Songti SC", "SimSun", serif;
  --font-body: "Manrope", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.main-body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--paper);
}

a { color: inherit; text-decoration: none; }

.fb-shelf {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.fb-shelf-wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

/* ===== Top bar ===== */
.fb-shelf-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0;
}

.fb-shelf-brand {
  display: flex;
  align-items: center;
  opacity: 0.98;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.fb-shelf-brand:hover { opacity: 1; transform: translateY(-1px); }
.fb-shelf-brand img {
  display: block;
  height: 34px;
  width: auto;
}

.fb-shelf-nav {
  display: flex;
  align-items: center;
  gap: 6px 18px;
  color: rgba(247, 242, 232, 0.86);
  font-size: 14px;
  font-weight: 600;
}
.fb-shelf-nav a {
  transition: color 0.2s ease;
}
.fb-shelf-nav a:hover { color: #fff; }
.fb-shelf-nav-cta {
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(196, 163, 90, 0.18);
  color: var(--gold) !important;
  border: 1px solid rgba(196, 163, 90, 0.35);
}
.fb-shelf-nav-cta:hover {
  background: rgba(196, 163, 90, 0.28);
  color: #e0c27a !important;
}

/* ===== Hero ===== */
.fb-shelf-hero {
  position: relative;
  overflow: hidden;
  min-height: min(72vh, 640px);
  display: flex;
  align-items: flex-end;
  padding: 120px 0 72px;
  color: #f7f2e8;
  background:
    radial-gradient(1100px 620px at 14% 20%, rgba(31, 111, 91, 0.34), transparent 55%),
    radial-gradient(900px 480px at 86% 78%, rgba(196, 163, 90, 0.16), transparent 52%),
    linear-gradient(145deg, #0b1d33 0%, #0f2744 42%, #163652 100%);
}

.fb-shelf-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fb-shelf-hero-bg .page {
  position: absolute;
  border-radius: 4px 14px 14px 4px;
  background: linear-gradient(110deg, rgba(243, 239, 230, 0.14), rgba(243, 239, 230, 0.04));
  border: 1px solid rgba(243, 239, 230, 0.14);
  box-shadow: inset 0 0 0 1px rgba(196, 163, 90, 0.08);
  transform-origin: left center;
  animation: fbPageFloat 8s ease-in-out infinite;
}
.fb-shelf-hero-bg .p1 {
  width: min(38vw, 380px);
  height: min(52vw, 520px);
  right: 6%;
  top: 10%;
  transform: rotate(8deg);
}
.fb-shelf-hero-bg .p2 {
  width: min(34vw, 340px);
  height: min(48vw, 480px);
  right: 14%;
  top: 14%;
  transform: rotate(14deg);
  animation-delay: -2s;
  opacity: 0.85;
}
.fb-shelf-hero-bg .p3 {
  width: min(30vw, 300px);
  height: min(44vw, 440px);
  right: 22%;
  top: 18%;
  transform: rotate(20deg);
  animation-delay: -4s;
  opacity: 0.65;
}
.fb-shelf-hero-bg .grain {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 0.6px, transparent 0.7px);
  background-size: 3px 3px;
  mix-blend-mode: soft-light;
}

.fb-shelf-hero-inner {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  max-width: 560px;
  margin-left: max(20px, calc((100% - 1120px) / 2));
  animation: fbRiseIn 0.85s ease both;
}

.fb-shelf-hero-logo {
  display: block;
  height: clamp(48px, 7vw, 68px);
  width: auto;
  margin: 0 0 22px;
}

.fb-shelf-hero h1 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.6vw, 36px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: rgba(247, 242, 232, 0.94);
}

.fb-shelf-lead {
  margin: 0 0 28px;
  max-width: 38ch;
  font-size: 16px;
  line-height: 1.65;
  color: rgba(247, 242, 232, 0.78);
}

.fb-shelf-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
}

.fb-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.fb-btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  color: #fff;
}

.fb-btn-ghost {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 4px;
  color: var(--gold);
  font-weight: 600;
  border-bottom: 1px solid rgba(196, 163, 90, 0.45);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.fb-btn-ghost:hover {
  color: #e0c27a;
  border-color: #e0c27a;
}

/* ===== Sections ===== */
.fb-shelf-block {
  padding: 56px 0 24px;
  animation: fbRiseIn 0.7s ease 0.12s both;
}

.fb-shelf-featured {
  background:
    linear-gradient(180deg, rgba(15, 39, 68, 0.04), transparent 40%),
    var(--paper);
}

.fb-shelf-head {
  margin-bottom: 22px;
}
.fb-shelf-head h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.fb-shelf-head p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

/* ===== Categories ===== */
.fb-shelf-cates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.fb-shelf-cates a {
  position: relative;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  padding: 4px 0;
  transition: color 0.2s ease;
}
.fb-shelf-cates a:hover { color: var(--ink); }
.fb-shelf-cates a.is-on {
  color: var(--forest);
}
.fb-shelf-cates a.is-on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -17px;
  height: 2px;
  background: var(--forest);
}

/* ===== Book grid ===== */
.fb-shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 28px 20px;
}

.fb-book {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: inherit;
  transition: transform 0.25s ease;
}
.fb-book:hover { transform: translateY(-4px); }

.fb-book-cover {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  border-radius: 3px 8px 8px 3px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(15, 39, 68, 0.12), transparent 8%),
    #dde3ea;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 10px 28px rgba(15, 39, 68, 0.12),
    0 2px 6px rgba(15, 39, 68, 0.06);
  transition: box-shadow 0.25s ease;
}
.fb-book:hover .fb-book-cover {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 18px 36px rgba(15, 39, 68, 0.18),
    0 4px 10px rgba(15, 39, 68, 0.08);
}
.fb-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.fb-book:hover .fb-book-cover img {
  transform: scale(1.03);
}

.fb-book-body {
  display: grid;
  gap: 4px;
}
.fb-book-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fb-book-meta {
  font-size: 12px;
  color: var(--muted);
}

/* ===== Empty / pager / foot ===== */
.fb-shelf-empty {
  padding: 48px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
}
.fb-shelf-empty p {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
}
.fb-shelf-empty span {
  color: var(--muted);
  font-size: 14px;
}

.fb-shelf-pager {
  margin-top: 36px;
  display: flex;
  justify-content: center;
}
.fb-shelf-pager .pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.fb-shelf-pager .pagination > li > a,
.fb-shelf-pager .pagination > li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.fb-shelf-pager .pagination > li > a:hover {
  border-color: rgba(31, 111, 91, 0.45);
  color: var(--forest);
}
.fb-shelf-pager .pagination > .active > span,
.fb-shelf-pager .pagination > .active > a {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
}
.fb-shelf-pager .pagination > .disabled > span {
  opacity: 0.45;
}

.fb-shelf-foot {
  margin-top: auto;
  padding: 40px 0 32px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(15, 39, 68, 0.03));
}
.fb-shelf-foot .fb-shelf-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.fb-shelf-foot-brand img {
  display: block;
  height: 28px;
  width: auto;
  opacity: 0.85;
}
.fb-shelf-foot p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

@keyframes fbPageFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}
@keyframes fbRiseIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .fb-shelf-hero {
    min-height: 58vh;
    padding: 104px 0 48px;
  }
  .fb-shelf-hero-bg .p1,
  .fb-shelf-hero-bg .p2,
  .fb-shelf-hero-bg .p3 {
    opacity: 0.4;
  }
  .fb-shelf-hero-inner {
    margin-left: 20px;
    max-width: none;
    width: calc(100% - 40px);
  }
  .fb-shelf-hero h1 { font-size: 26px; }
}

@media (max-width: 640px) {
  .fb-shelf-top {
    width: calc(100% - 28px);
    padding: 14px 0;
  }
  .fb-shelf-brand img { height: 30px; }
  .fb-shelf-nav { gap: 6px 12px; font-size: 13px; }
  .fb-shelf-nav a:first-child { display: none; }
  .fb-shelf-wrap { width: calc(100% - 28px); }
  .fb-shelf-block { padding: 40px 0 16px; }
  .fb-shelf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 12px;
  }
  .fb-shelf-cates a.is-on::after { bottom: -17px; }
}

@media (prefers-reduced-motion: reduce) {
  .fb-shelf-hero-bg .page,
  .fb-shelf-hero-inner,
  .fb-shelf-block,
  .fb-book,
  .fb-book-cover img {
    animation: none !important;
    transition: none !important;
  }
}
