/* ============================================================
   style.css — โซลาร์เซลล์จักรพรรดิ (SolarCellEmperor.com)
   Responsive + Animations + Lightbox + Popup + Cookie Banner
   ============================================================ */

/* ---------- ตัวแปรสี / ค่าพื้นฐาน ---------- */
@import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Sarabun:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=swap');

:root {
  --primary:        #0f4c81;   /* น้ำเงินเข้ม */
  --primary-dark:   #0a3560;
  --primary-light:  #7fb3e0;
  --accent:         #f59e0b;   /* ส้มอำพัน (พลังงานแสงอาทิตย์) */
  --accent-dark:    #d97706;
  --bg:             #f7f9fc;
  --surface:        #ffffff;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --border:         #e2e8f0;
  --success:        #16a34a;
  --danger:         #dc2626;
  --radius:         14px;
  --shadow:         0 4px 20px rgba(15, 76, 129, .10);
  --shadow-lg:      0 12px 40px rgba(15, 76, 129, .18);
  --font:           'Prompt', 'Leelawadee UI', 'Sarabun', 'Noto Sans Thai', Tahoma, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* สำคัญ: บังคับให้ attribute `hidden` ของ HTML ทำงานเสมอ
   มิฉะนั้น element ที่ตั้ง display (เช่น .lightbox, .promo-popup, .cookie-banner)
   จะทับ display:none ของ [hidden] ทำให้ค้างแสดงและปิดไม่ได้ */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a   { color: var(--primary); text-decoration: none; }
ul  { list-style: none; }

.container { width: min(1280px, 94%); margin-inline: auto; }

/* ============================================================
   แถบเมนูหลัก (Header / Navigation)
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 900;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
  transition: box-shadow .3s;
}

.header-inner {
  display: flex; align-items: center; gap: .8rem;
  min-height: 72px;
}

.logo { display: flex; align-items: center; gap: .6rem; }
.logo-icon { flex-shrink: 0; display: grid; place-items: center; }
.logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.logo-text strong { color: var(--primary); font-size: 1.12rem; }
.logo-text small  { color: var(--text-muted); font-size: .72rem; letter-spacing: .04em; }

.main-nav { margin-left: auto; }
.main-nav ul { display: flex; gap: .12rem; flex-wrap: nowrap; }
.main-nav a {
  display: block; padding: .5rem .6rem;
  color: var(--text); font-weight: 500; font-size: .9rem;
  border-radius: 8px; white-space: nowrap;
  transition: color .2s, background .2s;
}
.main-nav a:hover  { color: var(--primary); background: #eef4fa; }
.main-nav a.active { color: #fff; background: var(--primary); }

.header-cta {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--accent); color: #fff;
  padding: .55rem 1.05rem; border-radius: 999px;
  font-weight: 600; font-size: .92rem;
  box-shadow: 0 4px 14px rgba(245, 158, 11, .35);
  transition: transform .2s, background .2s;
  white-space: nowrap;
}
.header-cta:hover { background: var(--accent-dark); transform: translateY(-2px); }

/* ปุ่มแฮมเบอร์เกอร์ (มือถือ) */
.nav-toggle {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: .5rem;
}
.nav-toggle span {
  width: 26px; height: 3px; border-radius: 3px;
  background: var(--primary);
  transition: transform .3s, opacity .3s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ============================================================
   Hero Section
   ============================================================ */
.hero {
  position: relative;
  min-height: 340px;
  display: grid; place-items: center;
  text-align: center;
  color: #fff;
  padding: 4.5rem 0 5.5rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 50% at 80% 10%, rgba(245, 158, 11, .45), transparent 60%),
    linear-gradient(135deg, #0a3560 0%, #0f4c81 45%, #1a6ab5 100%);
}

/* ลายแผงโซลาร์เซลล์จางๆ บนพื้นหลัง */
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(500px) rotateX(30deg) scale(1.6);
  transform-origin: center bottom;
  pointer-events: none;
}

/* ดวงอาทิตย์เรืองแสง */
.hero::after {
  content: '';
  position: absolute; top: -80px; right: 8%;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,158,11,.75), rgba(245,158,11,.12) 55%, transparent 70%);
  filter: blur(6px);
  animation: sunPulse 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sunPulse {
  0%, 100% { opacity: .85; transform: scale(1); }
  50%       { opacity: 1;  transform: scale(1.08); }
}

/* หน้าแรกให้ hero สูงพิเศษ */
.hero--home { min-height: 520px; }

.hero-content { position: relative; z-index: 2; }

.hero-title {
  font-size: clamp(1.7rem, 4.2vw, 3rem);
  font-weight: 700;
  text-shadow: 0 3px 16px rgba(0, 0, 0, .35);
  margin-bottom: .65rem;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: rgba(255, 255, 255, .92);
  max-width: 760px; margin-inline: auto;
}

.hero-actions { margin-top: 1.8rem; display: flex; gap: .9rem; justify-content: center; flex-wrap: wrap; }

.hero-wave {
  position: absolute; bottom: -1px; left: 0; right: 0;
  line-height: 0; z-index: 1;
}
.hero-wave svg { width: 100%; height: 70px; }

/* ============================================================
   ปุ่ม (Buttons)
   ============================================================ */
.btn {
  display: inline-block;
  padding: .8rem 1.9rem;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 600; font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-3px); }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 6px 18px rgba(245, 158, 11, .4);
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--primary); color: #fff;
  box-shadow: 0 6px 18px rgba(15, 76, 129, .35);
}
.btn-secondary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent; color: #fff;
  border-color: rgba(255, 255, 255, .8);
}
.btn-outline:hover { background: rgba(255, 255, 255, .15); }

/* ปุ่ม outline บนพื้นสว่าง */
main .btn-outline, .cookie-actions .btn-outline {
  color: var(--primary); border-color: var(--primary);
}
main .btn-outline:hover, .cookie-actions .btn-outline:hover {
  background: var(--primary); color: #fff;
}

.btn-sm { padding: .5rem 1.15rem; font-size: .9rem; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* ============================================================
   Section ทั่วไป
   ============================================================ */
.section { padding: 4rem 0; }
.section-alt { background: var(--surface); }

.section-head { text-align: center; max-width: 720px; margin: 0 auto 2.6rem; }
.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  color: var(--primary);
  margin-bottom: .5rem;
  position: relative;
  display: inline-block;
  padding-bottom: .55rem;
}
.section-head h2::after {
  content: '';
  position: absolute; left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 64px; height: 4px; border-radius: 4px;
  background: var(--accent);
}
.section-head p { color: var(--text-muted); }

/* ============================================================
   การ์ดบริการ (Service Cards)
   ============================================================ */
.grid { display: grid; gap: 1.6rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.9rem 1.6rem;
  transition: transform .3s, box-shadow .3s;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

.card-icon {
  width: 62px; height: 62px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #eef4fa, #dbeafe);
  margin-bottom: 1.1rem;
  font-size: 1.7rem;
}

.card h3 { color: var(--primary); font-size: 1.12rem; margin-bottom: .5rem; }
.card p  { color: var(--text-muted); font-size: .94rem; }

/* ============================================================
   การ์ดสินค้า (Product Cards)
   ============================================================ */
.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .3s, box-shadow .3s;
}
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

.product-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f1f5f9;
  cursor: zoom-in;
}
.product-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .45s;
}
.product-card:hover .product-thumb img { transform: scale(1.06); }

.product-badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--accent); color: #fff;
  font-size: .74rem; font-weight: 600;
  padding: .25rem .7rem; border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0,0,0,.2);
  z-index: 2;
}

.product-body { padding: 1.15rem 1.2rem 1.35rem; display: flex; flex-direction: column; flex: 1; }
.product-cat  { font-size: .78rem; color: var(--accent-dark); font-weight: 600; margin-bottom: .25rem; }
.product-name {
  font-size: 1.02rem; color: var(--text); font-weight: 600;
  line-height: 1.45; margin-bottom: .45rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-desc {
  font-size: .86rem; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: .9rem;
}
.product-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.product-price { font-weight: 700; color: var(--primary); }

/* ตัวกรองหมวดหมู่ */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .55rem;
  justify-content: center; margin-bottom: 2.2rem;
}
.filter-btn {
  padding: .5rem 1.2rem; border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  font-family: var(--font); font-size: .9rem; font-weight: 500;
  cursor: pointer; transition: all .2s;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.search-box {
  display: flex; gap: .6rem; max-width: 480px; margin: 0 auto 1.6rem;
}
.search-box input {
  flex: 1; padding: .7rem 1.1rem;
  border: 1.5px solid var(--border); border-radius: 999px;
  font-family: var(--font); font-size: .95rem;
  outline: none; transition: border .2s;
}
.search-box input:focus { border-color: var(--primary); }

/* ============================================================
   หน้ารายละเอียดสินค้า
   ============================================================ */
.detail-layout {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 2.6rem;
  align-items: start;
}

.detail-image {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: zoom-in;
  position: relative;
}
.detail-image::after {
  content: '🔍 คลิกเพื่อขยาย';
  position: absolute; bottom: 12px; right: 12px;
  background: rgba(15, 76, 129, .85); color: #fff;
  font-size: .78rem; padding: .3rem .8rem; border-radius: 999px;
}

.detail-info h1 { color: var(--primary); font-size: 1.65rem; line-height: 1.4; margin-bottom: .4rem; }
.detail-brand { color: var(--text-muted); margin-bottom: 1rem; }
.detail-price { font-size: 1.5rem; font-weight: 700; color: var(--accent-dark); margin-bottom: 1.2rem; }

.spec-table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; }
.spec-table th, .spec-table td {
  text-align: left; padding: .68rem .9rem;
  border-bottom: 1px solid var(--border);
  font-size: .93rem;
}
.spec-table th { color: var(--primary); font-weight: 600; width: 42%; background: #f8fafc; }

/* ============================================================
   แกลเลอรี (Gallery)
   ============================================================ */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.gallery-item {
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: zoom-in;
  position: relative; aspect-ratio: 4 / 3; background: #f1f5f9;
}
.gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .45s;
}
.gallery-item:hover img { transform: scale(1.07); }
.gallery-item .gallery-caption {
  position: absolute; inset: auto 0 0 0;
  background: linear-gradient(transparent, rgba(10, 40, 70, .85));
  color: #fff; padding: 1.6rem .9rem .7rem;
  font-size: .88rem;
  opacity: 0; transition: opacity .3s;
}
.gallery-item:hover .gallery-caption { opacity: 1; }

/* ============================================================
   ฟอร์ม (Forms)
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group.full { grid-column: 1 / -1; }

.form-group label { font-weight: 600; font-size: .92rem; color: var(--text); }
.form-group label .req { color: var(--danger); }

.form-control {
  padding: .75rem 1rem;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: var(--font); font-size: .96rem;
  outline: none; background: var(--surface);
  transition: border .2s, box-shadow .2s;
  width: 100%;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, .12);
}
textarea.form-control { resize: vertical; min-height: 130px; }

.alert {
  padding: .9rem 1.2rem; border-radius: 10px;
  margin-bottom: 1.3rem; font-size: .95rem;
}
.alert-success { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.alert-danger  { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }

/* ============================================================
   เครื่องคำนวณโซลาร์ (Calculator)
   ============================================================ */
.calc-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2rem; align-items: start; }

.calc-panel {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2rem 1.8rem;
}
.calc-panel h3 { color: var(--primary); margin-bottom: 1.2rem; }

.calc-result { text-align: center; padding: 1rem 0; }
.calc-result .big {
  font-size: 2.6rem; font-weight: 700; color: var(--accent-dark);
  line-height: 1.2;
}
.calc-result .unit { color: var(--text-muted); }

.result-rows { margin-top: 1.4rem; }
.result-row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .68rem .3rem; border-bottom: 1px dashed var(--border);
  font-size: .95rem;
}
.result-row strong { color: var(--primary); }

.range-value { font-weight: 700; color: var(--accent-dark); }

/* ---------- ตัวเลือกระบบไฟ / ช่วงเวลา ---------- */
.calc-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.6rem; }
.calc-controls .form-group { margin-bottom: 0; }
@media (max-width: 560px) { .calc-controls { grid-template-columns: 1fr; } }

/* ---------- ตารางอุปกรณ์ไฟฟ้า ---------- */
.appl-head, .appl-row {
  display: grid;
  grid-template-columns: 1fr 84px 84px 96px;
  gap: .6rem; align-items: center;
}
.appl-head {
  font-size: .78rem; font-weight: 600; color: var(--text-muted);
  padding: 0 .2rem .55rem; border-bottom: 2px solid var(--border);
  text-align: center;
}
.appl-head span:first-child { text-align: left; }

.appl-row {
  padding: .6rem .2rem; border-bottom: 1px solid var(--border);
}
.appl-row:hover { background: #f8fafc; }

.appl-name { display: flex; align-items: center; gap: .5rem; font-size: .92rem; font-weight: 500; }
.appl-name small { display: block; color: var(--text-muted); font-weight: 400; font-size: .74rem; }
.appl-icon { font-size: 1.3rem; flex-shrink: 0; }

.appl-input {
  width: 100%; text-align: center;
  padding: .5rem .3rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-size: .95rem;
  outline: none; transition: border .2s;
}
.appl-input:focus { border-color: var(--primary); }
.appl-input.filled { border-color: var(--accent); background: #fffbeb; }

.appl-consume { text-align: right; font-size: .9rem; white-space: nowrap; }
.appl-consume .appl-wh { font-weight: 700; color: var(--primary); }
.appl-consume.zero .appl-wh { color: var(--text-muted); font-weight: 400; }

.appl-na { text-align: center; color: var(--border); }

/* ยอดรวมการใช้ไฟ */
.calc-total {
  margin-top: 1.4rem; padding: 1.2rem 1.4rem;
  background: linear-gradient(135deg, #eef4fa, #dbeafe);
  border-radius: var(--radius); text-align: center;
}
.calc-total .total-wh { font-size: 1.05rem; color: var(--text-muted); }
.calc-total .total-kwh { font-size: 2.2rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.calc-total .total-unit { font-size: .88rem; color: var(--text-muted); }

.result-note {
  margin-top: 1.2rem; padding: .9rem 1.1rem;
  background: #f0f9ff; border-left: 4px solid var(--primary);
  border-radius: 8px; font-size: .9rem; color: var(--text);
}

@media (max-width: 560px) {
  .appl-head, .appl-row { grid-template-columns: 1fr 60px 60px 74px; gap: .35rem; }
  .appl-icon { font-size: 1.1rem; }
  .appl-input { padding: .45rem .2rem; font-size: .88rem; }
}

/* ============================================================
   Popup โปรโมชั่น
   ============================================================ */
.promo-popup {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(10, 30, 55, .6);
  display: grid; place-items: center;
  padding: 1rem;
  animation: fadeIn .35s;
}
.promo-popup-box {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  max-width: 430px; width: 100%;
  padding: 2.4rem 2rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: popIn .4s cubic-bezier(.2, 1.2, .4, 1);
}
.promo-popup-box h2 { color: var(--primary); margin: .8rem 0 .5rem; }
.promo-popup-box p  { color: var(--text-muted); margin-bottom: 1.4rem; }
.promo-icon { display: grid; place-items: center; }

.promo-close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: 0; cursor: pointer;
  font-size: 1.9rem; line-height: 1; color: var(--text-muted);
  transition: color .2s;
}
.promo-close:hover { color: var(--danger); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn  { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: scale(1); } }

/* ============================================================
   Cookie / PDPA Banner
   ============================================================ */
.cookie-banner {
  position: fixed; z-index: 1100;
  left: 50%; bottom: 18px;
  transform: translateX(-50%);
  width: min(720px, 94%);
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 1.15rem 1.4rem;
  display: flex; align-items: center; gap: 1.2rem;
  animation: slideUp .5s cubic-bezier(.2, 1, .4, 1);
}
.cookie-text { flex: 1; font-size: .88rem; }
.cookie-text p { color: var(--text-muted); margin-top: .15rem; }
.cookie-actions { display: flex; flex-direction: column; gap: .5rem; }

@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 40px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============================================================
   Lightbox (ระบบคลิกดูภาพขยาย)
   ============================================================ */
.lightbox {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(8, 20, 35, .92);
  display: grid; place-items: center;
  padding: 2.2rem;
  animation: fadeIn .25s;
}
.lightbox img {
  max-width: min(1000px, 100%);
  max-height: 82vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  animation: popIn .3s;
  object-fit: contain;
}
.lightbox-caption {
  position: absolute; bottom: 22px; left: 0; right: 0;
  text-align: center; color: rgba(255, 255, 255, .9); font-size: .95rem;
}
.lightbox-close {
  position: absolute; top: 14px; right: 22px;
  background: none; border: 0; cursor: pointer;
  color: #fff; font-size: 2.6rem; line-height: 1;
  transition: transform .2s;
}
.lightbox-close:hover { transform: scale(1.15); }

/* ============================================================
   Scroll Animations (ระบบ animate ตอนเลื่อนหน้าจอ)
   ============================================================ */
/* หลักการ Progressive Enhancement:
   ซ่อนไว้เพื่อ animate เฉพาะเมื่อ JavaScript ทำงาน (html มีคลาส .js-anim)
   ถ้าปิด JavaScript หรือ JS โหลดไม่สำเร็จ เนื้อหาจะแสดงตามปกติเสมอ */
.js-anim .animate-on-scroll {
  opacity: 0;
  transition: opacity .7s ease, transform .7s ease;
  will-change: opacity, transform;
}
.js-anim .animate-on-scroll[data-animation="fade-up"]    { transform: translateY(36px); }
.js-anim .animate-on-scroll[data-animation="fade-down"]  { transform: translateY(-36px); }
.js-anim .animate-on-scroll[data-animation="fade-left"]  { transform: translateX(44px); }
.js-anim .animate-on-scroll[data-animation="fade-right"] { transform: translateX(-44px); }
.js-anim .animate-on-scroll[data-animation="zoom-in"]    { transform: scale(.88); }

.js-anim .animate-on-scroll.animated {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   แถบสถิติ / จุดเด่น (Why us)
   ============================================================ */
.stats-band {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 3rem 0;
}
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; text-align: center; }
.stat-item .stat-number { font-size: 2.1rem; font-weight: 700; color: var(--accent); }
.stat-item .stat-label  { font-size: .92rem; color: rgba(255, 255, 255, .85); }

/* CTA band */
.cta-band {
  background:
    radial-gradient(ellipse 50% 80% at 85% 20%, rgba(245,158,11,.35), transparent 60%),
    linear-gradient(120deg, var(--primary-dark), var(--primary));
  color: #fff; text-align: center;
  padding: 3.6rem 1rem; border-radius: 22px;
}
.cta-band h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: .6rem; }
.cta-band p  { color: rgba(255, 255, 255, .88); margin-bottom: 1.6rem; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: #0a2540;
  color: #cbd5e1;
  margin-top: 4rem;
}
.footer-grid {
  display: grid; grid-template-columns: 1.3fr 1fr 1.3fr;
  gap: 2.2rem; padding: 3.2rem 0 2.2rem;
}
.footer-col h3 {
  color: #fff; font-size: 1.05rem; margin-bottom: .9rem;
  padding-bottom: .5rem; position: relative;
}
.footer-col h3::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 38px; height: 3px; border-radius: 3px; background: var(--accent);
}
.footer-col p { font-size: .9rem; }
.footer-license { margin-top: .8rem; font-size: .82rem; color: #94a3b8; }

.footer-links li, .footer-contact li { margin-bottom: .45rem; font-size: .9rem; }
.footer-links a, .footer-contact a { color: #cbd5e1; transition: color .2s; }
.footer-links a:hover, .footer-contact a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding: 1.1rem 0; text-align: center;
  font-size: .84rem; color: #94a3b8;
}
.footer-bottom a { color: #cbd5e1; }
.footer-bottom a:hover { color: var(--accent); }

/* ============================================================
   Breadcrumb / utility
   ============================================================ */
.breadcrumb { font-size: .88rem; color: var(--text-muted); margin-bottom: 1.6rem; }
.breadcrumb a { color: var(--primary); }

.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }

.loading-spinner {
  width: 44px; height: 44px; margin: 2.5rem auto;
  border: 4px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; color: var(--text-muted); padding: 3rem 1rem; }

/* ============================================================
   Responsive
   ============================================================ */
/* ซ่อนปุ่มโทรในจอกลาง เพื่อให้เมนูมีที่พออยู่บรรทัดเดียว */
@media (max-width: 1200px) {
  .header-cta { display: none; }
}

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

  /* เมนูยุบเป็นแฮมเบอร์เกอร์ตั้งแต่จอกลาง — กันเมนูแน่น/ตัดบรรทัด */
  .nav-toggle { display: flex; }
  .main-nav {
    position: fixed; top: 72px; left: 0; right: 0;
    background: var(--surface);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .12);
    max-height: 0; overflow: hidden;
    transition: max-height .4s ease;
  }
  .main-nav.open { max-height: 520px; }
  .main-nav ul { flex-direction: column; padding: .8rem 1.2rem 1.2rem; }
  .main-nav a { padding: .8rem 1rem; font-size: .95rem; }
}

@media (max-width: 860px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .detail-layout, .calc-layout { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; gap: 1.8rem; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 3.2rem 0 4.2rem; }
  .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; }
  .cookie-actions { flex-direction: row; justify-content: center; }
  .section { padding: 2.6rem 0; }
}

/* ============================================================
   ส่วนผู้ดูแลระบบ (Admin)
   ============================================================ */
.admin-body { background: #eef2f7; min-height: 100vh; }

.admin-topbar {
  background: var(--primary-dark); color: #fff;
  padding: .85rem 0;
}
.admin-topbar .container { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.admin-topbar .brand { font-weight: 700; }
.admin-nav { display: flex; gap: .3rem; margin-left: auto; flex-wrap: wrap; }
.admin-nav a {
  color: rgba(255, 255, 255, .85); padding: .4rem .85rem;
  border-radius: 8px; font-size: .9rem;
}
.admin-nav a:hover  { background: rgba(255, 255, 255, .12); color: #fff; }
.admin-nav a.active { background: var(--accent); color: #fff; }

.admin-main { padding: 2.2rem 0 3rem; }
.admin-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.8rem;
  margin-bottom: 1.6rem;
}
.admin-card h2 { color: var(--primary); font-size: 1.25rem; margin-bottom: 1.2rem; }

.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td {
  padding: .7rem .8rem; text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table th { background: #f8fafc; color: var(--primary); font-weight: 600; white-space: nowrap; }
.admin-table img { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; }
.admin-table .actions { display: flex; gap: .4rem; white-space: nowrap; }

.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: .18rem .65rem; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.badge-green { background: #dcfce7; color: #14532d; }
.badge-gray  { background: #e2e8f0; color: #475569; }
.badge-amber { background: #fef3c7; color: #92400e; }

.dash-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.3rem; }
.dash-stat {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem;
  border-left: 5px solid var(--accent);
}
.dash-stat .num { font-size: 2rem; font-weight: 700; color: var(--primary); }
.dash-stat .lbl { color: var(--text-muted); font-size: .9rem; }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(ellipse 60% 50% at 80% 10%, rgba(245, 158, 11, .35), transparent 60%),
    linear-gradient(135deg, #0a3560, #0f4c81);
  padding: 1rem;
}
.login-box {
  background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-lg);
  width: min(420px, 100%); padding: 2.6rem 2.2rem;
}
.login-box h1 { color: var(--primary); font-size: 1.4rem; text-align: center; margin-bottom: .4rem; }
.login-box .sub { text-align: center; color: var(--text-muted); font-size: .9rem; margin-bottom: 1.6rem; }

@media (max-width: 900px) { .dash-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .dash-grid { grid-template-columns: 1fr; } }

/* ============================================================
   FAQ (Accordion)
   ============================================================ */
.faq-list { display: flex; flex-direction: column; gap: .85rem; }
.faq-item {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.faq-question {
  width: 100%; display: flex; align-items: center; gap: .9rem;
  padding: 1.05rem 1.3rem; background: none; border: 0; cursor: pointer;
  font-family: var(--font); font-size: 1rem; font-weight: 600; color: var(--text);
  text-align: left; line-height: 1.5;
}
.faq-q-num {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-size: .85rem; font-weight: 700;
}
.faq-q-text { flex: 1; }
.faq-icon {
  flex-shrink: 0; font-size: 1.5rem; color: var(--accent); font-weight: 400;
  transition: transform .3s; line-height: 1;
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-item.open .faq-question { color: var(--primary); }

.faq-answer {
  max-height: 0; overflow: hidden;
  transition: max-height .35s ease;
}
.faq-answer p {
  padding: 0 1.3rem 1.15rem 4.2rem;
  color: var(--text-muted); font-size: .95rem; line-height: 1.75;
}
@media (max-width: 560px) {
  .faq-answer p { padding-left: 1.3rem; }
}

/* ============================================================
   บทความ (Article cards + content)
   ============================================================ */
.article-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .3s, box-shadow .3s;
}
.article-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

.article-thumb {
  display: block; aspect-ratio: 16 / 9; overflow: hidden;
  background: linear-gradient(135deg, #0a3560, #1a6ab5);
  position: relative;
}
.article-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s; }
.article-card:hover .article-thumb img { transform: scale(1.06); }
.article-thumb-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 3rem; opacity: .85;
}

.article-body { padding: 1.2rem 1.3rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.article-date { font-size: .78rem; color: var(--accent-dark); font-weight: 600; margin-bottom: .35rem; }
.article-title { font-size: 1.08rem; line-height: 1.5; margin-bottom: .5rem; }
.article-title a { color: var(--text); transition: color .2s; }
.article-title a:hover { color: var(--primary); }
.article-excerpt {
  font-size: .9rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 1rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.article-more { margin-top: auto; color: var(--primary); font-weight: 600; font-size: .9rem; }

.article-hero-img {
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  margin-bottom: 1.8rem; cursor: zoom-in;
}
.article-hero-img img { width: 100%; max-height: 420px; object-fit: cover; }

.article-content { font-size: 1.03rem; line-height: 1.9; color: var(--text); }
.article-content p { margin-bottom: 1.15rem; }
