/* 
 * Travel 섹션 전용 스타일
 * /assets/css/travel.css
 */

/* 지도 영역 */
.travel-map-container {
  width: 100%;
  height: 400px;
  background-color: var(--surface-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--spacing-3xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 1; /* z-index for Leaflet compatibility */
}

@media (min-width: 768px) {
  .travel-map-container {
    height: 500px;
  }
}

/* 여행 카드 그리드 */
.travel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-xl);
}

@media (min-width: 768px) {
  .travel-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

/* 개별 여행 상세 템플릿 */
.travel-header {
  margin-bottom: var(--spacing-2xl);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--spacing-lg);
  text-align: center;
}

.travel-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.travel-location {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary-color);
  font-weight: 500;
}

/* YouTube 임베드 반응형 (16:9) */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  margin-bottom: var(--spacing-2xl);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background-color: var(--surface-2);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* 사진 갤러리 그리드 */
.gallery-section {
  margin-top: var(--spacing-3xl);
  margin-bottom: var(--spacing-3xl);
}

.gallery-title {
  margin-bottom: var(--spacing-lg);
  font-size: var(--font-size-xl);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--spacing-sm);
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gallery-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  background-color: var(--surface-2);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  cursor: pointer;
}

.gallery-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

/* Leaflet Popup 스타일 재정의 */
.leaflet-popup-content-wrapper {
  background-color: var(--surface-1) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg) !important;
  border-radius: var(--radius-md) !important;
}

.leaflet-popup-tip {
  background-color: var(--surface-1) !important;
  border-top: 1px solid var(--border-color) !important;
  border-left: 1px solid var(--border-color) !important;
}

[data-theme='dark'] .leaflet-popup-content-wrapper,
[data-theme='dark'] .leaflet-popup-tip {
  background-color: var(--surface-2) !important;
}

/* ── Scrollytelling Styles (대만 여행기) ─────────────────── */

.scrolly-body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
}

/* 인트로 커버 */
.scrolly-cover {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: var(--color-bg-primary);
  position: relative;
  z-index: 10;
}

.scrolly-cover__content {
  animation: fadeIn 1.5s ease;
}

.scroll-indicator {
  position: absolute;
  bottom: 10vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 10px); }
}

/* 레이아웃 컨테이너 */
.scrolly-container {
  display: flex;
  position: relative;
  width: 100%;
}

/* 고정(Sticky) 배경 영역 (왼쪽) */
.scrolly-map-wrapper {
  position: sticky;
  top: 0;
  width: 50%;
  height: 100vh;
  z-index: 1;
  background: var(--color-bg-primary);
  transition: background-color var(--transition-slow);
}

#scrolly-map {
  width: 100%;
  height: 100%;
}

/* 스크롤 텍스트 영역 (오른쪽) */
.scrolly-text {
  position: relative;
  width: 50%;
  padding: 10vh 5% 50vh 5%;
  z-index: 2;
  pointer-events: none; /* 클릭은 지도에 통과하게 하되 텍스트 카드는 살림 */
}

/* 텍스트 스텝(단락) 카드 */
.step {
  margin-bottom: 80vh;
  padding: var(--space-6) var(--space-8);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  opacity: 0.2;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

[data-theme='dark'] .step {
  background: rgba(42, 33, 29, 0.85); /* 다크 우드 투명 */
  border-color: rgba(255, 255, 255, 0.05);
}

.step.is-active {
  opacity: 1;
  transform: translateY(0);
}

.step h2 {
  color: var(--color-accent-primary);
  margin-bottom: var(--space-4);
  font-size: var(--text-2xl);
}

.step p {
  white-space: pre-line;
  font-size: var(--text-base);
  line-height: 1.8;
}

/* 집중 모드 (Theater Mode) */
.theater-mode-btn {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 100;
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  padding: var(--space-2);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  pointer-events: auto;
}

.is-theater-mode .scrolly-map-wrapper {
  filter: brightness(0.2) grayscale(0.8);
}
.is-theater-mode .step {
  background: var(--color-bg-primary);
  box-shadow: none;
  opacity: 0.5;
}
.is-theater-mode .step.is-active {
  opacity: 1;
  transform: scale(1.02);
}

/* SVG 경로 드로잉 */
.journey-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  opacity: 0.7;
}

/* 날씨 오버레이 캔버스 */
.weather-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}

.weather-canvas.is-raining {
  opacity: 1;
}

/* 영수증 모달 UI */
.receipt-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.receipt-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.receipt-paper {
  background: #FFF9E6; /* 빈티지 영수증 색상 */
  color: #333;
  width: 300px;
  padding: var(--space-6);
  border-radius: 2px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  transform: translateY(-50px);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-family: var(--font-mono);
}

.receipt-modal.is-open .receipt-paper {
  transform: translateY(0);
}

.receipt-paper h3 {
  text-align: center;
  border-bottom: 2px dashed #ccc;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  color: #333;
}

.receipt-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}

.receipt-total {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: var(--text-lg);
  margin-top: var(--space-4);
}

/* 모바일 분기 */
@media (max-width: 768px) {
  .scrolly-container {
    flex-direction: column;
  }
  .scrolly-map-wrapper {
    width: 100%;
    height: 50vh; /* 화면 상단 50% 지도 고정 */
  }
  .scrolly-text {
    width: 100%;
    padding: 5vh 5% 50vh 5%;
  }
  .step {
    margin-bottom: 90vh; /* 지도 아래에서부터 충분히 띄움 */
  }
}
