/* 달빛 도서관 — 라이브러리 홈 */

:root {
  --ink: #f4eedb;
  --ink-soft: #c8c2a8;
  --paper: #1a1f3a;
  --paper-2: #0f1230;
  --paper-3: #070925;
  --gold: #f3c969;
  --gold-soft: #e6b35a;
  --violet: #8a7ec6;
  --silver: #d6deea;
  --pink: #e29bb7;
  --green: #9bd1a8;

  --serif: "Gowun Batang", "Apple SD Gothic Neo", "Noto Serif KR", serif;
  --sans: "Gowun Dodum", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;

  --transition: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background:
    radial-gradient(ellipse at 15% 5%, rgba(138, 126, 198, 0.25), transparent 50%),
    radial-gradient(ellipse at 85% 95%, rgba(243, 201, 105, 0.10), transparent 55%),
    linear-gradient(180deg, #060728 0%, #0a0d2e 50%, #060728 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--serif);
}

body {
  display: flex; flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 별빛 배경 */
.stars-bg {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 10% 20%, rgba(255, 255, 255, 0.85), transparent 50%),
    radial-gradient(1px 1px at 25% 70%, rgba(255, 255, 255, 0.6), transparent 50%),
    radial-gradient(1.5px 1.5px at 40% 30%, rgba(255, 255, 255, 0.7), transparent 50%),
    radial-gradient(1px 1px at 55% 85%, rgba(255, 255, 255, 0.55), transparent 50%),
    radial-gradient(1.4px 1.4px at 70% 15%, rgba(255, 255, 255, 0.8), transparent 50%),
    radial-gradient(1px 1px at 80% 50%, rgba(255, 255, 255, 0.5), transparent 50%),
    radial-gradient(1.2px 1.2px at 90% 75%, rgba(255, 255, 255, 0.7), transparent 50%),
    radial-gradient(1px 1px at 5% 55%, rgba(255, 255, 255, 0.5), transparent 50%),
    radial-gradient(1.3px 1.3px at 35% 90%, rgba(255, 255, 255, 0.6), transparent 50%),
    radial-gradient(1px 1px at 60% 40%, rgba(255, 255, 255, 0.55), transparent 50%);
  background-size: 100% 100%;
  animation: twinkle 6s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* 달 장식 */
.moon-deco {
  position: fixed;
  top: 8%; right: 8%;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #f8f3d9 0%, #e8dca5 60%, #c5b676 100%);
  box-shadow: 0 0 60px rgba(248, 243, 217, 0.3), inset -8px -8px 16px rgba(0, 0, 0, 0.2);
  z-index: 1;
  pointer-events: none;
}

/* 헤더 */
.hero {
  position: relative; z-index: 5;
  padding: 80px 24px 40px;
  text-align: center;
}
.hero-inner {
  max-width: 700px; margin: 0 auto;
}
.hero-mark {
  display: inline-block;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.4em;
  color: var(--gold);
  padding: 6px 18px;
  border: 1px solid rgba(243, 201, 105, 0.4);
  border-radius: 999px;
  margin-bottom: 24px;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 64px);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-weight: 700;
  text-shadow: 0 4px 30px rgba(243, 201, 105, 0.15);
}
.hero #tagline {
  font-family: var(--sans);
  font-size: clamp(15px, 1.6vw, 17px);
  color: var(--ink-soft);
  margin: 0;
  letter-spacing: 0.02em;
}

/* 서가 */
.shelf {
  position: relative; z-index: 5;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 24px 80px;
  flex: 1;
}
.shelf-header {
  display: flex; align-items: baseline; gap: 14px;
  padding: 0 4px 18px;
  border-bottom: 1px solid rgba(243, 201, 105, 0.2);
  margin-bottom: 36px;
}
.shelf-header h2 {
  margin: 0; font-family: var(--serif);
  font-size: 22px; font-weight: 700;
  color: var(--silver);
}
.count {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.05em;
}

/* 책 카드 그리드 */
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px;
}
@media (max-width: 1000px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 28px; }
}
@media (max-width: 620px) {
  .book-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero { padding: 60px 20px 30px; }
  .moon-deco { width: 56px; height: 56px; top: 5%; right: 6%; }
}

/* 책 카드 */
.book-card {
  display: flex; flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  overflow: hidden;
  transition:
    transform 0.4s var(--transition),
    box-shadow 0.4s var(--transition),
    border-color 0.4s var(--transition);
  position: relative;
}
.book-card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(243, 201, 105, 0) 0%, rgba(243, 201, 105, 0.06) 100%);
  opacity: 0;
  transition: opacity 0.4s var(--transition);
  pointer-events: none;
}
.book-card:hover, .book-card:focus-visible {
  transform: translateY(-6px);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(243, 201, 105, 0.3);
  border-color: rgba(243, 201, 105, 0.4);
  outline: none;
}
.book-card:hover::before, .book-card:focus-visible::before {
  opacity: 1;
}

.card-cover {
  aspect-ratio: 2 / 3;
  background-size: cover;
  background-position: center;
  background-color: #1a1f3a;
  position: relative;
}
.card-cover::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(7, 9, 37, 0.65) 100%);
}
.card-cover .placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 14px;
}

.card-info {
  padding: 20px 22px 24px;
  display: flex; flex-direction: column; gap: 8px;
}
.card-info h2 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  line-height: 1.3;
}
.card-subtitle {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.55;
  /* 2줄 ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex; gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.badge {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--gold);
  background: rgba(243, 201, 105, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(243, 201, 105, 0.3);
}
.badge.style {
  color: var(--violet);
  background: rgba(138, 126, 198, 0.12);
  border-color: rgba(138, 126, 198, 0.35);
}
.badge.tag {
  color: var(--pink);
  background: rgba(226, 155, 183, 0.1);
  border-color: rgba(226, 155, 183, 0.3);
}

/* 빈 상태 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 18px;
}
.empty-state span {
  display: block;
  font-family: var(--sans);
  font-size: 13px;
  margin-top: 10px;
  color: var(--ink-soft);
  opacity: 0.6;
}

/* 푸터 */
.footer {
  position: relative; z-index: 5;
  padding: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.footer a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.2s var(--transition);
}
.footer a:hover { color: var(--gold-soft); text-decoration: underline; }

/* 책 뷰어용 도서관 링크 */
.back-link {
  color: var(--ink-soft);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 13px;
  margin-right: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  transition: all 0.2s var(--transition);
}
.back-link:hover {
  color: var(--gold);
  background: rgba(243, 201, 105, 0.08);
}
