:root{
  --brand:#2a3693; --brand2:#5b6ad9;
  --text:#0f172a; --muted:#64748b; --line:#e5e7eb;
  --radius:18px;
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;background:#fff;color:var(--text);
  font-family:"Inter","Kanit",system-ui,-apple-system,"Segoe UI","Noto Sans Thai",sans-serif;
  line-height:1.65;
}

.container{max-width:1230px;margin:0 auto;padding:0 20px}
.center{text-align:center}
.tiny{font-size:12px;color:var(--muted)}
.muted{color:var(--muted)}
.p{padding:16px}
.gap{gap:16px}

/* Topbar */
.topbar{background:#f8fafc;border-bottom:1px solid var(--line);font-size:14px;color:#334155}
.topbar .wrap{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:8px 0}

/* Header */
.header{
  background:#2a3693;
  border-bottom:none;
  position:sticky; top:0; z-index:40;
}
.header-inner{display:flex;align-items:center;justify-content:space-between;height:74px}

.logo{height:48px;width:auto}
.brand-name{color:#fff;font-weight:800;font-size:20px}

.nav{display:flex;gap:22px}
.nav a{color:#fff;text-decoration:none;font-weight:700;opacity:.9}
.nav a:hover{opacity:1;text-decoration:underline}
.hide-desktop{display:none}

.brand{
  display:flex;
  flex-direction:column;      /* tagline ใต้โลโก้ */
  align-items:flex-start;
  text-decoration:none;
}
.logo{height:48px;width:auto;display:block;margin-bottom:4px}
.brand-sub{color:#cbd5e1;font-size:12px;font-weight:400}

/* Drawer (mobile nav) */
.drawer{display:none;border-top:1px solid rgba(255,255,255,.15);background:#2a3693}
.drawer.show{display:grid}
.drawer a{padding:12px 20px;border-bottom:1px solid rgba(255,255,255,.15);color:#fff;text-decoration:none}

/* Buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;padding:.85rem 1.25rem;border-radius:14px;font-weight:800;cursor:pointer;border:0}
.btn-primary{background:var(--brand);color:#fff;box-shadow:0 14px 28px rgba(42,54,147,.18)}
.btn-primary:hover{filter:brightness(1.05)}
.btn-dark{background:#7aaee9;color:#111827}
.btn-outline{border:2px solid #fff;background:transparent;color:#fff}
.btn-outline:hover{background:#fff;color:#2a3693}

/* Hero */
.hero{position:relative;background:linear-gradient(180deg,#f6f7ff,#ffffff)}
.hero-wrap{display:grid;grid-template-columns:1.1fr .9fr;gap:24px;align-items:center;padding:30px 0 18px}
.hero-left h1{font-size:clamp(28px,4vw,46px);line-height:1.2;color:var(--brand);margin:0 0 .6rem 0}
.lead{color:#334155;margin:0 0 1rem}
.hero-right{position:relative;border-radius:22px;overflow:hidden;box-shadow:0 22px 44px rgba(2,6,23,.12)}
.hero-right img{display:block;width:100%;height:auto}
.hero-right .cta{position:absolute;bottom:16px;left:16px}

/* Sections */
.section{padding:54px 0}
.section h2{font-size:clamp(22px,3vw,32px);color:var(--brand);margin:0 0 .8rem 0}

/* Grid */
.grid{display:grid;gap:18px}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}

/* Service cards — FIX overlap */
.svc{
  display:flex;                 /* จาก grid -> flex แนวตั้ง */
  flex-direction:column;
  border-radius:18px;
  overflow:hidden;
  border:1px solid var(--line);
  background:#fff;
}

.svc img{
  width:100%;
  height:auto;
  aspect-ratio:16/10;           /* รักษาสัดส่วนภาพ แทนการฟิกซ์ความสูง */
  object-fit:cover;
  display:block;
}

.svc .body{ padding:14px }
.svc h3{ margin:.2rem 0 .2rem 0; color:#0f1a5c }
.svc p{ margin:0; color:var(--muted) }

/* มือถือ: ให้รูปเตี้ยลงเล็กน้อย+เว้นในเนื้อหา */
@media (max-width:480px){
  .svc img{ aspect-ratio:16/11; }
  .svc .body{ padding:12px }
}


/* Mission */
.mission{display:grid;grid-template-columns:1.2fr .8fr;gap:24px;align-items:center}
.collage{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.collage img{width:100%;height:180px;object-fit:cover;border-radius:16px}

/* Stats */
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-top:8px}
.stat{border:1px solid var(--line);border-radius:16px;padding:16px;text-align:center}
.stat .num{font-size:26px;font-weight:800;color:var(--brand)}
.stat .txt{color:var(--muted);font-size:14px}

/* Projects dark band */
.projects{background:#2a3693;color:#e5e7eb;padding:60px 0}
.projects .title{color:#fff;text-align:center;margin:0 0 .6rem 0}
.mosaic{display:grid;grid-template-columns:2fr 1fr 1fr;gap:12px}
.mosaic img{width:100%;height:260px;object-fit:cover;border-radius:12px}
.mosaic .tall{height:532px}

/* Contact form */
form.card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 6px 16px rgba(0,0,0,.06)}
form label{display:block;font-weight:600;margin:12px 0 4px;color:var(--brand)}
form input,form textarea,form select{width:100%;padding:.8rem 1rem;border:1px solid var(--line);border-radius:12px;font:inherit;outline:none;transition:.2s}
form input:focus,form textarea:focus,form select:focus{border-color:var(--brand);box-shadow:0 0 0 2px rgba(42,54,147,.15)}
form textarea{resize:vertical;min-height:100px}
form button.btn{margin-top:14px;width:100%;justify-content:center}

/* Footer */
.footer{border-top:1px solid var(--line);padding:20px 0;color:var(--muted)}

/* Social & Map */
.social{display:flex;gap:14px;margin:14px 0}
.social img{width:32px;height:32px;display:block;transition:.2s}
.social img:hover{transform:scale(1.1)}
.map{margin-top:16px;border-radius:12px;overflow:hidden;box-shadow:0 4px 12px rgba(0,0,0,.1)}

/* Responsive */
@media (max-width:1024px){
  .mosaic{grid-template-columns:1fr 1fr}
  .mosaic .tall{height:260px}
}
@media (max-width:900px){
  .nav{display:none}
  .hide-desktop{display:inline-flex}
  .hero-wrap{grid-template-columns:1fr}
  .mission{grid-template-columns:1fr}
  .grid-3{grid-template-columns:1fr 1fr}
}
@media (max-width:640px){
  .grid-2,.grid-3{grid-template-columns:1fr}
}

/* ปุ่มลิงก์ไม่ให้มีเส้นใต้ */
.btn,.btn:link,.btn:visited{ text-decoration:none !important }

/* ===== Mobile polish (<=480px) ===== */
@media (max-width:480px){

  /* topbar ซ้อนบรรทัด */
  .topbar .wrap{flex-direction:column;gap:4px;font-size:13px}

  /* header */
  .header-inner{height:64px}
  .brand-sub{font-size:11px}

  /* hero */
  .hero-wrap{gap:12px;padding:18px 0}
  .hero-left h1{font-size:24px;line-height:1.25;margin-bottom:.5rem}
  .lead{font-size:14px}
  .hero-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .btn{padding:.75rem 1rem;border-radius:12px}
  .hero-right{border-radius:16px}
  .hero-right .cta .btn{padding:.6rem .9rem;font-size:14px}

  /* services */
  .svc{grid-template-rows:180px auto}
  .svc .body{padding:12px}

  /* mission & stats */
  .mission{gap:16px}
  .collage img{height:140px}
  .stats{grid-template-columns:repeat(2,1fr);gap:12px;margin-top:10px}
  .stat{padding:12px}
  .stat .num{font-size:22px}
  .section .btn{margin-bottom:10px;box-shadow:0 10px 18px rgba(2,6,23,.10)}

  /* projects */
  .projects{padding:40px 0}
  .mosaic{grid-template-columns:1fr}
  .mosaic img,.mosaic .tall{height:200px}

  /* contact */
  .social{gap:12px}
  .social img{width:28px;height:28px}
  .map iframe{height:220px}

  /* section spacing */
  .section{padding:34px 0}
}

@media (max-width:640px){
  .topbar .wrap{
    flex-wrap:wrap;             /* บังคับขึ้นบรรทัดใหม่ถ้าพื้นที่ไม่พอ */
    justify-content:space-between;
    font-size:13px;             /* ย่อขนาดฟอนต์ */
    gap:6px;
  }
  .topbar{
    padding:6px 0;              /* เว้นช่องบน–ล่าง */
  }
  .header-inner{
    margin-top:0;                /* ไม่ให้โดนดันลง */
  }
}

/* About */
.about-grid{
  display:grid;
  grid-template-columns:1.05fr .95fr;
  gap:26px;
  align-items:center;
}
.about .img-wrap{
  position:relative;
  border-radius:20px;
  overflow:hidden;
  box-shadow:0 18px 38px rgba(2,6,23,.10);
}
.about .img-wrap img{width:100%;height:auto;display:block}
.about .badge{
  position:absolute; left:16px; bottom:16px;
  background:#fff; color:var(--text);
  border:1px solid var(--line);
  border-radius:14px; padding:10px 14px;
  box-shadow:0 10px 18px rgba(0,0,0,.08);
}
.about .badge strong{color:var(--brand)}
.about-content h2{color:var(--brand);margin:0 0 .6rem 0}
.about .features{
  margin:14px 0 6px; padding:0; list-style:none;
  display:grid; gap:10px;
}
.about .features li{
  position:relative; padding-left:30px; color:#334155;
}
.about .features li::before{
  content:""; position:absolute; left:0; top:.45rem;
  width:18px; height:18px; border-radius:50%;
  background:conic-gradient(from 180deg, var(--brand), var(--brand2));
  box-shadow:0 0 0 3px #eef2ff inset;
}
.kpis{
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:14px; margin:14px 0 6px;
}
.kpi{
  border:1px solid var(--line); border-radius:14px;
  text-align:center; padding:12px;
  background:#fff;
}
.kpi .num{color:var(--brand); font-weight:800; font-size:26px; line-height:1}
.kpi .txt{color:var(--muted); font-size:14px}
.about .cta-row{display:flex; gap:12px; margin-top:8px}

/* Responsive for About */
@media (max-width:900px){
  .about-grid{grid-template-columns:1fr; gap:18px}
}
@media (max-width:480px){
  .about .badge{left:12px; bottom:12px; padding:8px 12px}
  .kpis{grid-template-columns:repeat(3,1fr)}
  .about .cta-row{flex-wrap:wrap}
}
/* ========== Hero Slider ========== */
.slider{
  position:relative;
  border-radius:22px;
  overflow:hidden;
  box-shadow:0 22px 44px rgba(2,6,23,.12);
  background:#eef2ff;
  aspect-ratio: 16/9;            /* ช่วยรักษาสัดส่วน */
}
.slider .slide{
  position:absolute; inset:0;
  opacity:0; transition:opacity .45s ease;
  will-change:opacity;
}
.slider .slide.active{ opacity:1 }
.slider img{ width:100%; height:100%; object-fit:cover; display:block }

/* arrows */
.slider .nav{
  position:absolute; top:50%; transform:translateY(-50%);
  width:40px; height:40px; border-radius:999px; border:0;
  background:rgba(17,24,39,.55); color:#fff; font-size:24px; line-height:1;
  display:grid; place-items:center; cursor:pointer;
  transition:background .2s;
}
.slider .nav:hover{ background:rgba(17,24,39,.75) }
.slider .prev{ left:10px }
.slider .next{ right:10px }

/* dots */
.slider .dots{
  position:absolute; left:0; right:0; bottom:10px;
  display:flex; gap:8px; justify-content:center; align-items:center;
}
.slider .dots button{
  width:9px; height:9px; border-radius:999px; border:0;
  background:rgba(255,255,255,.55); cursor:pointer;
}
.slider .dots button[aria-current="true"]{ background:#fff }

/* มือถือให้ปุ่มเล็กลง */
@media (max-width:480px){
  .slider{ border-radius:16px; aspect-ratio: 16/10; }
  .slider .nav{ width:34px; height:34px; font-size:20px }
}
/* ซ่อน topbar บนจอเล็กกว่า 640px */
@media (max-width:640px){
  .topbar {
    display:none;
  }
}
/* ให้สไลเดอร์รับ gesture แนวนอนได้ดีบนมือถือ */
.slider{ touch-action: pan-y; }
.slider .nav{ pointer-events:auto; } /* ป้องกันปุ่มกดไม่ได้บน iOS */

.icon {
  width: 18px;
  height: 18px;
  margin-right: 6px;
  vertical-align: middle;
  fill: var(--brand);
  filter: invert(16%) sepia(70%) saturate(5400%) hue-rotate(225deg) brightness(92%) contrast(96%);
}
/* Contact list with text icons */
.contact-list{
  list-style:none; padding:0; margin:0 0 6px 0;
  display:grid; gap:8px;
}
.contact-list .ico{
  display:inline-block; width:22px;
  margin-right:6px; text-align:center;
  font-size:16px; transform:translateY(1px);
}
/* ปุ่มเมนู */
.menu-btn{
  display:none;
  background:transparent;
  border:2px solid #fff;
  color:#fff;
  border-radius:10px;
  font-weight:800;
  font-size:20px;
  padding:6px 12px;
  cursor:pointer;
  transition:.2s;
}
.menu-btn:hover{ background:#fff; color:var(--brand) }

/* เมนูมือถือ */
.drawer{
  display:none;
  background:#2a3693;
  border-top:1px solid rgba(255,255,255,.15);
}
.drawer.show{ display:grid }
.drawer a{
  color:#fff; text-decoration:none; font-weight:600;
  padding:14px 20px; border-bottom:1px solid rgba(255,255,255,.15);
}
.drawer a:hover{ background:rgba(255,255,255,.08) }

/* แสดงปุ่ม/ซ่อน nav เมื่อจอเล็ก */
@media (max-width:900px){
  .nav{ display:none }
  .menu-btn{ display:block }
}
/* ===== Mobile polish (header + hero) ===== */
@media (max-width:640px){

  /* เคารพ notch และเพิ่ม padding ซ้าย-ขวาให้ header */
  .header{
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  /* ไม่ต้องซ้อน padding จาก .container เดิม */
  .header .container{ padding:0 }

  .header-inner{
    height:66px;
    gap:10px;              /* ระยะห่างระหว่างโลโก้กับปุ่ม */
  }

  /* โลโก้เล็กลงนิด ให้หายอึดอัด */
  .logo{ height:40px }
  .brand-sub{ font-size:11px }

  /* ปุ่มเมนูให้มีพื้นที่รอบ ๆ มากขึ้น */
  .menu-btn{
    padding:8px 12px;
    border-radius:12px;
    box-shadow:0 2px 10px rgba(0,0,0,.12);
  }

  /* container ของ hero ให้เว้นขอบด้วยเช่นกัน */
  .hero .container{
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  /* ปุ่ม CTA ไม่ให้ชิดขอบเกินไป */
  .hero-actions{ gap:10px }
}
