/* =========================================================
   หน้า /about (พอร์ตโฟลิโอ)
   ธีมสี + ฟอนต์อยู่ที่ /shared/themes.css และ header / footer / ตัวสลับธีมอยู่ที่ /shared/chrome.css (ใช้ร่วมกับหน้าเครื่องมือ)
   ========================================================= */
@property --shift { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }


* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color .6s ease, color .6s ease;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
::selection { background: var(--a1); color: var(--on-a); }
:focus-visible { outline: 2px solid var(--a3); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
main, .footer-cta { overflow-x: clip; }
.ic { width: 18px; height: 18px; }
.muted { color: var(--muted); }

/* =========================================================
   Background: starfield + nebula
   ========================================================= */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; transition: --shift 1.4s ease; }
#stars { position: absolute; inset: 0; width: 100%; height: 100%; }
/* ไม่ใช้ filter: blur() บนก้อนแสงแล้ว: blur 100px บนภาพขนาด 60vmax ต้องวาดใหม่ทุกเฟรมตอนสีเลื่อน (--shift) = กระตุกตอนเลื่อนผ่านแต่ละ section
   ความนุ่มได้จาก gradient ที่จางหลายจุดแทน ผลแทบเหมือนเดิม */
.blob {
  position: absolute; border-radius: 50%; opacity: var(--blob-op);
  filter: hue-rotate(var(--shift)); will-change: transform;
  transition: opacity .8s;
}
.b1 { width: 60vmax; height: 60vmax; left: -18vmax; top: -22vmax; background: radial-gradient(circle, var(--a1) 0%, color-mix(in srgb, var(--a1) 45%, transparent) 30%, color-mix(in srgb, var(--a1) 12%, transparent) 52%, transparent 70%); animation: drift1 22s ease-in-out infinite alternate; }
.b2 { width: 55vmax; height: 55vmax; right: -22vmax; top: 18vh; background: radial-gradient(circle, var(--a2) 0%, color-mix(in srgb, var(--a2) 45%, transparent) 30%, color-mix(in srgb, var(--a2) 12%, transparent) 52%, transparent 70%); animation: drift2 26s ease-in-out infinite alternate; }
.b3 { width: 42vmax; height: 42vmax; left: 25vw; bottom: -24vmax; background: radial-gradient(circle, var(--a3) 0%, color-mix(in srgb, var(--a3) 45%, transparent) 30%, color-mix(in srgb, var(--a3) 12%, transparent) 52%, transparent 70%); opacity: calc(var(--blob-op) * .6); animation: drift3 30s ease-in-out infinite alternate; }
@keyframes drift1 { to { translate: 12vw 10vh; scale: 1.15; } }
@keyframes drift2 { to { translate: -14vw -8vh; scale: .9; } }
@keyframes drift3 { to { translate: -10vw -12vh; scale: 1.2; } }
.grid-overlay {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse at 50% 20%, #000 15%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 20%, #000 15%, transparent 70%);
}
.noise {
  position: absolute; inset: -50%; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(4) infinite;
}
@keyframes grain { 0%{transform:translate(0,0)} 25%{transform:translate(-3%,2%)} 50%{transform:translate(2%,-3%)} 75%{transform:translate(-2%,-1%)} 100%{transform:translate(0,0)} }

.cursor-glow {
  position: fixed; left: 0; top: 0; width: 560px; height: 560px; z-index: -1;
  border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--a1) 22%, transparent), transparent 60%);
  transform: translate(-50%, -50%); transition: opacity .4s;
}
.has-pointer .cursor-glow { opacity: 1; }

.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 40;
  background: linear-gradient(90deg, var(--a1), var(--a2), var(--a3));
  transform-origin: 0 50%; transform: scaleX(var(--p, 0));
  box-shadow: 0 0 14px var(--a1);
}

/* =========================================================
   Shared bits: eyebrow, sticker, mono label
   ========================================================= */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 .82rem var(--mono); letter-spacing: .04em; color: var(--a1);
  padding: 5px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--a1) 40%, transparent);
  background: color-mix(in srgb, var(--a1) 10%, transparent);
  margin-bottom: 14px;
}
.wave { width: 8px; height: 8px; border-radius: 50%; background: var(--a3); box-shadow: 0 0 10px var(--a3); }
.sticker {
  display: inline-block; font: 700 .72rem var(--mono); text-transform: uppercase; letter-spacing: .06em;
  padding: 5px 10px; border-radius: 8px; background: var(--a3); color: var(--on-a);
  box-shadow: 3px 3px 0 var(--a2); rotate: -3deg;
}
.mono-label { display: inline-flex; align-items: center; gap: 8px; font: 600 .75rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.live { width: 8px; height: 8px; border-radius: 50%; background: #3ee08a; animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 #3ee08a99; } 100% { box-shadow: 0 0 0 10px #3ee08a00; } }
.hl { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative; min-height: calc(100svh - 64px);
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 48px; align-items: center;
  padding: 48px 0 90px;
}
.hero-name {
  font-size: clamp(2.8rem, 8.5vw, 5.6rem); line-height: 1.15; font-weight: 700; letter-spacing: -.02em;
  background: linear-gradient(100deg, var(--ink) 15%, var(--a1) 50%, var(--a2) 75%, var(--a3) 95%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 7s ease-in-out infinite alternate;
  padding-top: .12em;
}
@keyframes shine { to { background-position: 100% 0; } }
.hero-name .ch {
  display: inline-block; opacity: 0; transform: translateY(.7em) rotate(10deg) scale(.8);
  animation: chIn 1s var(--ease-out) forwards; animation-delay: calc(var(--i) * 50ms + .15s);
  background: inherit; background-size: inherit; -webkit-background-clip: text; background-clip: text;
}
.hero-name .sp { display: inline-block; width: .3em; }
/* English name: each letter is its own inline-block, so only allow a break at the space (<wbr> added by script.js) */
html[lang="en"] .hero-name { white-space: nowrap; }
@keyframes chIn { to { opacity: 1; transform: none; } }
.hero-en { font-family: var(--display); font-weight: 500; font-size: clamp(1rem, 2.3vw, 1.4rem); color: var(--muted); margin-top: 6px; letter-spacing: .02em; }
.hero-role { margin-top: 22px; font: 600 clamp(1.05rem, 2.4vw, 1.45rem) var(--mono); min-height: 1.6em; }
.role-prefix { color: var(--muted); margin-right: .35em; font-weight: 400; }
.role-rotator { color: var(--a1); }
.caret { display: inline-block; width: .55em; height: 1.1em; margin-left: 3px; vertical-align: -.18em; background: var(--a1); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-lead { font-size: 1.06rem; color: var(--ink-2); margin-top: 14px; max-width: 34em; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px; overflow: hidden;
  padding: 14px 26px; border-radius: 16px; font-weight: 600; font-size: 1rem;
  transition: transform .3s var(--ease-out), box-shadow .3s, border-color .3s;
  will-change: transform;
}
.btn span, .btn svg { position: relative; z-index: 1; }
.btn-primary { background: var(--grad); color: var(--on-a); box-shadow: 0 12px 40px -10px var(--a1), 4px 4px 0 color-mix(in srgb, var(--a3) 70%, transparent); }
.btn-primary::before {
  content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.6), transparent 70%);
  transform: translateX(-120%); transition: transform .8s var(--ease-out);
}
.btn-primary:hover::before { transform: translateX(120%); }
.btn-ghost { border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn-ghost:hover { border-color: var(--a1); }

.hero-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 38px; }
.hero-stats li {
  padding: 14px 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); min-width: 120px;
}
.hero-stats strong { display: block; font-family: var(--display); font-size: 1.9rem; line-height: 1.1; }
.hero-stats span { font-size: .82rem; color: var(--muted); }

.hero-photo { position: relative; justify-self: center; }
.photo-ring {
  position: relative; padding: 5px; border-radius: 36px;
  background: conic-gradient(from var(--ang), var(--a1), var(--a2), var(--a3), var(--a1));
  animation: spin 6s linear infinite;
  box-shadow: 0 30px 90px -20px color-mix(in srgb, var(--a1) 60%, transparent);
}
@keyframes spin { to { --ang: 360deg; } }
.photo-frame { width: min(360px, 74vw); aspect-ratio: 4 / 5; border-radius: 31px; overflow: hidden; background: #111; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out); }
.hero-photo:hover .photo-frame img { transform: scale(1.06); }
.photo-tag, .photo-chip {
  position: absolute; display: flex; align-items: center; gap: 8px;
  background: var(--card); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: .85rem; font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.5);
}
.photo-tag { left: -26px; bottom: 36px; }
.photo-chip { font-family: var(--mono); }
.chip-a { right: -24px; top: 40px; color: var(--a1); }
.chip-b { left: -16px; top: 124px; color: var(--a2); }
.sticker-hero { position: absolute; right: -14px; bottom: -14px; rotate: 8deg; line-height: 1.3; text-align: center; animation: wobble 5s ease-in-out infinite; }
@keyframes wobble { 50% { rotate: -4deg; translate: 0 -6px; } }
.float { animation: float 4.5s ease-in-out infinite; animation-delay: var(--fd, 0s); }
@keyframes float { 50% { translate: 0 -12px; } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3ee08a; animation: ping 2s infinite; }

.scroll-hint { position: absolute; left: 50%; bottom: 18px; translate: -50% 0; width: 26px; height: 42px; border: 2px solid var(--line); border-radius: 14px; }
.scroll-hint span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--a1); animation: wheel 1.8s ease-in-out infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* =========================================================
   Marquee
   ========================================================= */
.marquee {
  position: relative; overflow: hidden; padding: 16px 0; margin: 10px 0 20px;
  background: var(--grad); rotate: -2deg; scale: 1.05;
  box-shadow: 0 20px 60px -20px var(--a1);
}
.marquee-track { display: flex; align-items: center; gap: 26px; width: max-content; animation: marquee 30s linear infinite; }
.marquee span { font-family: var(--display); font-size: clamp(1.3rem, 3.4vw, 2.2rem); font-weight: 800; white-space: nowrap; color: var(--on-a); text-transform: uppercase; letter-spacing: -.02em; }
.marquee span:nth-child(4n+3) { color: transparent; -webkit-text-stroke: 1.5px var(--on-a); }
.marquee i { width: 14px; height: 14px; flex: none; background: var(--on-a); clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* =========================================================
   Sections
   ========================================================= */
/* content-visibility: section ที่ยังไม่เข้าจอ เบราว์เซอร์ข้ามการจัดวาง/วาดไปก่อน = เปิดหน้าเร็วขึ้นและเลื่อนลื่นขึ้น
   contain-intrinsic-size auto จำความสูงจริงหลังวาดครั้งแรก แถบเลื่อนจึงไม่กระโดด */
/* --ih = ความสูงโดยประมาณที่วัดจริงต่อขนาดจอ ให้ใกล้ของจริงที่สุด แถบเลื่อน/แถบความคืบหน้าจะได้ไม่ยืดหดตอนเลื่อนลงครั้งแรก */
.section { position: relative; padding: 100px 0; content-visibility: auto; contain-intrinsic-size: auto var(--ih, 850px); }
#about { --ih: 860px; } #experience { --ih: 940px; } #projects { --ih: 2670px; } #skills { --ih: 700px; } #contact { --ih: 780px; }
@media (max-width: 1024px) { #about { --ih: 1190px; } #experience { --ih: 990px; } #projects { --ih: 3460px; } #skills { --ih: 790px; } }
@media (max-width: 780px) { .section { --ih: 670px; } #about { --ih: 1300px; } #experience { --ih: 1280px; } #projects { --ih: 6530px; } #skills { --ih: 1250px; } #contact { --ih: 1140px; } }
.ghost-word {
  position: absolute; top: 24px; left: 50%; z-index: -1; white-space: nowrap; pointer-events: none;
  font-family: var(--display); font-weight: 800; font-size: clamp(4.5rem, 17vw, 14rem); line-height: 1; letter-spacing: -.05em;
  color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--ink) 9%, transparent);
  transform: translateX(calc(-50% + var(--dx, 0px)));
}
.section-head { margin-bottom: 38px; }
.section-head h2 { font-size: clamp(2.1rem, 5.5vw, 3.6rem); line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.section-sub { color: var(--muted); margin-top: 8px; }

.card { border: 1px solid var(--line); border-radius: var(--radius); }
.glass {
  position: relative;
  /* พื้นทึบขึ้นแทน backdrop-filter: blur ทุกการ์ดต้องคำนวณใหม่ทุกเฟรมเพราะดาวพื้นหลังขยับตลอด (ตัวการหลักที่ทำให้หน่วง) */
  background: linear-gradient(var(--glass), var(--glass)), color-mix(in srgb, var(--bg) 62%, transparent);
  transition: border-color .4s, background-color .4s, transform .5s var(--ease-out), box-shadow .5s;
}
.glass:hover { border-color: color-mix(in srgb, var(--a1) 55%, transparent); background-image: linear-gradient(var(--glass-2), var(--glass-2)); box-shadow: 0 20px 50px -30px var(--a1); }

/* About: bento grid */
.bento {
  display: grid; gap: 16px;
  grid-template-columns: repeat(4, 1fr);
  grid-template-areas:
    "bio bio now loc"
    "bio bio name edu"
    "lang into into into";
}
.bento > .card { padding: 24px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.b-bio { grid-area: bio; gap: 16px !important; }
.b-now { grid-area: now; }
.b-loc { grid-area: loc; }
.b-name { grid-area: name; }
.b-edu { grid-area: edu; }
.b-lang { grid-area: lang; }
.b-into { grid-area: into; justify-content: center; }
.b-bio .sticker { align-self: flex-start; }
.b-big { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 700; line-height: 1.35; }
.b-mid { font-size: 1.15rem; font-weight: 700; line-height: 1.35; margin-top: auto; }
.b-huge { font-family: var(--display); font-size: 3.4rem; font-weight: 800; line-height: 1; letter-spacing: -.05em; margin-top: auto; }
.b-huge span { color: var(--a1); }
.orbit { position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; border: 1px dashed color-mix(in srgb, var(--a1) 50%, transparent); animation: spinZ 12s linear infinite; }
.orbit span { position: absolute; left: 50%; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--a3); box-shadow: 0 0 12px var(--a3); }
@keyframes spinZ { to { rotate: 360deg; } }
.lang { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 10px; font: 600 .85rem var(--mono); }
.bar { height: 8px; border-radius: 99px; background: var(--glass-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width 1.4s var(--ease-out) .3s; }
.is-visible .bar i { width: var(--w); }

/* Timeline (line fills as you scroll) */
.timeline { position: relative; display: grid; gap: 28px; --fill: 0; }
.timeline::before, .timeline::after { content: ""; position: absolute; left: 160px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; }
.timeline::before { background: var(--line); }
.timeline::after { background: linear-gradient(var(--a1), var(--a2), var(--a3)); transform-origin: top; transform: scaleY(var(--fill)); box-shadow: 0 0 14px var(--a1); }
.tl-item { display: grid; grid-template-columns: 160px 1fr; gap: 36px; position: relative; }
.tl-item::before {
  content: ""; position: absolute; left: 154px; top: 12px; z-index: 1;
  width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--a1);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--a1) 18%, transparent), 0 0 18px var(--a1);
}
.tl-date { font: 600 .9rem var(--mono); color: var(--muted); padding-top: 4px; }
.tl-card { padding: 26px 30px; }
.tl-card h3 { font-size: 1.3rem; }
.tl-org { color: var(--a1); font-weight: 600; margin-bottom: 10px; }
.tl-card ul { display: grid; gap: 6px; margin: 12px 0 16px; }
.tl-card li { position: relative; padding-left: 22px; color: var(--ink-2); }
.tl-card li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 9px; height: 9px; background: var(--grad); clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tags span {
  font: 500 .76rem var(--mono); padding: 4px 11px; border-radius: 999px;
  background: var(--glass-2); border: 1px solid var(--line); color: var(--ink-2);
  transition: border-color .3s, color .3s, transform .3s var(--ease-out), background-color .3s;
}
.tags span:hover { border-color: var(--a1); color: var(--ink); transform: translateY(-2px) rotate(-2deg); }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  font: 500 .88rem var(--mono); padding: 8px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--glass); color: var(--ink-2);
  transition: all .3s var(--ease-out);
}
.chip:hover { border-color: var(--a1); color: var(--ink); }
.chip.is-active { background: var(--grad); border-color: transparent; color: var(--on-a); font-weight: 600; box-shadow: 3px 3px 0 var(--a3); }
.internal-note { font-size: .88rem; color: var(--muted); margin-bottom: 26px; }
.badge {
  display: inline-block; font: 600 .7rem var(--mono); line-height: 1.6;
  padding: 1px 8px; margin-right: 4px; border-radius: 6px;
  background: color-mix(in srgb, var(--a1) 15%, transparent); color: var(--a1); border: 1px solid color-mix(in srgb, var(--a1) 40%, transparent);
}

.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; perspective: 1200px; }
.project {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  background: var(--card);
  transform-style: preserve-3d;
  transition: transform .5s var(--ease-out), box-shadow .5s, border-color .4s, opacity .4s;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}
.project::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.13), transparent 45%);
}
.project:hover { border-color: color-mix(in srgb, var(--a1) 60%, transparent); box-shadow: 0 30px 60px -25px color-mix(in srgb, var(--a1) 70%, transparent); }
.project:hover::after { opacity: 1; }
.project.is-hidden { display: none; }
.project.is-filtering { animation: popIn .5s var(--ease-out); }
@keyframes popIn { from { opacity: 0; scale: .92; } }
.project-cover {
  height: 180px; position: relative; display: flex; align-items: flex-end; padding: 18px;
  border-bottom: 1px solid var(--line); overflow: hidden;
  background-size: 220% 220%; animation: gradMove 8s ease-in-out infinite alternate;
}
@keyframes gradMove { to { background-position: 100% 100%; } }
.cover-label {
  position: relative; z-index: 1; font-family: var(--display); font-weight: 800; font-size: 2rem; letter-spacing: -.04em;
  color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.35); text-transform: uppercase;
  transition: transform .6s var(--ease-out);
}
.project:hover .cover-label { transform: translateY(-6px) scale(1.06); }
.project-cover::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.3) 1px, transparent 1px);
  background-size: 16px 16px; opacity: .5; transition: transform 1.2s var(--ease-out);
}
.project:hover .project-cover::before { transform: scale(1.3) rotate(4deg); }
.cover-mes    { background-image: linear-gradient(135deg, #3b5bff, #7a5cff, #2ec5ff); }
.cover-dp     { background-image: linear-gradient(135deg, #1f8f4e, #a3d04a, #12b886); }
.cover-mrp    { background-image: linear-gradient(135deg, #7c3aed, #c084fc, #6366f1); }
.cover-wms    { background-image: linear-gradient(135deg, #0f172a, #334155, #0ea5e9); }
.cover-denta  { background-image: linear-gradient(135deg, #0e9f9a, #5eead4, #0891b2); }
.cover-ticket { background-image: linear-gradient(135deg, #ea580c, #fbbf24, #f43f5e); }
.cover-web    { background-image: linear-gradient(135deg, #db2777, #f472b6, #a855f7); }
.cover-rescue { background-image: linear-gradient(135deg, #b91c1c, #f97316, #facc15); }
.cover-health { background-image: linear-gradient(135deg, #0d9488, #22d3ee, #34d399); }
.cover-post   { background-image: linear-gradient(135deg, #1d4ed8, #f43f5e, #f59e0b); }
.links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.cover-tools  { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.06) 0 12px, transparent 12px 24px), linear-gradient(135deg, #1e293b, #475569, #64748b); }
.soon-stamp {
  position: absolute; top: 16px; right: 14px; z-index: 1; rotate: 8deg;
  font: 700 .72rem var(--mono); text-transform: uppercase; letter-spacing: .1em;
  padding: 4px 10px; border-radius: 8px; background: var(--a3); color: var(--on-a); box-shadow: 3px 3px 0 var(--a2);
}
.badge-live { display: inline-flex; align-items: center; gap: 6px; background: rgba(62, 224, 138, .14); color: #3ee08a; border-color: rgba(62, 224, 138, .4); }
.badge-live .live { width: 6px; height: 6px; }
.badge-soon { background: color-mix(in srgb, var(--a3) 15%, transparent); color: var(--a3); border-color: color-mix(in srgb, var(--a3) 40%, transparent); }
.badge-muted { background: var(--glass-2); color: var(--muted); border-color: var(--line); }
.link-disabled { display: inline-block; margin-top: 8px; font: 600 .85rem var(--mono); color: var(--muted); cursor: not-allowed; }
.cover-shots {
  background-image: linear-gradient(135deg, #0f3d2e, #1d6b4f, #0f3d2e);
  justify-content: center; align-items: flex-start; gap: 10px; padding: 20px 16px 0;
}
.cover-shots::before { display: none; }
.cover-shots img {
  width: 30%; border-radius: 10px 10px 0 0; border: 1px solid rgba(255,255,255,.2); border-bottom: 0;
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.6); transition: transform .6s var(--ease-out);
}
.cover-shots img:nth-child(2) { transform: translateY(-8px); }
.project:hover .cover-shots img:nth-child(1) { transform: translateY(-6px) rotate(-4deg); }
.project:hover .cover-shots img:nth-child(2) { transform: translateY(-16px) scale(1.05); }
.project:hover .cover-shots img:nth-child(3) { transform: translateY(-6px) rotate(4deg); }

.project-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; transform: translateZ(30px); }
.project-meta { font: .76rem var(--mono); color: var(--muted); }
.project-body h3 { font-size: 1.2rem; line-height: 1.3; }
.project-body > p:not(.project-meta) { color: var(--ink-2); font-size: .94rem; }
.project-body .tags { margin-top: auto; padding-top: 10px; }
.links a { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--a1); font-weight: 600; font-size: .92rem; }
.links a .ic { width: 16px; height: 16px; transition: transform .3s var(--ease-out); }
.links a:hover .ic { transform: translate(3px, -3px); }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.skill-card { padding: 22px 24px; }
.skill-card h3 { font-size: 1.05rem; margin-bottom: 14px; }
.tags.pop span { opacity: 0; transform: scale(.6); }
.is-visible .tags.pop span { animation: tagPop .5s var(--ease-out) forwards; animation-delay: calc(var(--t) * 50ms + .2s); }
@keyframes tagPop { to { opacity: 1; transform: none; } }

/* Education */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.edu { padding: 26px 30px; }
.edu-year { font: 600 .85rem var(--mono); color: var(--a1); }
.edu h3 { font-size: 1.25rem; margin: 4px 0 6px; }
.edu p + p { margin-top: 8px; font-size: .9rem; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.gallery-item { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; position: relative; border: 1px solid var(--line); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out), filter .8s; filter: saturate(.85); }
.gallery-item:hover img { transform: scale(1.08) rotate(1deg); filter: saturate(1.1); }
.gallery-item figcaption {
  position: absolute; left: 10px; bottom: 10px; font: 500 .74rem var(--mono);
  background: var(--card); backdrop-filter: blur(6px); padding: 3px 10px; border-radius: 999px;
}
.gallery-item.placeholder {
  display: grid; place-items: center; color: var(--muted); font-size: .9rem; text-align: center; padding: 10px;
  background: repeating-linear-gradient(45deg, var(--glass), var(--glass) 10px, transparent 10px, transparent 20px);
  border-style: dashed;
}

/* Contact */
.contact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.contact-link[hidden] { display: none; }
.contact-link { position: relative; display: flex; align-items: center; gap: 16px; padding: 18px 20px; overflow: hidden; isolation: isolate; }
.contact-link::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(120deg, color-mix(in srgb, var(--a1) 25%, transparent), color-mix(in srgb, var(--a2) 25%, transparent));
  transform: translateX(-101%); transition: transform .6s var(--ease-out);
}
.contact-link:hover::before { transform: none; }
.contact-link:hover { transform: translateY(-3px); }
.cl-icon {
  flex: none; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px;
  background: var(--grad); color: var(--on-a); transition: transform .5s var(--ease-out);
  box-shadow: 3px 3px 0 var(--a3);
}
.cl-icon svg { width: 24px; height: 24px; }
.contact-link:hover .cl-icon { transform: rotate(-8deg) scale(1.08); }
.cl-text { min-width: 0; display: grid; }
.cl-text small { font: .74rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.cl-text strong { font-weight: 600; overflow-wrap: anywhere; }
.cl-arrow { flex: none; width: 22px; height: 22px; margin-left: auto; color: var(--muted); transition: transform .4s var(--ease-out), color .3s; }
.contact-link:hover .cl-arrow { color: var(--ink); transform: translate(3px, -3px); }
.doc-link:hover .cl-arrow { transform: translateY(3px); }

/* Footer */
.footer-cta { padding: 64px 0 48px; text-align: center; border-top: 1px solid var(--line); }
.footer-big {
  display: inline-block; margin-bottom: 18px;
  font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 6.5vw, 4.2rem); line-height: 1.1; letter-spacing: -.04em;
  background: linear-gradient(100deg, var(--ink), var(--a1), var(--a2), var(--a3)); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  transition: background-position .8s var(--ease-out);
}
.footer-big:hover { background-position: 100% 0; }

/* Floating contact button */
.fab { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 35; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.fab-btn {
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer; color: var(--on-a);
  background: var(--grad); display: grid; place-items: center;
  box-shadow: 0 12px 30px -8px var(--a1); transition: transform .4s var(--ease-out);
}
.fab-btn svg { width: 26px; height: 26px; }
.fab[data-open="true"] .fab-btn { transform: rotate(90deg); }
.fab-menu { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.fab-menu a {
  display: flex; align-items: center; gap: 8px; padding: 9px 16px 9px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: .9rem; opacity: 0; transform: translateY(14px) scale(.9);
  transition: opacity .3s, transform .4s var(--ease-out);
}
.fab-menu a svg { width: 18px; height: 18px; color: var(--a1); }
.fab[data-open="true"] .fab-menu { pointer-events: auto; }
.fab[data-open="true"] .fab-menu a { opacity: 1; transform: none; }
.fab[data-open="true"] .fab-menu a:nth-child(2) { transition-delay: .05s; }
.fab[data-open="true"] .fab-menu a:nth-child(1) { transition-delay: .1s; }

/* =========================================================
   Scroll reveal
   ========================================================= */
[data-reveal] { opacity: 0; transition: opacity .9s var(--ease-out), transform 1s var(--ease-out), filter 1s var(--ease-out); transition-delay: var(--d, 0s); }
[data-reveal="up"]   { transform: translateY(40px); }
[data-reveal="left"] { transform: translateX(-60px) rotate(-2deg); }
[data-reveal="right"]{ transform: translateX(60px) rotate(2deg); }
[data-reveal="zoom"] { transform: scale(.85); filter: blur(10px); }
[data-reveal="blur"] { transform: translateY(20px); filter: blur(14px); letter-spacing: .08em; transition-property: opacity, transform, filter, letter-spacing; }
[data-reveal].is-visible { opacity: 1; transform: none; filter: none; letter-spacing: normal; }
.glass[data-reveal].is-visible { transition: opacity .9s var(--ease-out), transform .5s var(--ease-out), filter 1s var(--ease-out), border-color .4s, background-color .4s, box-shadow .5s; }
/* ลูกแต่ละใบโผล่เองเมื่อเลื่อนมาถึง (script.js ใส่ .is-visible ทีละใบ) เพราะกลุ่มยาว ๆ อย่างการ์ดผลงานบนมือถือสูงหลายพัน px
   ถ้ารอทั้งกลุ่มเข้าจอ การ์ดจะไม่โผล่เลย · หน่วงเวลาเฉพาะตอนโผล่ ไม่หน่วง hover (border/bg/shadow = 0s) */
[data-stagger] > * { opacity: 0; transform: translateY(50px) scale(.96); transition: opacity .8s var(--ease-out), transform .9s var(--ease-out), border-color .4s, background-color .4s, box-shadow .5s; transition-delay: calc(var(--i, 0) * 90ms), calc(var(--i, 0) * 90ms), 0s, 0s, 0s; }
[data-stagger] > .is-visible, [data-stagger].is-visible > * { opacity: 1; transform: none; }
[data-stagger] > .project.is-visible, [data-stagger].is-visible > .project { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.no-js [data-reveal], .no-js [data-stagger] > *, .no-js .tags.pop span, .no-js .hero-name .ch { opacity: 1; transform: none; filter: none; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1024px) {
  .project-grid, .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .bento {
    grid-template-columns: repeat(2, 1fr);
    grid-template-areas: "bio bio" "now loc" "name edu" "lang lang" "into into";
  }
}
@media (max-width: 780px) {

  .hero { grid-template-columns: 1fr; min-height: auto; padding: 32px 0 80px; gap: 44px; }
  .hero-photo { order: -1; }
  .photo-frame { width: min(270px, 66vw); }
  .photo-tag { left: -8px; bottom: 22px; font-size: .78rem; }
  .chip-a { right: -12px; top: 22px; }
  .chip-b { left: -12px; top: 88px; }
  .sticker-hero { right: -8px; bottom: -16px; }
  .hero-stats li { flex: 1; min-width: 0; padding: 12px 14px; }
  .hero-stats strong { font-size: 1.5rem; }
  .scroll-hint { display: none; }
  .edu-grid, .contact-grid { grid-template-columns: 1fr; }
  .project-grid, .skills-grid { grid-template-columns: 1fr; }
  .timeline::before, .timeline::after { left: 6px; }
  .tl-item { grid-template-columns: 1fr; gap: 8px; padding-left: 30px; }
  .tl-item::before { left: 0; top: 6px; }
  .section { padding: 76px 0; }
  .ghost-word { top: 18px; }
  .tl-card, .edu { padding: 22px; }
  .noise { display: none; }
}
@media (max-width: 480px) {
  .bento { grid-template-columns: 1fr 1fr; gap: 12px; }
  .bento > .card { padding: 18px; }
  .b-huge { font-size: 2.6rem; }
  .hero-actions .btn { flex: 1; justify-content: center; }
  .gallery { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  [data-reveal], [data-stagger] > *, .tags.pop span, .hero-name .ch { opacity: 1 !important; transform: none !important; filter: none !important; }
  .bar i { width: var(--w) !important; }
  .cursor-glow, .noise { display: none; }
}

/* =========================================================
   Stage (3D chrome logo at the top, shrinks on scroll)
   --stage-p goes 0 -> 1 while scrolling through it (intro.js)
   ========================================================= */
.no-stage .stage { display: none; }
.stage { position: relative; height: 160svh; margin-top: -64px; }
/* the hero slides up over the stage while the logo finishes shrinking: no blank screen */
.stage + .hero { margin-top: -45svh; z-index: 1; }
.stage-sticky {
  position: sticky; top: 0; height: 100svh; overflow: hidden;
  background: radial-gradient(ellipse at 50% 55%, color-mix(in srgb, var(--a1) 14%, #000) 0%, #000 65%);
  /* fade the black backdrop into the page as the logo leaves */
  opacity: calc(1 - max(0, var(--stage-p, 0) - .7) / .3);
}
.intro-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .9s ease; }
.stage.is-3d .intro-canvas { opacity: 1; }
.intro-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; perspective: 900px;
  transition: opacity .6s;
  transform: translateY(calc(var(--stage-p, 0) * -38vh)) scale(calc(1 - var(--stage-p, 0) * .8));
}
.stage.is-3d .intro-fallback { opacity: 0; transition-duration: .9s; }
.intro-fallback span {
  font-family: var(--display); font-weight: 800; font-style: italic; font-size: clamp(4rem, 18vw, 13rem); letter-spacing: -.05em;
  background: linear-gradient(170deg, #fff 0%, #9aa3b8 30%, #f4f6fb 48%, #5c6378 62%, #e9ecf5 80%, #fff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--a1) 60%, transparent)) drop-shadow(0 2px 0 #444) drop-shadow(0 4px 0 #222);
  animation: chromeSpin 4s ease-in-out infinite; will-change: transform;
}
@keyframes chromeSpin {
  0% { transform: rotateY(-50deg) rotateX(8deg) scale(.7); }
  50% { transform: rotateY(25deg) rotateX(-6deg) scale(1); }
  100% { transform: rotateY(-50deg) rotateX(8deg) scale(.7); }
}
.intro-meta {
  position: absolute; top: calc(64px + 18px); left: 24px; right: 24px;
  display: flex; justify-content: space-between; gap: 12px;
  font: 600 .72rem var(--mono); letter-spacing: .22em; color: rgba(255,255,255,.55);
  opacity: calc(1 - var(--stage-p, 0) * 3);
}
.intro-foot {
  position: absolute; left: 50%; bottom: max(36px, env(safe-area-inset-bottom)); translate: -50% 0;
  display: grid; justify-items: center; gap: 10px; width: min(260px, 70vw);
  font: 700 .78rem var(--mono); letter-spacing: .28em; color: #fff;
  opacity: calc(1 - var(--stage-p, 0) * 4);
}
.intro-bar { width: 100%; height: 2px; background: rgba(255,255,255,.15); overflow: hidden; border-radius: 2px; transition: opacity .4s; }
.intro-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--a1), var(--a2)); transform-origin: left; transform: scaleX(var(--pct, 0)); box-shadow: 0 0 10px var(--a1); }
.intro-load { transition: opacity .4s; }
/* คำบอกให้เลื่อน: แสดงตั้งแต่เปิดหน้า (ไม่รอ 3D โหลด) เป็นคำไทยอ่านง่าย · มือถือเป็นนิ้วปัด คอมเป็นเมาส์ · กดแล้วเลื่อนลงให้ */
.stage-scroll { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; text-decoration: none; padding: 6px 14px; }
.stage-scroll-text { font: 600 .95rem var(--font); letter-spacing: .02em; text-transform: none; color: rgba(255,255,255,.9); text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.stage.is-ready .intro-load, .stage.is-ready .intro-bar { display: none; }
.swipe { display: none; position: relative; width: 34px; height: 46px; }
.swipe svg { position: absolute; left: 3px; bottom: 0; width: 30px; height: 30px; animation: swipeUp 1.8s ease-in-out infinite; filter: drop-shadow(0 2px 8px rgba(0,0,0,.45)); }
/* เส้นทางที่นิ้วลากผ่าน */
.swipe i { position: absolute; left: 12px; top: 0; width: 3px; height: 26px; border-radius: 3px; background: linear-gradient(to top, var(--a1), transparent); transform-origin: bottom; animation: swipeTrail 1.8s ease-in-out infinite; }
@keyframes swipeUp { 0% { translate: 0 6px; opacity: 0; } 15% { opacity: 1; } 70% { translate: 0 -14px; opacity: 1; } 100% { translate: 0 -14px; opacity: 0; } }
@keyframes swipeTrail { 0%, 15% { scale: 1 0; opacity: 0; } 70% { scale: 1 1; opacity: .9; } 100% { scale: 1 1; opacity: 0; } }
@media (hover: none) and (pointer: coarse) {
  .stage-scroll .swipe { display: block; }
  .stage-scroll .mouse { display: none; }
}
.mouse { position: relative; width: 24px; height: 38px; border: 2px solid rgba(255,255,255,.6); border-radius: 14px; }
.mouse i { position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--a1); animation: wheel 1.8s ease-in-out infinite; }

/* nav floats over the stage; the small brand appears once the big logo has shrunk away */
html:not(.stage-done):not(.no-stage) .site-header { background: transparent; border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
html:not(.stage-done):not(.no-stage) .site-header .site-brand { opacity: 0; transform: translateY(-8px); }

/* hold hero animations until the stage is mostly scrolled past */
.intro-active .hero-name .ch { animation-play-state: paused; }
.intro-active .hero [data-reveal] { opacity: 0 !important; transform: translateY(40px) scale(.96) !important; }
html:not(.stage-done):not(.no-stage) .fab { opacity: 0; pointer-events: none; }
.fab { transition: opacity .6s; }
@media (max-width: 600px) { .intro-meta span:last-child { display: none; } .stage { height: 150svh; } }

/* =========================================================
   Project covers: real screenshots (click = open demo) / locked internal systems
   ========================================================= */
a.project-cover { text-decoration: none; cursor: pointer; }
.cover-browser {
  background-image: linear-gradient(135deg, color-mix(in srgb, var(--a1) 35%, #0b1020), color-mix(in srgb, var(--a2) 35%, #0b1020));
  animation: none; padding: 0;
}
.cover-browser::before { display: none; }
.cover-browser img { position: absolute; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); box-shadow: 0 18px 40px -16px rgba(0,0,0,.7); object-fit: cover; object-position: top; transition: transform .6s var(--ease-out); }
/* กรอบภาพสัดส่วน 16:10 เท่ากับไฟล์ภาพ จะได้ไม่ถูกครอปด้านข้าง (ภาพหลักล้นขอบล่างนิดหน่อยโดยตั้งใจ) */
.cover-browser .shot-main { left: 7%; top: 12%; width: 74%; height: auto; aspect-ratio: 16 / 10; }
.cover-browser .shot-sub { right: 5%; top: 34%; width: 46%; height: auto; aspect-ratio: 16 / 10; }
.project:hover .cover-browser .shot-main { transform: translateY(-6px); }
.project:hover .cover-browser .shot-sub { transform: translate(-4px, -10px) rotate(-1.5deg); }
.cover-go {
  position: absolute; left: 14px; bottom: 12px; z-index: 2;
  font: 600 .74rem var(--mono); letter-spacing: .04em; padding: 5px 11px; border-radius: 999px;
  background: rgba(8, 10, 20, .78); color: #fff; border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(6px); opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s var(--ease-out);
}
.project:hover .cover-go, a.project-cover:focus-visible .cover-go { opacity: 1; transform: none; }
@media (hover: none) { .cover-go { opacity: 1; transform: none; } }

/* ปกระบบภายใน: ลิงก์ไปหน้าข้อมูลย่อ */
.cover-shots.cover-internal img:nth-child(2) { transform: translateY(-8px); }
.lock-badge {
  position: absolute; top: 14px; right: 14px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  font: 600 .74rem var(--mono); padding: 5px 11px; border-radius: 999px;
  background: rgba(8, 10, 20, .72); color: #fff; border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(6px);
}
.lock-badge .ic { width: 15px; height: 15px; }

/* target role line under the greeting */
.hero-target { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 2px 0 10px; font-size: 1.05rem; }
.hero-target strong { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.hero-target span { font: 600 .82rem var(--mono); padding: 3px 10px; border-radius: 999px; color: #3ee08a; background: rgba(62,224,138,.12); border: 1px solid rgba(62,224,138,.35); }
.project-role { font-size: .88rem; color: var(--ink-2); display: flex; gap: 8px; align-items: baseline; }
.project-role span { font: 600 .7rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
