/* ============================================================
   Sentiara AI — Design System
   Editorial / Case-Study aesthetic · dark, warm, high-contrast
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  /* surface */
  --bg:          #08080a;
  --bg-soft:     #0d0e12;
  --surface:     #121419;
  --surface-2:   #171a21;
  --line:        rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);

  /* ink */
  --text:        #eceae5;
  --text-dim:    #b3b7bf;
  --muted:       #868d99;

  /* accent — ไล่สีเดียวกับโลโก้ Sentiara (ฟ้า → น้ำเงิน → ม่วง → ชมพู) */
  --accent:      #35c9f5;   /* logo cyan — CTA, numbers */
  --accent-ink:  #04151d;   /* text on accent */
  --violet:      #9d5bf6;
  --cyan:        #22c3f3;
  --pink:        #f181e6;
  --amber:       #ffb454;
  --brand-grad:  linear-gradient(105deg, #22c3f3, #4f5ef2 45%, #9d5bf6 72%, #f181e6);
  --danger:      #ff6b6b;

  /* type */
  --font-display: 'Anuphan', 'Noto Sans Thai', system-ui, sans-serif,
                  'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji';
  --font-body:    'IBM Plex Sans Thai', 'Noto Sans Thai', system-ui, sans-serif,
                  'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji';
  --font-serif:   'Instrument Serif', 'Noto Serif Thai', Georgia, serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  /* scale */
  --step--1: clamp(0.875rem, 0.85rem + 0.14vw, 0.95rem);
  --step-0:  clamp(0.98rem, 0.94rem + 0.2vw, 1.08rem);
  --step-1:  clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  --step-2:  clamp(1.45rem, 1.25rem + 1vw, 2.1rem);
  --step-3:  clamp(1.9rem, 1.5rem + 2vw, 3.1rem);
  --step-4:  clamp(2.5rem, 1.7rem + 3.6vw, 4.6rem);
  --step-5:  clamp(3.1rem, 1.6rem + 6.4vw, 7.4rem);

  /* space */
  --gutter:  clamp(1.15rem, 4vw, 3.5rem);
  --section: clamp(4.5rem, 9vw, 9.5rem);
  --max:     1280px;
  --radius:  20px;
  --radius-lg: 30px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* หมายเหตุ: เว็บนี้ตั้งใจไม่รองรับ prefers-reduced-motion — เจ้าของเว็บตัดสินใจเอง
   เดิมตรงนี้มีกฎ blanket ที่บังคับ animation-duration เหลือ 0.001ms กับทุก element
   ผลคือแถบข้อความวิ่ง (.marquee) จบอนิเมชันทันทีแล้วค้างนิ่งถาวร บนเครื่องที่เปิด
   Reduce Motion ไว้ ซึ่งเป็นค่าที่คนเปิดกันเยอะบน iOS โดยไม่รู้ตัว
   ทำซ้ำได้: Chrome + emulateMediaFeatures prefers-reduced-motion=reduce
     ปิด → ขยับ -61.5 px/1.5วิ · duration 46s · iteration infinite
     เปิด → ขยับ   0.0 px/1.5วิ · duration 1e-06s · iteration 1
   ถ้าวันหลังจะกลับมารองรับ อย่าใช้ blanket แบบเดิม ให้เลือกปิดเป็นตัว ๆ ไป
   และเว้น .marquee ไว้ หรือเปลี่ยนแถบเป็นรายการที่เลื่อนเองด้วยนิ้วแทน */

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.72;
  font-feature-settings: 'liga' 1, 'kern' 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, canvas, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
ul, ol { padding: 0; list-style: none; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.7rem 1.2rem; border-radius: 0 0 12px 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- 3. Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section); position: relative; }
.section--tight { padding-block: clamp(3rem, 6vw, 6rem); }
.section--line { border-top: 1px solid var(--line); }

.grid { display: grid; gap: clamp(1.2rem, 2.5vw, 2rem); }
/* grid items default to min-width:auto — that lets wide children (tables) push the page wider */
.grid > *, .split > *, .calc > *, .dept-grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }

/* ---------- 4. Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  /* ไทยต้องการที่ว่างเหนือ-ใต้เส้นฐานมากกว่าละติน (สระบน + วรรณยุกต์ซ้อน + สระล่าง) */
  line-height: 1.45;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h3, h4 { line-height: 1.45; }
h1 { font-size: var(--step-5); font-weight: 700; letter-spacing: -0.035em; }
h2 { font-size: var(--step-4); letter-spacing: -0.03em; }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p  { text-wrap: pretty; }

.serif   { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: 0;
           font-synthesis-style: none; }
.mono    { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: 0.02em; }
.lead    { font-size: var(--step-1); color: var(--text-dim); line-height: 1.68; max-width: 62ch; }
.muted   { color: var(--muted); }
.dim     { color: var(--text-dim); }
.accent  { color: var(--accent); }
.center  { text-align: center; }
.measure { max-width: 68ch; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.4rem;
}
.eyebrow::before {
  content: ''; width: 26px; height: 1px; background: var(--accent); flex: none;
}
.eyebrow--plain::before { display: none; }

.section-head { max-width: 900px; margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.section-head p { margin-top: 1.3rem; }

/* highlight sweep on key words */
.hl { color: var(--accent); }
.hl-underline {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 92%;
  background-size: 100% 0.14em;
  padding-inline: 0.05em;
}

/* ---------- 5. Buttons & tags ---------- */
.btn {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  padding: 0.95rem 1.7rem;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid transparent; border-radius: 100px;
  font-family: var(--font-display); font-weight: 600; font-size: var(--step-0);
  cursor: pointer;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease), color 0.35s var(--ease);
  will-change: transform;
}
/* เอฟเฟกต์ที่ต้องมีเมาส์จริงเท่านั้น — บนจอสัมผัส :hover ติดค้างหลังนิ้วแตะ
   และไม่ปลดเองจนกว่าจะไปแตะที่อื่น ปุ่มที่เพิ่งกดจึงลอยค้างอยู่อย่างนั้น
   (ท่าเดียวกับที่ใช้กับแถบ .marquee และเมนูดรอปดาวน์ในจอเล็ก) */
@media (hover: hover) {
  .btn:hover { transform: translateY(-2px); }
}
.btn svg { width: 1.05em; height: 1.05em; }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--sm { padding: 0.62rem 1.15rem; font-size: var(--step--1); }
.btn--lg { padding: 1.05rem 2.1rem; font-size: var(--step-1); font-weight: 700; }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn--ghost:hover { background: rgba(255,255,255,0.05); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.4rem; }

.tag {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.34rem 0.85rem;
  border: 1px solid var(--line); border-radius: 100px;
  font-family: var(--font-mono); font-size: 0.84rem; letter-spacing: 0.04em;
  color: var(--text-dim); background: rgba(255,255,255,0.02);
}
.tag--accent { border-color: rgba(53,201,245,0.45); color: var(--accent); }

/* ป้ายสถานะงาน — แยก "ติดตั้งแล้ว" ออกจาก "ออกแบบแล้ว" ให้เห็นชัดตั้งแต่สายตาแรก
   อย่ารวมสามตัวนี้เป็นสีเดียว: จุดประสงค์ทั้งหมดของมันคือให้ลูกค้าแยกออกโดยไม่ต้องอ่าน */
.tag--live  { border-color: rgba(93,220,154,0.45); color: #5ddc9a;     background: rgba(93,220,154,0.07); }
.tag--pilot { border-color: rgba(53,201,245,0.45); color: var(--cyan);  background: rgba(53,201,245,0.07); }
.tag--plan  { border-color: rgba(255,180,84,0.45); color: var(--amber); background: rgba(255,180,84,0.07); }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---------- 6. Header / nav ---------- */
.nav-progress {
  position: fixed; inset: 0 auto auto 0; height: 2px; width: 0%;
  background: var(--accent); z-index: 120; transition: width 0.1s linear;
}
.header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: rgba(8, 8, 10, 0.72);
  border-bottom: 1px solid transparent;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}
.header.is-stuck { background: rgba(8,8,10,0.94); border-bottom-color: var(--line); }
.header__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: 68px;
}
.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-family: var(--font-display); font-weight: 700; font-size: 1.14rem; letter-spacing: -0.02em; }
.brand__mark { width: 30px; height: 30px; flex: none; }
.brand span.dim { font-weight: 400; }

.nav__list { display: flex; align-items: center; gap: clamp(0.1rem, 0.8vw, 0.7rem); }
.nav__item { position: relative; }

.nav__top,
.nav a:not(.btn) {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.55rem 0.7rem;
  background: none; border: 0; border-radius: 10px;
  font-family: var(--font-body); font-size: var(--step--1); color: var(--text-dim);
  cursor: pointer;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}
.nav__top:hover,
.nav__item--menu:hover > .nav__top,
.nav__top[aria-expanded="true"],
.nav__top[data-current="true"] { color: var(--text); background: rgba(255,255,255,0.05); }
.nav__caret {
  width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.25s var(--ease);
}
.nav__top[aria-expanded="true"] .nav__caret { transform: rotate(180deg); }

.nav__menu {
  position: absolute; top: calc(100% + 8px); left: 50%; translate: -50% 0;
  min-width: 292px;
  display: grid; gap: 2px;
  padding: 0.5rem;
  background: rgba(14, 16, 22, 0.98);
  border: 1px solid var(--line-strong); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  /* หน่วง visibility ไว้ตอนซ่อนเท่านั้น ถ้าใส่ไว้ใน transition ตรง ๆ เมนูจะยัง
     hidden ระหว่างเฟด ทำให้โฟกัสด้วยคีย์บอร์ดเข้าไม่ได้ */
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), visibility 0s linear 0.22s;
  z-index: 5;
}
.nav__item--menu:hover > .nav__menu,
.nav__item--menu:focus-within > .nav__menu,
.nav__top[aria-expanded="true"] + .nav__menu {
  opacity: 1; visibility: visible; transform: translateY(0);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), visibility 0s linear 0s;
}
.nav__menu a {
  display: grid; gap: 0.15rem;
  padding: 0.6rem 0.75rem; border-radius: 11px;
  color: var(--text);
  transition: background 0.2s var(--ease);
}
.nav__menu a:hover, .nav__menu a:focus-visible { background: rgba(53,201,245,0.10); }
.nav__menu a[aria-current="page"] { background: rgba(53,201,245,0.14); }
.nav__name { font-family: var(--font-display); font-weight: 600; font-size: var(--step-0); }
.nav__desc { font-size: 0.82rem; color: var(--muted); line-height: 1.5; }

.nav-toggle {
  display: none; align-items: center; gap: 0.5rem;
  background: none; border: 1px solid var(--line-strong); border-radius: 100px;
  padding: 0.5rem 0.95rem; cursor: pointer; font-size: var(--step--1);
}

@media (max-width: 1080px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: fixed; inset: 68px 0 auto 0;
    background: var(--bg-soft); border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--gutter) 1.5rem;
    transform: translateY(-140%); transition: transform 0.45s var(--ease);
    max-height: calc(100dvh - 68px); overflow-y: auto;
  }
  .nav[data-open="true"] { transform: translateY(0); }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__item { border-bottom: 1px solid var(--line); }
  .nav__item:last-child { border-bottom: 0; }
  .nav__top { width: 100%; justify-content: space-between; padding: 1rem 0.25rem; font-size: var(--step-0); }
  .nav__menu {
    position: static; translate: none; transform: none; min-width: 0;
    background: none; border: 0; box-shadow: none; padding: 0 0 0.6rem 0.25rem;
    display: none; opacity: 1; visibility: visible;
  }
  .nav__item--menu:hover > .nav__menu,
  .nav__item--menu:focus-within > .nav__menu { display: none; }
  .nav__top[aria-expanded="true"] + .nav__menu { display: grid; }
  .nav .btn { width: 100%; margin-top: 1.1rem; }
}

/* ---------- 7. Hero ---------- */
.hero { position: relative; padding-top: clamp(2.4rem, 5vw, 4.2rem); padding-bottom: clamp(3rem, 6vw, 5rem); overflow: hidden; }
.hero__glow {
  position: absolute; z-index: 0; pointer-events: none;
  width: min(1100px, 130vw); aspect-ratio: 1;
  top: -45%; left: 50%; translate: -50% 0;
  background: radial-gradient(circle at 50% 50%, rgba(157,91,246,0.16), rgba(53,201,245,0.07) 38%, transparent 66%);
  filter: blur(20px);
}
/* หัวข้อ hero จำกัดขนาดไว้ ไม่ให้ดันปุ่มหลักตกใต้ fold บนจอเดสก์ท็อป */
.hero h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(2.35rem, 1.5rem + 3.3vw, 4.15rem);
  line-height: 1.42;
}
.hero h1 .serif { color: var(--accent); }
.hero__sub {
  max-width: 54ch; margin-bottom: 2rem;
  font-size: clamp(1.02rem, 0.96rem + 0.35vw, 1.28rem);
  line-height: 1.72; color: var(--text-dim);
}
.hero__cta { margin-top: 0; margin-bottom: 2.6rem; }
.hero__meta {
  display: flex; flex-wrap: wrap; gap: clamp(1.2rem, 3.5vw, 3.4rem);
  padding-top: 1.6rem; border-top: 1px solid var(--line);
}
.hero__meta div { min-width: 130px; }
.hero__meta dt { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.hero__meta dd { margin: 0.35rem 0 0; font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); }

/* ฉากเมืองเคลื่อนไหวหลัง hero เป็นบรรยากาศ ห้ามแย่งความสนใจไปจากข้อความ */
.hero--landing { padding-bottom: clamp(3.5rem, 7vw, 6rem); }
.hero__scene { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hero__scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(100deg, rgba(8,8,10,0.96) 0%, rgba(8,8,10,0.9) 42%, rgba(8,8,10,0.58) 72%, rgba(8,8,10,0.42) 100%),
    linear-gradient(180deg, rgba(8,8,10,0.82) 0%, rgba(8,8,10,0.34) 42%, rgba(8,8,10,0.92) 100%);
}
.hero__inner { position: relative; z-index: 2; }
@media (max-width: 720px) {
  /* เดิมทึบ 0.80-0.96 ซึ่งกลบพื้นหลังเมืองจนแทบมองไม่เห็นว่ามีอะไรเคลื่อนไหวอยู่
     เปิดให้บางลงตรงกลางที่ไม่มีตัวอักษรทับ แล้วคงความทึบไว้ตรงหัวและท้ายที่มีข้อความ
     พื้นหลังวาดที่ความสว่างราว 20/255 อยู่แล้ว ต่อให้เปิดถึง 0.55 ก็ยังเข้มพอสำหรับ contrast */
  .hero__scrim {
    background: linear-gradient(180deg,
      rgba(8,8,10,0.86) 0%, rgba(8,8,10,0.55) 38%, rgba(8,8,10,0.62) 62%, rgba(8,8,10,0.94) 100%);
  }
}

/* line-reveal เดิม ใช้กับหน้าอื่น */
.reveal-line {
  display: block; overflow: hidden;
  padding-block: 0.22em 0.18em;
  margin-block: -0.22em -0.18em;
}
.reveal-line > span {
  display: block;
  transform: translateY(135%);
  animation: lineUp 1s var(--ease) forwards;
}
.reveal-line:nth-of-type(2) > span { animation-delay: 0.1s; }
.reveal-line:nth-of-type(3) > span { animation-delay: 0.2s; }
@keyframes lineUp { to { transform: translateY(0); } }

/* ---------- 7.5 Value ---------- */
.value__item { position: relative; padding-top: 2.7rem; }
.value__num {
  position: absolute; top: 0; left: 0;
  font-family: var(--font-mono); font-size: 0.86rem; letter-spacing: 0.16em; color: var(--accent);
}
.value__item::before {
  content: ""; position: absolute; top: 0.6rem; left: 2.7rem; right: 0; height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
.value__item h3 { font-size: var(--step-1); margin-bottom: 0.7rem; }
.value__item p { color: var(--text-dim); }

/* ---------- 8. Marquee ---------- */
.marquee {
  border-block: 1px solid var(--line);
  padding-block: 1.15rem;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
}
.marquee__track {
  display: flex; width: max-content; gap: 3rem;
  animation: slide 46s linear infinite;
  /* ยกเป็นเลเยอร์ของตัวเอง แถบนี้เลื่อนตลอดเวลาอยู่แล้ว จะได้ไม่ต้องวาดใหม่ทั้งแถวทุกเฟรม */
  will-change: transform;
}
/* หยุดแถบตอนเอาเมาส์ชี้ — ให้เฉพาะเครื่องที่มีเมาส์จริงเท่านั้น
   บนมือถือ :hover จะติดค้างหลังนิ้วแตะหรือปัดผ่าน และไม่มีทางปลดเองจนกว่าจะแตะที่อื่น
   แถบกินความกว้างเต็มจอ เลื่อนหน้าทีไรนิ้วก็ผ่านมันทุกที แถบเลยหยุดถาวร
   (main.js:132 ใช้ท่าเดียวกันนี้กับเอฟเฟกต์เอียงการ์ดอยู่แล้ว ตรงนี้แค่ตกหล่นไป) */
@media (hover: hover) and (pointer: fine) {
  .marquee:hover .marquee__track { animation-play-state: paused; }
}
.marquee__item {
  display: inline-flex; align-items: center; gap: 0.9rem;
  font-family: var(--font-display); font-size: var(--step-1); font-weight: 500;
  color: var(--text-dim); white-space: nowrap;
}
.marquee__item b { color: var(--accent); font-weight: 700; }
.marquee__item::after { content: '✦'; color: var(--muted); font-size: 0.7em; margin-left: 0.9rem; }
@keyframes slide { to { transform: translateX(-50%); } }

/* ---------- 8.5 Icons (Lucide · ISC) ---------- */
.icon {
  display: inline-block; flex: none;
  width: 1em; height: 1em;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  overflow: visible;
}
/* ไอคอนที่อยู่หน้าหัวข้อ — จัดให้อยู่ระดับเดียวกับตัวอักษร */
.icon--h {
  width: 1.05em; height: 1.05em;
  vertical-align: -0.12em;
  margin-right: 0.5rem;
}

/* ---------- 9. Cards ---------- */
.card {
  position: relative;
  background: linear-gradient(160deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 2.4vw, 2.1rem);
  transition: border-color 0.45s var(--ease), transform 0.45s var(--ease), background 0.45s var(--ease);
  overflow: hidden;
}
.card::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(53,201,245,0.1), transparent 62%);
  opacity: 0; transition: opacity 0.45s var(--ease);
}
/* ยกการ์ดขึ้นและเปิดแสงตามเมาส์ — เฉพาะเครื่องที่มีเมาส์ (เหตุผลเดียวกับ .btn:hover)
   ตรงนี้สำคัญกว่าที่อื่น เพราะ --mx/--my ตั้งจาก main.js ที่เช็ค hover:hover ไว้แล้ว
   บนมือถือค่าจึงค้างที่ค่าเริ่มต้น 50%/0% กลายเป็นแสงฟ้าก้อนใหญ่ค้างบนการ์ดที่เพิ่งแตะ */
@media (hover: hover) {
  .card:hover { border-color: var(--line-strong); transform: translateY(-4px); }
  .card:hover::after { opacity: 1; }
}
.card h3 { margin-bottom: 0.7rem; }
.card p { color: var(--text-dim); font-size: var(--step-0); }

/* feature — numbered case-study card */
.feature { display: flex; flex-direction: column; gap: 1rem; }
.feature__top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.feature__num {
  font-family: var(--font-mono); font-size: 0.86rem; letter-spacing: 0.14em; color: var(--accent);
}
.feature__icon { width: 1.7rem; height: 1.7rem; color: var(--accent); }
.feature__title { font-size: var(--step-2); }
.feature__hook { font-family: var(--font-serif); font-style: italic; font-size: var(--step-1); color: var(--text); line-height: 1.45;
                 font-synthesis-style: none; }
.feature ul { display: grid; gap: 0.55rem; margin-top: 0.3rem; }
.feature li {
  position: relative; padding-left: 1.35rem; color: var(--text-dim); font-size: var(--step--1); line-height: 1.6;
}
.feature li::before {
  content: ''; position: absolute; left: 0; top: 0.62em;
  width: 6px; height: 6px; border-radius: 2px; background: var(--accent); opacity: 0.75;
}
.feature__foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }

/* stat */
.stat { padding: clamp(1.3rem, 2vw, 1.8rem); border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,0.015); }
.stat__num {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.1rem, 4.4vw, 3.4rem); line-height: 1; letter-spacing: -0.04em;
  color: var(--text); display: flex; align-items: baseline; gap: 0.15rem;
}
.stat__num small { font-size: 0.42em; color: var(--accent); font-weight: 600; letter-spacing: 0; }
.stat__label { margin-top: 0.7rem; color: var(--muted); font-size: var(--step--1); line-height: 1.55; }

/* ---------- 10. Split / sticky case-study layout ---------- */
.split { display: grid; gap: clamp(2rem, 5vw, 4.5rem); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .split { grid-template-columns: minmax(240px, 300px) 1fr; } }
.split__aside { position: sticky; top: 106px; }
@media (max-width: 899px) { .split__aside { position: static; } }

.toc { display: grid; gap: 0.15rem; border-left: 1px solid var(--line); }
.toc a {
  display: block; padding: 0.55rem 0 0.55rem 1.1rem; margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: var(--step--1); color: var(--muted);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.toc a:hover, .toc a.is-active { color: var(--text); border-left-color: var(--accent); }
.toc a .mono { color: var(--accent); margin-right: 0.55rem; }

.meta-list { display: grid; gap: 1.15rem; }
.meta-list dt { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.meta-list dd { margin: 0.2rem 0 0; font-weight: 500; }

.chapter { scroll-margin-top: 100px; padding-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.chapter + .chapter { padding-top: clamp(2.5rem, 5vw, 4rem); border-top: 1px solid var(--line); }
.chapter__num { font-family: var(--font-mono); color: var(--accent); font-size: 0.86rem; letter-spacing: 0.16em; display: block; margin-bottom: 0.9rem; }
.chapter h2 { font-size: var(--step-3); margin-bottom: 1.2rem; }
.chapter p + p { margin-top: 1.1rem; }
.chapter p { color: var(--text-dim); }
.chapter h3 { margin: 2.2rem 0 0.9rem; font-size: var(--step-1); }

.quote {
  margin: 2.4rem 0;
  padding: clamp(1.4rem, 3vw, 2.2rem) clamp(1.4rem, 3vw, 2.4rem);
  border-left: 2px solid var(--accent);
  background: linear-gradient(90deg, rgba(53,201,245,0.06), transparent 70%);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.quote p { font-family: var(--font-display); font-size: var(--step-2); color: var(--text); line-height: 1.45; letter-spacing: -0.02em; }
.quote cite { display: block; margin-top: 0.9rem; font-style: normal; font-size: var(--step--1); color: var(--muted); }

/* answer box — AEO extractable summary */
.answer {
  border: 1px solid rgba(53,201,245,0.28);
  background: linear-gradient(150deg, rgba(53,201,245,0.07), rgba(255,255,255,0.01));
  border-radius: var(--radius);
  padding: clamp(1.25rem, 2.4vw, 1.9rem);
  margin: 1.8rem 0;
}
.answer__label {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.7rem;
}
.answer p { color: var(--text); font-size: var(--step-0); }

/* ---------- 10.5 Figure ---------- */
.figure { margin: 2.4rem 0; }
.figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.figure figcaption {
  margin-top: 0.85rem;
  font-size: 0.875rem; line-height: 1.75; color: var(--muted);
  display: flex; gap: 0.55rem; align-items: flex-start;
}
.figure figcaption::before { content: '▲'; color: var(--accent); font-size: 0.6rem; padding-top: 0.35em; }
@media (min-width: 720px) { .figure { max-width: 560px; } }

/* ---------- 11. Table ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,0.012); }
table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: var(--step--1); }
th, td { padding: 1rem 1.15rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 400; background: rgba(255,255,255,0.02);
}
tbody th { font-family: var(--font-display); font-weight: 600; color: var(--text); font-size: var(--step-0); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
/* ไฮไลต์แถวตอนเอาเมาส์ชี้ — บนมือถือแถวที่เผลอแตะจะสว่างค้าง ดูเหมือนถูกเลือกไว้ */
@media (hover: hover) {
  tbody tr:hover td, tbody tr:hover th { background: rgba(255,255,255,0.022); }
}
td strong { color: var(--text); }

/* ---------- 12. FAQ (AEO) ---------- */
.faq { display: grid; gap: 0.7rem; }
.faq details {
  border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,0.015);
  transition: border-color 0.35s var(--ease), background 0.35s var(--ease);
}
.faq details[open] { border-color: var(--line-strong); background: rgba(255,255,255,0.03); }
.faq summary {
  display: flex; align-items: flex-start; gap: 1rem; justify-content: space-between;
  padding: 1.15rem 1.4rem; cursor: pointer; list-style: none;
  font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); letter-spacing: -0.015em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; flex: none; font-family: var(--font-mono); font-size: 1.35rem; line-height: 1; color: var(--accent);
  transition: transform 0.35s var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .faq__body { padding: 0 1.4rem 1.4rem; color: var(--text-dim); }
.faq .faq__body p + p { margin-top: 0.85rem; }

/* ---------- 13. Hologram canvas ---------- */
.holo {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: radial-gradient(120% 90% at 50% 0%, rgba(79,216,232,0.09), transparent 55%), var(--bg-soft);
  overflow: hidden;
}
.holo canvas { width: 100%; height: auto; aspect-ratio: 16 / 10; }
.holo__hud {
  position: absolute; inset: auto 0 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem;
  padding: 0.9rem 1.1rem; background: linear-gradient(0deg, rgba(8,8,10,0.92), transparent);
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-dim);
}
.holo__hud span { display: inline-flex; align-items: center; gap: 0.4rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.holo__badge {
  position: absolute; top: 1rem; left: 1rem;
  font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 100px; padding: 0.32rem 0.75rem;
  background: rgba(8,8,10,0.6); backdrop-filter: blur(6px);
}

/* ---------- 14. Pricing calculator ---------- */
.calc { display: grid; gap: clamp(1.4rem, 3vw, 2.4rem); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 980px) { .calc { grid-template-columns: 1.35fr 1fr; } }
.dept-grid { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 215px), 1fr)); }
.dept {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.85rem 1rem; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255,255,255,0.015); cursor: pointer;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
  font-size: var(--step--1);
}
@media (hover: hover) { .dept:hover { border-color: var(--line-strong); } }
.dept input { position: absolute; opacity: 0; pointer-events: none; }
.dept__box {
  width: 19px; height: 19px; flex: none; border-radius: 6px;
  border: 1px solid var(--line-strong); display: grid; place-items: center;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.dept__box::after { content: '✓'; font-size: 0.72rem; color: var(--accent-ink); opacity: 0; font-weight: 700; }
.dept:has(input:checked) { border-color: rgba(53,201,245,0.5); background: rgba(53,201,245,0.07); }
.dept:has(input:checked) .dept__box { background: var(--accent); border-color: var(--accent); }
.dept:has(input:checked) .dept__box::after { opacity: 1; }
.dept:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.dept__icon { width: 1.15rem; height: 1.15rem; color: var(--accent); }

.calc__panel {
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: linear-gradient(165deg, var(--surface-2), var(--bg-soft));
  padding: clamp(1.4rem, 2.6vw, 2rem); position: sticky; top: 100px;
}
@media (max-width: 979px) { .calc__panel { position: static; } }
.calc__row { display: flex; justify-content: space-between; gap: 1rem; padding-block: 0.6rem; font-size: var(--step--1); color: var(--text-dim); border-bottom: 1px dashed var(--line); }
.calc__row b { color: var(--text); font-weight: 600; }
.calc__total { margin-top: 1.3rem; }
.calc__total .stat__num { font-size: clamp(2.3rem, 5vw, 3.2rem); }
.calc__save { color: var(--accent); font-family: var(--font-mono); font-size: var(--step--1); margin-top: 0.5rem; }
.calc__note { margin-top: 1.2rem; font-size: 0.85rem; color: var(--muted); line-height: 1.7; }

/* ---------- 15. Steps / timeline ---------- */
.steps { display: grid; gap: 0; counter-reset: step; }
.step {
  display: grid; gap: 0.4rem 1.6rem; grid-template-columns: auto 1fr;
  padding: 1.5rem 0; border-top: 1px solid var(--line);
}
.step:last-child { border-bottom: 1px solid var(--line); }
.step__n {
  font-family: var(--font-mono); font-size: 0.86rem; color: var(--accent); padding-top: 0.3rem;
  min-width: 3.2rem;
}
.step h3 { font-size: var(--step-1); margin-bottom: 0.35rem; }
.step p { color: var(--text-dim); font-size: var(--step--1); }

/* ---------- 16. CTA & footer ---------- */
.cta {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background:
    radial-gradient(90% 140% at 15% 0%, rgba(139,125,255,0.16), transparent 55%),
    radial-gradient(70% 120% at 90% 100%, rgba(53,201,245,0.12), transparent 55%),
    var(--bg-soft);
  padding: clamp(2.2rem, 6vw, 4.6rem);
  text-align: center;
}
.cta h2 { font-size: var(--step-4); margin-bottom: 1.2rem; }
.cta .btn-row { justify-content: center; }

.footer { border-top: 1px solid var(--line); padding-block: clamp(3rem, 6vw, 5rem) 2.5rem; margin-top: var(--section); }
.footer__grid { display: grid; gap: 2.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.footer h2 { font-size: 0.85rem; font-family: var(--font-mono); font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 1.1rem; }
.footer li + li { margin-top: 0.6rem; }
.footer a { color: var(--text-dim); font-size: var(--step--1); transition: color 0.3s var(--ease); }
.footer a:hover { color: var(--accent); }
/* แถวช่องทางโซเชียลในฟุตเตอร์ — ไอคอนคู่ข้อความ ไม่ใช่ไอคอนเปล่า
   เพราะไอคอนอย่างเดียวคนอ่านหน้าจอไม่รู้ว่าคืออะไร และคนทั่วไปก็ต้องเดา */
.social { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; margin-top: 1.1rem; }
/* `.footer li + li` ด้านบนใส่ margin-top ไว้ให้ลิงก์ที่เรียงลงมาเป็นคอลัมน์
   แต่แถวนี้เรียงแนวนอน กฎนั้นเลยดันปุ่มที่สองต่ำลง 9.6px — ล้างทิ้ง
   ส่วน align-items:center กันไว้เผื่อป้ายข้อความยาวจนขึ้นบรรทัดใหม่ในจอแคบ */
.social li + li { margin-top: 0; }
.social a {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line-strong); border-radius: 100px;
  font-size: var(--step--1);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.social a:hover { color: var(--accent); border-color: rgba(53,201,245,0.55); }
/* ครอบ viewBox ของแต่ละไอคอนให้พอดีเส้นที่วาดจริง แล้วล็อกความสูงปล่อยความกว้างตามสัดส่วน
   ถ้าบังคับให้เป็นสี่เหลี่ยมจัตุรัสเท่ากัน ตัว f ของ Facebook ซึ่งวาดกินแค่ 46% ของกรอบ
   จะเหลือที่ว่างสองข้างเกินมา ทำให้ช่องไฟก่อนข้อความไม่เท่ากับปุ่ม Instagram
   วัดแล้วต่างกัน 3.3 px ซึ่งตาจับได้ */
.social .icon { height: 1.05em; width: auto; }

.footer__bottom {
  margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
  font-size: 0.875rem; color: var(--muted);
}

/* ---------- 16.5 Intro sequence ---------- */
#intro canvas { width: 100%; height: 100%; display: block; }
#intro { transition: opacity 0.35s linear; }
.intro__actions {
  position: absolute; top: clamp(1rem, 3vw, 2rem); right: clamp(1rem, 3vw, 2rem);
  display: flex; align-items: center; gap: 0.5rem;
  animation: introSkipIn 0.6s 0.5s var(--ease) backwards;
}
.intro__skip, .intro__sound {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  background: rgba(255,255,255,0.04); color: var(--text-dim);
  border: 1px solid var(--line-strong); border-radius: 100px;
  font-family: var(--font-body); font-size: var(--step--1); cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.intro__skip:hover, .intro__sound:hover { color: var(--text); border-color: var(--accent); }
.intro__skip:focus-visible, .intro__sound:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
/* เสียงเปิดอยู่ = ปุ่มติดสว่าง มองปราดเดียวรู้สถานะโดยไม่ต้องอ่านข้อความ */
.intro__sound[aria-pressed="true"] { color: var(--accent); border-color: rgba(53,201,245,0.55); }
/* เบราว์เซอร์บล็อกการเล่นอัตโนมัติอยู่ ปุ่มต้องกะพริบให้เห็นว่ารอผู้ใช้แตะ */
.intro__sound.is-waiting {
  color: var(--accent); border-color: rgba(53,201,245,0.75);
  animation: introSoundWait 1.6s var(--ease) infinite;
}
@keyframes introSoundWait {
  0%, 100% { box-shadow: 0 0 0 0 rgba(53,201,245,0.42); }
  60%      { box-shadow: 0 0 0 9px rgba(53,201,245,0); }
}
@keyframes introSkipIn { from { opacity: 0; } }

/* ---------- 17. Scroll reveal ---------- */
[data-anim] { opacity: 0; transform: translateY(26px); transition: opacity 0.85s var(--ease), transform 0.85s var(--ease); }
[data-anim].is-in { opacity: 1; transform: none; }
[data-anim][data-delay="1"] { transition-delay: 0.08s; }
[data-anim][data-delay="2"] { transition-delay: 0.16s; }
[data-anim][data-delay="3"] { transition-delay: 0.24s; }
[data-anim][data-delay="4"] { transition-delay: 0.32s; }

/* ---------- 18. Misc ---------- */
.breadcrumb { font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); letter-spacing: 0.06em; padding-top: 1.8rem; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin-inline: 0.45rem; opacity: 0.5; }

.pill-nav { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 2rem; }
.pill-nav a { padding: 0.5rem 1.05rem; border: 1px solid var(--line); border-radius: 100px; font-size: var(--step--1); color: var(--text-dim); transition: all 0.3s var(--ease); }
.pill-nav a:hover { border-color: var(--accent); color: var(--accent); }

.note { font-size: 0.875rem; color: var(--muted); line-height: 1.75; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
hr.rule { border: 0; border-top: 1px solid var(--line); margin-block: clamp(2.5rem, 5vw, 4rem); }
