:root {
  --bg: #0a0a0a;
  --bg-soft: #111116;
  --surface: #17171f;
  --line: rgba(255, 255, 255, 0.14);
  --text: #f5f5f7;
  --muted: #a3a3ad;
  --cream: #fee9ce;
  --accent: #ef5143;
  --orange: #ffb261;
  --blue: #2f6bff;
  --paper: #f7f5f2;
  --ink: #17171a;
  --radius: 5px;
  --max: 1480px;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans Thai", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

body.is-transitioning { pointer-events: none; }

body[data-page="news"] {
  background: var(--paper);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }

/* ห้ามหักกลางคำ (โดยเฉพาะภาษาไทย) — ให้เบราว์เซอร์ตัดคำตามพจนานุกรมเท่านั้น */
h1, h2, h3, p, blockquote, li, small, figcaption {
  overflow-wrap: normal;
  word-break: normal;
  line-break: auto;
}

h1, h2, h3, blockquote { text-wrap: balance; }
p { text-wrap: pretty; }

/* fallback: หัวข้อใหญ่ยอมหักคำได้เฉพาะกรณีคำเดียวยาวเกินทั้งบรรทัด (กันตัวอักษรโดนตัดขอบ) */
h1, h2, h3 { overflow-wrap: break-word; }

/* ---------- Page transition wipe ---------- */

.page-wipe {
  position: fixed;
  z-index: 999;
  inset: 0;
  background: var(--accent);
  transform: translateY(100%);
  pointer-events: none;
  overflow: hidden;
}

.page-wipe::before {
  content: "";
  position: absolute;
  inset: -18%;
  background: var(--bg);
  opacity: .98;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='260' viewBox='0 0 420 260'%3E%3Cdefs%3E%3Cmask id='cut'%3E%3Crect width='420' height='260' fill='white'/%3E%3Cg fill='black' font-family='Arial,Helvetica,sans-serif' font-size='36' font-weight='900' letter-spacing='2'%3E%3Ctext x='18' y='54'%3EUNCLETUNGAI%3C/text%3E%3Ctext x='88' y='118'%3EUNCLETUNGAI%3C/text%3E%3Ctext x='-28' y='182'%3EUNCLETUNGAI%3C/text%3E%3Ctext x='138' y='246'%3EUNCLETUNGAI%3C/text%3E%3C/g%3E%3C/mask%3E%3C/defs%3E%3Crect width='420' height='260' fill='black' mask='url(%23cut)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='260' viewBox='0 0 420 260'%3E%3Cdefs%3E%3Cmask id='cut'%3E%3Crect width='420' height='260' fill='white'/%3E%3Cg fill='black' font-family='Arial,Helvetica,sans-serif' font-size='36' font-weight='900' letter-spacing='2'%3E%3Ctext x='18' y='54'%3EUNCLETUNGAI%3C/text%3E%3Ctext x='88' y='118'%3EUNCLETUNGAI%3C/text%3E%3Ctext x='-28' y='182'%3EUNCLETUNGAI%3C/text%3E%3Ctext x='138' y='246'%3EUNCLETUNGAI%3C/text%3E%3C/g%3E%3C/mask%3E%3C/defs%3E%3Crect width='420' height='260' fill='black' mask='url(%23cut)'/%3E%3C/svg%3E");
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
  -webkit-mask-size: 420px 260px;
  mask-size: 420px 260px;
  transform: rotate(-8deg) scale(1.18);
}

.page-wipe::after {
  content: "UNCLE TUNG AI";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(86vw, 760px);
  transform: translate(-50%, -50%);
  color: rgba(254, 233, 206, .88);
  font-size: clamp(34px, 9vw, 112px);
  font-weight: 900;
  line-height: .95;
  text-align: center;
  letter-spacing: .08em;
  text-transform: uppercase;
}

body.is-entering .page-wipe {
  animation: enterWipe 820ms cubic-bezier(.77, 0, .175, 1) both;
}

body.is-leaving .page-wipe {
  animation: leaveWipe 640ms cubic-bezier(.77, 0, .175, 1) forwards;
}

@keyframes enterWipe {
  0% { transform: translateY(0); }
  100% { transform: translateY(-100%); }
}

@keyframes leaveWipe {
  0% { transform: translateY(100%); }
  100% { transform: translateY(0); }
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 190px 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 74px;
  padding: 14px clamp(16px, 2vw, 32px);
  background: rgba(10, 10, 10, .72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

body[data-page="news"] .site-header {
  background: rgba(247, 245, 242, .82);
  color: var(--ink);
  border-bottom-color: rgba(23, 23, 26, .12);
}

.brand-mark img { width: 172px; }

.nav-links {
  display: flex;
  justify-content: center;
  gap: clamp(18px, 2.6vw, 46px);
  color: var(--muted);
  font-size: 14px;
}

body[data-page="news"] .nav-links { color: rgba(23, 23, 26, .62); }

.nav-links a,
.nav-login,
.motion-link,
.site-footer a,
.contact-panel a,
.door,
.motion-button,
.social-row a,
.category-row button {
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease, background 180ms ease, opacity 180ms ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"],
.nav-login:hover {
  color: var(--cream);
}

body[data-page="news"] .nav-links a:hover,
body[data-page="news"] .nav-links a[aria-current="page"],
body[data-page="news"] .nav-login:hover {
  color: var(--accent);
}

.nav-login {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 240px;
  padding: 0 18px;
  overflow: hidden;
  color: var(--bg);
  background: var(--cream);
  border-radius: var(--radius);
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Layout ---------- */

.page-shell {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 48px);
}

.scene {
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: 106px 0 58px;
  border-bottom: 1px solid var(--line);
}

/* กัน grid item ล้น track เมื่อเจอคำยาวที่ตัดไม่ได้ */
.scene > *,
.news-card > *,
.gallery-grid figure,
.cert-grid figure,
.feature-panel > *,
.editorial-card > * {
  min-width: 0;
  max-width: 100%;
}

/* grid คอลัมน์เดียวทั้งหมด: ห้าม track กว้างเกิน container */
.contact-panel,
.member-form,
.admin-panel,
.article-card,
.footer-brand,
.door,
.gallery-grid figure,
.cert-grid figure,
.mission-body,
label {
  grid-template-columns: minmax(0, 1fr);
}

body[data-page="news"] .scene { border-bottom-color: rgba(23, 23, 26, .13); }

/* hero แบบซ้อนชั้น: ภาพนั่งชิดเส้น divider ล่าง, text วางทับภาพ, ขอบภาพ fade เข้าพื้นดำ */
.hero-scene {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  min-height: 100svh;
  padding-bottom: 0;
  overflow: hidden;
}

.scene-copy {
  position: relative;
  z-index: 2;
  align-self: end;
  max-width: 900px;
  padding-bottom: clamp(56px, 10vh, 130px);
}

.kicker {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

/* line-height ต้องไม่ต่ำกว่า ~1.05 เพื่อไม่ให้สระบน-วรรณยุกต์ภาษาไทยถูกตัด */
h1 {
  margin-bottom: 22px;
  font-size: clamp(52px, 10.5vw, 170px);
  line-height: 1.1;
  font-weight: 900;
}

h2 {
  margin-bottom: 24px;
  font-size: clamp(36px, 5.8vw, 96px);
  line-height: 1.15;
  font-weight: 900;
}

h3 {
  margin-bottom: 14px;
  color: var(--cream);
  font-size: clamp(22px, 2.6vw, 40px);
  line-height: 1.18;
}

.lead {
  max-width: 760px;
  color: var(--cream);
  font-size: clamp(19px, 2.2vw, 32px);
  line-height: 1.45;
  font-weight: 700;
}

body[data-page="news"] .lead { color: var(--ink); }

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 34px;
}

.motion-link,
.motion-button {
  position: relative;
  overflow: hidden;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border: 1px solid var(--cream);
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--bg);
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.motion-link.ghost {
  background: transparent;
  color: var(--cream);
  border-color: var(--line);
}

/* multi-layer hover feedback: ยกตัว + เงาเรืองส้ม + แสง sheen กวาดผ่าน + กดยุบ */
.motion-link::before,
.motion-button::before,
.nav-login::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -130%;
  width: 55%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .5), transparent);
  transform: skewX(-18deg);
  transition: left 550ms ease;
  pointer-events: none;
}

.motion-link:hover::before,
.motion-button:hover::before,
.nav-login:hover::before { left: 145%; }

.motion-link:hover,
.motion-button:hover {
  transform: translateY(-3px);
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  box-shadow: 0 14px 34px rgba(239, 81, 67, .38);
}

.motion-link:active,
.motion-button:active {
  transform: translateY(-1px) scale(.97);
  box-shadow: 0 6px 16px rgba(239, 81, 67, .3);
}

.motion-link:focus-visible,
.motion-button:focus-visible,
.carousel-btn:focus-visible,
.nav-login:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.nav-login {
  position: relative;
  overflow: hidden;
}

.nav-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(254, 233, 206, .22);
}

.nav-login:active { transform: translateY(0) scale(.96); }

/* ---------- Hero portrait ---------- */

.hero-portrait {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  width: min(74vw, 1080px);
  margin: 0;
  pointer-events: none;
}

.hero-portrait img {
  display: block;
  width: 100%;
  height: auto;
}

/* fade ขอบบน-ซ้ายของภาพให้กลืนกับพื้นดำ */
.hero-portrait::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 1;
  background:
    linear-gradient(to bottom, var(--bg) 0%, transparent 34%),
    linear-gradient(to right, var(--bg) 0%, transparent 40%);
}

/* neon glow ใต้ภาพ ติดเส้น divider */
.hero-portrait::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -10% -16% -10%;
  height: 52%;
  background: radial-gradient(ellipse at center, rgba(47, 107, 255, .38), transparent 70%);
  filter: blur(26px);
  pointer-events: none;
}

.article-scene img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* ---------- Mission ---------- */

.mission-scene {
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  gap: clamp(28px, 6vw, 96px);
}

.large-line {
  max-width: 990px;
  color: var(--accent);
  font-size: clamp(46px, 8vw, 140px);
  line-height: 1;
  font-weight: 900;
}

.mission-body p,
.feature-panel p,
.editorial-card p,
.process-list p,
.credential-scene p,
.article-scene p,
.contact-panel p,
.member-output,
.price-copy p,
.news-card p,
.gallery-note {
  color: var(--muted);
  font-size: clamp(16px, 1.3vw, 20px);
  line-height: 1.6;
}

/* ---------- Marquee (แถบเลื่อนไม่มีช่องว่าง เพราะเนื้อหาถูก duplicate ใน JS) ---------- */

.signal-scene {
  min-height: 70svh;
  gap: 54px;
}

.stat-marquee { overflow: hidden; }

.stat-loop {
  display: flex;
  gap: 28px;
  width: max-content;
  color: var(--accent);
  font-size: clamp(32px, 6vw, 100px);
  line-height: 1.1;
  font-weight: 900;
  white-space: nowrap;
  animation: marquee 26s linear infinite;
}

.stat-loop span { flex: 0 0 auto; }

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- Client logos ---------- */

.trust-strip {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 24px;
  align-items: center;
}

.trust-strip p { margin: 0; color: var(--muted); }

.trust-strip div,
.client-wall {
  display: grid;
  grid-template-columns: repeat(6, minmax(78px, 1fr));
  gap: 14px;
}

.trust-strip img,
.client-wall img {
  width: 100%;
  height: 118px;
  object-fit: contain;
  padding: 2px;
  background: #ffffff;
  border-radius: var(--radius);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.client-wall img { height: 168px; padding: 3px; }

.trust-strip img:hover,
.client-wall img:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .5);
}

/* ---------- Doors ---------- */

.next-scene.compact { min-height: 68svh; }

.door-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.door {
  min-height: 280px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 24px;
  background: var(--bg);
}

.door:hover {
  background: var(--accent);
  color: var(--bg);
}

.door span { color: var(--accent); font-weight: 900; }
.door:hover span { color: var(--bg); }
.door strong { font-size: 26px; line-height: 1.2; transition: transform 220ms cubic-bezier(.2, .8, .2, 1); }
.door:hover strong { transform: translateX(8px); }
.door:active { filter: brightness(.92); }
.door small { color: var(--muted); font-size: 15px; line-height: 1.5; }
.door:hover small { color: rgba(10, 10, 10, .76); }

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

.page-hero {
  min-height: 86svh;
  align-content: end;
}

.page-hero h1 { max-width: 1220px; }

/* ---------- Two-column scenes ---------- */

.detail-scene,
.editorial-grid,
.form-scene,
.member-scene,
.credential-scene,
.article-scene {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 64px);
  align-items: stretch;
}

.feature-panel,
.editorial-card,
.member-form,
.member-output,
.contact-panel {
  min-height: 100%;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

/* การ์ดสองใบวางแถวเดียวกัน: โครงเดียวกัน แนวตั้ง ท้ายการ์ดดันชิดล่างให้สมดุล */
.feature-panel,
.editorial-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.feature-panel > .card-tag,
.editorial-card > .card-tag {
  display: block;
  margin-bottom: 24px;
  color: var(--accent);
  font-weight: 900;
}

.feature-panel h2,
.editorial-card h2 {
  margin-bottom: 16px;
  font-size: clamp(26px, 2.6vw, 40px);
  line-height: 1.2;
}

.course-poster {
  width: 100%;
  margin: 0 0 24px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}

.course-poster img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
}

.tool-line { margin-top: auto !important; padding-top: 24px; }

.editorial-card .motion-link {
  margin-top: auto;
}

.editorial-card ul { margin-bottom: 28px; }

.price-copy .action-row { margin-top: 26px; }

ul {
  margin: 20px 0 0;
  padding-left: 18px;
  color: var(--cream);
}

li + li { margin-top: 10px; }
li { line-height: 1.55; }

.tool-line {
  margin: 22px 0 0;
  color: var(--orange) !important;
}

/* ---------- Pricing ---------- */

.price-scene {
  grid-template-columns: .8fr 1.2fr;
  gap: 48px;
  min-height: 72svh;
}

.price-grid,
.assessment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.price-grid div,
.assessment-grid a,
.assessment-grid button {
  min-height: 180px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 24px;
  background: var(--bg);
  text-align: left;
}

.assessment-grid button {
  border: 0;
  color: var(--cream);
  cursor: pointer;
}

/* หัวข้อราคา: คุมให้ไม่เกิน 2 บรรทัด แต่คงขนาดใหญ่ */
.price-copy h2 {
  font-size: clamp(38px, 5vw, 84px);
  line-height: 1.08;
}

.price-grid strong { color: var(--cream); font-size: 24px; }
.price-grid span, .assessment-grid small { color: var(--muted); }
.assessment-grid a { color: var(--cream); }
.assessment-grid a:hover, .assessment-grid button:hover { background: var(--surface); }

/* ---------- Process ---------- */

.process-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.process-list div {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.process-list span { color: var(--accent); font-weight: 900; }
.process-list p { margin: 0; font-size: clamp(22px, 2.8vw, 42px); line-height: 1.3; color: var(--cream); }

/* ---------- Works: gallery ---------- */

.gallery-scene { align-content: start; gap: 34px; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.gallery-grid figure {
  margin: 0;
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
}

.gallery-grid figcaption {
  color: var(--muted);
  font-size: 14px;
}

/* mosaic: ภาพแรกใหญ่เต็มคอลัมน์ซ้าย อีกสองภาพเรียงขวา (สไตล์ image-story ของเว็บต้นแบบ) */
.gallery-grid.mosaic { grid-template-columns: 1.35fr 1fr; }

.gallery-grid.mosaic figure:first-child {
  grid-row: 1 / 3;
  grid-template-rows: 1fr auto;
}

.gallery-grid.mosaic figure:first-child img {
  height: 100%;
  aspect-ratio: auto;
  min-height: 480px;
}

/* cols-2: กริดสองคอลัมน์เท่ากัน ใช้กับหมวดที่มีภาพ 2 หรือ 4 ใบ (2x1 หรือ 2x2) */
.gallery-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* speaker-grid: ภาพบุคคลแนวตั้ง crop โดยเก็บช่วงศีรษะ-ลำตัวไว้ */
.speaker-grid img { object-position: center 22%; }

.gallery-note { margin: 0; }

/* ---------- Carousel: ภาพเรียงเลื่อนแนวนอน (scroll-snap + ปุ่มเลื่อน) ---------- */

.carousel { display: grid; gap: 18px; }

.carousel-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.carousel-track::-webkit-scrollbar { display: none; }

.carousel-track figure {
  flex: 0 0 min(460px, 84%);
  scroll-snap-align: start;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.carousel-track img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
}

.carousel-track figcaption {
  color: var(--muted);
  font-size: 14px;
}

/* carousel ของ certificate: เห็นใบเต็มบนพื้นขาว พร้อมชื่อผู้ออก */
.cert-carousel .carousel-track figure {
  flex-basis: min(420px, 86%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  gap: 14px;
}

.cert-carousel .carousel-track img {
  object-fit: contain;
  padding: 8px;
  background: #ffffff;
}

.cert-carousel .carousel-track figcaption {
  font-size: 13.5px;
  line-height: 1.5;
}

.cert-carousel .carousel-track figcaption strong {
  display: block;
  margin-bottom: 2px;
  color: var(--cream);
  font-size: 14.5px;
}

.carousel-nav {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.carousel-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--cream);
  font-size: 19px;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.carousel-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  transform: translateY(-2px);
}

.carousel-btn:active { transform: translateY(0) scale(.94); }

/* ---------- Certificates: 1px-line grid ตามเอกลักษณ์เว็บต้นแบบ เห็นใบเต็มไม่ถูก crop ---------- */

.trust-page { min-height: 64svh; align-content: center; gap: 30px; }

.credential-scene { align-items: center; }

.cert-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.cert-grid figure {
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
  gap: 14px;
  padding: 18px;
  background: var(--bg);
}

.cert-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  padding: 8px;
  background: #ffffff;
  border-radius: var(--radius);
}

.cert-grid figcaption {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.cert-grid figcaption strong {
  display: block;
  margin-bottom: 2px;
  color: var(--cream);
  font-size: 14.5px;
}

/* ---------- Quotes ---------- */

.quote-scene {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px;
}

blockquote {
  margin: 0;
  color: var(--cream);
  font-size: clamp(26px, 4vw, 64px);
  line-height: 1.2;
  font-weight: 900;
}

cite {
  display: block;
  margin-top: 20px;
  color: var(--accent);
  font-size: 18px;
  font-style: normal;
}

/* ---------- News (light page) ---------- */

.light-page { color: var(--ink); }
.light-page .kicker { color: var(--accent); }
.light-page .article-scene p,
.light-page .gallery-note { color: rgba(23, 23, 26, .72); }
.light-page h2, .light-page h3 { color: var(--ink); }

.light-page code {
  display: inline-flex;
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  font-size: 15px;
}

.article-scene { align-items: start; }

.article-scene figure {
  min-height: 560px;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #eceae6;
}

.article-scene article > .kicker { margin-bottom: 12px; }

.article-meta {
  margin: 0 0 18px;
  color: rgba(23, 23, 26, .55);
  font-size: 14px;
}

.article-scene h2 { font-size: clamp(30px, 3.4vw, 52px); line-height: 1.18; }

.article-scene ul {
  margin: 4px 0 18px;
  color: var(--ink);
}

.article-scene ul li { line-height: 1.6; }
.article-scene ul strong { color: var(--accent); }

.hashtag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.hashtag-row span {
  padding: 6px 10px;
  border-radius: var(--radius);
  background: rgba(23, 23, 26, .06);
  color: rgba(23, 23, 26, .6);
  font-size: 13px;
}

.category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.category-row button,
.category-row a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid rgba(23, 23, 26, .18);
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.category-row button:hover,
.category-row a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* หมวดที่มีเนื้อหาแล้ว — ชี้ไปที่บทความจริง */
.category-row .is-live {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.category-row .is-live::after {
  content: "●";
  color: var(--orange);
  font-size: 9px;
}

/* ---------- AI Trick: admin panel + บทความที่เพิ่มโดยแอดมิน ---------- */

.light-page input,
.light-page select,
.light-page textarea {
  background: #ffffff;
  color: var(--ink);
  border-color: rgba(23, 23, 26, .2);
}

.light-page label { color: var(--ink); }

.admin-scene { align-content: start; gap: 30px; }

.admin-panel {
  display: grid;
  gap: 16px;
  padding: 26px;
  border: 1px solid rgba(23, 23, 26, .16);
  border-radius: var(--radius);
  background: #ffffff;
}

.admin-panel[hidden] { display: none; }

.admin-note {
  margin: 0;
  color: rgba(23, 23, 26, .55);
  font-size: 14.5px;
}

.article-list {
  display: grid;
  gap: 16px;
}

.article-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 24px;
  border: 1px solid rgba(23, 23, 26, .14);
  border-radius: var(--radius);
  background: #ffffff;
}

.article-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(20px, 2vw, 28px);
}

.article-card p {
  margin: 0;
  color: rgba(23, 23, 26, .72);
  white-space: pre-line;
}

.article-card .badge {
  justify-self: start;
  padding: 5px 10px;
  border-radius: var(--radius);
  background: rgba(239, 81, 67, .12);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.article-card small { color: rgba(23, 23, 26, .5); }

.article-card .delete-article {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid rgba(23, 23, 26, .2);
  border-radius: var(--radius);
  background: transparent;
  color: rgba(23, 23, 26, .55);
  font-size: 13px;
  cursor: pointer;
}

.article-card .delete-article:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- Home: news preview ---------- */

.news-preview-scene { align-content: center; gap: 34px; }

.news-card {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: clamp(20px, 3vw, 44px);
  padding: clamp(20px, 2.4vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.news-card:hover { border-color: var(--accent); }

.news-card figure {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}

.news-card img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  object-position: center top;
}

.news-card .badge {
  display: inline-block;
  margin-bottom: 16px;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: rgba(239, 81, 67, .14);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.news-card h3 { color: var(--cream); }
.news-card .motion-link { margin-top: 18px; }

/* ---------- Forms ---------- */

.request-form,
.member-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.member-form { grid-template-columns: minmax(0, 1fr); align-content: start; }

label {
  display: grid;
  gap: 8px;
  color: var(--cream);
  font-weight: 700;
}

.wide { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .055);
  color: var(--text);
  outline: none;
}

textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.form-note { min-height: 24px; margin: 0; color: var(--orange); }

/* ---------- Contact panel ---------- */

.contact-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.contact-panel a {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--cream);
}

.contact-panel a:hover { color: var(--accent); border-color: var(--accent); }
.contact-panel svg { flex: 0 0 auto; width: 18px; height: 18px; }

/* อีเมล/ลิงก์ยาวไม่มีช่องว่าง อนุญาตให้หักได้เฉพาะเมื่อจำเป็นจริง ๆ */
.contact-panel,
.contact-panel :is(p, a, strong, small, li),
.member-output,
.member-output :is(p, a, strong, small, li),
.footer-note { overflow-wrap: anywhere; }

.assessment-scene { min-height: 58svh; }
.assessment-grid { grid-template-columns: 1fr 1fr; }

/* ---------- Member ---------- */

.member-output { border-radius: var(--radius); }
.member-output a { color: var(--orange); }
.member-output h2 { font-size: clamp(24px, 2.4vw, 36px); }

.text-action {
  justify-self: start;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.text-action:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Footer + Social ---------- */

.site-footer {
  width: min(100%, var(--max));
  margin: 0 auto;
  display: grid;
  gap: 28px;
  padding: 44px clamp(16px, 3vw, 48px) 48px;
  color: var(--muted);
}

.footer-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-weight: 700;
}

.site-footer a:hover { color: var(--cream); }

.footer-brand {
  display: grid;
  gap: 10px;
}

.footer-brand img { width: 190px; }
.footer-brand p { margin: 0; max-width: 480px; }

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.social-row a,
.social-row button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.social-row a:hover,
.social-row button:hover {
  color: var(--bg);
  background: var(--cream);
  border-color: var(--cream);
}

.social-row svg { width: 17px; height: 17px; }

.footer-note {
  margin: 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.light-footer { color: rgba(23, 23, 26, .65); }
.light-footer a:hover { color: var(--accent); }
.light-footer .social-row a,
.light-footer .social-row button {
  border-color: rgba(23, 23, 26, .18);
  color: rgba(23, 23, 26, .65);
}
.light-footer .social-row a:hover,
.light-footer .social-row button:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.light-footer .footer-note { border-top-color: rgba(23, 23, 26, .13); }

/* ---------- Coming soon toast ---------- */

.toast {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  max-width: min(92vw, 480px);
  padding: 14px 20px;
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--bg);
  font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease, transform 240ms cubic-bezier(.2, .8, .2, 1);
}

.toast.is-showing {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Reveal + split-text effects ---------- */

.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 780ms ease, transform 780ms cubic-bezier(.2, .8, .2, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.split-title .word {
  display: inline-block;
  white-space: nowrap;
}

.split-title .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(.55em) rotate(4deg);
  transition: opacity 620ms ease, transform 620ms cubic-bezier(.2, .8, .2, 1);
  transition-delay: var(--char-delay, 0ms);
}

.split-title.is-visible .char {
  opacity: 1;
  transform: translateY(0) rotate(0);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }

  .split-title .char { transition-delay: 0ms !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .site-header { grid-template-columns: 1fr auto; }
  .nav-links { display: none; }

  .hero-scene,
  .mission-scene,
  .detail-scene,
  .editorial-grid,
  .price-scene,
  .form-scene,
  .member-scene,
  .credential-scene,
  .article-scene,
  .quote-scene,
  .news-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-portrait { width: min(92vw, 720px); opacity: .92; }
  .door-grid, .price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cert-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trust-strip { grid-template-columns: minmax(0, 1fr); }
  .trust-strip div, .client-wall { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .article-scene figure { min-height: 420px; }
}

@media (max-width: 680px) {
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 66px;
    padding: 10px 14px;
    row-gap: 10px;
  }

  .brand-mark img { width: 148px; }
  .brand-mark {
    grid-column: 1;
    grid-row: 1;
  }
  .nav-login {
    grid-column: 2;
    grid-row: 1;
  }
  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin: 0 -14px;
    padding: 2px 14px 4px;
    overflow-x: auto;
    color: var(--muted);
    font-size: 13px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a {
    flex: 0 0 auto;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .035);
    scroll-snap-align: start;
  }
  .nav-links a[aria-current="page"] {
    color: var(--bg);
    background: var(--cream);
    border-color: var(--cream);
  }
  body[data-page="news"] .nav-links a {
    background: rgba(23, 23, 26, .045);
    border-color: rgba(23, 23, 26, .16);
  }
  body[data-page="news"] .nav-links a[aria-current="page"] {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
  }
  .nav-login { min-height: 40px; max-width: 170px; padding: 0 13px; }
  .scene { min-height: auto; padding: 136px 0 58px; }
  .hero-scene, .page-hero { min-height: 92svh; }
  h1 { font-size: clamp(30px, 13vw, 62px); }
  h2 { font-size: clamp(26px, 9vw, 46px); }
  .lead { font-size: 20px; }
  .large-line { font-size: clamp(40px, 12vw, 54px); }

  /* มือถือ: คุมความสูงภาพให้เห็นตัวบุคคลเต็ม ส่วนเกินด้านซ้าย (พื้นดำ) ล้นออกนอกจอแทน */
  .hero-portrait { width: auto; max-width: none; opacity: .85; }
  .hero-portrait img { height: min(56svh, 540px); width: auto; max-width: none; }
  .hero-portrait::before {
    background:
      linear-gradient(to bottom, var(--bg) 0%, transparent 42%),
      linear-gradient(to right, var(--bg) 4%, transparent 52%);
  }
  .scene-copy { padding-bottom: 48px; }

  .door-grid,
  .price-grid,
  .assessment-grid,
  .request-form,
  .gallery-grid,
  .trust-strip div,
  .client-wall,
  .cert-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-scene figure { min-height: 340px; }
  .news-card img { min-height: 240px; }

  .gallery-grid.mosaic { grid-template-columns: minmax(0, 1fr); }
  .gallery-grid.mosaic figure:first-child { grid-row: auto; }
  .gallery-grid.mosaic figure:first-child img { min-height: 0; aspect-ratio: 4 / 3; }
  .gallery-grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .process-list div { grid-template-columns: 1fr; gap: 8px; }
  .feature-panel, .editorial-card, .member-form, .member-output, .contact-panel { padding: 20px; }
  .feature-panel:active,
  .editorial-card:active,
  .member-form:active,
  .member-output:active,
  .contact-panel:active,
  .gallery-grid figure:active,
  .carousel-track figure:active,
  .price-grid div:active,
  .assessment-grid a:active,
  .assessment-grid button:active {
    transform: translateY(-2px);
    border-color: rgba(254, 233, 206, .38);
    background: var(--surface);
  }
  .gallery-grid img,
  .carousel-track img,
  .course-poster img,
  .news-card img,
  .client-wall img,
  .trust-strip img {
    transition: transform 240ms ease, filter 240ms ease, box-shadow 240ms ease;
  }
  .gallery-grid figure:active img,
  .carousel-track figure:active img,
  .course-poster:active img,
  .news-card:active img {
    transform: scale(.985);
    filter: saturate(1.08) brightness(1.05);
  }
  .social-row a:active,
  .social-row button:active,
  .nav-links a:active {
    transform: translateY(1px) scale(.97);
  }
  .page-wipe::before {
    -webkit-mask-size: 300px 186px;
    mask-size: 300px 186px;
  }
  .page-wipe::after {
    width: min(82vw, 420px);
    font-size: clamp(30px, 12vw, 58px);
    line-height: 1;
  }
  .footer-nav { flex-direction: column; gap: 10px; }
}
