/* ==========================================================================
   landing.css — หน้า index เท่านั้น
   ประกอบภาพจาก assets/images ตามดีไซน์: hero (ท่าเรือ) + content (กระดาษแผนที่)
   ใช้ร่วมกับ style.css (ตัวแปรสี / ปุ่ม / loader)
   ========================================================================== */

.page-landing {
  overflow-x: hidden;
  background: linear-gradient(180deg, #cfe7fa 0%, #eddcba 42%, #e6d3ad 100%);
}

/* เต็มความกว้างจอ ไม่จำกัด max-width */
.stage {
  position: relative;
  width: 100%;
}

/* ------------------------------------------------------------- full bleed
   บังคับให้ hero กับ content กว้างเต็มจอเสมอ แม้ถูก container ครอบอยู่
   (margin ลบ = เทคนิคดันตัวเองออกจากขอบ container)
   body มี overflow-x: hidden กันแถบเลื่อนที่เกิดจาก 100vw ไว้แล้ว
   -------------------------------------------------------------------------- */

.hero,
.content {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* ==========================================================================
   HERO — ฉากท่าเรือ + โลโก้ + ตัวละครสองข้าง
   ========================================================================== */

/* ความสูงคิดจากสัดส่วนภาพจริง 1920x1031 เทียบความกว้างจอ แต่ไม่เกิน 96vh
   (คิดเป็น height ตรง ๆ แทน aspect-ratio + max-height เพื่อไม่ให้สองค่าตีกัน) */
.hero {
  position: relative;
  height: min(calc(100vw * 1031 / 1920), 100vh);
  min-height: 420px;
  margin-top: 40px;               /* เผื่อที่ให้ topbar ของเว็บหลัก */
  overflow: hidden;
  background: url("../images/bg-hero.png") center bottom / cover no-repeat, #cfe7fa;
}

/* ชั้นสีสาดกระจาย (color.png) ลอย + หมุนเอียงช้า ๆ ให้ดูมีชีวิต */
.hero__splash {
  position: absolute;
  inset: -5%;
  background: url("../images/color.png") center / cover no-repeat;
  opacity: .92;
  pointer-events: none;
  animation: splash-drift 28s ease-in-out infinite alternate;
}

@keyframes splash-drift {
  0%   { transform: scale(1) translate(0, 0) rotate(0deg); opacity: .82; }
  50%  { transform: scale(1.018) translate(.5%, -.4%) rotate(.4deg); opacity: 1; }
  100% { transform: scale(1.032) translate(-.6%, .5%) rotate(-.35deg); opacity: .9; }
}

/* ดาวประกายบนท้องฟ้า (สร้างด้วย JS) */
.hero__stars {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ---- ตัวละครสองข้าง ---- */

.hero__char {
  position: absolute;
  bottom: -1.5%;
  width: 34%;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 12px 26px rgba(12, 43, 87, .22));
}

.hero__char--l {
  left: -1.5%;
  transform-origin: 40% 100%;
  animation: sway-l 9s ease-in-out infinite alternate;
}

.hero__char--r {
  right: -2%;
  width: 37%;
  transform-origin: 60% 100%;
  animation: sway-r 10.5s ease-in-out infinite alternate;
}

/* โยกเบา ๆ ช้า ๆ พอให้รู้ว่ามีชีวิต ไม่ให้ดึงสายตาจากโลโก้ */
@keyframes sway-l {
  0%   { transform: translate(0, 0) rotate(-.4deg) scale(1); }
  50%  { transform: translate(.5%, -.9%) rotate(.15deg) scale(1.005); }
  100% { transform: translate(-.25%, -.3%) rotate(.45deg) scale(1.001); }
}

@keyframes sway-r {
  0%   { transform: translate(0, -.4%) rotate(.4deg) scale(1.003); }
  50%  { transform: translate(-.55%, .3%) rotate(-.2deg) scale(1); }
  100% { transform: translate(.25%, -.75%) rotate(-.45deg) scale(1.006); }
}

/* ---- โลโก้ + tagline ตรงกลาง ---- */

.hero__center {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2.5%;
  padding: 3% 4% 6%;
  text-align: center;
}

.hero__logo { margin: 0; }

/* โลโก้ลอยขึ้นลงเบา ๆ พร้อมแสงเรืองเต้นตามจังหวะ */
.hero__logo img {
  width: min(40vw, 620px);
  animation:
    logo-float 5s ease-in-out infinite alternate,
    logo-glow 3.4s ease-in-out infinite alternate;
}

@keyframes logo-float {
  0%   { transform: translateY(-4px) rotate(-.2deg) scale(1); }
  50%  { transform: translateY(1px) rotate(.1deg) scale(1.005); }
  100% { transform: translateY(4px) rotate(.25deg) scale(1.002); }
}

@keyframes logo-glow {
  from { filter: drop-shadow(0 14px 30px rgba(12, 43, 87, .34)); }
  to   { filter: drop-shadow(0 14px 34px rgba(12, 43, 87, .4)) drop-shadow(0 0 16px rgba(255, 226, 150, .75)); }
}

.hero__tagline { margin: 0; }

.hero__tagline img {
  width: min(56vw, 880px);
  filter: drop-shadow(0 8px 18px rgba(12, 43, 87, .26));
  animation: tagline-breathe 5.4s ease-in-out infinite alternate;
}

@keyframes tagline-breathe {
  0%   { transform: scale(1) translateY(0); }
  50%  { transform: scale(1.009) translateY(-1.5px); }
  100% { transform: scale(1.004) translateY(1.5px); }
}

/* จอแคบ — ขยายโลโก้ ยืดฉากให้สูงขึ้นเพื่อไม่ให้ตัวละครทับโลโก้ */
@media (max-width: 900px) {
  .hero { height: min(100vw, 96vh); }
  .hero__logo img { width: 74vw; }
  .hero__tagline img { width: 88vw; }
  .hero__char { width: 46%; }
  .hero__char--r { width: 48%; }
  .hero__center { justify-content: center; gap: 4%; padding-bottom: 22%; }
}

@media (max-width: 540px) {
  .hero { height: min(calc(100vw * 5 / 4), 96vh); }
  .hero__logo img { width: 84vw; }
  .hero__tagline img { width: 94vw; }
  .hero__char { width: 54%; }
  .hero__char--r { width: 56%; }
}

/* ==========================================================================
   CONTENT — กระดาษแผนที่ (ปุ่มใหญ่ 2 ปุ่ม + ไทม์ไลน์ระยะเวลา)
   ========================================================================== */

.content {
  position: relative;
  z-index: 3;
  margin-top: -7%;                /* ให้ขอบโค้งทองซ้อนขึ้นไปทับ hero */
  padding: 7% 20px 10%;           /* padding-top ดันเนื้อหาลงมาให้พ้นขอบโค้งทอง */
  background: url("../images/bg-content.png") center top / 100% 100% no-repeat;
}

/* ชั้นดาวลอยขึ้นในกระดาษแผนที่ (สร้างด้วย JS) */
.content__floats {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.content__floats .floaty { --rise: 88vh; }

.content__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
}

/* จอแคบ ขอบโค้งเตี้ยลง ลดการซ้อนไม่ให้กินโลโก้ */
@media (max-width: 900px) {
  .content { margin-top: -7%; padding-top: 17%; }
}

@media (max-width: 540px) {
  .content {
    margin-top: 0;
    padding-top: 24%;
    background-size: cover;
  }
}

/* ---- ปุ่มใหญ่ 2 ปุ่ม ---- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(16px, 4vw, 60px);
  margin-bottom: clamp(28px, 5vw, 64px);
}

.act {
  position: relative;
  display: block;
  width: clamp(180px, 23vw, 360px);
  text-decoration: none;
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.3), filter .25s;
}

/* แสงทองเรือง ๆ ด้านหลังปุ่ม */
.act::before {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 150, .85) 0%, rgba(255, 226, 150, 0) 66%);
  opacity: .55;
  animation: glow-pulse 3s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
  0%   { opacity: .28; transform: scale(.9) rotate(0deg); }
  50%  { opacity: .82; transform: scale(1.06) rotate(6deg); }
  100% { opacity: .45; transform: scale(.98) rotate(-6deg); }
}

/* ปุ่มลอยขึ้นลง + ส่ายซ้ายขวา คนละจังหวะกับอีกปุ่ม */
.act__img {
  width: 100%;
  filter: drop-shadow(0 10px 20px rgba(71, 51, 30, .3));
  animation: act-bob 2.9s ease-in-out infinite alternate;
}

.act:nth-child(2) .act__img { animation-delay: -1.45s; }
.act:nth-child(2)::before { animation-delay: -1.5s; }

@keyframes act-bob {
  0%   { transform: translate(-5px, -9px) rotate(-2.2deg) scale(1); }
  50%  { transform: translate(2px, 1px) rotate(.6deg) scale(1.022); }
  100% { transform: translate(5px, 9px) rotate(2.2deg) scale(1.006); }
}

.act:hover { transform: scale(1.09) translateY(-6px); }

/* hover แล้วเด้งแบบเยลลี่ */
.act:hover .act__img {
  filter: drop-shadow(0 18px 30px rgba(71, 51, 30, .44)) brightness(1.06);
  animation: jelly .62s cubic-bezier(.25, .9, .3, 1.4);
}

@keyframes jelly {
  0%   { transform: scale(1, 1) rotate(0deg); }
  25%  { transform: scale(1.1, .9) rotate(-2deg); }
  50%  { transform: scale(.93, 1.08) rotate(2deg); }
  75%  { transform: scale(1.05, .96) rotate(-1deg); }
  100% { transform: scale(1, 1) rotate(0deg); }
}

.act:active { transform: scale(1.01); }

.act:focus-visible {
  outline: 4px solid var(--c-blue);
  outline-offset: 6px;
  border-radius: var(--radius-lg);
}

/* ดาวประกายรอบปุ่ม (สร้างด้วย JS) */
.act__stars {
  position: absolute;
  inset: -8%;
  pointer-events: none;
}

/* ---- ปุ่มหลักแบบตัวอักษร ----
   ใช้แทน .act__img ในเฟสที่ยังไม่มีรูปปุ่มจากดีไซน์ (โหวต / ดูผลงาน)
   ขยับจังหวะเดียวกับปุ่มรูป จะได้ดูเป็นชุดเดียวกัน
   พอได้รูปปุ่มจริงมา ใส่ path ที่ phaseButtons ใน config.js แล้วบล็อกนี้
   จะเลิกถูกใช้ไปเอง (ลบทิ้งได้เลย)
   -------------------------------------------------------------------------- */

.act__plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1vw, 12px);
  aspect-ratio: 1 / 1;
  padding: clamp(14px, 2.4vw, 30px);
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, .34) 0%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(162deg, var(--c-blue-light) 0%, var(--c-blue) 44%, var(--c-blue-dark) 100%);
  border: clamp(3px, .5vw, 6px) solid var(--c-gold-light);
  border-radius: 28%;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .5),
    0 10px 24px rgba(71, 51, 30, .34);
  filter: drop-shadow(0 8px 16px rgba(12, 43, 87, .28));
  animation: act-bob 2.9s ease-in-out infinite alternate;
}

.act:nth-child(2) .act__plate { animation-delay: -1.45s; }

.act__plate-icon {
  width: clamp(38px, 5.6vw, 80px);
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(12, 43, 87, .5));
}

.act__plate-text {
  font-family: var(--font-display);
  font-size: clamp(17px, 2.5vw, 34px);
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  text-shadow:
    0 2px 0 var(--c-blue-deep),
    0 6px 14px rgba(12, 43, 87, .55);
}

.act:hover .act__plate {
  border-color: #fff;
  animation: jelly .62s cubic-bezier(.25, .9, .3, 1.4);
}

/* ---- ปุ่มดาวน์โหลด Template ----
   ทำด้วย CSS ล้วน เพราะยังไม่มีไฟล์ปุ่มจาก design
   ถ้าได้ภาพปุ่มมาแล้ว เปลี่ยนไปใช้โครงเดียวกับ .act ได้เลย
   -------------------------------------------------------------------------- */

.tmpl {
  display: flex;
  justify-content: center;
  margin-bottom: clamp(26px, 4.5vw, 56px);
}

.tmpl__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 13px 30px 13px 22px;
  text-decoration: none;
  background: linear-gradient(180deg, #fffdf6 0%, var(--c-paper-alt) 100%);
  border: 2.5px solid var(--c-gold);
  border-radius: 999px;
  box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(255, 255, 255, .85);
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.3), box-shadow .2s, border-color .2s;
}

.tmpl__btn:hover {
  transform: translateY(-3px) scale(1.03);
  border-color: var(--c-gold-dark);
  box-shadow: var(--shadow-gold), inset 0 0 0 1.5px #fff;
}

.tmpl__btn:active { transform: translateY(0) scale(1); }

.tmpl__btn:focus-visible {
  outline: 4px solid var(--c-blue-pale);
  outline-offset: 3px;
}

/* วงกลมไอคอนน้ำเงินขอบทอง ให้เข้าชุดกับไทม์ไลน์ */
.tmpl__icon {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, var(--c-blue-light), var(--c-blue-dark));
  border: 2px solid var(--c-gold);
  border-radius: 50%;
  box-shadow: var(--shadow-blue);
  animation: tmpl-nudge 2.4s ease-in-out infinite;
}

/* ลูกศรขยับลงเบา ๆ บอกว่ากดดาวน์โหลดได้ */
@keyframes tmpl-nudge {
  0%, 62%, 100% { transform: translateY(0); }
  76%           { transform: translateY(3px); }
  88%           { transform: translateY(-1px); }
}

.tmpl__text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  text-align: left;
}

.tmpl__text b {
  font-family: var(--font-display);
  font-size: clamp(15px, 1.6vw, 17px);
  font-weight: 500;
  color: var(--c-heading);
  text-shadow: var(--sh-text-em);
}

.tmpl__text small {
  font-size: clamp(11.5px, 1.2vw, 13px);
  color: var(--c-text-muted);
  text-shadow: var(--sh-text-em);
}

@media (max-width: 420px) {
  .tmpl__btn { gap: 11px; padding: 11px 20px 11px 14px; }
  .tmpl__icon { width: 36px; height: 36px; }
}

/* ---- ไทม์ไลน์ระยะเวลากิจกรรม ---- */

.phases-wrap {
  position: relative;
  --dot: clamp(74px, 8.6vw, 142px);
}

.phases {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* รางเส้นพร้อมดาว/เพชรคั่น วางไว้หลังวงกลม */
.phases__rail {
  position: absolute;
  top: calc(var(--dot) / 2);
  left: 2%;
  right: 2%;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  transform: translateY(-50%);
}

.phases__rail::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: #6b4a2c;
  opacity: .75;
}

.phases__rail img {
  position: relative;
  height: clamp(13px, 1.6vw, 20px);
  width: auto;
  animation: gem-pulse 2.6s ease-in-out infinite alternate;
}

.phases__rail img:nth-child(2) { animation-delay: -.65s; }
.phases__rail img:nth-child(3) { animation-delay: -1.3s; }
.phases__rail img:nth-child(4) { animation-delay: -1.95s; }
.phases__rail img:nth-child(5) { animation-delay: -2.6s; }

.phases__rail img.is-star {
  height: clamp(15px, 1.9vw, 24px);
  animation: gem-spin 5.5s linear infinite;
}

@keyframes gem-pulse {
  from { transform: scale(.82); opacity: .6; }
  to   { transform: scale(1.14); opacity: 1; }
}

@keyframes gem-spin {
  from { transform: rotate(0deg) scale(.9); }
  50%  { transform: rotate(180deg) scale(1.15); }
  to   { transform: rotate(360deg) scale(.9); }
}

.phase {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* วงกลมน้ำเงินขอบทอง + ไอคอนข้างใน — ลอยขึ้นลงคนละจังหวะทั้งสามวง
   (ใช้ transform ทำ animation, ใช้ property scale แยกทำ hover จะไม่ตีกัน) */
.phase__badge {
  position: relative;
  width: var(--dot);
  height: var(--dot);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  transition: scale .28s cubic-bezier(.2, .9, .3, 1.4);
  animation: badge-bob 3.1s ease-in-out infinite alternate;
}

.phase:nth-child(2) .phase__badge { animation-delay: -1.03s; }
.phase:nth-child(3) .phase__badge { animation-delay: -2.06s; }
.phase:nth-child(4) .phase__badge { animation-delay: -3.09s; }

@keyframes badge-bob {
  0%   { transform: translateY(-8px) rotate(-1.6deg); }
  50%  { transform: translateY(1px) rotate(0deg); }
  100% { transform: translateY(8px) rotate(1.6deg); }
}

.phase__ring {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  filter: drop-shadow(0 8px 16px rgba(71, 51, 30, .32));
  animation: ring-glow 2.7s ease-in-out infinite alternate;
}

.phase:nth-child(2) .phase__ring { animation-delay: -.9s; }
.phase:nth-child(3) .phase__ring { animation-delay: -1.8s; }
.phase:nth-child(4) .phase__ring { animation-delay: -2.7s; }

@keyframes ring-glow {
  from { filter: drop-shadow(0 8px 16px rgba(71, 51, 30, .32)); }
  to   { filter: drop-shadow(0 10px 20px rgba(26, 98, 180, .46)) drop-shadow(0 0 12px rgba(255, 226, 150, .6)); }
}

/* ไอคอนในวงเต้นเบา ๆ สวนจังหวะกับวงกลม */
.phase__icon {
  position: relative;
  width: 44%;
  height: auto;
  animation: icon-beat 2.2s ease-in-out infinite alternate;
}

.phase:nth-child(2) .phase__icon { animation-delay: -.73s; }
.phase:nth-child(3) .phase__icon { animation-delay: -1.46s; }
.phase:nth-child(4) .phase__icon { animation-delay: -2.19s; }

@keyframes icon-beat {
  from { transform: scale(.94) rotate(-2deg); }
  to   { transform: scale(1.06) rotate(2deg); }
}

.phase:hover .phase__badge { scale: 1.11; }
.phase:hover .phase__ring { filter: drop-shadow(0 14px 24px rgba(26, 98, 180, .55)); }

.phase__name {
  font-family: var(--font-display);
  font-size: clamp(12px, 1.4vw, 15px);
  font-weight: 500;
  color: var(--c-blue-dark);
  line-height: 1.4;
  text-shadow: var(--sh-text);
}

.phase__date {
  font-size: clamp(11px, 1.25vw, 13.5px);
  color: var(--c-text);
  line-height: 1.5;
  text-shadow: var(--sh-text-em);
}

/* จอแคบ — เรียงไทม์ไลน์ลงล่าง แล้วซ่อนราง */
@media (max-width: 720px) {
  .phases-wrap { --dot: 88px; }
  .phases {
    flex-direction: row;
    align-items: center;
    gap: 22px;
  }
  .phases__rail { display: none; }
  .phase { width: 100%; max-width: 320px; }
  .phase__name { font-size: 15px; }
  .phase__date { font-size: 13.5px; }
}

/* ---- ท้ายหน้า ---- */

.landing-foot {
  padding: 10px 20px 34px;
  text-align: center;
  font-size: 12.5px;
  color: #7a5f3f;
  background: var(--c-paper-alt);
  text-shadow: var(--sh-text-em);
}
