:root {
  --orange: #ff9a5c;
  --orange-deep: #f2723a;
  --ink: #2e2624;
  --ink-soft: #5b504c;
  --paper: #f4f1ee;
  --card: rgba(250, 248, 246, 0.82);
  --line: rgba(46, 38, 36, 0.07);
  --radius: 34px;
  --font: "Inter", "IBM Plex Sans Thai", system-ui, sans-serif;
  --display: "Poppins", "IBM Plex Sans Thai", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ---------- Ambient background ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    var(--paper);
}
.bg-grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(80% 70% at 60% 40%, #000 30%, transparent 85%);
          mask-image: radial-gradient(80% 70% at 60% 40%, #000 30%, transparent 85%);
}
.bg-glyphs span {
  position: absolute;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
  opacity: 0.06;
  user-select: none;
  animation: drift linear infinite;
}
.bg-glyphs span.o { color: var(--orange-deep); opacity: 0.16; }
@keyframes drift {
  from { transform: translateY(0) rotate(0deg); }
  to   { transform: translateY(-120vh) rotate(25deg); }
}

/* ---------- Frame (the big rounded card) ---------- */
.frame {
  position: relative;
  margin: 0;
  padding: 0;
}
.frame::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--card);
  border-bottom: 1px solid rgba(46,38,36,.08);
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: -1;
}

/* ---------- Nav ---------- */
.nav {
  display: flex; align-items: center; gap: 40px;
  padding: 22px clamp(24px, 4vw, 72px);
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .02em; }
.brand img { width: 44px; height: auto; }
.nav-links { display: flex; gap: 34px; margin-right: auto; }
.nav-links a { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0; background: var(--orange); transition: width .25s; }
.nav-links a:hover::after { width: 100%; }
.nav-right { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.lang { display: flex; font-size: 13px; font-weight: 600; }
.lang button { padding: 12px 14px; color: var(--ink-soft); border-radius: 4px; }
.lang button.is-active { background: #fff; color: var(--ink); border: 1px solid rgba(46,38,36,.1); }

.btn { display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .03em; border-radius: 999px; transition: transform .2s, box-shadow .2s, background .2s; }
.btn:hover { transform: translateY(-2px); }
.btn-dark { background: var(--ink); color: #fff; padding: 15px 30px; }
.btn-orange { background: var(--orange-deep); color: #fff; }
.btn-orange:hover { }
.btn-lg { padding: 20px 46px; }

.burger { display: none; width: 42px; height: 42px; border-radius: 50%; background: #fff; flex-direction: column; justify-content: center; align-items: center; gap: 5px; }
.burger span { width: 16px; height: 2px; background: var(--ink); border-radius: 2px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  height: max(600px, calc(100vh - 96px));
  height: max(600px, calc(100svh - 96px));
  padding: 0 clamp(24px, 4vw, 72px);
}

.hero-copy { position: absolute; left: clamp(24px, 4vw, 72px); top: 34%; z-index: 3; }
.hero-copy h1 { font-family: var(--display); font-weight: 500; font-size: clamp(34px, 3.8vw, 76px); line-height: 1.12; letter-spacing: -.02em; margin-bottom: 36px; }
.hero-copy h1 span { display: block; }
.hero-copy h1 .indent { padding-left: 1.1ch; }
.hero-copy .btn { margin-left: 1.1ch; }

/* center visual */
.hero-visual {
  position: absolute; left: 50%; top: 52%;
  width: min(720px, 42vw, 75vh); aspect-ratio: 1;
  transform: translate(-18%, -50%);
  display: grid; place-items: center;
  z-index: 2;
}
.hero-logo { width: 72%; position: relative; animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-14px); } }

.chip {
  position: absolute; z-index: 3;
  font-family: var(--mono); font-size: 13px;
  padding: 10px 16px; border-radius: 14px;
  background: rgba(255,255,255,.85); border: 1px solid rgba(46,38,36,.1);
  white-space: nowrap;
  animation: float 7s ease-in-out infinite;
}
.c1 { top: 8%; right: -6%; animation-delay: -1s; }
.c2 { bottom: 12%; left: -10%; animation-delay: -3s; display: flex; align-items: center; gap: 8px; }
.c3 { top: 14%; left: 2%; background: var(--ink); color: #fff; border-color: var(--ink); animation-delay: -5s; }
.dot-ok { width: 8px; height: 8px; border-radius: 50%; background: #3ac47d; }
.t-tag { color: var(--orange-deep); } .t-attr { color: #8a6cff; } .t-str { color: #2f9e72; } .c3 .t-str { color: var(--orange); }
.t-kw { color: #ff9a5c; } .t-fn { color: #ffd2b4; } .t-num { color: #8fd3ff; }

/* socials */
.socials {
  position: absolute; right: clamp(24px, 4vw, 72px); top: 30%; z-index: 4;
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: #fff; border-radius: 999px; border: 1px solid rgba(46,38,36,.1);
}
.socials a { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; transition: background .2s, color .2s; }
.socials a svg { width: 17px; height: 17px; }
.socials a.is-active, .socials a:hover { background: var(--orange-deep); color: #fff; }

/* side card */
.side-card { position: absolute; right: clamp(24px, 4vw, 72px); bottom: 44px; width: 210px; z-index: 4; }
.side-card h3 { font-family: var(--display); font-weight: 500; font-size: 16px; margin-bottom: 4px; }
.side-card p { font-size: 13px; color: var(--ink-soft); line-height: 1.4; margin-bottom: 12px; }
.code-card { background: var(--ink); color: #f6e9e1; border-radius: 16px; padding: 12px 14px 14px; }
.code-card pre { font-family: var(--mono); font-size: 11.5px; line-height: 1.6; overflow: hidden; }
.win-dots { display: flex; gap: 5px; margin-bottom: 8px; }
.win-dots i { width: 8px; height: 8px; border-radius: 50%; background: #ff6b5f; }
.win-dots i:nth-child(2) { background: #ffbd2e; } .win-dots i:nth-child(3) { background: #28c840; }

/* showreel */
.reel { position: absolute; left: clamp(24px, 4vw, 72px); bottom: 112px; display: flex; width: 260px; height: 74px; border-radius: 12px; overflow: hidden; z-index: 4; }
.reel-play { width: 74px; flex: none; background: var(--ink); display: grid; place-items: center; }
.reel-play svg { width: 40px; height: 40px; padding: 10px; border-radius: 50%; background: #fff; color: var(--orange-deep); transition: transform .2s; }
.reel-play:hover svg { transform: scale(1.1); }
.reel-preview { flex: 1; background: #2a2220; color: var(--orange); font-family: var(--mono); font-size: 13px; display: flex; align-items: center; padding: 0 14px; position: relative; overflow: hidden; }
.typed { position: relative; white-space: nowrap; }
.caret { width: 8px; height: 16px; background: var(--orange); margin-left: 3px; animation: blink 1s steps(1) infinite; position: relative; }
@keyframes blink { 50% { opacity: 0; } }
.reel-caption { position: absolute; left: clamp(24px, 4vw, 72px); bottom: 40px; width: 280px; font-size: 13px; color: var(--ink-soft); line-height: 1.45; z-index: 4; }

/* ---------- Sections ---------- */
.section { margin: 110px 0 0; padding: 0 clamp(24px, 4vw, 72px); }
.section-head { margin-bottom: 40px; }
.eyebrow { font-family: var(--mono); color: var(--orange-deep); font-size: 14px; }
.section-head h2 { font-family: var(--display); font-weight: 600; font-size: clamp(30px, 3.6vw, 44px); letter-spacing: -.02em; margin-top: 6px; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.card { background: var(--card); border: 1px solid rgba(46,38,36,.1); border-radius: 26px; padding: 28px 26px; transition: transform .3s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-6px); }
.card-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 18px; color: #fff; background: var(--orange-deep); }
.card-ico svg { width: 26px; height: 26px; }
.card h3 { font-family: var(--display); font-weight: 600; font-size: 19px; margin-bottom: 8px; }
.card p { color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; flex: 1; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.badge { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--orange-deep); background: rgba(242,114,58,.1); padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.card-link { margin-top: 20px; font-size: 14px; font-weight: 600; color: var(--orange-deep); }
.card-link:hover span { text-decoration: underline; }
.card-link.muted { color: var(--ink-soft); font-weight: 500; font-family: var(--mono); font-size: 12.5px; }
.card-more { background: var(--ink); border-color: var(--ink); color: #fff; }
.card-more p { color: #d8cbc5; }
.card-more .card-link { color: var(--orange); }
.section-sub { color: var(--ink-soft); margin-top: 10px; font-size: 16px; }
.about-text { font-family: var(--display); font-weight: 500; font-size: clamp(20px, 2.3vw, 30px); line-height: 1.5; letter-spacing: -.01em; max-width: 1000px; }

.contact-card { display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(28px, 5vw, 72px); padding: clamp(28px, 4vw, 56px); border-radius: var(--radius); background: #fff; border: 1px solid rgba(46,38,36,.1); }
.contact-logo { width: 96px; margin-bottom: 24px; }
.contact-card h2 { font-family: var(--display); font-weight: 600; font-size: clamp(28px, 3vw, 40px); letter-spacing: -.02em; margin-bottom: 12px; }
.contact-card p { color: var(--ink-soft); line-height: 1.6; }
.contact-alt { margin-top: 18px; font-size: 14px; }
.contact-alt a { color: var(--orange-deep); font-weight: 600; word-break: break-all; }
.contact-form { display: flex; flex-direction: column; gap: 16px; }
.contact-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.contact-form input, .contact-form textarea { font: inherit; font-weight: 400; font-size: 15px; color: var(--ink); background: var(--paper); border: 1px solid rgba(46,38,36,.12); border-radius: 14px; padding: 13px 15px; resize: vertical; transition: border-color .2s, background .2s; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--orange-deep); background: #fff; }
.contact-form .btn { align-self: flex-start; }
.contact-form .btn[disabled] { opacity: .6; cursor: wait; transform: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { font-size: 14px; min-height: 1.4em; }
.form-status.ok { color: #23854f; }
.form-status.err { color: #c0392b; }


.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: s; }
.steps li { border-top: 2px solid var(--ink); padding-top: 22px; }
.steps li span { font-family: var(--mono); color: var(--orange-deep); font-size: 14px; }
.steps h3 { font-family: var(--display); font-weight: 600; font-size: 24px; margin: 8px 0 6px; }
.steps p { color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }


.footer { margin: 60px 0 0; padding: 30px clamp(24px, 4vw, 72px) 40px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); border-top: 1px solid var(--line); }
.mono { font-family: var(--mono); }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .nav { gap: 24px; }
  .nav-links { gap: 22px; }
  .cards { grid-template-columns: repeat(2, 1fr); }

  /* stacked hero */
  .hero { height: auto; min-height: calc(100svh - 96px); padding: 24px clamp(20px, 5vw, 56px) 48px; display: flex; flex-direction: column; justify-content: center; gap: 24px; }
  .hero-copy, .hero-visual, .socials { position: relative; inset: auto; transform: none; }
  .hero-copy { order: 1; }
  .hero-copy h1 { font-size: clamp(32px, 6.4vw, 60px); margin-bottom: 28px; }
  .hero-visual { order: 2; width: min(520px, 86vw); aspect-ratio: 5 / 4; margin: 0 auto; }
  .hero-logo { width: 74%; }
  .socials { order: 3; align-self: center; flex-direction: row; }
  .c1 { top: 2%; right: 0; }
  .c3 { top: 6%; left: 0; }
}
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: absolute; top: 76px; left: 16px; right: 16px; background: #fff; border: 1px solid rgba(46,38,36,.1); padding: 24px; border-radius: 20px; gap: 18px; z-index: 20; }
  .burger { display: flex; border: 1px solid rgba(46,38,36,.1); }
  .nav-right .btn-dark { display: none; }
  .cards, .steps { grid-template-columns: repeat(2, 1fr); }
  .contact-card { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nav { padding: 14px 16px; gap: 12px; }
  .brand { font-size: 17px; }
  .brand img { width: 36px; }
  .nav-right { gap: 10px; }
  .lang button { padding: 9px 10px; }
  .hero { padding: 12px 16px 36px; min-height: 0; }
  .hero-copy h1 .indent { padding-left: 0; }
  .hero-copy .btn { margin-left: 0; width: 100%; }
  .btn-lg { padding: 18px 28px; }
  .hero-visual { width: 100%; }
  .section { padding: 0 16px; margin-top: 72px; }
  .cards, .steps { grid-template-columns: 1fr; }
  .contact-card { padding: 28px 20px; gap: 28px; }
  .contact-logo { width: 72px; }
  .contact-form .btn { width: 100%; align-self: stretch; }
  .footer { padding: 24px 16px 32px; }
  .chip { font-size: 11px; padding: 7px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
