/* =================================================================== */
/* 기본 스타일 (데스크톱 우선)                                           */
/* =================================================================== */

.carousel-main.initial-carousel-space {
  padding-top: 100vh;
  box-sizing: border-box;
}

.carousel-hero {
  position: absolute;
  top: 6rem;
  left: 0;
  width: 100vw;
  z-index: 900;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 6vw;
  box-sizing: border-box;
  pointer-events: none;
}

.big-hero-desc {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--poster-text-color);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 1.8rem;
  text-align: left;
  flex-basis: 60%;
  pointer-events: auto;
}

.carousel-category-jump {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 1rem 1rem;
  pointer-events: auto;
}

.category-jump-item {
  position: relative;
  display: flex;
  flex-direction: row-reverse; 
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.3s ease-out;
  filter: grayscale(80%);
  justify-self: end;
}

.category-jump-btn {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  border: none;
  background: #fff;
  cursor: var(--cursor-grab-bottom2) !important;
  box-shadow: 0 2px 18px #ffd16644;
  transition: background 0.18s, color 0.16s, transform 0.14s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  scale: 0.8;
}

.category-jump-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.category-jump-label {
  color: var(--poster-text-color);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.2s ease-out, color 0.2s ease-out;
}

.category-jump-item:hover {
  filter: grayscale(0%);
}

.category-jump-item.active {
  filter: grayscale(0%);
}

.category-jump-item:hover .category-jump-btn {
  transform: scale(1.12);
  background: #ffd166;
  color: #24243e;
}

.category-jump-item:hover .category-jump-label {
  opacity: 1;
}

.category-jump-btn.active {
  background: #ffd166;
  color: #24243e;
  transform: scale(1.12);
}

.category-jump-item.active .category-jump-label {
  opacity: 1;
  transform: translateY(0);
  color: var(--primary-color);
}

.carousel-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 90vh;
  justify-content: flex-end;
}

.initial-carousel-space {
  min-height: calc(160px + 340px + 50px + 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100vw;
  position: relative;
}

.carousel {
  position: relative;
  width: 98vw;
  height: 340px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
  z-index: 1;
}

/* --- Poster 기본 스타일 (데스크톱/모바일 공통) --- */
.poster {
  opacity: 0;
  width: 200px;
  height: 280px;
  margin: 0 -50px;
  color: var(--poster-text-color);
  box-shadow: var(--poster-box-shadow);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  cursor: var(--cursor-grabbing-single2);
  transition: box-shadow 0.18s;
  user-select: none;
  position: absolute;
  top: 50px;
  will-change: transform, opacity, filter;
  perspective: 1000px;
  transform-style: preserve-3d;
  border-radius: 7px;
  overflow: hidden;
  background-color: #fdfaf3; /* 기본 배경 색상 */
}

.poster-preview-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-color: transparent;
}

/* --- iframe (데스크톱 전용) --- */
.poster-iframe {
  width: 1000px;
  height: 1400px;
  border: none;
  transform-origin: 0 0;
  transform: scale(0.2);
  pointer-events: none;
  opacity: 0; /* JS에서 로드 후 서서히 보이게 처리 */
  transition: opacity 0.3s;
  z-index: 1;
  display: block; /* 데스크톱 기본 */
}

/* --- poster-paper-overlay (데스크톱 전용) --- */
.poster-paper-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; 
    background: url('../images/papertexture.png') center/cover no-repeat;
    pointer-events: none;
    opacity: 1; /* 데스크톱에서 초기에는 보이다가 JS로 사라짐 */
    transition: opacity 0.8s ease-in-out;
    border-radius: 7px;
    display: block; /* 데스크톱 기본 */
}

.poster-dim-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.4);
  z-index: 3;
  pointer-events: none;
  transition: background-color 0.3s ease;
}

body[data-theme='dark'] .poster-dim-overlay {
  background-color: rgba(0, 0, 0, 0.4);
}

.poster-text-overlay {
  position: relative;
  z-index: 4;
  padding: 2.5rem 1.3rem 1.2rem 1.5rem;
  font-size: 1.5rem;
  font-family: 'Georgia', serif;
  font-weight: bold;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5), -1px -1px 3px rgba(0, 0, 0, 0.5);
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 50%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  box-sizing: border-box;
  color: #fff;
}

/* 데스크톱 라이트 모드일 때만 종이 질감 배경 적용 */
body[data-theme='light'] .poster.is-desktop-preview {
  filter: sepia(20%);
  background-blend-mode: multiply;
  background-image: url('../images/papertexture.png');
  background-size: cover;
  background-position: center;
}

/* 데스크톱 다크 모드일 때 배경 제거 */
body[data-theme='dark'] .poster.is-desktop-preview {
  filter: none;
  background-image: none;
}

/* --- binding (데스크톱 전용) --- */
.poster::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -6px;
  width: 6px;
  border-radius: 7px;
  height: 100%;
  transform: translateZ(-10px);
  display: block; /* 데스크톱 기본 */
}

.poster::after {
  content: '';
  position: absolute;
  top: -6px;
  left: -3px;
  width: 100%;
  border-radius: 7px;
  height: 6px;
  transform: translateZ(-10px);
  display: block; /* 데스크톱 기본 */
}

body[data-theme='light'] .poster.is-desktop-preview::before {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.2));
}

body[data-theme='light'] .poster.is-desktop-preview::after {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.2));
}

body[data-theme='dark'] .poster.is-desktop-preview::before,
body[data-theme='dark'] .poster.is-desktop-preview::after {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
}

.book-binding {
  position: absolute;
  left: 10px;
  top: 4px;
  height: calc(100% - 8px);
  width: 12px;
  z-index: 5;
  transition: opacity 0.3s ease;
  display: block; /* 데스크톱 기본 */
}

body[data-theme='light'] .book-binding {
  opacity: 1;
}

body[data-theme='dark'] .book-binding {
  opacity: 0;
  pointer-events: none;
  /* display: none; */ /* 모바일에서만 none */
}

.binding-line {
  position: absolute;
  filter: url(#yarnFilter);
  background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNCIgaGVpZ2h0PSI0IiB2aWV3Qm94PSIwIDAgNCA0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC4zIiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iMC41IiBvcGFjaXR5PSIwLjMiLz4KIDwvc2VnPg==');
  background-repeat: repeat;
  background-blend-mode: multiply;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
}

.carousel-labels {
  pointer-events: none;
  width: 100vw;
  text-align: center;
  height: 0em;
  margin-top: 20px;
  position: relative;
}

.carousel-labels .label {
  position: absolute;
  left: 50%;
  top: 0;
  color: var(--poster-text-color);
  font-size: 1.05em;
  font-family: 'Georgia', serif;
  opacity: 0.7;
  transform-origin: bottom center;
  pointer-events: none;
}

.footer-spacer-hobby {
  height: 21rem;
  width: 100%;
}

#hobbyPageStandardFooter {
  min-height: 350px;
  padding-top: 3rem;
  padding-bottom: 4rem;
}

#background-slideshow {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100vw;
  height: 100vh;
  z-index: -10;
  background-color: var(--bg-slideshow-color);
  transform: translateZ(0) !important;
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  transition: background-color 0.3s ease;
}

#background-slideshow img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  will-change: opacity, transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

#bgImageA,
#bgImageB {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  pointer-events: none;
  transition: opacity 0.5s ease;
  filter: blur(1px);
}

/* --- poster-image (모바일 전용) --- */
.poster-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0; /* JS에서 로드 후 서서히 보이게 처리 (transition or gsap) */
  border-radius: 7px;
  display: none; /* 데스크톱 기본 */
}


/* =================================================================== */
/* 모바일 화면 대응 (768px 이하)                                       */
/* =================================================================== */

@media (max-width: 768px) {

  /* --- 히어로 섹션 --- */
  .carousel-hero {
    justify-content: center;
    top: 4rem;
    padding: 0 5vw;
  }

  .big-hero-desc {
    display: none;
  }
  
  .carousel-category-jump {
    margin-top: 5rem;
    gap: 0.8rem 1rem;
  }

  .category-jump-btn {
    width: 2.5rem;
    height: 2.5rem;
  }

  .category-jump-label {
    font-size: 13px;
  }
  

  /* --- 캐러셀 --- */
  .carousel {
    height: 300px;
  }

  .poster {
    width: 160px;
    height: 224px;
    margin: 0 -60px;
    /* 모바일에서는 poster-paper-overlay를 아예 숨깁니다. */
    /* JS에서 .is-mobile-preview 클래스를 붙이므로, 그 클래스에 따라 제어하는 것이 더 명확합니다. */
  }

  /* 모바일 환경에서만 poster-paper-overlay 및 iframe 숨기기 */
  .poster.is-mobile-preview .poster-paper-overlay {
    display: none !important;
  }
  
  .poster.is-mobile-preview .poster-iframe {
    display: none !important;
  }
  
  /* 모바일 환경에서만 스크린샷 이미지 표시 */
  .poster.is-mobile-preview .poster-screenshot-preview {
    display: block !important; /* 스크린샷 이미지를 강제로 표시 */
    opacity: 1 !important; /* JS에서 opacity를 0으로 설정하지만, 모바일에서는 바로 1로 설정 */
  }
  
  /* 모바일 미리보기 상태일 때 배경 제거 */
  body[data-theme='light'] .poster.is-mobile-preview {
    background-image: none !important;
    filter: none !important;
    background-blend-mode: normal !important;
  }
  body[data-theme='dark'] .poster.is-mobile-preview {
    background-image: none !important;
    filter: none !important;
    background-blend-mode: normal !important;
  }


  .poster-text-overlay {
    padding: 2rem 1rem 1rem 1.2rem;
    font-size: 1.2rem;
  }

  .carousel-labels {
    margin-top: 15px;
  }
  
  .carousel-labels .label {
    font-size: 0.95em;
  }

  /* 모바일 미리보기 상태일 때 binding, before, after 제거 */
  .poster.is-mobile-preview .book-binding,
  .poster.is-mobile-preview::before,
  .poster.is-mobile-preview::after {
      display: none !important;
  }
}