/* hero แบบการ์ดลอยรอบหัวข้อ — ต้นแบบ motion: fastwork.com/th/selling (วัดใน .reanimate/hero/spec.md)
   section สูง 2 จอ · ชั้นใน sticky 1 จอ · การ์ดกระจายออกจากกลางจอตามระยะเลื่อน (hero.js) */
/* hero เริ่มที่ขอบบนจอ (ซ้อนใต้ navbar แบบต้นแบบ) — ไม่งั้น sticky เริ่มช้าไปเท่าความสูง navbar */
.fh { position: relative; height: 200vh; margin-top: calc(-1 * var(--hdr, 96px)); }
.header.w-nav { position: sticky; top: 0; z-index: 1000; }   /* ต้อง sticky (เดิม relative ทับไว้ → หน้าแรก navbar ไม่ตามลงมาเป็นแคปซูล) */
.fh-stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.fh-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 0 32px; z-index: 2;
  pointer-events: none;
}
.fh-center > * { pointer-events: auto; }
.fh-title {
  margin: 0; font-family: "Google Sans", Inter, sans-serif; font-size: clamp(36px, 4.4vw, 64px);
  line-height: 1.2; font-weight: 500; letter-spacing: -0.025em; color: var(--tp-text);
}
.fh-sub { margin: 40px 0 0;  /* เส้นใต้คำเน้นยื่นลงมา — เว้นที่ให้ */ max-width: min(480px, 100%); font-size: 18px; line-height: 1.6; color: var(--tp-text-2); }
.fh-cta { display: flex; gap: 12px; margin-top: 36px; flex-wrap: wrap; justify-content: center; }
.fh-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 200px; height: 48px; padding: 0 24px; border-radius: 999px;
  font-size: 16px; font-weight: 600; text-decoration: none; transition: transform .15s ease, background .15s ease;
}
.fh-btn:hover { transform: translateY(-1px); }
.fh-btn--solid { background: var(--tp-text); color: var(--tp-on-brand); }
.fh-btn--ghost { border: 1px solid var(--tp-border-strong); color: var(--tp-text); background: var(--tp-surface); }
.fh-cue {
  position: absolute; left: 50%; bottom: 24px; translate: -50% 0; z-index: 2;
  animation: fh-float 2.2s ease-in-out infinite;  /* ลอยขึ้นลง 8px · จังหวะเดียวกับต้นแบบ */
  font-size: 13px; color: var(--tp-text-3); text-align: center; text-decoration: none;
}
.fh-cue::after { content: ""; display: block; width: 8px; height: 8px; margin: 6px auto 0;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }

/* การ์ด: ตำแหน่งเริ่มเป็น % ของจอ (ถอดจากต้นแบบที่ 1728×997) · หมุนคงที่ · JS เติม translate */
.fh-card {
  position: absolute; left: var(--x); top: var(--y); width: var(--w);
  background: var(--tp-surface); border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--tp-text);
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 12px 32px rgba(0,0,0,.10);
  rotate: var(--r); will-change: transform; z-index: 1;
}
.fh-card img { display: block; width: 100%; aspect-ratio: 4 / 3.4; object-fit: cover; object-position: 8% center; /* ชื่องานใน og image อยู่ชิดซ้าย */ background: var(--tp-surface-2); }
.fh-card b { display: block; padding: 10px 12px 0; font-size: 13px; font-weight: 600; line-height: 1.35; }
.fh-card span { display: block; padding: 2px 12px 12px; font-size: 11px; color: var(--tp-text-3); }
.fh-card:hover { z-index: 3; }

/* จอแคบ (อิงต้นแบบบนมือถือ): หัวข้อค่อนบน · การ์ด 4 ใบโผล่ครึ่งใบจากขอบซ้าย-ขวาช่วงล่างจอ · ปุ่มเรียงซ้อน */
@media (max-width: 767px) {
  .fh { height: 100vh; }
  .fh-center { justify-content: flex-start; padding-top: calc(var(--hdr, 80px) + 9vh); }
  .fh-card { width: 36vw; }
  .fh-card:nth-child(n+5) { display: none; }
  .fh-card:nth-child(1) { left: -12%; top: 63%; }
  .fh-card:nth-child(2) { left: 80%;  top: 61%; }
  .fh-card:nth-child(3) { left: -4%;  top: 79%; }
  .fh-card:nth-child(4) { left: 70%;  top: 80%; }
  .fh-card b { font-size: 11px; padding: 6px 8px 0; }
  .fh-card span { font-size: 10px; padding: 2px 8px 8px; }
  .fh-sub { font-size: 15px; margin-top: 30px; }
  .fh-cta { flex-direction: column; align-items: center; gap: 10px; margin-top: 24px; }
  .fh-btn { justify-content: center; min-width: 200px; height: 46px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .fh { height: 100vh; } }

/* section Projects บนหน้าแรก — การ์ดดึงงานจาก projects.tanplanet.work ใช้ thumbnail เต็มกว้างแทนไอคอนแอป */
.pp-thumb { display: block; width: calc(100% + 64px); max-width: none; margin: -40px -32px 28px; aspect-ratio: 16 / 9;
  object-fit: cover; background: var(--tp-surface-2); }  /* ชิดขอบการ์ด: ลบ padding ของ .card.portfolio-project (40/32) */
@media (max-width: 479px) { .pp-thumb { width: calc(100% + 40px); margin: -30px -20px 22px; } }

/* โลโก้โปรเจกต์ทรงกลมซ้อนขอบล่างของรูป (แบบ avatar ในการ์ดต้นแบบ) */
.fh-card { display: flex; flex-direction: column; }
.fh-card .fh-ava {  /* ต้องชนะ .fh-card span (บรรทัดรอง) ไม่งั้นได้ display:block + padding ไอคอนเบี้ยว */
  display: grid; place-items: center; padding: 0; flex: none; width: 44px; height: 44px; margin: -22px 0 0 12px; position: relative; /* flex: none — ไม่งั้นโดนบีบจนไม่กลม · ยกขึ้นครึ่งวง = คร่อมขอบรูปพอดี */
  border-radius: 50%; background: var(--c); border: 3px solid var(--tp-surface); box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.fh-ico { width: 20px; height: 20px; color: var(--tp-on-brand); stroke: currentColor; }
.fh-card b { padding-top: 8px; }
@media (max-width: 767px) { .fh-card .fh-ava { width: 32px; height: 32px; margin-top: -16px; border-width: 2px; } .fh-ico { width: 15px; height: 15px; } }

/* คำเน้นลายมือ: เขียนจากซ้ายไปขวาตอนโหลด แล้วสั่นเบา ๆ ทุก 0.6s แบบเส้นวาดมือ (จังหวะอิงต้นแบบ) */
.fh-accent {
  display: inline-block; margin: 0 .18em; font-family: Sriracha, "Google Sans", cursive; font-style: normal; font-weight: 400;
  font-size: 1.08em; color: var(--tp-text); transform-origin: 50% 60%;
  position: relative; clip-path: inset(-30% 100% -60% -12%); animation: fh-write .9s cubic-bezier(.4,0,.2,1) .35s forwards, fh-idle 1.8s steps(1) 1.3s infinite;
}
@keyframes fh-write { to { clip-path: inset(-30% -12% -60% -12%); } }  /* เผื่อหางตัวเขียน (b/d) ที่ยื่นเกินกล่องคำ */
@keyframes fh-idle { 0% { rotate: -1.2deg; } 33% { rotate: .8deg; translate: 0 -1px; } 66% { rotate: -.4deg; translate: 0 1px; } }
@media (prefers-reduced-motion: reduce) { .fh-accent { animation: none; clip-path: none; } }
.nw { white-space: nowrap; }

/* ไล่สีคำเน้น + เส้นใต้ลายมือ (path วาดเอง) ลากตามหลังคำที่เขียนเสร็จ */
.fh-grad { padding: 0 .14em; margin: 0 -.14em; background: linear-gradient(90deg, var(--tp-hero-1), var(--tp-hero-2) 50%, var(--tp-text) 92%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.fh-ul { position: absolute; left: -2%; bottom: -.12em; width: 104%; height: .32em; overflow: visible; }
.fh-ul path { fill: none; stroke: url(#fhg); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: fh-ul .6s cubic-bezier(.4,0,.2,1) 1.15s forwards; }
@keyframes fh-ul { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .fh-ul path { animation: none; stroke-dashoffset: 0; } }
@media (max-width: 767px) { .fh-ul path { stroke-width: 3.5; } }

@keyframes fh-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ตกถึงพื้น: แสงฟุ้ง (หลังการ์ด) + แสงวาบกวาดผ่านหน้าการ์ด — โทนเดียวกับคำเน้นในหัวข้อ */
.fh-glow {
  position: absolute; translate: -50% -50%; border-radius: 50%; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(219,39,119,.28) 0%, rgba(124,58,237,.18) 32%, rgba(249,115,22,.08) 52%, rgba(255,255,255,0) 68%);
  filter: blur(10px); opacity: 0; animation: fh-glow 1.1s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes fh-glow { 0% { opacity: 0; transform: scale(.35); } 20% { opacity: 1; } 100% { opacity: 0; transform: scale(1.15); } }
.fh-card.fh-shine::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(115deg, rgba(255,255,255,0) 35%, rgba(255,255,255,.85) 50%, rgba(255,255,255,0) 65%);
  transform: translateX(-120%); animation: fh-shine .75s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes fh-shine { to { transform: translateX(120%); } }

@media (prefers-reduced-motion: reduce) { .fh-cue { animation: none; } }


@media (max-width: 520px) { .nw { white-space: normal; } }  /* จอแคบมาก: ปล่อยให้ตัดบรรทัดได้ ดีกว่าล้นขอบ */

/* section Projects หน้าแรก: 3 คอลัมน์ (แทนขอ 27 พ.ย.) · การ์ดแคบลง → ลดขนาดตัวหนังสือ/ระยะ */
.section .portfolio-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; row-gap: 24px; }
.portfolio-grid .card.portfolio-project .title.card-portfolio-project { font-size: 20px; line-height: 1.4; }
.portfolio-grid .card.portfolio-project .paragraph-14 { font-size: 15px; line-height: 1.7; }
@media (max-width: 991px) { .section .portfolio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .section .portfolio-grid { grid-template-columns: minmax(0, 1fr); } }
.fh-card img { aspect-ratio: 16 / 9; object-position: center; }  /* ปกจาก engine 16:9 — เห็นทั้งใบ */
.fh-card .fh-ava svg { width: 55%; height: 55%; color: #fff; stroke: #fff; fill: none; }  /* ไอคอนจากการ์ดผลงาน (stroke) */
