:root{
  --bg:#ffffff;
  --surface:#ffffff;

  --text:#0b1220;
  --muted:#475569;

  --brand:#2563eb;   /* น้ำเงิน */
  --brand2:#16a34a;  /* เขียว */

  --border:rgba(39, 80, 27, 0.1);
  --ring:rgba(37,99,235,.35);

  --shadow:0 14px 34px rgba(2,6,23,.10);
  --shadow2:0 26px 80px rgba(2,6,23,.12);

  --radius:18px;

  /* ใช้ค่านี้คุมตำแหน่ง header ใต้ topbar */
  --topbar-h: 46px;
}

/* Base */
*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }

body{
  margin:0;
  font-family:"Prompt", system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans Thai", sans-serif;
  color:var(--text);
  line-height:1.65;

  background:
    radial-gradient(900px 520px at 16% 0%, rgba(37,99,235,.08), transparent 55%),
    radial-gradient(900px 520px at 84% 0%, rgba(22,163,74,.07), transparent 55%),
    var(--bg);
}

a{ color:inherit; text-decoration:none; }
img{ max-width:100%; display:block; }
::selection{ background:rgba(37,99,235,.18); }

.container{
  width:min(1120px, 92vw);
  margin-inline:auto;
}

/* ============================================
   Topbar (ดำ) - sticky ตามเลื่อน
============================================ */
.topbar{
  position: sticky;
  top: 0;
  z-index: 1000;
  background:linear-gradient(180deg, #000, #0a0a0a);
  border-bottom:1px solid rgba(255,255,255,.14);
}

.topbar__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
  font-size:.95rem;
  min-height: var(--topbar-h); /* ให้ความสูงนิ่ง */
}

.topbar__left{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  color:rgba(255,255,255,.72);
}
.topbar__left a{ color:rgba(255,255,255,.72); }
.topbar__left a:hover{ color:#fff; }
.sep{ opacity:.6; }

/* ถ้ามีฝั่งขวา (เช่นปุ่มภาษา) */
.topbar__right{
  display:flex;
  align-items:center;
  gap:10px;
}

.pill{
  padding:.5rem .9rem;
  border:1px solid rgba(255,255,255,.18);
  border-radius:999px;
  background:rgba(255,255,255,.06);
  color:#fff;
  transition:filter .14s ease, border-color .14s ease, transform .14s ease;
}
.pill:hover{ border-color:rgba(255,255,255,.32); filter:brightness(1.03); transform:translateY(-1px); }
.pill:active{ transform:translateY(0); }

/* ============================================
   Header (ดำ) - sticky ใต้ topbar
============================================ */
.header{
  position:sticky;
  top: var(--topbar-h);
  z-index: 900;
  background:linear-gradient(180deg, #000, #0a0a0a);
  border-bottom:1px solid rgba(255,255,255,.14);
  box-shadow:0 10px 28px rgba(0,0,0,.26);
}
.header__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 0;
  position:relative;
}

.brand{ display:flex; align-items:center; gap:10px; }
.brand__logo{
  width:86px;
  height:auto;
  background:#fff;
  padding:6px;
  border-radius:14px;
}

/* Nav */
.nav{
  display:flex;
  align-items:center;
  gap:10px;
}
.nav a{
  padding:.55rem .7rem;
  border-radius:12px;
  color:rgba(255,255,255,.92);
}
.nav a:hover{ background:rgba(255,255,255,.10); }

/* Burger */
.burger{
  display:none;
  width:44px; height:44px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:14px;
  background:rgba(255,255,255,.06);
  align-items:center;
  justify-content:center;
  gap:5px;
  cursor:pointer;
}
.burger span{
  display:block;
  width:18px; height:2px;
  background:#fff;
  border-radius:2px;
}

/* Hero */
.hero{
  position:relative;
  padding:74px 0 54px;
}
.hero__bg{
  position:absolute; inset:0;
  background:
    radial-gradient(720px 280px at 20% 22%, rgba(37,99,235,.10), transparent 62%),
    radial-gradient(720px 280px at 80% 22%, rgba(22,163,74,.09), transparent 62%),
    linear-gradient(180deg, rgba(2,6,23,.02), transparent 38%);
  pointer-events:none;
}
.hero__inner{ position:relative; }

.hero__badge{
  display:inline-block;
  padding:.38rem .8rem;
  border:1px solid rgba(37,99,235,.20);
  border-radius:999px;
  color:rgba(2,6,23,.72);
  background:rgba(37,99,235,.06);
  margin-bottom:12px;
}

.hero h1{
  font-size:clamp(1.9rem, 3.2vw, 2.7rem);
  line-height:1.15;
  margin:0 0 10px;
  letter-spacing:-.01em;
}
.hero p{
  max-width:76ch;
  color:rgba(2,6,23,.72);
  margin:0 0 18px;
}

/* Buttons */
.hero__actions{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin:18px 0 22px;
}

.btn{
  display:inline-block;
  padding:.88rem 1.18rem;
  border-radius:14px;
  border:1px solid rgba(37,99,235,.28);
  background:linear-gradient(180deg, rgba(37,99,235,.22), rgba(37,99,235,.12));
  color:rgba(2,6,23,.92);
  box-shadow:0 12px 30px rgba(37,99,235,.12);
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}
.btn:hover{ filter:brightness(1.02); transform:translateY(-1px); box-shadow:0 16px 44px rgba(37,99,235,.14); }
.btn:active{ transform:translateY(0); }

.btn--ghost{
  background:#fff;
  border-color:var(--border);
  box-shadow:none;
}
.btn--ghost:hover{ border-color:rgba(37,99,235,.22); }

/* Highlights */
.hero__highlights{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:12px;
  margin-top:18px;
}

/* Sections */
.section{ padding:56px 0; }
.section--alt{
  background:linear-gradient(180deg, rgba(37,99,235,.03), rgba(22,163,74,.02));
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border);
}

.section__head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:18px;
}
.section__head h2{
  margin:0;
  font-size:clamp(1.35rem, 2.4vw, 1.85rem);
  padding-bottom:8px;
  position:relative;
}
.section__head h2::after{
  content:"";
  position:absolute;
  left:0; bottom:0;
  width:58px; height:3px;
  border-radius:999px;
  background:linear-gradient(90deg, rgba(37,99,235,.95), rgba(22,163,74,.90));
}
.section__head p{
  margin:0;
  color:var(--muted);
  max-width:72ch;
}

/* Grid */
.grid{ display:grid; gap:14px; }
.grid--3{ grid-template-columns:repeat(3, minmax(0,1fr)); }

/* Cards */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px;
  box-shadow:var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover{
  transform:translateY(-3px);
  box-shadow:var(--shadow2);
  border-color:rgba(37,99,235,.18);
}
.card h3{ margin:0 0 8px; font-weight:600; }
.card p{ margin:0 0 12px; color:rgba(2,6,23,.72); }

.bullets{
  margin:0;
  padding-left:18px;
  color:var(--muted);
}
.bullets li{ margin:7px 0; }

/* Mini blocks */
.mini{
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:14px;
  background:#fff;
  box-shadow:0 10px 24px rgba(2,6,23,.06);
}
.mini__title{ font-weight:600; margin-bottom:4px; }
.mini__text{ color:var(--muted); font-size:.95rem; }

/* Price cards */
.price{ position:relative; overflow:hidden; }
.price__tag{
  display:inline-block;
  font-size:.85rem;
  padding:.35rem .6rem;
  border:1px solid rgba(37,99,235,.18);
  border-radius:999px;
  color:rgba(2,6,23,.70);
  background:rgba(37,99,235,.06);
  margin-bottom:10px;
}
.price__list{ display:grid; gap:8px; color:var(--muted); }

.price--hot{
  border-color:rgba(22,163,74,.22);
  box-shadow:0 18px 52px rgba(22,163,74,.12);
}
.price--hot::after{
  content:"";
  position:absolute;
  inset:-90px -90px auto auto;
  width:190px; height:190px;
  background:radial-gradient(circle at 35% 35%, rgba(22,163,74,.22), transparent 60%);
  transform:rotate(20deg);
}

/* Steps */
.steps{ display:grid; gap:12px; }
.step{
  display:flex;
  gap:14px;
  align-items:flex-start;
  padding:16px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:#fff;
  box-shadow:0 10px 24px rgba(2,6,23,.06);
}
.step__num{
  flex:0 0 auto;
  width:38px; height:38px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:rgba(37,99,235,.12);
  border:1px solid rgba(37,99,235,.18);
  font-weight:700;
  color:rgba(2,6,23,.85);
}
.step h3{ margin:0 0 4px; font-weight:600; }
.step p{ margin:0; color:rgba(2,6,23,.72); }

/* Projects thumbs */
.card--media{
  padding:0;
  overflow:hidden;
}

.thumb{
  width:100%;
  height:220px;
  object-fit:cover;
  display:block;
  border-bottom:1px solid var(--border);
  background:#e5e7eb;
}

.card__body{
  padding:16px 18px;
}

/* Contact cards */
.contact-cards{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:12px;
}
.contact-cards a{
  color:rgba(2,6,23,.86);
  text-decoration: underline;
  text-decoration-color: rgba(2,6,23,.22);
  text-underline-offset: 3px;
  text-decoration-thickness:2px;
}
.contact-cards a:hover{ text-decoration-color: rgba(37,99,235,.65); }

/* Footer */
.footer{
  padding:22px 0;
  border-top:1px solid var(--border);
  background:#ffffff;
}
.footer__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  color:var(--muted);
}
.link{
  color:var(--muted);
  border-bottom:1px dashed rgba(2,6,23,.25);
}
.link:hover{ color:var(--text); }

/* Floating Line CTA */
.fab-line {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #00c300;
  color: #fff;
  padding: 14px 18px;
  border-radius: 999px;
  text-decoration: none;
  z-index: 9999;
  cursor: grab;
  user-select: none;
}
.fab-line:hover{ transform:translateY(-1px); filter:brightness(1.02); }
.fab-line:active{ transform:translateY(0); }

/* Utilities / A11y */
.muted{ color:var(--muted); }

a:focus-visible,
button:focus-visible{
  outline:3px solid var(--ring);
  outline-offset:3px;
  border-radius:12px;
}

/* ปรับ scroll-margin-top ให้สัมพันธ์กับ topbar+header (46 + ประมาณ 68) */
section, footer{ scroll-margin-top: 120px; }

/* ============================================
   Responsive
============================================ */
@media (max-width: 980px){
  .burger{ display:flex; }

  /* Mobile nav dropdown (white) */
  .nav{
    position:absolute;
    right:4vw;
    top:calc(100% + 10px);
    width:min(340px, 92vw);
    display:none;

    flex-direction:column;
    align-items:stretch;
    gap:6px;

    padding:10px;
    border-radius:18px;
    background:#fff;
    border:1px solid var(--border);
    box-shadow:var(--shadow);

    max-height: calc(100vh - 140px);
    overflow:auto;

    transform: translateY(-6px);
    opacity:0;
    transition: opacity .14s ease, transform .14s ease;
  }
  .nav.is-open{ display:flex; opacity:1; transform: translateY(0); }
  .nav a{ padding:.72rem .85rem; color:var(--text); }
  .nav a:hover{ background:rgba(2,6,23,.06); }

  .grid--3{ grid-template-columns:1fr; }
  .hero__highlights{ grid-template-columns:1fr; }
  .contact-cards{ grid-template-columns:1fr; }

  .brand__logo{ width:148px; }
}

/* มือถือเล็ก: แก้ปัญหา TH/EN บัง email โดยทำ topbar เป็น 2 แถว */
@media (max-width: 520px){
  .topbar__inner{
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 0;
  }

  .topbar__left{
    gap: 8px;
  }

  .topbar__right{
    justify-content: flex-end;
  }

  /* ถ้า email ยาว ให้ขึ้นบรรทัดใหม่ */
  .topbar__left a[href^="mailto:"]{
    flex-basis: 100%;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  .btn, .nav, .card, .fab-line{ transition:none !important; }
}

/* =========================
   Home Slider
========================= */
.home-slider{
  position:relative;
  padding:0;
}

.slider{
  position:relative;
  height: clamp(420px, 60vh, 620px);
  overflow:hidden;
  background:#0b1220;
}

.slider__track{
  height:100%;
  display:flex;
  transition: transform 600ms ease;
  will-change: transform;
}

.slider__slide{
  position:relative;
  flex:0 0 100%;
  height:100%;
}

.slider__img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  transform: scale(1.02);
}

.slider__overlay{
  position:absolute;
  inset:0;
  background:
    linear-gradient(90deg, rgba(2,6,23,.78) 0%, rgba(2,6,23,.35) 50%, rgba(2,6,23,.05) 100%),
    linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.08));
}

.slider__content{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  padding: 54px 0;
  color:#fff;
}

.slider__badge{
  display:inline-block;
  width:max-content;
  padding:.38rem .75rem;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.22);
  background:rgba(255,255,255,.08);
  margin-bottom:10px;
}

.slider__content h1,
.slider__content h2{
  margin:0 0 10px;
  line-height:1.15;
  letter-spacing:-.01em;
  font-size:clamp(1.7rem, 3.3vw, 2.6rem);
  max-width:22ch;
}

.slider__content p{
  margin:0 0 16px;
  color:rgba(255,255,255,.82);
  max-width:70ch;
}

.slider__actions{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}

/* ให้ปุ่มบนสไลด์เข้ากับพื้นเข้ม */
.home-slider .btn{
  color:#fff;
  background:linear-gradient(180deg, rgba(37,99,235,.55), rgba(37,99,235,.25));
  border-color:rgba(255,255,255,.14);
  box-shadow:0 18px 55px rgba(0,0,0,.28);
}
.home-slider .btn--ghost{
  background:rgba(255,255,255,.10);
  border-color:rgba(255,255,255,.18);
}

/* arrows */
.slider__btn{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:44px;
  height:44px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.22);
  background:rgba(0,0,0,.25);
  color:#fff;
  font-size:28px;
  line-height:1;
  display:grid;
  place-items:center;
  cursor:pointer;
  z-index:3;
  transition: filter .14s ease, transform .14s ease;
}
.slider__btn:hover{ filter:brightness(1.08); }
.slider__btn:active{ transform:translateY(-50%) scale(.98); }
.slider__btn--prev{ left:14px; }
.slider__btn--next{ right:14px; }

/* dots */
.slider__dots{
  position:absolute;
  left:0; right:0;
  bottom:14px;
  display:flex;
  justify-content:center;
  gap:8px;
  z-index:3;
  padding:0 16px;
}
.slider__dot{
  width:9px;
  height:9px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.35);
  background:rgba(255,255,255,.18);
  cursor:pointer;
}
.slider__dot.is-active{
  width:26px;
  background:rgba(255,255,255,.78);
  border-color:rgba(255,255,255,.85);
}

/* swipe cursor hint */
.slider{ touch-action: pan-y; }

@media (max-width: 980px){
  .slider__btn{ display:none; } /* มือถือใช้ swipe เป็นหลัก */
  .slider__content{ padding: 38px 0; }
  .slider__content h1,
  .slider__content h2{ max-width: 26ch; }
}

.page-title{
  margin:0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.split{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 22px;
  align-items:start;
}

.media-box{
  border:1px solid rgba(15, 23, 42, .10);
  border-radius:18px;
  background: #0b1220;
  overflow:hidden;
  min-height: 320px;
  box-shadow: 0 18px 55px rgba(0,0,0,.08);
}

.media-box__placeholder{
  height:100%;
  min-height: 320px;
  display:grid;
  place-items:center;
  color: rgba(255,255,255,.75);
  background:
    radial-gradient(900px 350px at 30% 30%, rgba(56,189,248,.25), transparent 60%),
    radial-gradient(900px 350px at 70% 70%, rgba(34,197,94,.18), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}

.note{
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(2, 6, 23, .04);
  border: 1px solid rgba(15, 23, 42, .08);
}

@media (max-width: 980px){
  .split{ grid-template-columns: 1fr; }
  .media-box, .media-box__placeholder{ min-height: 220px; }
}

body.is-locked{ overflow:hidden; }

/* ============================================
   Language Toggle Button (แก้: ไม่ fixed แล้ว)
============================================ */
.lang-toggle-wrap {
  display: flex;
  align-items: center;
  /* เอา margin-left เดิมไว้ได้ แต่ไม่จำเป็นเสมอ */
  margin-left: 0;
}

#lang-toggle {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.2s, background 0.2s;
  font-size: 0.95rem;
  color: #fff;
  white-space: nowrap;
}

#lang-toggle:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.lang-flag {
  font-size: 1.1rem;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.lang-flag.active { opacity: 1; }

.lang-sep {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
}

.fab-line {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #00c300;
  color: #fff;
  padding: 14px 18px;
  border-radius: 999px;
  text-decoration: none;
  z-index: 9999;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.fab-line.is-dragging {
  cursor: grabbing;
}