/**
 * 专题书架 — Quiet Romance / Oriental poetic shelf
 * Palette aligned with QDQC: 月白 · 黛青 · 雾蓝 · 蝶蓝 · 淡金
 */

:root {
  --moon-white: #f7f3e9;
  --parchment: #fbf7ef;
  --parchment-deep: #ebe4d6;
  --dai-qing: #172b49;
  --mist-blue: #6f8fb7;
  --butterfly-blue: #4e83b5;
  --pale-gold: #c7a66a;
  --gold-bright: #e8c47a;
  --cinnabar: #9c493e;

  --ink: var(--dai-qing);
  --ink-muted: rgba(23, 43, 73, 0.68);
  --spine-top: #2a4570;
  --spine-mid: #172b49;
  --spine-bot: #0e1a30;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  color: var(--ink);
  background:
    radial-gradient(70% 55% at 50% 0%, rgba(255, 255, 255, 0.72), transparent 58%),
    radial-gradient(55% 50% at 12% 88%, rgba(111, 143, 183, 0.18), transparent 52%),
    radial-gradient(45% 40% at 92% 18%, rgba(78, 131, 181, 0.12), transparent 48%),
    radial-gradient(40% 35% at 70% 70%, rgba(199, 166, 106, 0.12), transparent 50%),
    linear-gradient(165deg, #fbf8f1 0%, #f3eee3 38%, #e7ebf2 72%, #dde3ee 100%);
  background-attachment: fixed;
  line-height: 1.55;
}

::selection {
  background: color-mix(in srgb, var(--butterfly-blue) 42%, transparent);
  color: var(--moon-white);
}

/* —— Atmosphere —— */
.shelf-atmosphere {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.shelf-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.55;
}

.shelf-orb--a {
  width: min(42vw, 28rem);
  height: min(42vw, 28rem);
  top: -8%;
  left: -6%;
  background: radial-gradient(circle, rgba(111, 143, 183, 0.35), transparent 68%);
}

.shelf-orb--b {
  width: min(36vw, 22rem);
  height: min(36vw, 22rem);
  top: 12%;
  right: -8%;
  background: radial-gradient(circle, rgba(199, 166, 106, 0.22), transparent 70%);
}

.shelf-orb--c {
  width: min(48vw, 30rem);
  height: min(48vw, 30rem);
  bottom: -12%;
  left: 30%;
  background: radial-gradient(circle, rgba(78, 131, 181, 0.16), transparent 70%);
}

.shelf-grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.shelf-wrap {
  position: relative;
  z-index: 1;
  width: min(72rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.75rem 0 4.5rem;
}

/* —— Header / brand —— */
.shelf-header {
  margin-bottom: 2.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.shelf-brand {
  display: block;
  margin: 0 0 1.15rem;
  text-decoration: none;
  transition: transform 0.45s ease, filter 0.45s ease;
}

.shelf-brand:hover,
.shelf-brand:focus-visible {
  transform: translateY(-3px);
  filter: drop-shadow(0 12px 28px rgba(78, 131, 181, 0.28));
}

.shelf-logo {
  display: block;
  width: min(11rem, 42vw);
  height: auto;
  margin: 0 auto;
}

.shelf-eyebrow {
  margin: 0 0 0.55rem;
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: 0.95rem;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--mist-blue);
}

.shelf-title {
  margin: 0 0 0.7rem;
  font-size: clamp(1.85rem, 3.6vw, 2.45rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--dai-qing);
  line-height: 1.25;
}

.shelf-lead {
  margin: 0 auto;
  max-width: 28rem;
  font-size: 0.98rem;
  font-weight: 400;
  color: var(--ink-muted);
  line-height: 1.75;
  letter-spacing: 0.02em;
}

.shelf-rule {
  position: relative;
  width: min(14rem, 55vw);
  height: 1px;
  margin: 1.55rem auto 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(199, 166, 106, 0.55) 22%,
    rgba(199, 166, 106, 0.85) 50%,
    rgba(199, 166, 106, 0.55) 78%,
    transparent
  );
}

.shelf-rule__star {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--pale-gold);
  box-shadow: 0 0 0 3px rgba(251, 247, 239, 0.92);
}

/* —— Book grid —— */
.topic-book-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 2.5rem 1.85rem;
  align-items: stretch;
}

.topic-book-item {
  margin: 0;
  display: flex;
}

.topic-book {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  width: 100%;
  min-height: 100%;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.topic-book:hover,
.topic-book:focus-visible {
  transform: translateY(-8px);
  text-decoration: none;
  color: inherit;
}

.topic-book__volume {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 12.5rem;
  height: 17.5rem;
  margin-bottom: 1.2rem;
  perspective: 960px;
  filter: drop-shadow(0 16px 30px rgba(23, 43, 73, 0.28));
}

.topic-book__spine {
  width: 1.65rem;
  flex-shrink: 0;
  background: linear-gradient(
    180deg,
    var(--spine-top) 0%,
    var(--spine-mid) 52%,
    var(--spine-bot) 100%
  );
  border-radius: 4px 0 0 4px;
  box-shadow:
    inset -2px 0 6px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(199, 166, 106, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.15rem;
}

.topic-book__spine-title {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(247, 243, 233, 0.9);
  line-height: 1.45;
  max-height: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-book__cover {
  position: relative;
  flex: 1;
  overflow: hidden;
  border-radius: 0 6px 6px 0;
  background: var(--spine-bot);
  transform-origin: left center;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: inset 0 0 0 1px rgba(247, 243, 233, 0.08);
}

.topic-book:hover .topic-book__cover {
  transform: rotateY(-9deg);
}

.topic-book__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.topic-book__shine {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.32) 0%,
    transparent 40%,
    transparent 58%,
    rgba(111, 143, 183, 0.14) 100%
  );
}

.topic-book__info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 14rem;
  min-height: 10.5rem;
  flex: 1;
}

.topic-book__title {
  margin: 0 0 0.5rem;
  min-height: 2.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--dai-qing);
  line-height: 1.4;
  letter-spacing: 0.04em;
}

.topic-book__summary {
  flex: 1;
  width: 100%;
  min-height: 3.9rem;
  margin: 0 0 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topic-book__summary:empty::before {
  content: "\00a0";
  visibility: hidden;
}

.topic-book__cta {
  display: inline-block;
  margin-top: auto;
  flex-shrink: 0;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--dai-qing);
  padding: 0.34rem 1rem;
  border-radius: 999px;
  background: rgba(111, 143, 183, 0.14);
  border: 1px solid rgba(111, 143, 183, 0.38);
  transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease,
    color 0.25s ease;
}

.topic-book:hover .topic-book__cta {
  color: var(--moon-white);
  background: color-mix(in srgb, var(--butterfly-blue) 88%, var(--dai-qing));
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(78, 131, 181, 0.28);
}

.topic-shelf-empty {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

/* —— Footer —— */
.shelf-footer {
  margin-top: 4rem;
  text-align: center;
}

.shelf-footer__motto {
  margin: 0 0 0.45rem;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: 1rem;
  font-style: italic;
  letter-spacing: 0.08em;
  color: var(--mist-blue);
}

.shelf-footer__meta {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: rgba(23, 43, 73, 0.48);
}

.shelf-footer a {
  color: var(--butterfly-blue);
  text-decoration: none;
}

.shelf-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

@media (max-width: 576px) {
  .shelf-wrap {
    padding-top: 2rem;
  }

  .shelf-logo {
    width: min(9.5rem, 48vw);
  }

  .topic-book-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 2.25rem;
  }

  .topic-book__volume {
    width: 11rem;
    height: 15.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topic-book,
  .topic-book__cover,
  .shelf-brand {
    transition: none;
  }

  .topic-book:hover,
  .topic-book:focus-visible,
  .shelf-brand:hover,
  .shelf-brand:focus-visible {
    transform: none;
    filter: none;
  }

  .topic-book:hover .topic-book__cover {
    transform: none;
  }
}
