/* =========================================================
   QBR Scrollytelling — Ufriend theme
   Palette: brand blue #0051BA · yellow #FFC107 · Kanit
   ========================================================= */

:root {
  --ink: #12141a;
  --ink-2: #5a6472;
  --paper: #f7f8fa;
  --card: #ffffff;
  --blue: #0051ba;
  --blue-bright: #1e7bff;
  --blue-deep: #002b66;
  --blue-night: #001433;
  --blue-100: #d8e9ff;
  --yellow: #ffc107;
  --yellow-bright: #ffda1a;
  --amber: #b8860b; /* chart marks on light surface — passes 3:1 (validated) */
  --bar-before: #6b7a99;
  --radius: 20px;
  --shadow: 0 24px 60px -24px rgba(0, 27, 63, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

/* Kanit ไม่มี tnum ทั้ง family (ตรวจ GSUB ตัวเต็มจาก google/fonts แล้ว) — font-variant-numeric:
   tabular-nums ทุกจุดในไฟล์นี้เป็น no-op เก็บไว้เผื่อเปลี่ยน font; ตัวนับเลขกัน jitter
   ด้วย width reservation ใน main.js (runCounter + perf pct) แทน */
body {
  font-family: 'Kanit', sans-serif;
  font-weight: 300;
  background: var(--paper);
  color: var(--ink);
  overflow-x: clip; /* clip, not hidden — hidden turns body into a nested scroll container and kills smooth window.scrollTo */
  line-height: 1.55;
}

img { max-width: 100%; display: block; }

/* ---------- chrome: progress bar + dots nav ---------- */

.progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 5px;
  background: rgba(0, 81, 186, 0.15);
  z-index: 100;
}
.progress__fill {
  height: 100%;
  width: 100%;
  background: var(--yellow);
  transform-origin: left center;
  transform: scaleX(0);
}

.dots {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 100;
}
.dots__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--blue);
  background: rgba(255, 255, 255, 0.85); /* ขาวโปร่ง — เห็นบนทั้งฉากน้ำเงินและฉากขาว */
  cursor: pointer;
  padding: 0;
  transition: background 0.25s, transform 0.25s, border-color 0.25s;
}
.dots__dot:hover { transform: scale(1.35); }
.dots__dot:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.dots__dot.is-active { background: var(--yellow); border-color: var(--yellow); transform: scale(1.25); }

.keyhint {
  position: fixed;
  left: 22px; bottom: 18px;
  z-index: 100;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: 6px 14px;
  opacity: 0.85;
}

/* ---------- gesture nav (js/gesture.js) ---------- */

.gesture-btn {
  position: fixed;
  right: 22px; bottom: 18px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--blue);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.gesture-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.gesture-btn[data-state="on"] {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
}
.gesture-btn[data-state="loading"] { animation: gesture-pulse 1s ease-in-out infinite; }
.gesture-btn[data-state="error"] { border-color: #b3261e; color: #b3261e; }
@keyframes gesture-pulse {
  50% { opacity: 0.45; }
}

.gesture-pip {
  position: fixed;
  right: 22px; bottom: 62px;
  z-index: 100;
  width: 180px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 2px solid var(--yellow);
  display: none;
  background: #000;
}
.gesture-pip.is-on { display: block; }
.gesture-pip video {
  width: 100%;
  display: block;
  transform: scaleX(-1); /* mirror ให้ทิศทางตรงกับมือจริง */
}
.gesture-pip canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.gesture-pip__arrow {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3rem;
  font-weight: 600;
  color: var(--yellow-bright);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
}
.gesture-pip__arrow.is-flash { animation: gesture-arrow 0.6s ease-out; }
@keyframes gesture-arrow {
  0% { opacity: 1; transform: scale(0.8); }
  100% { opacity: 0; transform: scale(1.3); }
}

/* ---------- scenes ---------- */

.scene {
  position: relative;
  z-index: 1; /* อยู่เหนือ .walk--fixed (3D stage) เสมอ */
  min-height: 100vh;
  padding: clamp(56px, 9vh, 110px) clamp(24px, 6vw, 96px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--paper); /* ต้องทึบ — กัน 3D stage ทะลุหลัง section */
}

.scene--dark {
  background: linear-gradient(158deg, var(--blue-deep) 0%, var(--blue-night) 68%);
  color: #fff;
}
.scene--brand {
  background: linear-gradient(140deg, var(--blue) 0%, var(--blue-bright) 100%);
  color: #fff;
}

.wrap { width: min(1240px, 100%); margin: 0 auto; }

.eyebrow {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 14px;
}
.scene--dark .eyebrow,
.scene--brand .eyebrow { color: var(--yellow-bright); }

.scene__title {
  font-size: clamp(2.2rem, 4.6vw, 3.9rem);
  font-weight: 600;
  line-height: 1.12;
  margin-bottom: 12px;
}
.scene__sub {
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  color: var(--ink-2);
  max-width: 60ch;
}
.scene--dark .scene__sub,
.scene--brand .scene__sub { color: var(--blue-100); }

/* ---------- hero ---------- */

.hero {
  overflow: hidden;
  text-align: left;
}
.hero__brand {
  font-weight: 600;
  letter-spacing: 0.3em;
  font-size: clamp(0.85rem, 1.4vw, 1.05rem);
  color: var(--yellow-bright);
  margin-bottom: 3vh;
}
.hero__title {
  font-size: clamp(3rem, 8.4vw, 8rem);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.01em;
}
.hero__title .accent {
  color: var(--yellow-bright);
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
.hero__badge {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 4vh;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 10px 26px;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 600;
}
.hero__badge strong { color: var(--yellow-bright); font-weight: 900; font-size: 1.25em; }
.hero__sub { margin-top: 3.5vh; color: var(--blue-100); font-size: 1.1rem; }
.hero__cue {
  position: absolute;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  width: 26px; height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 14px;
}
.hero__cue::after {
  content: '';
  position: absolute;
  left: 50%; top: 8px;
  width: 4px; height: 9px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--yellow-bright);
  animation: cue 1.6s ease-in-out infinite;
}
@keyframes cue {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}
.hero__shape {
  position: absolute;
  border-radius: 26%;
  opacity: 0.16;
  pointer-events: none;
}
.hero__shape--1 { width: 340px; height: 340px; background: var(--yellow-bright); right: -80px; top: -90px; transform: rotate(18deg); }
.hero__shape--2 { width: 220px; height: 220px; background: #fff; right: 18%; bottom: -70px; transform: rotate(-12deg); }
.hero__shape--3 { width: 150px; height: 150px; border: 3px solid #fff; background: transparent; left: -40px; bottom: 18%; transform: rotate(24deg); }

/* ---------- team ---------- */

.team__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 26px;
  margin-top: 6vh;
}
.team__card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 38px 30px;
  text-align: center;
}
.team__avatar {
  width: 92px; height: 92px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 900;
  color: #fff;
  background: var(--blue);
}
.team__card--yellow .team__avatar { background: var(--yellow); color: var(--ink); }
.team__avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 15%; /* รูป crop แนวตั้ง — เลื่อนหน้าต่างขึ้นให้เห็นหน้าพอดีวงกลม */
}
.team__name { font-size: 1.6rem; font-weight: 600; }
.team__role { color: var(--ink-2); font-weight: 400; }
.team__crew {
  margin-top: 5vh;
  text-align: center;
  font-size: 1.15rem;
  color: var(--ink-2);
}

/* ---------- numbers ---------- */

.numbers__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 30px;
  margin-top: 7vh;
}
.stat { text-align: left; border-left: 4px solid var(--yellow); padding-left: 22px; }
.stat__value {
  font-size: clamp(3rem, 6vw, 5.2rem);
  font-weight: 900;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.stat__label { margin-top: 10px; color: var(--blue-100); font-size: 1.05rem; }

/* ---------- track divider ---------- */

.divider { overflow: hidden; }
.divider__chapter {
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--yellow-bright);
  font-size: 1rem;
  margin-bottom: 8px;
}
.divider__name {
  font-size: clamp(4rem, 13vw, 12rem);
  font-weight: 900;
  line-height: 0.95;
  color: #fff;
}
.divider__tagline { margin-top: 22px; font-size: 1.25rem; color: var(--blue-100); max-width: 56ch; }

/* ---------- project scenes ---------- */

.project {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: clamp(48px, 8vh, 90px) clamp(24px, 6vw, 96px);
  background: var(--paper);
}
.project__grid {
  width: min(1280px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(30px, 5vw, 80px);
  align-items: center;
}
.project__grid--noimg { grid-template-columns: minmax(0, 1fr); max-width: 880px; }
.project__index {
  font-weight: 600;
  color: var(--blue);
  letter-spacing: 0.18em;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.project__title {
  font-size: clamp(2rem, 3.8vw, 3.3rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 14px;
}
.project__desc { font-size: 1.2rem; color: var(--ink-2); margin-bottom: 26px; max-width: 48ch; }
.project__bullets { list-style: none; display: grid; gap: 14px; }
.project__bullets li {
  position: relative;
  padding-left: 34px;
  font-size: 1.12rem;
  font-weight: 400;
}
.project__bullets li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.42em;
  width: 18px; height: 18px;
  border-radius: 6px;
  background: var(--yellow);
}
.project__tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.project__tag {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-100);
  padding: 5px 14px;
  border-radius: 999px;
}
.project__metric {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 28px;
  background: var(--blue);
  color: #fff;
  border-radius: 16px;
  padding: 14px 24px;
}
.project__metric-value {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--yellow-bright);
  font-variant-numeric: tabular-nums;
}
.project__metric-label { font-size: 1rem; color: var(--blue-100); }
.project__media {
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(0, 43, 102, 0.08);
}
.project__media-bar {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  background: #eef2f7;
}
.project__media-bar span { width: 10px; height: 10px; border-radius: 50%; background: #c3cddb; }
.project__media img,
.project__media video { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; display: block; }

.hero__video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.28;
  pointer-events: none;
}

/* ---------- walk-in intro (ported from ufriend-simulation) ---------- */

.hero--walkin { background: var(--blue-night); }
.walk { position: absolute; inset: 0; overflow: hidden; }
.walk__gl { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.walk--3d .walk__gl { display: block; }
/* 3D mode: เปิดด้วยภาพหน้าร้านจริง (ext plate ค้างไว้) — ซ่อนเฉพาะ int + ประตู CSS */
.walk--3d .walk__plate--int,
.walk--3d .walk__doors { display: none; }

/* บรรยากาศทับ canvas — สูตร .ambient / .webgl-atmosphere จาก ufriend-simulation */
.walk__ambient,
.walk__atmo { display: none; position: absolute; inset: 0; pointer-events: none; }
.walk--3d .walk__ambient,
.walk--3d .walk__atmo { display: block; }
.walk__ambient { opacity: 0.16; }
.walk__ambient i {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
}
.walk__ambient i:nth-child(1) { width: 38vw; height: 38vw; background: #075eff; left: -12vw; top: 20%; }
.walk__ambient i:nth-child(2) { width: 30vw; height: 30vw; background: #0849e0; right: -5vw; bottom: -8vw; }
.walk__ambient i:nth-child(3) { width: 16vw; height: 16vw; background: #ffdb19; left: 48%; top: -12vw; opacity: 0.08; }
.walk__atmo {
  opacity: 0.55;
  background:
    linear-gradient(180deg, rgba(2, 7, 19, 0.22) 0%, transparent 17%, transparent 82%, rgba(2, 7, 19, 0.37) 100%),
    radial-gradient(circle at 50% 46%, transparent 68%, rgba(1, 4, 13, 0.36) 100%);
}
.walk__plate {
  position: absolute;
  inset: -3%;
  width: 106%; height: 106%;
  object-fit: cover;
}
.walk__plate--int { opacity: 0; }
.walk__dim {
  position: absolute;
  inset: 0;
  background: linear-gradient(158deg, rgba(0, 43, 102, 0.88) 0%, rgba(0, 20, 51, 0.92) 70%);
  opacity: 0;
}

/* ประตูกระจกสไลด์ — สูตร glass gradient จาก .shop-door ของ ufriend-simulation */
.walk__doors {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  opacity: 0;
  pointer-events: none;
}
.walk__door {
  flex: 1;
  position: relative;
  background: linear-gradient(110deg,
    rgba(12, 42, 80, 0.60),
    rgba(134, 191, 255, 0.10) 45%,
    rgba(255, 255, 255, 0.16) 46%,
    rgba(12, 31, 57, 0.60));
  backdrop-filter: blur(2px);
  will-change: transform;
}
.walk__door--left { border-right: 1px solid rgba(255, 255, 255, 0.35); }
.walk__door--right { border-left: 1px solid rgba(255, 255, 255, 0.35); }
.walk__door::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: rgba(255, 255, 255, 0.18);
}
.walk__door::after {
  content: '';
  position: absolute;
  top: 38%;
  height: 24%;
  width: 7px;
  border-radius: 4px;
  background: var(--yellow);
  box-shadow: 0 0 18px rgba(255, 193, 7, 0.55);
}
.walk__door--left::after { right: 26px; }
.walk__door--right::after { left: 26px; }
.walk__prompt {
  position: absolute;
  left: 50%; bottom: 40px;
  transform: translateX(-50%);
  z-index: 3;
  color: #fff;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  background: rgba(0, 20, 51, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 10px 26px;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.walk__arrow { display: inline-block; animation: walkArrow 1.4s ease-in-out infinite; }
@keyframes walkArrow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}
.hero__content { position: relative; z-index: 2; }

/* no-JS / reduced fallback: ข้ามฉากเดิน โชว์ในร้าน + headline เลย */
.no-js .walk__plate--ext { opacity: 0; }
.no-js .walk__plate--int { opacity: 1; }
.no-js .walk__dim { opacity: 0.78; }
.no-js .walk__prompt { display: none; }

/* ---------- walkway: เดินทะลุเข้าห้องหัวข้อ (3D stage กลางแบบ fixed) ---------- */

.walk--fixed { position: fixed; z-index: 0; } /* stage เดียวหลังทุก section */
.hero--glass.hero--walkin { background: transparent; } /* hero โปร่งให้เห็น stage ข้างหลัง */

.walkway {
  position: relative;
  z-index: 1;
  height: 100vh;
  background: transparent; /* โปร่ง — มองทะลุลงไปเห็นห้อง 3D */
  overflow: hidden;
}
.walkway__label {
  position: absolute;
  left: clamp(24px, 7vw, 110px);
  bottom: 14vh;
  z-index: 2;
  max-width: 36ch;
  color: #fff;
  opacity: 0;
  text-shadow: 0 4px 30px rgba(0, 8, 24, 0.85);
}
.walkway__eyebrow {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--yellow-bright);
  margin-bottom: 10px;
}
.walkway__label h2 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  font-weight: 600; /* 700 ไม่ได้โหลด — browser เด้งไป 900 หนาผิดตั้งใจ; 600 ให้เท่ากับ .scene__title */
  line-height: 1.05;
}
.walkway__label p {
  margin-top: 8px;
  color: var(--blue-100);
  font-size: 1.05rem;
}
@media (prefers-reduced-motion: reduce) {
  .walk__arrow { animation: none; }
}

/* ---------- CR list ---------- */

.crs__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 6vh;
}
.crs__item {
  background: var(--card);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 10px 30px -18px rgba(0, 27, 63, 0.3);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.crs__check {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.crs__text { font-weight: 600; font-size: 1.05rem; }
.crs__impact { color: var(--ink-2); font-size: 0.98rem; margin-top: 2px; }

/* ---------- plan vs actual (Q2) ---------- */

.plan__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 4vh;
}
.plan__item {
  background: var(--card);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 10px 30px -18px rgba(0, 27, 63, 0.3);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.plan__status {
  flex: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
  margin-top: 2px;
}
.plan__status--done { background: #d9f2e2; color: #0f7a40; }
.plan__status--part { background: var(--yellow); color: var(--ink); }
.plan__status--doing { background: rgba(0, 81, 186, 0.12); color: var(--blue); }
.plan__status--plan { background: #e8ebf0; color: #5a6472; }
.plan__name { font-weight: 600; font-size: 1.08rem; }
.plan__desc { color: var(--ink-2); font-size: 0.96rem; margin-top: 2px; }
.plan__extra {
  margin-top: 22px;
  border-left: 4px solid var(--yellow);
  background: var(--card);
  border-radius: 0 16px 16px 0;
  padding: 14px 20px;
  box-shadow: 0 10px 30px -18px rgba(0, 27, 63, 0.3);
}
.plan__extra-label {
  font-weight: 600;
  color: var(--blue);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.plan__extra p { margin-top: 6px; color: var(--ink-2); font-size: 0.96rem; }

/* ---------- perf (signature scene) ---------- */

.perf { justify-content: flex-start; }
.perf__rows { margin-top: 5vh; display: grid; gap: clamp(26px, 4.5vh, 44px); }
.perf-row__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.perf-row__name { font-size: 1.35rem; font-weight: 600; }
.perf-row__note { font-size: 0.9rem; color: var(--blue-100); font-weight: 300; }
.perf-row__pct {
  margin-left: auto;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 900;
  color: var(--yellow-bright);
  font-variant-numeric: tabular-nums;
}
.perf-row__track { position: relative; height: 34px; }
.perf-row__bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 4px 8px 8px 4px;
  height: 100%;
  transform-origin: left center; /* after-bar scrub ด้วย scaleX — ต้องหดจากซ้าย */
}
.perf-row__bar--before { background: var(--bar-before); opacity: 0.55; }
.perf-row__bar--after { background: var(--yellow); }
.perf-row__mb {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  white-space: nowrap;
  padding-left: 12px;
  font-variant-numeric: tabular-nums;
}
.perf-row__time { margin-top: 8px; font-size: 0.95rem; color: var(--blue-100); }
.perf__legend {
  display: flex;
  gap: 26px;
  margin-top: 4vh;
  font-size: 0.95rem;
  color: var(--blue-100);
}
.perf__legend i {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: -2px;
}
.perf__legend .swatch-before { background: var(--bar-before); opacity: 0.55; }
.perf__legend .swatch-after { background: var(--yellow); }

/* บีบแนวตั้งให้ 5 แถว + legend อยู่ในจอเดียวตอน pin (1280x800 / 1920x1080) */
.perf { padding-top: clamp(28px, 5vh, 56px); padding-bottom: clamp(18px, 3vh, 34px); }
.perf__rows { margin-top: 2.5vh; gap: clamp(10px, 2vh, 22px); }
.perf-row__head { margin-bottom: 6px; }
.perf-row__head > * { line-height: 1.15; }
.perf-row__track { height: 30px; }
.perf-row__time { margin-top: 5px; }
.perf__legend { margin-top: 2.5vh; }

/* Q2: 8 แถว — บีบอีกขั้นให้ยังอยู่ในจอเดียวตอน pin (main.js ใส่ class เมื่อ rows > 6) */
.perf--dense .perf__rows { margin-top: 2vh; gap: clamp(7px, 1.4vh, 14px); }
.perf--dense .perf-row__name { font-size: 1.05rem; }
.perf--dense .perf-row__pct { font-size: clamp(1.25rem, 2.2vw, 1.8rem); }
.perf--dense .perf-row__track { height: 18px; }
.perf--dense .perf-row__time { margin-top: 3px; font-size: 0.84rem; }
.perf--dense .perf__legend { margin-top: 1.8vh; }

/* ---------- how we work ---------- */

.work__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 5vh;
}
.work__group {
  background: var(--card);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 10px 30px -18px rgba(0, 27, 63, 0.3);
}
.work__group h3 {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 12px;
}
.work__group ul { list-style: none; display: grid; gap: 8px; }
.work__group li { font-weight: 400; font-size: 1.02rem; padding-left: 20px; position: relative; }
.work__group li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.5em;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--yellow);
}
.work__arch {
  margin-top: 6vh;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: clamp(24px, 4vw, 60px);
  align-items: center;
}
.work__arch h3 { font-size: 1.7rem; font-weight: 600; margin-bottom: 10px; }
.work__arch p { color: var(--ink-2); font-size: 1.1rem; }
.work__arch img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 43, 102, 0.08);
}
.work__arch--noimg { grid-template-columns: 1fr; }
.work__arch--noimg p { max-width: 78ch; }

/* ---------- debt quote ---------- */

.debt { text-align: center; }
.debt__quote {
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 900;
  line-height: 1.1;
  max-width: 22ch;
  margin: 0 auto;
}
.debt__quote em { font-style: normal; color: var(--yellow-bright); }
.debt__desc {
  margin: 4vh auto 0;
  max-width: 62ch;
  font-size: 1.2rem;
  color: var(--blue-100);
}

/* ---------- csat — ความพึงพอใจระหว่างแผนก (dot plot 3 squad) ---------- */
/* palette validate แล้ว (dataviz): #b8860b / #0051ba / #1d9bf0 — sky ต่ำกว่า 3:1 เลยมีเลขกำกับทุกแถว */

.csat__cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin: 4vh 0 5vh; }
.csat-card {
  background: #fff;
  border-radius: 18px;
  border-top: 4px solid var(--sq);
  padding: 26px 22px 20px;
  box-shadow: 0 14px 34px rgba(9, 32, 75, 0.08);
  text-align: center;
}
.csat-card__face {
  width: 62px; height: 62px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 15%;
  margin-bottom: 10px;
}
.csat-card__who { font-weight: 600; }
.csat-card__num {
  font-size: clamp(2.3rem, 4.2vw, 3.4rem);
  font-weight: 900;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.csat-card__cap { color: var(--ink-2); font-size: 0.92rem; }
.csat__legend { display: flex; gap: 24px; margin-bottom: 3vh; font-weight: 600; flex-wrap: wrap; }
.csat__legend i, .csat-row__vals i {
  display: inline-block;
  width: 13px; height: 13px;
  border-radius: 4px;
  margin-right: 7px;
  vertical-align: -1px;
}
.csat-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.5fr) auto;
  gap: 20px;
  align-items: center;
  padding: 9px 0;
}
.csat-row__name { font-size: 1.02rem; }
.csat-row__track { position: relative; height: 30px; background: rgba(0, 81, 186, 0.05); border-radius: 6px; }
.csat-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(18, 20, 26, 0.08); }
.csat-dot {
  position: absolute;
  top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px #fff; /* วงแหวนสีพื้น — จุดคะแนนใกล้กันยังเห็นแยกวง */
}
.csat-row__vals {
  display: flex;
  gap: 14px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.csat-row--axis { padding: 0; }
.csat__axis { position: relative; height: 20px; color: var(--ink-2); font-size: 0.8rem; }
.csat__axis span { position: absolute; transform: translateX(-50%); }
.csat__note { margin-top: 2.5vh; color: var(--ink-2); font-size: 0.9rem; }

/* ---------- roadmap (horizontal) ---------- */

.roadmap { overflow: hidden; padding-left: 0; padding-right: 0; }
/* fallback ไม่มี GSAP / reduced-motion: เลื่อน lane แนวนอนด้วยมือ */
.no-anim .roadmap { overflow-x: auto; }
.roadmap__head { padding: 0 clamp(24px, 6vw, 96px); }
.roadmap__track {
  display: flex;
  gap: clamp(24px, 3vw, 48px);
  padding: 6vh clamp(24px, 6vw, 96px) 0;
  align-items: stretch;
  width: max-content;
}
.roadmap__lane {
  width: min(78vw, 620px);
  background: #2272df; /* ทึบเทียบเท่าขาว 8% บนกลาง gradient ฟ้า — เลี่ยง backdrop-filter ใต้ pin scrub */
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 34px 34px 38px;
}
.roadmap__team {
  font-size: 2rem;
  font-weight: 900;
  color: var(--yellow-bright);
  margin-bottom: 20px;
}
.roadmap__items { list-style: none; display: grid; gap: 14px; }
.roadmap__items li {
  position: relative;
  padding-left: 30px;
  font-size: 1.12rem;
  font-weight: 400;
}
.roadmap__items li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.42em;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 3px solid var(--yellow-bright);
}

/* ---------- engagement ---------- */

.engage__grid {
  margin-top: 5vh;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.engage__shot {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--card);
}
.engage__shot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.engage__shot figcaption { padding: 12px 16px; font-size: 0.95rem; color: var(--ink-2); }
.engage__caption { margin-top: 18px; color: var(--ink-2); font-size: 1.1rem; }

/* ---------- internal AI projects (scene--dark) ---------- */

.aiproj__pitch {
  margin-top: 14px;
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  font-weight: 500;
  color: var(--yellow-bright);
  max-width: 56ch;
}
.aiproj-row {
  margin-top: 6vh;
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}
.aiproj-row--flip .aiproj-row__info { order: 2; } /* สลับฝั่งแถวคู่ — จังหวะไม่ซ้ำ */
.aiproj-row__info h3 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 600; }
.aiproj-row__info h3 span {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.aiproj-row__info > p { margin-top: 12px; color: rgba(255, 255, 255, 0.8); line-height: 1.7; }
.aiproj-row__flow { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.aiproj-row__flow span {
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  position: relative;
}
.aiproj-row__flow span:not(:last-child)::after { content: '→'; position: absolute; right: -14px; color: rgba(255, 255, 255, 0.4); }
.aiproj-row__flow span:not(:last-child) { margin-right: 12px; }
.aiproj-row__stat { margin-top: 20px; color: rgba(255, 255, 255, 0.7); }
.aiproj-row__stat b { color: var(--yellow-bright); font-size: 1.4em; font-weight: 700; }
.aiproj-row__shots { display: grid; gap: 16px; }
.aiproj-row__shots figure {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #0d1420;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.aiproj-row__shots img { width: 100%; display: block; }
.aiproj-row__shots figcaption { padding: 10px 16px; font-size: 0.9rem; color: rgba(255, 255, 255, 0.6); }

/* ---------- closing ---------- */

.closing { text-align: center; }
.closing__code {
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--yellow-bright);
  line-height: 1;
  margin: 3vh 0;
}
.closing__img {
  width: min(640px, 80vw); /* Q2: รูปทีมแนวนอน (เดิม QR สี่เหลี่ยม 420px) */
  margin: 4vh auto 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.closing__img img { width: 100%; height: auto; } /* attr width/height ไว้กัน layout shift — ratio จริงตามไฟล์รูปเสมอ */
.closing__brand {
  margin-top: 5vh;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--blue-100);
  font-size: 0.9rem;
}

/* ---------- reveal defaults (JS toggles) ---------- */

.js .reveal { opacity: 0; transform: translateY(36px); }
.js .reveal--left { transform: translateX(-40px); }
.js .reveal--pop { transform: scale(0.85); }

/* no-JS + reduced motion: everything visible */
.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .hero__cue::after { animation: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .project__grid { grid-template-columns: 1fr; }
  .dots { display: none; }
  .keyhint { display: none; }
  .work__arch { grid-template-columns: 1fr; }
  .csat__cards { grid-template-columns: 1fr; }
  .csat-row { grid-template-columns: 1fr; gap: 6px; padding: 14px 0; }
  .csat-row--axis { display: none; } /* จอแคบ track ต่อแถวไม่ตรงคอลัมน์เดียวกันแล้ว — เลขกำกับต่อแถวยังอยู่ครบ */
  .aiproj-row { grid-template-columns: 1fr; }
  .aiproj-row--flip .aiproj-row__info { order: 0; } /* จอเดียวคอลัมน์เดียว — ข้อมูลนำเสมอ */
}
