/* ==========================================================================
   Smart Cyber Tech — base.css
   Design tokens / reset / typography / buttons / utilities / animations
   ธีมหลัก: ขาวเป็นพื้น (Light-first) — น้ำเงินกรมท่าแทนสีดำสำหรับตัวอักษร
   ========================================================================== */

:root {
  /* ---- Neutrals (ขาวคือพระเอก) ---- */
  --white:      #ffffff;
  --paper:      #f5f8fd;   /* พื้นหลังสลับส่วน */
  --paper-2:    #ebf2fc;   /* พื้นหลังชั้นสอง */
  --line:       #dde7f5;   /* เส้นขอบ */
  --line-2:     #eef3fa;

  /* ---- Ink (ใช้กรมท่าแทนดำสนิท เพื่อความนุ่มตา) ---- */
  --ink:        #0a1730;   /* หัวเรื่อง */
  --ink-2:      #2c3f63;   /* เนื้อความ */
  --muted:      #6a7e9e;   /* คำอธิบายรอง */

  /* ---- Brand ---- */
  --blue:       #1256e0;
  --blue-700:   #0b41b4;
  --blue-100:   #e3edff;
  --sky:        #00a8f0;
  --sky-100:    #dff4ff;
  --grad:       linear-gradient(100deg, #1256e0 0%, #0f7ddb 55%, #00b4f5 100%);
  --grad-soft:  linear-gradient(120deg, #e8f1ff 0%, #f3f9ff 50%, #e6f7ff 100%);

  /* ---- Deep (ใช้เท่าที่จำเป็น: แถบ CTA, Footer, บล็อกโค้ด) ---- */
  --deep:       #071429;
  --deep-2:     #0d2144;

  /* ---- Effects ---- */
  --sh-xs: 0 1px 2px rgba(10, 30, 70, .06);
  --sh-sm: 0 4px 14px rgba(10, 35, 85, .06);
  --sh-md: 0 14px 34px rgba(10, 35, 85, .09);
  --sh-lg: 0 30px 70px rgba(10, 35, 85, .13);
  --sh-blue: 0 14px 34px rgba(18, 86, 224, .28);

  --r-xs: 8px;
  --r-sm: 12px;
  --r:    18px;
  --r-lg: 26px;
  --r-xl: 34px;
  --r-pill: 999px;

  --ease: cubic-bezier(.22, .68, .3, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --container: 1240px;
  --gutter: 24px;
  --header-h: 82px;

  --f-th: "Noto Sans Thai", "Sarabun", system-ui, sans-serif;   /* ข้อความไทย + เนื้อความหลัก */
  --f-en: "Noto Sans Thai", system-ui, sans-serif;              /* อังกฤษ ตัวเลข ป้ายกำกับ */
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  /* ขยายตัวอักษรทั้งเว็บขึ้นสี่ขั้นจากเดิม (16px → 17px → 18px → 19px → 20px)
     ทำที่ root ได้เพราะทั้งโปรเจกต์ใช้ rem เฉพาะกับ font-size ส่วน layout เป็น px ล้วน
     ระยะห่าง กริด และความกว้างคอนเทนเนอร์จึงไม่ขยับตาม */
  font-size: 20px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--f-th);
  font-size: 1.06rem;   /* ≈19px — Noto Sans Thai เล็กกว่า IBM Plex ราว 5% ที่ขนาดเท่ากัน จึงชดเชยขึ้น */
  font-weight: 400;
  line-height: 1.78;
  color: var(--ink-2);
  background: var(--white);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-locked { overflow: hidden; }

img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

::selection { background: var(--blue); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: #b3cae9; border-radius: 99px; border: 4px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }
/* Firefox ไม่รองรับ ::-webkit-scrollbar — ใช้ scrollbar-width แทน (auto = หนากว่า thin) */
html { scrollbar-width: auto; scrollbar-color: #b3cae9 var(--paper); }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -100px; left: 20px; z-index: 999;
  background: var(--blue); color: #fff; padding: 12px 20px; border-radius: 0 0 12px 12px;
  transition: top .25s var(--ease);
}
.skip-link:focus { top: 0; }

/* ---------- Typography ---------- */
/* Noto Sans Thai เป็นฟอนต์ไทยแบบมีหัว วรรณยุกต์กับสระซ้อนสูงกว่าฟอนต์ละติน
   จึงต้องเผื่อ line-height มากขึ้น และผ่อน letter-spacing ติดลบลง ไม่ให้รูปสระเบียดกัน */
h1, h2, h3, h4 { color: var(--ink); font-weight: 600; line-height: 1.34; letter-spacing: -.005em; }

.h2 {
  font-size: clamp(2rem, 1.35rem + 2.5vw, 3.15rem);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.01em;
}
.h3 { font-size: clamp(1.35rem, 1.15rem + .7vw, 1.75rem); }

.lead { font-size: 1.06rem; color: var(--ink-2); line-height: 1.85; }
/* หัวข้อที่ตามด้วยย่อหน้านำ ต้องได้ระยะเท่ากับ .sec-head__desc (18px)
   ไม่งั้นหมวดที่เขียนโครงเอง (about / faq / contact) จะชิดกว่าหมวดที่ใช้ .sec-head */
:is(h2, .h2) + .lead { margin-top: 18px; }

.grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-en); font-size: .95rem; font-weight: 600;
  /* ข้อความส่วนใหญ่เป็นไทย uppercase ไม่มีผล และ letter-spacing กว้างทำให้สระ-วรรณยุกต์ลอย จึงผ่อนลง */
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-100);
  border: 1px solid #cfe0ff;
  padding: 8px 18px 8px 15px;
  border-radius: var(--r-pill);
  margin-bottom: 20px;
}
.eyebrow__dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--sky);
  box-shadow: 0 0 0 0 rgba(0, 168, 240, .55);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 168, 240, .5); }
  70%  { box-shadow: 0 0 0 9px rgba(0, 168, 240, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 168, 240, 0); }
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding: clamp(72px, 8vw, 128px) 0; position: relative; }

.sec-head { max-width: 720px; margin-bottom: 56px; }
/* หัวข้อกึ่งกลางเผื่อความกว้างมากกว่าหัวข้อชิดซ้าย ไม่ให้ .h2 ภาษาไทยตกบรรทัดคาคำ
   (ไทยไม่มีเว้นวรรคระหว่างคำ เบราว์เซอร์จึงตัดตามพจนานุกรมกลางวลี ซึ่งอ่านแล้วสะดุด)
   ส่วนคำอธิบายคุมความยาวบรรทัดไว้ที่ 720px เท่าเดิมเพื่อให้ยังอ่านสบาย */
.sec-head--center { max-width: 860px; margin-inline: auto; text-align: center; }
.sec-head--center .sec-head__desc { max-width: 720px; margin-inline: auto; }
.sec-head--center .eyebrow { justify-content: center; }
.sec-head--split { max-width: none; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: end; }
.sec-head__desc { margin-top: 18px; color: var(--muted); font-size: 1.03rem; }

/* ---------- Icons ---------- */
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; }
svg.icon use { pointer-events: none; }

/* ---------- Buttons ---------- */
.btn {
  --btn-h: 50px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--btn-h); padding: 0 26px;
  border-radius: var(--r-pill);
  font-family: var(--f-th); font-weight: 600; font-size: .97rem;
  letter-spacing: .01em; white-space: nowrap;
  cursor: pointer; overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease),
              background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}
.btn .icon { width: 1.05em; height: 1.05em; transition: transform .35s var(--ease); }
.btn:hover .icon { transform: translateX(4px); }
.btn:active { transform: translateY(1px) scale(.99); }

.btn--primary { background: var(--grad); color: #fff; box-shadow: var(--sh-blue); background-size: 160% 100%; }
.btn--primary:hover { box-shadow: 0 18px 40px rgba(18, 86, 224, .38); transform: translateY(-3px); background-position: 100% 0; }
.btn--primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.42) 50%, transparent 75%);
  transform: translateX(-120%);
}
.btn--primary:hover::after { animation: shine .9s var(--ease); }
@keyframes shine { to { transform: translateX(120%); } }

.btn--ghost { background: var(--white); color: var(--ink); border: 1.5px solid var(--line); box-shadow: var(--sh-xs); }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-3px); box-shadow: var(--sh-sm); }

.btn--sm { --btn-h: 42px; padding: 0 20px; font-size: .9rem; }
.btn--lg { --btn-h: 58px; padding: 0 34px; font-size: 1.02rem; }
.btn--block { width: 100%; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--blue);
  border-bottom: 1.5px solid transparent; padding-bottom: 2px;
  transition: border-color .3s var(--ease), gap .3s var(--ease);
}
.link-arrow:hover { border-color: var(--blue); gap: 13px; }
.link-arrow .icon { width: 1.05em; height: 1.05em; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .85s var(--ease-out), transform .85s var(--ease-out); will-change: opacity, transform; }
.reveal.is-in { opacity: 1; transform: none; }

/* Split-text (hero headline) */
[data-split] .word { display: inline-block; overflow: hidden; vertical-align: top; }
[data-split] .word > i {
  display: inline-block; font-style: inherit;
  transform: translateY(105%); opacity: 0;
  transition: transform .95s var(--ease-out), opacity .95s var(--ease-out);
}
[data-split].is-in .word > i { transform: none; opacity: 1; }

/* หมายเหตุ: เดิมมีบล็อก @media (prefers-reduced-motion: reduce) ปิด animation ทั้งหน้า
   ถูกถอดออกตามที่ต้องการให้แอนิเมชันทำงานเสมอ ไม่ว่าผู้ใช้ตั้งค่าระบบไว้อย่างไร
   หากต้องการคืนพฤติกรรมเดิม ให้เพิ่มบล็อกกลับที่นี่ พร้อมแก้ js/main.js และ js/particles.js
   ให้อ่านค่า matchMedia('(prefers-reduced-motion: reduce)') ตามเดิม */
