:root {
  --navy-deep: #0B2545;
  --navy: #14325C;
  --navy-soft: #24466E;
  --gold: #C9A227;
  --gold-light: #E8D9A0;
  --gold-pale: #F5EBC9;
  --white: #FFFFFF;
  --cream: #F7F5F0;
  --ink: #1B1B18;
  --ink-muted: #5A5A54;
  --line: rgba(201, 162, 39, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans Thai', sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, .display { font-family: 'Noto Serif Thai', serif; }
.mono { font-family: 'IBM Plex Mono', monospace; }
a { text-decoration: none; color: inherit; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* Navbar */
.navbar { position: sticky; top: 0; z-index: 50; background: var(--navy-deep); border-bottom: 1px solid var(--gold); }
.navbar .container { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); font-family: 'Noto Serif Thai', serif; font-weight: 600; font-size: 25px; }
.brand-mark { width: 78px; height: 78px; object-fit: contain; }
.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links > a { color: var(--gold-light); font-size: 15px; letter-spacing: 0.02em; transition: color 0.2s; }
.nav-links > a:hover, .nav-links > a:focus-visible { color: var(--gold); }
.nav-cta { border: 1px solid var(--gold); padding: 9px 20px; color: var(--gold) !important; font-size: 14px; }
.nav-cta:hover { background: var(--gold); color: var(--navy-deep) !important; }
/* Hamburger (mobile only) */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  background: var(--gold);
  transition: transform 0.2s, opacity 0.2s;
}
.nav-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Dropdown */
.nav-item { position: relative; }
.nav-item > .nav-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gold-light);
  font-size: 15px;
  letter-spacing: 0.02em;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Noto Sans Thai', sans-serif;
  padding: 0;
  transition: color 0.2s;
}
.nav-item > .nav-trigger:hover,
.nav-item > .nav-trigger:focus-visible,
.nav-item:focus-within > .nav-trigger { color: var(--gold); }
.nav-caret {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s;
  margin-top: -3px;
}
.nav-item:focus-within .nav-caret { transform: rotate(225deg); margin-top: 3px; }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 18px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 220px;
  background: var(--navy);
  border: 1px solid var(--line);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 60;
}
@media (min-width: 861px) {
  .nav-item:focus-within .nav-dropdown,
  .nav-item.is-open .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
}
.nav-item:focus-within .nav-caret,
.nav-item.is-open .nav-caret { transform: rotate(225deg); margin-top: 3px; }
.nav-dropdown a {
  display: block;
  padding: 11px 14px;
  font-size: 14px;
  color: rgba(255,255,255,0.82);
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-dropdown a:hover, .nav-dropdown a:focus-visible {
  background: rgba(201, 162, 39, 0.08);
  color: var(--gold);
  border-left-color: var(--gold);
}

/* Hero */
.hero { background: var(--navy-deep); color: var(--white); position: relative; overflow: hidden; }
.hero .container { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; padding-top: 88px; padding-bottom: 88px; align-items: center; }
.eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 13px; letter-spacing: 0.12em; color: var(--gold); display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--gold); }
.hero h1 { font-size: 42px; font-weight: 600; line-height: 1.35; margin-bottom: 20px; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero p { color: rgba(255,255,255,0.75); font-size: 16px; max-width: 460px; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 14px; }
.btn { display: inline-flex; align-items: center; padding: 13px 26px; font-size: 15px; border: 1px solid transparent; transition: all 0.2s; }
.btn-gold { background: var(--gold); color: var(--navy-deep); font-weight: 600; }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { border-color: rgba(255,255,255,0.35); color: var(--white); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.hero-title { font-size: 30px; font-weight: 600; line-height: 1.35; margin-bottom: 20px; }
.hero-subtitle { color: rgba(255,255,255,0.75); font-size: 20px; max-width: 460px; margin-bottom: 32px; }
.ledger-card { background: var(--navy); border: 1px solid var(--line); padding: 32px 28px; }
.ledger-card .ledger-title { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.1em; color: var(--gold-light); padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.ledger-row { display: flex; justify-content: space-between; align-items: baseline; padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 14px; }
.ledger-row:last-of-type { border-bottom: none; }
.ledger-row .label { color: rgba(255,255,255,0.7); }
.ledger-row .value { font-family: 'IBM Plex Mono', monospace; color: var(--white); font-size: 14px; }
.ledger-total { margin-top: 16px; padding-top: 16px; border-top: 1.5px solid var(--gold); display: flex; justify-content: space-between; align-items: baseline; }
.ledger-total .label { color: var(--gold-light); font-size: 14px; }
.ledger-total .value { font-family: 'IBM Plex Mono', monospace; color: var(--gold); font-size: 20px; font-weight: 500; }
/* แถวคำมั่นที่ย้ายไปอยู่บนสุดของการ์ด (หน้าแรก) — เส้นทองย้ายจากด้านบนมาเป็นด้านล่างแทน */
.ledger-total--top { margin-top: 0; padding-top: 0; border-top: none; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1.5px solid var(--gold); }

/* Section shared */
section { padding: 88px 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 48px; padding-bottom: 24px; border-bottom: 1px solid var(--line); gap: 24px; }
.section-eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.1em; color: var(--gold); margin-bottom: 10px; }
.section-head h2 { font-size: 28px; font-weight: 600; color: var(--navy-deep); }
.section-link { font-size: 14px; color: var(--navy); white-space: nowrap; border-bottom: 1px solid var(--gold); padding-bottom: 2px; }
.section-link:hover { color: var(--gold); }

/* Services */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.service-card { background: var(--white); padding: 36px; }
.service-index { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--gold); margin-bottom: 16px; }
.service-card h3 { font-size: 19px; font-weight: 600; color: var(--navy-deep); margin-bottom: 10px; }
.service-card p { color: var(--ink-muted); font-size: 14.5px; margin-bottom: 20px; }
.service-price { display: flex; justify-content: space-between; align-items: baseline; padding-top: 16px; border-top: 1px dashed var(--line); }
.service-price .amount { font-family: 'IBM Plex Mono', monospace; color: var(--navy-deep); font-size: 16px; }
.service-price .unit { font-size: 12.5px; color: var(--ink-muted); }
.service-card .link-arrow { font-size: 13.5px; color: var(--navy); }

/* Glass cards — ใช้ร่วมกันในหน้า list บริการ (services/*.html), คอร์ส (courses.html), สินค้า (products.html) — การ์ดกระจกโปร่งแสง (glassmorphism) บนพื้นกรมท่า
   hover: การ์ดลอยขึ้น, ขอบเป็นสีทอง, มีแสงเรืองมุมขวาบน, ชื่อบริการเปลี่ยนเป็นสีทอง */
.glass-section {
  /* ยืดเต็มจอถ้าเนื้อหาน้อย (body เป็น flex column) กันแถบพื้นครีมโผล่ระหว่าง section กับ footer */
  flex: 1 0 auto;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 0%, rgba(201, 162, 39, 0.12), transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(20, 50, 92, 0.9), transparent 55%),
    var(--navy-deep);
}
.glass-section .section-head { border-color: rgba(255, 255, 255, 0.12); }
.glass-section .section-head h2 { color: var(--white); }
.glass-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 24px; }
.glass-empty { grid-column: 1 / -1; padding: 36px; color: rgba(255, 255, 255, 0.7); }
.glass-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.01) 100%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--white);
  overflow: hidden;
  transition: transform 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease, background 0.5s ease;
}
/* แสงเรืองมุมขวาบน โผล่ตอน hover */
.glass-card::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(201, 162, 39, 0.22);
  filter: blur(48px);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.glass-card:hover, .glass-card:focus-within {
  transform: translateY(-8px);
  border-color: rgba(201, 162, 39, 0.55);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.02) 100%);
  box-shadow: 0 24px 48px -12px rgba(201, 162, 39, 0.18);
}
.glass-card:hover::before, .glass-card:focus-within::before { opacity: 1; }
.glass-card > * { position: relative; }
.glass-media {
  aspect-ratio: 4 / 3; /* ตามสัดส่วนที่แนะนำในฟอร์ม admin — กรอบย่อขยายตามความกว้างการ์ด */
  margin-bottom: 22px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.glass-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease; }
.glass-card:hover .glass-media img, .glass-card:focus-within .glass-media img { transform: scale(1.05); }
/* บริการที่ไม่มีรูป: ใช้กล่องเลขลำดับสีทองแทนโลโก้/รูป */
.glass-badge {
  width: 56px; height: 56px;
  margin-bottom: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
  background: rgba(201, 162, 39, 0.14);
  border: 1px solid rgba(201, 162, 39, 0.35);
  color: var(--gold);
  font-family: 'IBM Plex Mono', monospace; font-size: 18px;
  transition: transform 0.3s ease;
}
.glass-card:hover .glass-badge, .glass-card:focus-within .glass-badge { transform: scale(1.06); }
.glass-index { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.1em; color: var(--gold); margin-bottom: 6px; }
.glass-card h3 { font-size: 21px; font-weight: 600; line-height: 1.4; margin-bottom: 10px; color: var(--white); transition: color 0.3s ease; }
.glass-card h3 a { color: inherit; }
.glass-card:hover h3, .glass-card:focus-within h3 { color: var(--gold); }
.glass-desc { font-size: 14.5px; color: rgba(255, 255, 255, 0.62); margin-bottom: 16px; }
.glass-highlights { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 14px; color: rgba(255, 255, 255, 0.88); }
.glass-highlights li { position: relative; padding-left: 22px; }
.glass-highlights li::before { content: '✓'; position: absolute; left: 0; color: var(--gold); font-weight: 600; }
.glass-highlights .glass-more-count { color: var(--gold-light); font-size: 13px; }
.glass-highlights .glass-more-count::before { content: ''; }
.glass-channel { font-size: 13px; color: var(--gold-light); margin-bottom: 16px; }
.glass-price {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.glass-price .amount { font-family: 'IBM Plex Mono', monospace; font-size: 18px; color: var(--gold); }
.glass-price .unit { font-size: 12.5px; color: rgba(255, 255, 255, 0.55); }
.glass-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.glass-actions .btn { padding: 10px 20px; font-size: 14px; border-radius: 999px; }
.glass-more { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--gold-light); transition: color 0.3s ease; }
.glass-more span { transition: transform 0.3s ease; }
.glass-more:hover { color: var(--white); }
.glass-card:hover .glass-more span, .glass-card:focus-within .glass-more span { transform: translateX(4px); }
/* ตัดคำอธิบายให้สั้นในการ์ด (คอร์ส/สินค้า) — อ่านเต็มในหน้ารายละเอียด */
.glass-desc--clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* การ์ดบริการ: ชื่อไม่เกิน 2 บรรทัด + จุดเด่นข้อละ 1 บรรทัด ให้การ์ดทุกใบสูงพอดีกัน (อ่านเต็มในหน้ารายละเอียด) */
.glass-card .glass-title--clamp { line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.glass-highlights--compact li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* รูปต้องเห็นทั้งภาพ ไม่ crop ไม่ว่าสัดส่วนไหน — ใช้กับการ์ดสินค้า คอร์ส และบริการ (พื้นขาวเพราะรูปส่วนใหญ่พื้นขาว) */
.glass-media--contain { background: var(--white); }
.glass-media--contain img { object-fit: contain; padding: 12px; }
.glass-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.glass-tag {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  color: var(--gold-light); background: rgba(201, 162, 39, 0.12); border: 1px solid rgba(201, 162, 39, 0.3);
}
.glass-tag--muted { color: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.15); }
.glass-tag--danger { color: #F4A6A0; background: rgba(192, 57, 43, 0.15); border-color: rgba(192, 57, 43, 0.4); }
.glass-actions button.btn { cursor: pointer; font-family: inherit; }
.glass-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.glass-status { font-size: 13px; color: var(--gold-light); flex-basis: 100%; }
.glass-status:empty { display: none; }
/* หน้าเกี่ยวกับเรา (about.html) — หลายบล็อกต่อกันใน glass-section เดียว */
.glass-block + .glass-block { margin-top: 96px; }
.glass-lead { max-width: 760px; margin-bottom: 40px; font-size: 16px; line-height: 1.9; color: rgba(255, 255, 255, 0.78); }
.glass-badge--letter { font-family: 'Noto Serif Thai', serif; font-size: 26px; font-weight: 600; }
.glass-value { margin-bottom: 16px; padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); font-size: 13.5px; color: rgba(255, 255, 255, 0.75); }
.glass-value span { display: block; margin-bottom: 4px; font-size: 12px; letter-spacing: 0.04em; color: var(--gold); }
.glass-value + .glass-actions { margin-top: auto; }
/* การ์ดติดต่อทั้งใบเป็นลิงก์ (แผนที่ / โทร / อีเมล) */
.glass-contact { color: var(--white); }
.glass-contact-value { flex: 1; margin-bottom: 16px; font-size: 16px; line-height: 1.6; color: var(--white); overflow-wrap: anywhere; }
.glass-contact:hover .glass-more span, .glass-contact:focus-visible .glass-more span { transform: translateX(4px); }
.glass-contact:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.glass-cta { margin-top: 40px; text-align: center; }
.glass-cta .btn { border-radius: 999px; }
@media (max-width: 560px) {
  .glass-card { padding: 22px; border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .glass-card, .glass-card::before, .glass-media img, .glass-badge, .glass-more span { transition: none; }
  .glass-card:hover, .glass-card:focus-within { transform: none; }
}

/* Courses */
.courses-section { background: var(--navy-deep); }
.courses-section .section-head h2 { color: var(--white); }
.courses-section .section-head { border-color: var(--line); }
.courses-section .section-link { color: var(--gold-light); border-color: var(--gold); }
.course-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.course-card { background: var(--navy); border: 1px solid var(--line); }
.course-thumb { height: 140px; background: linear-gradient(135deg, var(--navy-soft), var(--navy)); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--gold-light); font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.08em; }
.course-body { padding: 22px; }
.course-body h3 { font-size: 16.5px; color: var(--white); font-weight: 600; margin-bottom: 8px; line-height: 1.5; }
.course-meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.1); }
.course-meta .lessons { font-size: 13px; color: rgba(255,255,255,0.6); }
.course-meta .price { font-family: 'IBM Plex Mono', monospace; color: var(--gold); font-size: 15px; }

/* Course detail */
.course-hero { background: var(--navy-deep); color: var(--white); padding: 64px 0; }
.course-hero .container { display: flex; justify-content: space-between; align-items: center; gap: 32px; flex-wrap: wrap; }
.course-hero h1 { font-size: 32px; margin-bottom: 12px; }
.course-hero p { color: rgba(255,255,255,0.75); max-width: 560px; }
.course-hero .price-tag { font-family: 'IBM Plex Mono', monospace; color: var(--gold); font-size: 26px; white-space: nowrap; }
.lesson-list { border: 1px solid var(--line); background: var(--white); }
.lesson-item { padding: 22px 26px; border-bottom: 1px solid var(--line); }
.lesson-item:last-child { border-bottom: none; }
.lesson-item.is-locked { background: var(--cream); }
.lesson-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.lesson-title { font-weight: 600; color: var(--navy-deep); }
.lesson-desc { font-size: 13.5px; color: var(--ink-muted); margin-top: 6px; }
.lesson-badge { font-family: 'IBM Plex Mono', monospace; font-size: 11px; padding: 4px 10px; border: 1px solid var(--gold); color: var(--navy); white-space: nowrap; }
.lesson-badge.locked { border-color: var(--ink-muted); color: var(--ink-muted); }
.lesson-video { margin-top: 16px; }
.lesson-video video, .lesson-video iframe { width: 100%; max-width: 480px; aspect-ratio: 16/9; border: none; display: block; }
.lesson-doc-link { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--navy); border-bottom: 1px solid var(--gold); }
.enroll-box { background: var(--gold-pale); border: 1px solid var(--gold); padding: 28px; margin-top: 32px; text-align: center; }
.enroll-box p { color: var(--ink-muted); font-size: 14px; margin-bottom: 16px; }
.enroll-status { margin-top: 14px; font-size: 14px; }

/* Products */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.product-card { background: var(--white); border: 1px solid var(--line); }
.product-thumb { height: 120px; background: var(--gold-pale); display: flex; align-items: center; justify-content: center; color: var(--gold); font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.product-body { padding: 18px; }
.product-body h3 { font-size: 14.5px; color: var(--navy-deep); font-weight: 600; margin-bottom: 10px; line-height: 1.5; }
.product-price { font-family: 'IBM Plex Mono', monospace; color: var(--navy); font-size: 15px; }

.gallery-thumb { cursor: pointer; border: 2px solid transparent; box-sizing: border-box; }
.gallery-thumb.active { border-color: var(--gold); }
.gallery-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(255,255,255,0.85); color: var(--navy); font-size: 20px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.gallery-arrow:hover { background: var(--white); }
.gallery-arrow-prev { left: 10px; }
.gallery-arrow-next { right: 10px; }

/* Follow us */
.follow-section { background: var(--white); }
.follow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
/* สองกล่องสูงเท่ากันบนจอกว้าง (500px ต้องตรงกับ height=500 ใน iframe src ของ Facebook — แก้คู่กัน) */
.follow-embed { height: 500px; border: 1px solid var(--line); background: var(--cream); overflow: hidden; display: flex; }
.follow-embed iframe { display: block; width: 100%; border: 0; }
/* Facebook Page Plugin กว้างได้สูงสุด 500px — จัดกึ่งกลางถ้าคอลัมน์กว้างกว่านั้น */
.follow-embed-fb { justify-content: center; }
.follow-embed-fb iframe { max-width: 500px; height: 100%; }
/* ตัวเล่น YouTube ต้องเป็น 16:9 เลยเติมพื้นที่ที่เหลือด้วยแถบข้อมูลช่อง แทนการยืดวิดีโอจนมีแถบดำ */
.follow-embed-yt { flex-direction: column; background: var(--navy-deep); }
.follow-embed-yt iframe { aspect-ratio: 16 / 9; flex: none; }
.follow-yt-info { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 10px; padding: 24px 30px; }
.follow-yt-label { font-size: 13px; color: var(--gold); letter-spacing: 0.04em; }
.follow-yt-info h3 { font-size: 19px; color: var(--white); font-weight: 600; margin-bottom: 8px; }

/* Contact */
.contact-section { background: var(--cream); }
.contact-wrap { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 0; border: 1px solid var(--line); }
.contact-info { background: var(--navy-deep); color: var(--white); padding: 44px; }
.contact-info h2 { font-size: 24px; margin-bottom: 16px; }
.contact-info p { color: rgba(255,255,255,0.7); font-size: 14.5px; margin-bottom: 32px; }
.contact-detail { padding: 14px 0; border-top: 1px solid rgba(255,255,255,0.12); }
.contact-detail:first-of-type { border-top: none; }
.contact-detail .k { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--gold); letter-spacing: 0.08em; margin-bottom: 4px; }
.contact-detail .v { font-size: 14.5px; }
.contact-form { background: var(--white); padding: 44px; }
.form-row { margin-bottom: 20px; }
.form-row label { display: block; font-size: 13px; color: var(--ink-muted); margin-bottom: 8px; }
.form-row input, .form-row textarea { width: 100%; border: none; border-bottom: 1px solid var(--line); background: transparent; padding: 10px 2px; font-family: 'Noto Sans Thai', sans-serif; font-size: 15px; color: var(--ink); transition: border-color 0.2s; }
.form-row input:focus, .form-row textarea:focus { outline: none; border-bottom-color: var(--gold); }
.form-row textarea { resize: vertical; min-height: 80px; }
.contact-status { margin-top: 16px; font-size: 14px; }
.contact-status-success { color: #2E7D32; }
.contact-status-error { color: #C0392B; }
.contact-form button[disabled] { opacity: 0.6; cursor: not-allowed; }
.form-two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Footer */
footer { margin-top: auto; background: var(--navy-deep); color: rgba(255,255,255,0.6); padding: 40px 0; border-top: 1px solid var(--gold); }
footer .container { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
footer .foot-links { display: flex; gap: 24px; }
footer .foot-links a:hover { color: var(--gold); }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (max-width: 860px) {
  .nav-hamburger { display: flex; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--navy-deep);
    border-bottom: 1px solid var(--gold);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-links.is-open { max-height: 80vh; overflow-y: auto; }

  .nav-item { width: 100%; }
  .nav-item > .nav-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .nav-dropdown {
    position: static;
    transform: none;
    min-width: 0;
    width: 100%;
    background: var(--navy-soft);
    border: none;
    padding: 0;
    opacity: 1;
    visibility: visible;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
  }
  .nav-item.is-open .nav-dropdown { max-height: 240px; }
  .nav-dropdown a { padding: 13px 36px; }

  .nav-links > .nav-cta {
    margin: 16px 24px 20px;
    text-align: center;
    border-top: none;
  }

  .hero .container { grid-template-columns: 1fr; padding-top: 56px; padding-bottom: 56px; }
  .hero h1 { font-size: 32px; }
  .card-grid { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .follow-grid { grid-template-columns: 1fr; }
  .follow-embed-yt { height: auto; }
  .contact-wrap { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; }
  footer .container { flex-direction: column; gap: 16px; text-align: center; }
}

/* Auth (login/register) - M12 */
.auth-section { padding: 88px 0; }
.auth-card { max-width: 420px; margin: 0 auto; background: var(--white); border: 1px solid var(--line); padding: 44px; }
.auth-card h1 { font-size: 24px; color: var(--navy-deep); margin-bottom: 8px; }
.auth-card .auth-sub { font-size: 14px; color: var(--ink-muted); margin-bottom: 32px; }
.auth-card button[type="submit"] { width: 100%; justify-content: center; border: none; cursor: pointer; margin-top: 8px; }
.auth-links { margin-top: 24px; text-align: center; font-size: 14px; color: var(--ink-muted); }
.auth-links a { color: var(--navy); border-bottom: 1px solid var(--gold); }
.auth-error { margin-top: 16px; font-size: 14px; color: #C0392B; min-height: 1.2em; }
.form-hint { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }
/* ข้อความแจ้งการใช้ข้อมูลใต้ปุ่มส่งฟอร์ม (PDPA) + ลิงก์ไป privacy.html */
.privacy-note { font-size: 12.5px; line-height: 1.6; color: var(--ink-muted); margin-top: 12px; }
.privacy-note a { color: var(--navy); text-decoration: underline; margin-left: 4px; }
/* หน้านโยบายความเป็นส่วนตัว: ตารางเต็มความกว้าง (ต่างจากตารางใน rich text ทั่วไปที่เลื่อนแนวนอน) */
.privacy-policy table { display: table; width: 100%; }
.privacy-policy th { background: rgba(201, 162, 39, 0.1); text-align: left; color: var(--navy-deep); }
.privacy-policy td:first-child { width: 34%; font-weight: 500; }
.password-field { position: relative; }
.password-field input { padding-right: 56px; }
.password-toggle { position: absolute; right: 0; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 12.5px; color: var(--navy); cursor: pointer; padding: 4px 2px; }
.password-toggle:hover { color: var(--gold); }

/* Enrollment status badges (my-courses.html) - reuses .lesson-badge base from Course detail */
.lesson-badge.status-payment_review { border-color: var(--gold); color: var(--navy); }
.lesson-badge.status-approved { border-color: #2E7D32; color: #2E7D32; }
.lesson-badge.status-rejected { border-color: #C0392B; color: #C0392B; }

/* my-orders.html reuses .lesson-badge.status-payment_review/.status-approved/.status-rejected above directly
   (Order.status uses the exact same string values as Enrollment.status) */

/* Product card quick-add (products.html) */
.product-card { display: flex; flex-direction: column; }
.product-card-actions { padding: 0 18px 18px; margin-top: -6px; }
.add-cart-status { display: block; font-size: 12px; margin-top: 6px; min-height: 1.2em; }

/* Nav cart link + count badge (all public pages) — ไอคอนตะกร้า, badge ลอยมุมขวาบนของไอคอน */
.nav-cart { position: relative; display: inline-flex; align-items: center; gap: 10px; }
.nav-cart-icon { display: block; flex: none; }
.nav-cart-label { display: none; } /* เดสก์ท็อปโชว์แค่ไอคอน — ข้อความโผล่เฉพาะในเมนูมือถือ (ดู media query ด้านล่าง) */
.nav-cart .cart-count-badge { position: absolute; top: -8px; right: -10px; margin-left: 0; }
.cart-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy-deep);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* Cart page (cart.html) */
.cart-table { border: 1px solid var(--line); background: var(--white); }
.cart-line { display: grid; grid-template-columns: 72px 1fr auto auto auto; gap: 18px; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: none; }
.cart-line-thumb { width: 72px; height: 72px; background: var(--gold-pale); display: flex; align-items: center; justify-content: center; color: var(--gold); font-family: 'IBM Plex Mono', monospace; font-size: 11px; overflow: hidden; }
.cart-line-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cart-line-name { font-weight: 600; color: var(--navy-deep); font-size: 14.5px; }
.cart-line-price { font-size: 13px; color: var(--ink-muted); margin-top: 4px; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); }
.qty-stepper button { width: 30px; height: 30px; background: none; border: none; cursor: pointer; font-size: 15px; color: var(--navy); font-family: 'IBM Plex Mono', monospace; }
.qty-stepper button:hover { background: var(--cream); }
.qty-stepper input { width: 40px; height: 30px; border: none; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font-family: 'IBM Plex Mono', monospace; font-size: 14px; }
.cart-line-subtotal { font-family: 'IBM Plex Mono', monospace; color: var(--navy-deep); font-size: 15px; white-space: nowrap; }
.cart-line-remove { font-size: 12.5px; color: #C0392B; background: none; border: none; cursor: pointer; border-bottom: 1px solid #C0392B; padding: 0; }
.cart-summary { max-width: 360px; margin-left: auto; margin-top: 28px; background: var(--gold-pale); border: 1px solid var(--gold); padding: 24px 26px; }
.cart-summary-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; padding: 8px 0; }
.cart-summary-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 14px; margin-top: 8px; border-top: 1.5px solid var(--gold); }
.cart-summary-total .value { font-family: 'IBM Plex Mono', monospace; color: var(--navy-deep); font-size: 20px; font-weight: 600; }
.cart-empty { padding: 48px 0; text-align: center; color: var(--ink-muted); }

/* Checkout page (checkout.html) - reuses .enroll-box pattern from course-detail for the slip-upload form */
.checkout-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: start; }
.order-item-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.order-item-row:last-child { border-bottom: none; }
.order-item-row .name { color: var(--ink); }
.order-item-row .meta { color: var(--ink-muted); white-space: nowrap; }

@media (max-width: 860px) {
  .checkout-grid { grid-template-columns: 1fr; }
  .cart-line { grid-template-columns: 56px 1fr; row-gap: 10px; }
  .cart-line-thumb { width: 56px; height: 56px; grid-row: span 3; }
}

/* Responsive: tablet + phone (เพิ่มต่อจาก breakpoint 860px ด้านบน) */
img, video, iframe { max-width: 100%; }
/* หน้ารายละเอียดสินค้า: รูปซ้าย ข้อมูลขวา — จอ ≤ 860px เรียงเป็นคอลัมน์เดียว (ดู media query ด้านล่าง) */
.product-detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.product-detail-layout > * { min-width: 0; }
.lesson-title, .lesson-desc, .order-item-row .name, .cart-line-name { overflow-wrap: anywhere; }
/* คงรูปแบบข้อความที่แอดมินวางมาจาก textarea (ขึ้นบรรทัดใหม่/ย่อหน้า/ช่องว่าง) ไม่ให้ browser ยุบเป็นบรรทัดเดียว */
.text-preserve { white-space: pre-wrap; overflow-wrap: anywhere; }

/* เนื้อหา rich text ที่แอดมินวางจาก Word ผ่าน editor (ผ่าน DOMPurify ใน js/rich-text.js แล้ว) */
.rich-text { overflow-wrap: anywhere; line-height: 1.75; }
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text p { margin: 0 0 0.6em; }
.rich-text p:empty::after { content: "\00a0"; }
.rich-text h1, .rich-text h2, .rich-text h3, .rich-text h4 { color: var(--navy-deep); margin: 1.1em 0 0.5em; line-height: 1.4; }
.rich-text h1 { font-size: 1.5em; }
.rich-text h2 { font-size: 1.3em; }
.rich-text h3 { font-size: 1.15em; }
.rich-text ul, .rich-text ol { margin: 0 0 0.8em; padding-left: 1.6em; }
.rich-text ul { list-style: disc; }
.rich-text ol { list-style: decimal; }
.rich-text ul ul { list-style: circle; }
.rich-text li { margin-bottom: 0.25em; }
.rich-text a { color: var(--navy); text-decoration: underline; }
.rich-text blockquote { border-left: 3px solid var(--gold); margin: 0 0 0.8em; padding: 4px 0 4px 14px; color: var(--ink-muted); }
.rich-text .ql-indent-1 { padding-left: 2em; } .rich-text .ql-indent-2 { padding-left: 4em; } .rich-text .ql-indent-3 { padding-left: 6em; }
/* ตารางจาก Word: กว้างเกินจอมือถือให้เลื่อนแนวนอนได้ในตัวเอง ไม่ดันทั้งหน้าล้น */
.rich-text table { border-collapse: collapse; margin: 0 0 1em; display: block; max-width: 100%; overflow-x: auto; }
.rich-text td, .rich-text th { border: 1px solid var(--line); padding: 6px 10px; vertical-align: top; min-width: 60px; }

@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .course-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  section { padding: 64px 0; }
  .auth-section { padding: 56px 0; }
  .contact-info, .contact-form { padding: 32px 24px; }
  .course-grid { grid-template-columns: 1fr; }
  .course-hero { padding: 48px 0; }
  .course-hero h1 { font-size: 26px; }
  .cart-summary { max-width: none; }
  .product-detail-layout { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 560px) {
  .container { padding: 0 16px; }
  section { padding: 48px 0; }
  .navbar .container { height: 64px; }
  .brand { font-size: 17px; gap: 6px; min-width: 0; }
  .brand-mark { width: 52px; height: 52px; flex-shrink: 0; }
  .nav-item > .nav-trigger { padding: 16px; }
  .nav-dropdown a { padding: 13px 28px; }
  .nav-links > .nav-cta { margin: 16px 16px 20px; }

  .hero .container { padding-top: 40px; padding-bottom: 40px; gap: 32px; }
  .hero h1 { font-size: 26px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { justify-content: center; }
  .btn { padding: 12px 20px; }

  .section-head { margin-bottom: 32px; padding-bottom: 16px; }
  .section-head h2 { font-size: 23px; }
  .service-card { padding: 24px 20px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-body { padding: 14px; }
  .product-card-actions { padding: 0 14px 14px; }
  .follow-yt-info { padding: 20px; }
  .form-two { grid-template-columns: 1fr; gap: 0; }
  .contact-info, .contact-form { padding: 28px 20px; }
  .auth-card { padding: 28px 20px; }
  .enroll-box { padding: 20px 16px; }
  .lesson-item { padding: 18px 16px; }
  .lesson-head { flex-wrap: wrap; }
  .course-hero .price-tag { font-size: 22px; }
  .cart-line { padding: 16px; gap: 12px; }
  .cart-summary { padding: 20px 18px; }
  .order-item-row { flex-direction: column; gap: 4px; }
  footer { padding: 28px 0; }
  footer .foot-links { gap: 16px; }
  footer .container { font-size: 12.5px; }
}

/* Mobile nav = sidebar เลื่อนออกจากขวา (override แบบ dropdown เดิมใน breakpoint 860px ด้านบน) */
.nav-backdrop { display: none; }
@media (max-width: 860px) {
  .nav-links {
    position: fixed;
    top: 72px;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(320px, 86vw);
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-bottom: none;
    border-left: 1px solid var(--gold);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0.25s;
    z-index: 55;
  }
  .nav-links > .nav-cart .nav-cart-label { display: inline; }
  .nav-links > .nav-cart .cart-count-badge { position: static; margin-left: auto; }
  .nav-links.is-open { max-height: none; transform: none; visibility: visible; overflow-y: auto; }
  .nav-item.is-open .nav-dropdown { max-height: 70vh; overflow-y: auto; }
  .nav-links > .nav-cart {
    justify-content: flex-start;
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 72px 0 0 0;
    background: rgba(11, 37, 69, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
    z-index: 45;
  }
  .nav-links > .nav-cta { margin: 28px 24px 24px; padding: 12px 20px; }
  body.nav-open { overflow: hidden; }
  body.nav-open .nav-backdrop { opacity: 1; visibility: visible; }
}
@media (max-width: 560px) {
  .nav-links { top: 64px; }
  .nav-backdrop { inset: 64px 0 0 0; }
  .nav-links > .nav-cart { padding: 16px; }
  .nav-links > .nav-cta { margin: 28px 16px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ปุ่มกลับบนหน้ารายละเอียด (เช่น product-detail) */
.back-link-bar { padding-top: 24px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--navy); text-decoration: none; }
.back-link:hover { color: var(--gold); }
