@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Caveat:wght@400;700&display=swap');

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

:root {
  /* Japan palette (default) */
  --bg-primary: #fef5e7;
  --bg-secondary: #fff5f5;
  --accent: #c0392b;
  --accent-soft: #f8c8d4;
  --highlight: #d4a849;
  --text-primary: #2c1810;
  --text-secondary: #5a3e36;
  --text-accent: #8b2252;

  /* Thailand palette (applied via GSAP at transition) */
  --thai-bg-primary: #fef9e7;
  --thai-bg-secondary: #e8f6f3;
  --thai-accent: #1abc9c;
  --thai-accent-soft: #a3e4d7;
  --thai-highlight: #e67e22;
  --thai-text-primary: #2c3e50;
  --thai-text-secondary: #34495e;
  --thai-text-accent: #1a6b5a;
  --thai-palm: #27ae60;
  --section-underlay: rgba(255, 250, 245, 0.6);
}

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
  font-size: 1.12rem;
}

h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  font-size: clamp(2.4rem, 5vw, 4.1rem);
}

h3 {
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.handwritten {
  font-family: 'Caveat', cursive;
  font-weight: 400;
}

.section {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  padding: 80px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}

.section::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--section-underlay);
  pointer-events: none;
  z-index: 2;
}

.section-content {
  max-width: 1200px;
  width: 100%;
  position: relative;
  z-index: 3;
  padding: clamp(20px, 3vw, 32px);
  border-radius: 28px;
  background: rgba(255, 250, 245, 0.42);
  border: 1px solid rgba(192, 57, 43, 0.12);
  box-shadow: 0 20px 50px rgba(44, 24, 16, 0.12);
  backdrop-filter: blur(10px);
}

.thailand-section .section-content {
  background: rgba(245, 255, 251, 0.44);
  border-color: rgba(26, 188, 156, 0.14);
}

[data-chapter="practical"] .section-content,
[data-chapter="closing"] .section-content {
  background: rgba(255, 251, 246, 0.48);
}

.section-content > h2,
.section-content > h3,
.section-content > p,
.section-content > .subtitle,
.section-content > .tagline {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65), 0 0 18px rgba(255, 255, 255, 0.78);
}

/* Parallax layer base */
.parallax-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

.parallax-mid {
  position: absolute;
  inset: 0;
  z-index: 1;
  will-change: transform;
  pointer-events: none;
}

/* Utility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

img { max-width: 100%; height: auto; display: block; }

/* Music toggle */
.music-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1001;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(254, 245, 231, 0.9);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, background 0.3s;
}

.music-toggle .vinyl-icon {
  font-size: 1.3rem;
  animation: vinylSpin 3s linear infinite;
}

.music-toggle.is-muted .vinyl-icon {
  animation: none;
  opacity: 0.4;
}

/* Splash overlay */
.splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: linear-gradient(135deg, #fef5e7, #fff5f5, #f8c8d4);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.splash-content h1 {
  font-size: 3.5rem;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.splash-content .handwritten {
  font-size: 1.8rem;
  color: var(--text-accent);
  margin-bottom: 40px;
}

.splash-button {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  padding: 16px 40px;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
  letter-spacing: 1px;
}

.splash-button:hover {
  background: var(--accent);
  color: #fff;
}

/* Budget section */
.budget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin: 40px 0;
}

.budget-column {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.japan-budget { border-top: 4px solid #c0392b; }
.thailand-budget { border-top: 4px solid #1abc9c; }

.budget-category {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px dashed rgba(0,0,0,0.1);
  font-size: 1.12rem;
}

.budget-total {
  display: flex;
  justify-content: space-between;
  padding: 16px 0 0;
  font-weight: 700;
  font-size: 1.3rem;
  font-family: 'Playfair Display', serif;
}

.budget-flights {
  text-align: center;
  margin: 32px 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 12px;
}

.grand-total {
  text-align: center;
  padding: 32px;
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-primary));
  border-radius: 16px;
  margin-top: 24px;
}

.grand-total h2 { font-size: clamp(2.4rem, 4.5vw, 3.4rem); }
.grand-total .handwritten { font-size: 1.7rem; margin-top: 8px; color: var(--text-secondary); }

/* Cheat sheet */
.cheatsheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin: 40px 0;
}

.cheatsheet-column h3 {
  margin-bottom: 16px;
  font-size: 1.7rem;
}

.japan-tips { border-left: 4px solid #c0392b; padding-left: 20px; }
.thailand-tips { border-left: 4px solid #1abc9c; padding-left: 20px; }

.tip-card {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 1.08rem;
  line-height: 1.5;
}

/* Closing stamp collection */
.stamp-collection {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  padding: 40px 0;
}

.passport-stamp { width: 100px; height: 100px; }
.passport-stamp .city { font-size: 0.7rem; }

.subtitle {
  font-family: 'Caveat', cursive;
  font-size: 1.7rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.tagline {
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1.15;
}

#title .section-content {
  text-align: center;
}

#title h2 {
  font-size: clamp(3.2rem, 8vw, 6.5rem);
}

#title .subtitle {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
}

#title .tagline {
  font-size: clamp(1.8rem, 3.8vw, 2.8rem);
  max-width: 980px;
  margin: 16px auto 0;
}

#japan-route .section-content {
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px);
  border-radius: 28px;
  background: rgba(255, 250, 245, 0.76);
  border: 1px solid rgba(192, 57, 43, 0.14);
  box-shadow: 0 24px 60px rgba(44, 24, 16, 0.14);
  backdrop-filter: blur(16px);
}

#japan-route h2 {
  text-align: center;
  margin-bottom: 20px;
}

#japan-route .route-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

#japan-route .route-card {
  padding: 24px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 42px rgba(44, 24, 16, 0.12);
}

#japan-route .route-card--thailand {
  background: rgba(244, 255, 251, 0.82);
}

#japan-route .route-card h3 {
  text-align: center;
  margin-bottom: 18px;
}

#japan-route .route-map {
  display: block;
  width: min(100%, 520px);
  margin: 0 auto;
  filter: drop-shadow(0 12px 24px rgba(44, 24, 16, 0.12));
}

#japan-route .route-map text {
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 6px;
  stroke-linejoin: round;
}

#japan-route .route-map__label {
  font-family: 'Caveat', cursive;
  font-size: 38px;
}

#japan-route .route-map__label--left {
  text-anchor: start;
}

#japan-route .route-note {
  max-width: 420px;
  margin: 24px auto 0 !important;
  text-align: center;
}

#japan-route .route-note--thai {
  background: rgba(240, 255, 251, 0.92);
}

#japan-route .route-flight {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 220px;
}

#japan-route .route-flight__line {
  width: 100%;
  border-top: 4px dashed rgba(230, 126, 34, 0.78);
}

#japan-route .route-flight__plane {
  position: absolute;
  top: calc(50% - 26px);
  left: 20px;
  font-size: 2.6rem;
  color: #e67e22;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.8);
  animation: routePlaneTravel 4s ease-in-out infinite;
}

#japan-route .route-flight__label {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  color: var(--text-accent);
  text-align: center;
}

@media (max-width: 1100px) {
  #japan-route .route-grid {
    grid-template-columns: 1fr;
  }

  #japan-route .route-flight {
    min-height: 140px;
  }

  #japan-route .route-flight__line {
    width: min(320px, 100%);
  }
}

@media (max-width: 768px) {
  #japan-route .route-map__label {
    font-size: 28px;
  }

  #japan-route .route-flight__label {
    font-size: 1.6rem;
  }
}

.scroll-indicator {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding: 14px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(192, 57, 43, 0.18);
  box-shadow: 0 12px 30px rgba(44, 24, 16, 0.08);
  color: var(--text-accent);
}

.scroll-indicator__label {
  font-family: 'Caveat', cursive;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1;
}

.scroll-indicator__arrow {
  font-size: 1.8rem;
  animation: scrollCueBounce 1.8s ease-in-out infinite;
}

/* === Responsive Design === */

@media (max-width: 768px) {
  .section { padding: 40px 20px; }
  .splash-content h1 { font-size: 2rem; }
  .splash-content .handwritten { font-size: 1.3rem; }
  .photo-collage { grid-template-columns: 1fr 1fr; gap: 12px; }
  .budget-grid { grid-template-columns: 1fr; }
  .cheatsheet-grid { grid-template-columns: 1fr; }
  .detail-cards { grid-template-columns: 1fr; }
  .grand-total h2 { font-size: 1.9rem; }
  .stamp-collection { gap: 12px; }
  .passport-stamp { width: 80px; height: 80px; }
  .passport-stamp .city { font-size: 0.6rem; }
}

@media (max-width: 480px) {
  .section { padding: 30px 16px; }
  .photo-collage { grid-template-columns: 1fr; }
  .section-content h2 { font-size: 1.9rem; }
  .splash-content h1 { font-size: 1.6rem; }
  .splash-button { padding: 12px 28px; font-size: 1rem; }
  .passport-stamp { width: 70px; height: 70px; }
  .scroll-indicator {
    width: 100%;
    max-width: 320px;
  }
}

/* === Reduced Motion === */

@media (prefers-reduced-motion: reduce) {
  .sakura-petal, .firefly { animation: none !important; display: none; }
  .parallax-bg, .parallax-mid { will-change: auto; }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
