/* ==========================================================================
   SILVER WOODS HOUSE - Scrollytelling & GSAP Visual Effects
   ========================================================================== */

/* Falling Leaves Background Gimmick */
.falling-leaves-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99;
  overflow: hidden;
}

.falling-leaf {
  position: absolute;
  top: -40px;
  pointer-events: none;
  user-select: none;
  will-change: transform;
  animation-name: leafFall, leafSway;
  animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite;
}

@keyframes leafFall {
  0% {
    top: -40px;
    opacity: 0;
  }
  10% {
    opacity: 0.75;
  }
  85% {
    opacity: 0.75;
  }
  100% {
    top: 105vh;
    opacity: 0;
  }
}

@keyframes leafSway {
  0% {
    transform: translateX(0) rotate(0deg) rotateY(0deg);
  }
  50% {
    transform: translateX(70px) rotate(180deg) rotateY(180deg);
  }
  100% {
    transform: translateX(-50px) rotate(360deg) rotateY(360deg);
  }
}

/* Hero Canvas Background (Fixed behind Hero + Stories) */
#hero-canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.hero-frame-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 2;
}

#hero-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.95) contrast(1.02);
  will-change: transform, opacity;
  transform-origin: center center;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Natural Atmospheric Hero Overlay Layer */
.fog-layer {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.25) 50%, rgba(247, 249, 252, 0.9) 100%);
  pointer-events: none;
  z-index: 3;
}

/* Scroll-driven Crossfade Layer (Tree → Stream transition) */
.hero-crossfade-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  will-change: opacity;
  transition: opacity 0.1s linear;
  z-index: 2;
}

/* Scroll-driven Video Layer */
.hero-scroll-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

/* Scroll Progress Line Indicator at Top */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #94A3B8 0%, #CBD5E1 50%, #0F172A 100%);
  width: 0%;
  z-index: 1000;
  box-shadow: 0 0 10px rgba(148, 163, 184, 0.6);
  transition: width 0.1s linear;
}

/* Hero Section */
.hero-scroll-section {
  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 1.5rem 3rem 1.5rem;
  box-sizing: border-box;
  z-index: 1;
}

.hero-pinned-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 10;
  max-width: 960px;
  width: min(92vw, 960px);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: 3rem 2.5rem;
  border-radius: 32px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  box-sizing: border-box;
}

.hero-japanese-tag {
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: #334155;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  background: rgba(241, 245, 249, 0.9);
  backdrop-filter: blur(8px);
  padding: 0.45rem 1.4rem;
  border-radius: 30px;
  border: 1px solid #CBD5E1;
  box-shadow: 0 4px 15px rgba(0,0,0,0.04);
}

.hero-main-title {
  font-size: clamp(1.6rem, 4vw, 3.4rem);
  line-height: 1.15;
  font-family: var(--font-serif);
  color: #0F172A;
  background: none;
  -webkit-text-fill-color: initial;
  margin-bottom: 0.75rem;
  letter-spacing: 0.03em;
  font-weight: 800;
  white-space: nowrap;
  max-width: 100%;
  box-sizing: border-box;
}

.hero-subtitle {
  font-size: clamp(0.85rem, 1.8vw, 1.25rem);
  letter-spacing: 0.25em;
  color: #1E293B;
  font-family: var(--font-sans);
  font-weight: 700;
  margin-bottom: 1.5rem;
}


.scroll-indicator-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: #64748B;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 1.5rem;
}

.scroll-mouse {
  width: 24px;
  height: 38px;
  border: 2px solid rgba(71, 85, 105, 0.5);
  border-radius: 20px;
  position: relative;
}

.scroll-wheel {
  width: 4px;
  height: 8px;
  background: #0F172A;
  border-radius: 2px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollWheel 2s infinite ease-in-out;
}

@keyframes scrollWheel {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 14px); }
}

/* Story Chapters Full-Screen Backgrounds */
#stories-bg-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1; /* Above Hero Canvas (0) but below content sections (2) */
  pointer-events: none;
}

.story-bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  will-change: opacity, transform;
  transform: scale(1.08);
}

/* White Vignette (ความฟุ้งขอบขาว) */
.story-bg-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(255,255,255,0) 25%, rgba(255,255,255,0.8) 85%, rgba(247,249,252,1) 100%);
  pointer-events: none;
}

/* Story Chapters Section (GSAP Pinning & Center Lock) */
.story-chapter-section {
  position: relative;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  z-index: 3;
}

.story-chapter-section.full-screen-story {
  height: 100vh;
  min-height: 750px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-pinned-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.story-glass-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: 3.5rem 4rem;
  border-radius: 28px;
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.12);
  max-width: 680px;
  text-align: center;
  transform: translateY(0) scale(1);
  opacity: 1;
  will-change: transform, opacity;
}

.story-chapter-num {
  font-size: 0.9rem;
  letter-spacing: 0.25em;
  color: #334155;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.story-title {
  font-size: 2.25rem;
  margin-bottom: 1.25rem;
  color: #0F172A;
}

.story-desc {
  color: #334155;
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.story-image-wrap {
  position: relative;
  height: 330px;
  max-height: 330px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.06);
  border: 1px solid #CBD5E1;
}

.story-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
}

/* Mobile Typography & Layout Optimization (< 768px) */
@media (max-width: 768px) {
  #hero-canvas-container {
    height: 85vh;
  }

  .hero-scroll-section {
    padding: 4.5rem 0.75rem 2rem 0.75rem !important;
    min-height: 85vh;
  }

  .hero-pinned-content {
    padding: 1.5rem 1rem !important;
    border-radius: 20px !important;
    max-width: 95% !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06) !important;
  }

  .hero-japanese-tag {
    font-size: 0.68rem !important;
    letter-spacing: 0.15em !important;
    padding: 0.35rem 0.9rem !important;
    margin-bottom: 0.85rem !important;
  }

  .hero-main-title {
    font-size: clamp(1.15rem, 5.6vw, 1.85rem) !important;
    line-height: 1.2 !important;
    letter-spacing: 0.02em !important;
    margin-bottom: 0.5rem !important;
    white-space: nowrap !important;
  }

  .hero-subtitle {
    font-size: 0.78rem !important;
    letter-spacing: 0.22em !important;
    margin-bottom: 1rem !important;
  }
  .story-chapter-section.full-screen-story {
    min-height: 600px !important;
  }

  .story-glass-card {
    padding: 2rem 1.5rem !important;
    max-width: 90% !important;
    border-radius: 20px !important;
  }

  .story-chapter-num {
    font-size: 0.75rem !important;
    letter-spacing: 0.2em !important;
    margin-bottom: 0.5rem !important;
  }

  .story-title {
    font-size: 1.65rem !important;
    line-height: 1.35 !important;
    margin-bottom: 0.75rem !important;
  }

  .story-desc {
    font-size: 0.95rem !important;
    line-height: 1.65 !important;
    margin-bottom: 1rem !important;
  }
}

