/* ==========================================================================
   ESG ZOOM — แกลเลอรีซูมทะลุตาม scroll (สำหรับหน้า timeline)
   ดัดแปลงเทคนิคจาก Ref/code-scroll-52 (gallery scroll zoom)
   - .esg-zoom = รางเลื่อนสูง ๆ ขับ scrub (ระยะ scroll)
   - .esg-zoom__pin = เลเยอร์ sticky เต็มจอ (ครอบแกลเลอรี) — ใช้ sticky แทน fixed
     เพราะ section อยู่กลางหน้า ไม่ควรทับทั้งเว็บ
   - แกลเลอรีขยาย + คอลัมน์ข้างเลื่อนหลุดเฟรม + รูปกลางคลายสเกล = ภาพลวงตาพุ่งเข้ารูปกลาง
   - เนื้อหา ESG เผย (fade) ตอนซูมสุด
   หมายเหตุ: transform จริงคุมโดย js/esg-zoom.js (คำนวณตาม progress) — ที่นี่ตั้งค่าเริ่มต้น
   ========================================================================== */

.esg-zoom {
  position: relative;
  /* อยู่ "ด้านหลัง" content ของ timeline (video ขาว + projref) — z ต่ำกว่าทุกอย่างใน timeline
     ให้ content timeline ที่เลื่อนขึ้นตอน scroll ทำหน้าที่เป็น "ม่านจริง" เผย gallery ด้านหลัง */
  z-index: -1 !important;
  /* ดึงขึ้นซ้อนช่วงท้าย timeline (outro/projref) → ไม่ต้องมีม่านปลอม + ลดพื้นที่ด้านล่าง
     (ปรับค่าให้ตรงกับช่วงจอขาวของ outro ได้) */
  margin-top: -100vh;
  /* รางเลื่อน: ยิ่งสูงยิ่งซูมช้า/นุ่ม (ปรับได้) */
  height: 300vh;
  /* พื้นขาว กลืนต่อเนื่องกับช่วงจอขาวของ timeline */
  background-color: #ffffff;
  font-family: "FC Minimal", sans-serif;
}

.esg-zoom__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background-color: #ffffff;
}

/* แกลเลอรีจัดกลางจอ กว้างเกินจอเพื่อให้เห็นคอลัมน์ข้างตอนยังไม่ซูม */
.esg-zoom__gallery {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 160vw;
  height: 100vh;
  display: flex;
  gap: clamp(1em, 4vw, 4em);
  will-change: transform;
}

.esg-zoom__col {
  position: relative;
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(1em, 4vw, 4em);
  will-change: transform;
}

.esg-zoom__img {
  flex: 1;
  overflow: hidden;
  border-radius: 12px;
  /* placeholder เทาอ่อน (กลืนพื้นขาว ไม่โผล่ดำตอนรูปยังโหลด) */
  background-color: var(--kpn-green-grey-grey-50);
}

.esg-zoom__img img,
.esg-zoom__img video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* สื่อกลาง (img/video): เริ่มซูมไว้ก่อน (scale 2) แล้ว JS คลายลงตอน scroll ให้รู้สึกพุ่งทะลุเข้าไป */
.esg-zoom__img--main img,
.esg-zoom__img--main video {
  position: relative;
  transform: scale(2);
  will-change: transform;
}

/* scrim มืดโปร่งคลุมตอนเผยเนื้อหา (คลุมบนรูปกลางที่ซูมเต็มจอ) ให้ตัวอักษรขาวอ่านชัด — JS คุม opacity */
.esg-zoom__scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-color: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
}

/* เนื้อหา ESG เผยตอนซูมสุด (JS คุม opacity + pointer-events) */
.esg-zoom__content {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 80px clamp(24px, 6vw, 120px);
  text-align: center;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
}

.esg-zoom__title-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 900px;
}

.esg-zoom__title {
  margin: 0;
  font-weight: 500;
  font-size: clamp(32px, 5vw, var(--fc-minimal-heading-48-medium));
  /* 48px */
  line-height: 1.2;
  color: #ffffff;
}

/* "Green Energy" ไล่เฉดเขียว green-300 -> ขาว (ตาม .esg เดิม) */
.esg-zoom__title-accent {
  background-image: linear-gradient(0deg, var(--kpn-green-green-green-300) 56.7%, #ffffff 86.9%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--kpn-green-green-green-300);
  /* fallback */
}

.esg-zoom__subtitle {
  margin: 0;
  font-weight: 400;
  font-size: clamp(18px, 2.5vw, var(--fc-minimal-heading-30-regular));
  /* 30px */
  line-height: 1.4;
  color: #ffffff;
}

/* ปุ่มจัดกึ่งกลาง (override align-self ของ .btn-more--light) */
.esg-zoom__content .btn-more--light {
  align-self: center;
}

/* Mobile keeps the same zoom interaction. Use the stable viewport unit so
   showing/hiding the browser toolbar does not resize the sticky rail. */
@media (max-width: 768px) {
  .esg-zoom {
    height: 240vh;
    height: 240svh;
    margin-top: -100vh;
    margin-top: -100svh;
  }

  .esg-zoom__gallery {
    width: 220vw;
    height: 100svh;
  }
}
