/* =========================================================
   main.css — ไฟล์ CSS หลัก โหลดทุกหน้า
   เก็บเฉพาะ: ตัวแปรสี/ฟอนต์, ตัวอักษร H1–H6/p/strong, ปุ่ม, layout, animation พื้นฐาน
   (Header / Footer / แต่ละหน้า แยกไฟล์ของตัวเอง)
   ========================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
  /* สีหลัก โทนน้ำเงิน–ขาว */
  --c-navy: #071A33;       /* หัวข้อ / พื้นหลังเข้ม */
  --c-navy-2: #0D2A52;
  --c-blue-800: #123E86;
  --c-blue: #1E63D6;       /* สีหลัก (ปุ่ม, ลิงก์) */
  --c-blue-400: #5B9BF0;
  --c-aqua: #8FD3F4;       /* สีน้ำในสระ ใช้เป็น accent */
  --c-blue-100: #E2EDFC;
  --c-blue-50: #F3F8FF;    /* พื้นหลัง section อ่อน */
  --c-white: #FFFFFF;
  --c-line: #DCE6F2;       /* เส้นขอบ */
  --c-muted: #64748B;      /* ข้อความรอง */
  --c-success: #12A150;
  --c-danger: #D93A3A;

  /* สีตัวอักษรแต่ละระดับ */
  --c-h1: var(--c-navy);
  --c-h2: var(--c-navy);
  --c-h3: var(--c-navy);
  --c-h4: var(--c-navy-2);
  --c-h5: var(--c-navy-2);
  --c-h6: var(--c-blue);
  --c-p: #3A4A60;
  --c-strong: var(--c-blue);  /* <strong>, <b> ตัวหนา */

  /* ฟอนต์: Kanit ทั้งเว็บ (หัวข้อใช้น้ำหนักบาง 200–300 ให้ดูหรู) */
  --font: "Kanit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Kanit", system-ui, sans-serif;

  /* ขนาดตัวอักษร (ย่อ/ขยายตามจออัตโนมัติ) */
  --fs-h1: clamp(2.25rem, 1.5rem + 3.4vw, 4.25rem);     /* 36 → 68px */
  --fs-h2: clamp(1.75rem, 1.3rem + 2vw, 3rem);          /* 28 → 48px */
  --fs-h3: clamp(1.375rem, 1.2rem + .8vw, 1.875rem);    /* 22 → 30px */
  --fs-h4: clamp(1.1875rem, 1.1rem + .4vw, 1.5rem);     /* 19 → 24px */
  --fs-h5: 1.125rem;                                    /* 18px */
  --fs-h6: .875rem;                                     /* 14px */
  --fs-p: 1rem;                                         /* 16px */
  --fs-sm: .875rem;                                     /* 14px */
  --fs-xs: .75rem;                                      /* 12px */

  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-bold: 600;

  /* ระยะ / มุม / เงา / การเคลื่อนไหว */
  --container: 1280px;
  --gutter: clamp(1rem, .5rem + 2vw, 2.5rem);
  --section: clamp(5rem, 3.5rem + 5vw, 9rem);
  --radius-sm: 10px;
  --radius: 20px;
  --radius-lg: 32px;
  --radius-ui: 10px;      /* มุมปุ่ม / เมนู / ช่องค้นหา / ป้าย (ทรงเหลี่ยมมน) */
  --shadow-sm: 0 1px 2px rgb(7 26 51 / .05), 0 4px 16px rgb(7 26 51 / .06);
  --shadow: 0 24px 60px -24px rgb(7 26 51 / .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: var(--fs-p);
  font-weight: var(--fw-light);
  line-height: 1.75;
  color: var(--c-p);
  background: var(--c-white);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; object-fit: cover; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--c-blue); text-decoration: none; transition: color .25s var(--ease); }
a:hover { color: var(--c-blue-800); }
ul[class], ol[class] { list-style: none; padding: 0; }
:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 3px; }
::selection { background: var(--c-blue); color: #fff; }

/* ---------- 3. Typography ---------- */
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.015em; text-wrap: balance; }
h4, h5, h6 { line-height: 1.35; text-wrap: balance; }
h1 { font-size: var(--fs-h1); font-weight: 200;               color: var(--c-h1); line-height: 1.15; }
h2 { font-size: var(--fs-h2); font-weight: 200;               color: var(--c-h2); line-height: 1.2; }
h3 { font-size: var(--fs-h3); font-weight: var(--fw-light);   color: var(--c-h3); line-height: 1.3; }
h4 { font-size: var(--fs-h4); font-weight: var(--fw-medium);  color: var(--c-h4); }
h5 { font-size: var(--fs-h5); font-weight: var(--fw-medium);  color: var(--c-h5); }
h6 { font-size: var(--fs-h6); font-weight: var(--fw-medium);  color: var(--c-h6); text-transform: uppercase; letter-spacing: .14em; }
p  { font-size: var(--fs-p);  color: var(--c-p); text-wrap: pretty; }
strong, b { font-weight: var(--fw-medium); color: var(--c-strong); }
em.accent, .accent { font-family: var(--font-display); font-style: italic; color: var(--c-blue); }
small { font-size: var(--fs-sm); }
.text-muted { color: var(--c-muted); }
.lead { font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem); color: var(--c-muted); }

/* ---------- 4. Layout ---------- */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.section { padding-block: var(--section); }
.section--tint { background: var(--c-blue-50); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 200; padding: .5rem 1rem; background: var(--c-navy); color: #fff; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; color: #fff; }
.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; }

/* ---------- 5. Buttons ---------- */
.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 50px; padding: .75rem 1.6rem;
  font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 1.2; letter-spacing: .01em;
  border: 1px solid transparent; border-radius: var(--radius-ui);
  transition: color .4s var(--ease), border-color .4s var(--ease), transform .3s var(--ease), box-shadow .4s var(--ease);
  white-space: nowrap;
}
/* แสงกวาดตอน hover */
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--btn-hover, var(--c-navy)); transform: scaleX(0); transform-origin: right;
  transition: transform .5s var(--ease-out);
}
.btn:hover::before { transform: scaleX(1); transform-origin: left; }
.btn .icon { transition: transform .4s var(--ease-out); }
.btn:hover .icon { transform: translateX(4px); }
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--c-blue); color: #fff; box-shadow: 0 10px 30px -10px rgb(30 99 214 / .6); }
.btn--primary:hover { color: #fff; }
.btn--dark { background: var(--c-navy); color: #fff; --btn-hover: var(--c-blue); }
.btn--dark:hover { color: #fff; }
.btn--light { background: #fff; color: var(--c-navy); --btn-hover: var(--c-blue); }
.btn--light:hover { color: #fff; }
.btn--ghost { border-color: var(--c-line); color: var(--c-navy); background: transparent; }
.btn--ghost:hover { border-color: var(--c-navy); color: #fff; }
.btn--glass { border-color: rgb(255 255 255 / .35); color: #fff; background: rgb(255 255 255 / .1); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); --btn-hover: #fff; }
.btn--glass:hover { color: var(--c-navy); }
.btn--block { width: 100%; }
.btn-round {
  display: inline-grid; place-items: center; width: 52px; height: 52px;
  border: 1px solid var(--c-line); border-radius: var(--radius-ui); background: #fff; color: var(--c-navy);
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease);
}
.btn-round:hover { background: var(--c-navy); border-color: var(--c-navy); color: #fff; }
.btn-round:disabled { opacity: .35; pointer-events: none; }

/* ---------- 6. Section head (ใช้ซ้ำทุกหน้า) ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem; margin-bottom: 1.25rem;
  font-size: var(--fs-xs); font-weight: var(--fw-medium); letter-spacing: .1em; text-transform: uppercase;
  color: var(--c-blue);
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem 3rem; margin-bottom: clamp(2.5rem, 2rem + 2vw, 4rem); }
.section-head__main { max-width: 720px; }
.section-head__side { max-width: 380px; display: grid; gap: 1.25rem; justify-items: start; }
.section-head__side p { color: var(--c-muted); }
.section-head--center { justify-content: center; text-align: center; }

/* ---------- 7. Page hero (หัวหน้าเพจย่อย: รูปพื้นหลังในกรอบโค้ง) ---------- */
.page-hero { padding: .75rem; }
.page-hero__frame {
  position: relative; isolation: isolate; display: flex; align-items: flex-end; overflow: hidden;
  min-height: clamp(460px, 64vh, 640px); padding-block: 8rem clamp(5rem, 4rem + 3vw, 7rem);
  border-radius: var(--radius-lg); background: var(--c-navy); color: #fff;
}
.page-hero__bg { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; }
.page-hero__frame::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgb(7 26 51 / .55), rgb(7 26 51 / .15) 40%, rgb(7 26 51 / .8)); }
.page-hero h1 { max-width: 820px; color: #fff; }
.page-hero p { max-width: 560px; margin-top: 1.25rem; color: rgb(255 255 255 / .8); }
.page-hero .eyebrow, .page-hero .accent { color: var(--c-aqua); }
.page-hero--plain .page-hero__frame { background: linear-gradient(135deg, var(--c-navy), var(--c-blue-800)); }
.page-hero--center .page-hero__frame { align-items: center; justify-content: center; text-align: center; }
.page-hero--center .container { display: grid; justify-items: center; gap: 1rem; }
.page-hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1rem; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; font-size: var(--fs-sm); color: rgb(255 255 255 / .7); }
.breadcrumb li + li::before { content: "/"; margin-right: .5rem; opacity: .5; }
.breadcrumb a { color: rgb(255 255 255 / .7); }
.breadcrumb a:hover { color: #fff; }
.breadcrumb--dark, .breadcrumb--dark a { color: var(--c-muted); }
.breadcrumb--dark a:hover { color: var(--c-blue); }

/* ---------- 8. Rating stars ---------- */
.stars { display: inline-flex; gap: 2px; color: #F5B301; }
.stars .icon { width: 1rem; height: 1rem; }

/* ---------- 9. Motion (ทำงานเมื่อมี JS เท่านั้น) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(40px); transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out); transition-delay: var(--d, 0s); }
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="scale"] { transform: scale(.94); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
/* รูป: ค่อยๆ ลอยขึ้น + ขยายเต็ม + จากเบลอเป็นชัด (นุ่มนวล) */
.js [data-reveal="img"] {
  overflow: hidden; transform: translateY(48px) scale(.96); filter: blur(8px);
  transition: opacity 1.4s var(--ease-out), transform 1.6s var(--ease-out), filter 1.2s var(--ease-out);
  transition-delay: var(--d, 0s);
}
.js [data-reveal="img"].is-in { filter: none; }
.parallax { overflow: hidden; }
.parallax > img, [data-parallax] { will-change: transform; }

/* Smooth scroll (Lenis) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
html:has(dialog[open]) { overflow: hidden; } /* ล็อกหน้าเว็บด้านหลังตอนเปิด popup */

/* แถบความคืบหน้าการเลื่อนหน้า */
.scroll-progress { position: fixed; inset: 0 0 auto; z-index: 120; height: 3px; background: linear-gradient(90deg, var(--c-blue), var(--c-aqua)); transform: scaleX(var(--p, 0)); transform-origin: left; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; }
  .js [data-reveal] { opacity: 1; transform: none; filter: none; }
}

/* ---------- 10. บรรทัดภาษาไทยใต้หัวข้ออังกฤษ (ช่วย SEO คำค้นภาษาไทยใน H1) ---------- */
.h-th {
  display: block; margin-top: 1rem;
  font-family: var(--font); font-size: clamp(.9375rem, .9rem + .25vw, 1.125rem); font-style: normal;
  font-weight: var(--fw-regular); line-height: 1.5; letter-spacing: .02em; opacity: .8;
}

/* =========================================================
   11. Responsive (ปรับต่อจากด้านบน — breakpoint มาตรฐานทั้งเว็บ)
   Desktop ≥1200 · Laptop 992–1199 · Tablet 768–991 · Mobile L 576–767 · Mobile S 320–575
   ========================================================= */
/* ตัดคำยาว (อีเมล, ลิงก์) ไม่ให้ล้นกรอบ */
h1, h2, h3, h4, h5, h6, p, li, dd, dt, blockquote, figcaption, address { overflow-wrap: break-word; }
/* ช่องกรอกข้อมูลทุกช่องไม่ล้นกรอบ */
input, select, textarea { max-width: 100%; }

@media (max-width: 1199px) {
  .section-head { gap: 1.25rem 2rem; }
  .section-head__side { max-width: 340px; }
}

@media (max-width: 991px) {
  :root { --gutter: 16px; }
  .section-head__side { max-width: 560px; }
}

@media (max-width: 767px) {
  .section-head { flex-direction: column; align-items: flex-start; margin-bottom: 2rem; }
  .section-head__side { max-width: none; }
  .lead { font-size: 1.0625rem; }
  p, li { line-height: 1.7; }
}

@media (max-width: 575px) {
  /* กลุ่มปุ่มหลายปุ่ม → เรียงแนวตั้ง เต็มความกว้าง */
  .cta__actions, .feature__actions, .page-hero__actions, .reviews-cta__actions { flex-direction: column; align-items: stretch; width: 100%; max-width: 360px; }
  .cta__actions .btn, .feature__actions .btn, .page-hero__actions .btn, .reviews-cta__actions .btn { width: 100%; }
  .btn { padding-inline: 1.25rem; }
  .page-hero { padding: .5rem; }
  .page-hero__frame { border-radius: var(--radius); }
}

@media (max-width: 375px) {
  :root { --gutter: 12px; }
  h1 { font-size: 2.125rem; }
  h2 { font-size: 1.625rem; }
  h3 { font-size: 1.25rem; }
}

/* ---------- ปุ่มเลื่อนเดือน ‹ เดือน › (ปฏิทินว่าง) ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.month-nav__title { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-navy); text-align: center; }
.month-nav__btn {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0; flex: none;
  border: 1px solid var(--c-line); border-radius: 8px; background: #fff; color: var(--c-navy); cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.month-nav__btn .icon { width: 18px; height: 18px; }
.month-nav__btn:hover:not(:disabled) { border-color: var(--c-blue); background: var(--c-blue-50); }
.month-nav__btn:disabled { opacity: .35; cursor: default; }
a.month-nav__btn { text-decoration: none; }
a.month-nav__btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }
[data-month-panel][hidden] { display: none !important; }
