/* =====================================================================
   base.css — สไตล์กลางของทั้งเว็บ (โทนสว่าง)
   - ตัวแปรสีและฟอนต์ของทั้งเว็บ (--site-*) แก้ที่ :root ด้านล่าง
   - เมนูบนสุด (.gnav) แถบความคืบหน้า (.gprogress) ปุ่มบทถัดไป (.gpager)
   สไตล์เฉพาะของแต่ละบทเรียนอยู่ใน style.css ของโฟลเดอร์บทเรียนนั้น
   ภาพเคลื่อนไหวทั้งหมดอยู่ใน animations.css
   ===================================================================== */
:root {
  --site-bg: #ffffff;
  --site-bg2: #f5f5f7;
  --site-ink: #1d1d1f;
  --site-muted: #6e6e73;
  --site-line: #d2d2d7;
  --site-accent: #0071e3;
  --site-link: #0066cc;
  --site-nav: rgba(251, 251, 253, 0.82);
  --site-grad: linear-gradient(90deg, #0071e3 0%, #7a5af8 45%, #e8590c 100%);
  --site-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Noto Sans Thai", "Helvetica Neue", Arial, sans-serif;
  --site-font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Noto Sans Thai", "Helvetica Neue", Arial, sans-serif;
  --site-wrap: 1120px;
  --site-ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

/* ---------- เมนูบนสุด (สร้างโดย site.js) ---------- */
.gnav {
  position: relative; z-index: 30;
  background: var(--site-nav);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  font-family: var(--site-font); font-size: 12px; line-height: 1;
  padding-top: env(safe-area-inset-top, 0px);
}
.gwrap {
  max-width: var(--site-wrap); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.gnav .gwrap { display: flex; align-items: center; gap: 20px; height: 44px; }
.gnav a { color: var(--site-ink); opacity: 0.8; text-decoration: none; white-space: nowrap; transition: opacity 0.2s; }
.gnav a:hover, .gnav a[aria-current="page"] { opacity: 1; text-decoration: none; }
.gnav a[aria-current="page"] { font-weight: 600; }
.gnav-home { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.gnav-logo {
  width: 18px; height: 18px; border-radius: 6px; background: var(--site-grad);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.gnav ul {
  display: flex; gap: 22px; list-style: none; margin: 0 0 0 auto; padding: 0;
  overflow-x: auto; scrollbar-width: none;
}
.gnav ul::-webkit-scrollbar { display: none; }
@media (max-width: 560px) { .gnav ul { gap: 16px; } }

/* ---------- แถบความคืบหน้าการเลื่อน ---------- */
.gprogress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
  background: var(--site-grad); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none;
}

/* เส้นใต้เมนูของบทเรียนเมื่อเลื่อนลงแล้ว */
.is-scrolled nav.top, .is-scrolled .nav { box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04); }

/* ---------- บทก่อนหน้า / บทถัดไป (สร้างโดย site.js) ---------- */
.gpager { background: var(--site-bg); padding-block: clamp(48px, 7vw, 88px); font-family: var(--site-font); border-top: 1px solid var(--site-line); }
.gpager-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .gpager-row { grid-template-columns: 1fr; } }
.gpager-card {
  --acc: var(--site-accent);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px; padding: 24px 26px; border-radius: 22px;
  background: var(--site-bg2); color: var(--site-ink); text-decoration: none;
  transition: transform 0.5s var(--site-ease), box-shadow 0.5s var(--site-ease);
}
.gpager-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--acc); }
.gpager-card:hover { text-decoration: none; transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08); }
.gpager-card.next { text-align: right; }
.gpager-card small { font-size: 13px; font-weight: 600; color: var(--acc); }
.gpager-card b { font-family: var(--site-font-display); font-size: clamp(19px, 2.2vw, 24px); line-height: 1.3; font-weight: 700; }
.gpager-card span { font-size: 14px; color: var(--site-muted); }
.gpager-all { text-align: center; margin: 22px 0 0; font-size: 17px; }
.gpager-all a { color: var(--site-link); }
