/* style.css */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Noto Sans', sans-serif;
  background: linear-gradient(to right, #fdf6e3, #fefae0);
  color: #4e3b31;
  overflow-x: hidden;
}

h1 {
  text-align: center;
  font-size: 2.7rem;
  margin-top: 40px;
  font-family: 'Georgia', serif;
  color: #5a4637;
  animation: fadeInDown 1s ease;
}

.page {
  width: 100vw;
  height: 100vh;
  padding: 20px;
}

.book-carousel {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60vh;
  gap: 40px;
  animation: fadeIn 1s ease;
}

.book-item {
  width: 160px;
  height: 240px;
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  opacity: 0.5;
  filter: grayscale(40%);
  cursor: pointer;
  transition:
    opacity 0.5s ease,
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    filter 0.5s ease;
  transform-origin: center center;
  transform: scale(1);
}

/* 호버된 책: 크게 */
.book-item:hover {
  opacity: 1 !important;
  filter: grayscale(0%) !important;
  transform: scale(1.15);
  z-index: 10;
}

/* 선택된 책: 기본 상태는 약간 크게 */
.book-item.active {
  width: 220px;
  height: 320px;
  opacity: 0.85;
  filter: grayscale(0%);
  transform: scale(1.1);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25);
  transition:
    opacity 0.5s ease,
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    filter 0.5s ease;
  z-index: 5;
  
  /* 애니메이션 적용 */
  animation: activePulse 2s ease-in-out infinite;
}

/* 호버된 책이 있을 때 선택된 책이 작아지는 애니메이션을 JS로 토글하기 위해 클래스 숨겨놓기 */
.book-item.active.shrink {
  animation: activeShrinkPulse 2s ease-in-out infinite;
}

/* 선택된 책 기본 펄스 애니메이션: 커졌다 작아졌다 반복 */
@keyframes activePulse {
  0%, 100% { transform: scale(1.1); }
  50% { transform: scale(1.2); }
}

/* 선택된 책 축소 펄스 애니메이션 (반대 동작) */
@keyframes activeShrinkPulse {
  0%, 100% { transform: scale(1.1); }
  50% { transform: scale(1.0); }
}


.carousel-controls {
  display: flex;
  justify-content: space-between;
  width: 60%;
  margin: 0 auto;
  margin-top: 20px;
}

.arrow-btn {
  font-size: 24px;
  cursor: pointer;
  padding: 10px 24px;
  border: none;
  background-color: #deb887;
  color: #fffef9;
  border-radius: 12px;
  transition: background-color 0.3s;
  font-weight: bold;
}

.arrow-btn:hover {
  background-color: #c89d75;
}

button {
  display: block;
  margin: 50px auto 0;
  padding: 14px 28px;
  font-size: 18px;
  background-color: #a29bfe;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  animation: fadeInUp 1s ease;
  font-family: 'Noto Sans', sans-serif;
}

button:hover {
  background-color: #7e78d2;
}

/* 애니메이션 효과 */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

