/* ============================================================
   SAO Website — Design System (Public)
   Navy Government Premium · Kanit + Sarabun · CSS variables
   ทุกสีแบรนด์ใช้ var(--brand-*) → เปลี่ยนธีมจากหลังบ้านได้ทั้งเว็บ
   ============================================================ */

:root {
    /* ── Brand scale (navy default) — override ได้ผ่าน theme_style_tag ── */
    --brand-50:  #eff5ff;
    --brand-100: #dbe7fe;
    --brand-200: #bfd3fe;
    --brand-300: #93b4fd;
    --brand-400: #6088fa;
    --brand-500: #3b62f6;
    --brand-600: #2543eb;
    --brand-700: #1d33d8;
    --brand-800: #1e2caf;
    --brand-900: #1e2a8a;
    --brand-950: #172156;

    /* ── Accent (gold ราชการ) ── */
    --gold-400: #fbbf24;
    --gold-500: #f59e0b;
    --gold-600: #d97706;

    /* ── Neutral / surface ── */
    --ink:        #0f172a;
    --ink-soft:   #334155;
    --ink-muted:  #64748b;
    --line:       #e2e8f0;
    --line-strong:#cbd5e1;
    --bg:         #f4f7fb;
    --surface:    #ffffff;

    /* ── Status ── */
    --green: #059669; --green-bg:#ecfdf5;
    --red:   #dc2626; --red-bg:  #fef2f2;
    --amber: #d97706; --amber-bg:#fffbeb;
    --sky:   #0284c7; --sky-bg:  #f0f9ff;
    --violet:#7c3aed; --violet-bg:#f5f3ff;

    --radius:   16px;
    --radius-sm:12px;
    --radius-lg:24px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.08);
    --shadow:    0 4px 14px rgba(15,23,42,.08);
    --shadow-lg: 0 18px 48px rgba(15,23,42,.16);
    --shadow-brand: 0 10px 30px rgba(30,42,138,.28);
    --ease: cubic-bezier(.4,0,.2,1);
    --header-h: 72px;
}

/* ── Reset ── */
*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Sarabun', system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}
h1,h2,h3,h4,h5,.font-display { font-family: 'Kanit', system-ui, sans-serif; font-weight: 600; line-height: 1.3; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; }
:focus-visible { outline: 3px solid var(--brand-300); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0; }

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
    background: var(--brand-950);
    color: #cbd5e1;
    font-size: 13px;
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 38px; gap: 16px; }
.topbar a { color: #cbd5e1; transition: color .2s; }
.topbar a:hover { color: #fff; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 18px; }
.topbar-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.topbar-item i { color: var(--gold-400); }
.topbar-social { display: flex; gap: 8px; }
.topbar-social a {
    width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
    background: rgba(255,255,255,.08); font-size: 13px;
}
.topbar-social a:hover { background: var(--gold-500); color: var(--brand-950); }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    position: sticky; top: 0; z-index: 40;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    transition: box-shadow .3s;
}
.navbar.is-scrolled { box-shadow: var(--shadow); }
.navbar .container { display: flex; align-items: center; gap: 18px; height: var(--header-h); }
.nav-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-logo {
    width: 48px; height: 48px; border-radius: 13px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--brand-800), var(--brand-600));
    display: grid; place-items: center; color: #fff; font-size: 24px;
    box-shadow: var(--shadow-brand);
    overflow: hidden;
}
.nav-logo img { width: 100%; height: 100%; object-fit: cover; }
.nav-brand-text strong { font-family: 'Kanit',sans-serif; font-size: 17px; color: var(--brand-900); display: block; line-height: 1.2; }
.nav-brand-text span { font-size: 11.5px; color: var(--ink-muted); }

.nav-menu { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-menu a {
    padding: 9px 14px; border-radius: 10px; font-weight: 500; font-size: 15px;
    color: var(--ink-soft); position: relative; transition: all .2s var(--ease); white-space: nowrap;
}
.nav-menu a:hover { color: var(--brand-700); background: var(--brand-50); }
.nav-menu a.is-active { color: var(--brand-700); background: var(--brand-50); }
.nav-menu a.is-active::after {
    content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2.5px;
    background: var(--gold-500); border-radius: 3px;
}
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-search-btn, .nav-toggle {
    width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink-soft); display: grid; place-items: center; font-size: 18px;
    transition: all .2s;
}
.nav-search-btn:hover { border-color: var(--brand-300); color: var(--brand-600); }
.nav-toggle { display: none; }
.nav-login {
    display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px; border-radius: 11px;
    background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
    color: #fff; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-brand);
    transition: transform .15s, box-shadow .15s;
}
.nav-login:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(30,42,138,.4); color: #fff; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: 12px; border: 0; font-family: 'Kanit',sans-serif;
    font-weight: 600; font-size: 15px; cursor: pointer; transition: all .18s var(--ease);
    text-decoration: none; position: relative; overflow: hidden;
}
.btn-primary { background: linear-gradient(135deg, var(--brand-700), var(--brand-500)); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 36px rgba(30,42,138,.4); color: #fff; }
.btn-gold { background: linear-gradient(135deg, var(--gold-500), var(--gold-600)); color: #422006; box-shadow: 0 10px 26px rgba(245,158,11,.4); }
.btn-gold:hover { transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--brand-700); border: 1.5px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--brand-400); background: var(--brand-50); }
.btn-white { background: #fff; color: var(--brand-800); box-shadow: var(--shadow); }
.btn-white:hover { transform: translateY(-1px); }
.btn-danger { background: linear-gradient(135deg,#dc2626,#ef4444); color:#fff; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { padding: 15px 30px; font-size: 17px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn .ripple { position:absolute; border-radius:50%; transform:scale(0); background:rgba(255,255,255,.5); animation:ripple .6s linear; pointer-events:none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* ============================================================
   HERO SLIDER
   ============================================================ */
.hero {
    position: relative;
    min-height: clamp(440px, 60vw, 600px);
    overflow: hidden;
    background: var(--brand-950);
}
.hero-slides { position: absolute; inset: 0; } /* fill min-height parent (ไม่ใช้ height:100%) */
.hero-slide {
    position: absolute; inset: 0;
    opacity: 0; visibility: hidden;
    transition: opacity .9s var(--ease);
    background-size: cover; background-position: center;
    background-color: var(--brand-900);
}
.hero-slide.is-active { opacity: 1; visibility: visible; }
/* overlay แบบ side gradient — ฝั่งซ้ายเข้ม(อ่าน text), ฝั่งขวาใส(เห็นภาพ) */
.hero-slide::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(15,33,86,.92) 0%, rgba(15,33,86,.7) 38%, rgba(15,33,86,.25) 72%, rgba(15,33,86,0) 100%);
}
.hero-inner {
    position: relative; z-index: 2; height: 100%;
    display: flex; flex-direction: column; justify-content: center;
    min-height: clamp(440px, 60vw, 600px);
    color: #fff; max-width: 640px;
}
.hero-badge {
    display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
    padding: 7px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
    background: rgba(251,191,36,.18); color: var(--gold-400); border: 1px solid rgba(251,191,36,.3);
    margin-bottom: 18px; backdrop-filter: blur(8px);
}
.hero-title { font-size: clamp(28px, 5vw, 46px); font-weight: 700; line-height: 1.2; margin-bottom: 16px; text-shadow: 0 2px 20px rgba(0,0,0,.3); }
.hero-sub { font-size: clamp(15px, 2.2vw, 19px); opacity: .92; margin-bottom: 28px; max-width: 540px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-dots { position: absolute; bottom: 24px; left: 0; right: 0; z-index: 3; display: flex; justify-content: center; gap: 10px; }
.hero-dot { width: 10px; height: 10px; border-radius: 999px; background: rgba(255,255,255,.4); border: 0; transition: all .3s; cursor: pointer; }
.hero-dot.is-active { width: 32px; background: var(--gold-400); }
.hero-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
    width: 48px; height: 48px; border-radius: 50%; border: 0;
    background: rgba(255,255,255,.15); color: #fff; font-size: 22px; backdrop-filter: blur(8px);
    display: grid; place-items: center; transition: background .2s;
}
.hero-arrow:hover { background: rgba(255,255,255,.3); }
.hero-arrow.prev { left: 20px; } .hero-arrow.next { right: 20px; }

/* Quick access floating card (overlap hero) */
.quick-access {
    position: relative; z-index: 5; margin-top: -60px;
}
.quick-grid {
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    padding: 22px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
    border: 1px solid var(--line);
}
.quick-item {
    display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
    padding: 18px 10px; border-radius: var(--radius); transition: all .2s var(--ease);
    color: var(--ink-soft);
}
.quick-item:hover { background: var(--brand-50); transform: translateY(-3px); }
.quick-icon {
    width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 26px;
    box-shadow: var(--shadow-sm); transition: transform .2s;
}
.quick-item:hover .quick-icon { transform: scale(1.08) rotate(-4deg); }
.quick-item span { font-size: 13.5px; font-weight: 600; line-height: 1.35; }

/* color tokens for icons */
.c-blue  { background: #dbeafe; color: #1e40af; }
.c-green { background: #d1fae5; color: #047857; }
.c-orange{ background: #ffedd5; color: #c2410c; }
.c-purple{ background: #ede9fe; color: #6d28d9; }
.c-red   { background: #fee2e2; color: #b91c1c; }
.c-teal  { background: #ccfbf1; color: #0f766e; }
.c-pink  { background: #fce7f3; color: #be185d; }
.c-indigo{ background: #e0e7ff; color: #4338ca; }

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: 60px 0; }
.section-tight { padding: 40px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.section-head-left { max-width: 640px; }
.section-eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--brand-600); font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.section-eyebrow::before { content: ""; width: 28px; height: 3px; background: var(--gold-500); border-radius: 3px; }
.section-title { font-size: clamp(22px, 3.5vw, 30px); color: var(--brand-900); }
.section-desc { color: var(--ink-muted); margin-top: 6px; }
.section-link { color: var(--brand-600); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.section-link:hover { gap: 10px; }

/* ============================================================
   NEWS CARDS
   ============================================================ */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.news-card {
    background: var(--surface); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow-sm); border: 1px solid var(--line);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
    display: flex; flex-direction: column;
}
.news-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.news-thumb { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--brand-100); }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.news-card:hover .news-thumb img { transform: scale(1.06); }
.news-cat {
    position: absolute; top: 12px; left: 12px; padding: 5px 12px; border-radius: 999px;
    font-size: 12px; font-weight: 600; backdrop-filter: blur(8px);
    background: rgba(30,42,138,.9); color: #fff;
}
.news-date-badge {
    position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.95); color: var(--brand-800);
    border-radius: 12px; padding: 6px 10px; text-align: center; font-family: 'Kanit',sans-serif; line-height: 1;
}
.news-date-badge b { font-size: 18px; display: block; }
.news-date-badge span { font-size: 11px; color: var(--ink-muted); }
.news-body { padding: 18px; display: flex; flex-direction: column; flex: 1; }
.news-title { font-size: 16.5px; line-height: 1.4; margin-bottom: 8px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-card:hover .news-title { color: var(--brand-700); }
.news-excerpt { color: var(--ink-muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 14px; flex: 1; }
.news-meta { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ink-muted); padding-top: 12px; border-top: 1px solid var(--line); }
.news-meta .views { display: inline-flex; align-items: center; gap: 5px; }

/* Featured news (large) */
.news-feature { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; }
.news-feature .feat-main { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 360px; box-shadow: var(--shadow); }
.news-feature .feat-main img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.news-feature .feat-main::after { content:""; position:absolute; inset:0; background:linear-gradient(0deg, rgba(15,33,86,.92), transparent 60%); }
.feat-content { position: absolute; bottom: 0; z-index: 2; padding: 28px; color: #fff; }
.feat-content .news-title { color: #fff; font-size: 24px; -webkit-line-clamp: 3; }
.feat-side { display: flex; flex-direction: column; gap: 14px; }
.feat-item { display: flex; gap: 14px; background: var(--surface); border-radius: var(--radius-sm); padding: 12px; border: 1px solid var(--line); transition: all .2s; }
.feat-item:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); }
.feat-item img { width: 90px; height: 72px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.feat-item-body h4 { font-size: 14.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feat-item-body time { font-size: 12.5px; color: var(--ink-muted); }

/* ============================================================
   SERVICE CARDS
   ============================================================ */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.service-card {
    background: var(--surface); border-radius: var(--radius); padding: 24px; border: 1px solid var(--line);
    box-shadow: var(--shadow-sm); transition: all .25s var(--ease); position: relative; overflow: hidden;
    display: flex; flex-direction: column;
}
.service-card::before { content:""; position:absolute; top:0; left:0; right:0; height:4px; background: var(--brand-500); transform: scaleX(0); transform-origin:left; transition: transform .3s; }
.service-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.service-card:hover::before { transform: scaleX(1); }
.service-icon { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; margin-bottom: 16px; }
.service-card h3 { font-size: 17px; margin-bottom: 8px; line-height: 1.4; }
.service-card p { color: var(--ink-muted); font-size: 14px; flex: 1; margin-bottom: 16px; }
.service-foot { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ink-muted); }
.service-foot .go { color: var(--brand-600); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }

/* compact service list item */
.service-list-card { display: flex; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; transition: all .2s; }
.service-list-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow); transform: translateX(3px); }
.service-list-card .service-icon { margin: 0; width: 52px; height: 52px; font-size: 24px; flex-shrink: 0; }

/* ============================================================
   STATS STRIP
   ============================================================ */
.stats-strip { background: linear-gradient(135deg, var(--brand-900), var(--brand-700)); position: relative; overflow: hidden; }
.stats-strip::before { content:""; position:absolute; inset:0; background: radial-gradient(circle at 85% 20%, rgba(251,191,36,.18), transparent 50%); }
.stats-grid { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; padding: 44px 0; }
.stat-cell { text-align: center; color: #fff; }
.stat-cell .stat-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 26px; color: var(--gold-400); }
.stat-cell .stat-value { font-family: 'Kanit',sans-serif; font-size: clamp(26px, 4vw, 38px); font-weight: 700; line-height: 1; }
.stat-cell .stat-suffix { font-size: 14px; opacity: .8; font-weight: 400; margin-left: 4px; }
.stat-cell .stat-label { font-size: 14px; opacity: .85; margin-top: 8px; }

/* ============================================================
   PAGE HEADER (inner pages)
   ============================================================ */
.page-header { background: linear-gradient(120deg, var(--brand-900), var(--brand-700)); color: #fff; position: relative; overflow: hidden; padding: 48px 0; }
.page-header::before { content:""; position:absolute; inset:0; background: radial-gradient(circle at 88% -10%, rgba(251,191,36,.2), transparent 55%); }
.page-header::after { content:""; position:absolute; right:-40px; bottom:-60px; width:240px; height:240px; border-radius:50%; border: 30px solid rgba(255,255,255,.05); }
.page-header .container { position: relative; z-index: 2; }
.page-header h1 { font-size: clamp(26px, 4vw, 38px); margin-bottom: 8px; }
.page-header p { opacity: .9; max-width: 640px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; opacity: .85; margin-bottom: 14px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--gold-400); }
.breadcrumb .sep { opacity: .5; }

/* ============================================================
   LAYOUT: content + sidebar
   ============================================================ */
.layout-sidebar { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; }
.layout-sidebar.right { grid-template-columns: 1fr 300px; }
.sidebar-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 20px; }
.sidebar-card-head { padding: 16px 18px; font-family: 'Kanit',sans-serif; font-weight: 600; color: var(--brand-900); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 9px; background: var(--brand-50); }
.sidebar-card-body { padding: 8px; }
.sidebar-menu a { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-radius: 10px; color: var(--ink-soft); font-size: 14.5px; transition: all .18s; }
.sidebar-menu a:hover { background: var(--brand-50); color: var(--brand-700); }
.sidebar-menu a.is-active { background: var(--brand-600); color: #fff; }
.sidebar-menu a .count { font-size: 12px; background: var(--brand-100); color: var(--brand-700); padding: 1px 9px; border-radius: 999px; }
.sidebar-menu a.is-active .count { background: rgba(255,255,255,.25); color: #fff; }

.contact-cta { background: linear-gradient(135deg, var(--brand-800), var(--brand-600)); border-radius: var(--radius); padding: 22px; color: #fff; text-align: center; }
.contact-cta .ph-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; background: rgba(255,255,255,.15); display: grid; place-items: center; font-size: 24px; }
.contact-cta .ph-num { font-family: 'Kanit',sans-serif; font-size: 22px; font-weight: 700; }
.contact-cta small { opacity: .8; }

/* ============================================================
   FILTER TOOLBAR
   ============================================================ */
.toolbar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.toolbar .search-box { flex: 1; min-width: 200px; position: relative; }
.toolbar .search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); }
.toolbar .search-box input { width: 100%; padding: 11px 14px 11px 40px; border: 1px solid var(--line-strong); border-radius: 11px; font-family: inherit; font-size: 14.5px; transition: border-color .2s; }
.toolbar .search-box input:focus { border-color: var(--brand-400); outline: none; }
.toolbar select { padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 11px; font-family: inherit; font-size: 14.5px; background: #fff; cursor: pointer; }
.toolbar .view-toggle { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 11px; }
.toolbar .view-toggle button { width: 38px; height: 36px; border: 0; background: transparent; border-radius: 8px; color: var(--ink-muted); font-size: 16px; }
.toolbar .view-toggle button.is-active { background: #fff; color: var(--brand-700); box-shadow: var(--shadow-sm); }

/* ============================================================
   GALLERY GRID
   ============================================================ */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.gallery-card { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--line); background: var(--surface); transition: all .25s var(--ease); }
.gallery-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.gallery-thumb { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--brand-100); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.gallery-card:hover .gallery-thumb img { transform: scale(1.07); }
.gallery-thumb .photo-count { position: absolute; bottom: 10px; right: 10px; background: rgba(15,33,86,.85); color: #fff; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; backdrop-filter: blur(6px); }
.gallery-body { padding: 16px; }
.gallery-body h3 { font-size: 16px; line-height: 1.4; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gallery-meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-muted); }
.gallery-meta span { display: inline-flex; align-items: center; gap: 5px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.badge-blue { background: var(--brand-100); color: var(--brand-800); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-gray { background: #f1f5f9; color: var(--ink-muted); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 36px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 42px; height: 42px; padding: 0 12px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-weight: 600; font-size: 14.5px; transition: all .2s;
}
.pagination a:hover { border-color: var(--brand-400); color: var(--brand-700); }
.pagination .is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 7px; color: var(--ink-soft); }
.form-label .req { color: var(--red); }
.form-control, .form-select, textarea.form-control {
    width: 100%; padding: 12px 15px; border: 1.5px solid var(--line-strong); border-radius: 12px;
    font-family: inherit; font-size: 15px; transition: border-color .2s, box-shadow .2s; background: #fff; color: var(--ink);
}
.form-control:focus, .form-select:focus, textarea.form-control:focus { border-color: var(--brand-500); outline: none; box-shadow: 0 0 0 4px var(--brand-50); }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-hint { font-size: 12.5px; color: var(--ink-muted); margin-top: 5px; }
.form-error { font-size: 12.5px; color: var(--red); margin-top: 5px; }
.form-control.is-invalid { border-color: var(--red); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================================
   CARD (generic)
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 24px; }
.prose { color: var(--ink-soft); line-height: 1.85; }
.prose h2 { font-size: 22px; color: var(--brand-900); margin: 28px 0 12px; }
.prose h3 { font-size: 18px; color: var(--brand-800); margin: 22px 0 10px; }
.prose p { margin-bottom: 14px; }
.prose ul, .prose ol { margin: 0 0 16px 22px; }
.prose ul { list-style: disc; } .prose ol { list-style: decimal; }
.prose li { margin-bottom: 6px; }
.prose blockquote { border-left: 4px solid var(--gold-500); background: var(--brand-50); padding: 14px 20px; border-radius: 0 12px 12px 0; font-family: 'Kanit',sans-serif; color: var(--brand-800); margin: 16px 0; font-size: 18px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-muted); }
.empty-state .icon { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 24px; background: var(--brand-50); color: var(--brand-300); display: grid; place-items: center; font-size: 40px; }
.empty-state h3 { color: var(--ink-soft); font-size: 19px; margin-bottom: 6px; }
.empty-state p { margin-bottom: 18px; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact-channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.channel-card { display: flex; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: all .2s; }
.channel-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.channel-icon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.channel-card h4 { font-size: 14px; color: var(--ink-muted); margin-bottom: 3px; font-weight: 500; }
.channel-card p { font-weight: 600; color: var(--ink); font-size: 15px; word-break: break-word; }
.map-embed { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.map-embed iframe { width: 100%; height: 340px; border: 0; display: block; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { background: var(--brand-950); color: #cbd5e1; padding-top: 52px; position: relative; }
.site-footer::before { content:""; position:absolute; top:0; left:0; right:0; height:4px; background: linear-gradient(90deg, var(--brand-600), var(--gold-500)); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: 36px; padding-bottom: 36px; }
.footer-brand { display: flex; gap: 14px; margin-bottom: 16px; }
.footer-brand .nav-logo { width: 52px; height: 52px; }
.footer-brand strong { color: #fff; font-family: 'Kanit',sans-serif; font-size: 17px; display: block; }
.footer-brand span { font-size: 12.5px; }
.footer-col h4 { color: #fff; font-family: 'Kanit',sans-serif; font-size: 16px; margin-bottom: 16px; position: relative; padding-bottom: 10px; }
.footer-col h4::after { content:""; position:absolute; left:0; bottom:0; width:32px; height:2.5px; background: var(--gold-500); border-radius:3px; }
.footer-col ul li { margin-bottom: 9px; }
.footer-col ul a { font-size: 14px; transition: all .2s; display: inline-flex; align-items: center; gap: 7px; }
.footer-col ul a:hover { color: #fff; padding-left: 4px; }
.footer-contact-item { display: flex; gap: 11px; margin-bottom: 13px; font-size: 14px; }
.footer-contact-item i { color: var(--gold-400); margin-top: 3px; }
.footer-social { display: flex; gap: 10px; margin-top: 16px; }
.footer-social a { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.08); display: grid; place-items: center; font-size: 18px; transition: all .2s; }
.footer-social a:hover { background: var(--gold-500); color: var(--brand-950); transform: translateY(-2px); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.footer-dev { display: flex; align-items: center; gap: 12px; }
.footer-dev img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--gold-500); box-shadow: 0 0 14px rgba(251,191,36,.4); object-fit: cover; }
.footer-dev .dev-text small { display: block; opacity: .7; font-size: 11.5px; }
.footer-dev .dev-text a { color: var(--gold-400); font-weight: 600; }
.version-pill { background: rgba(255,255,255,.1); padding: 2px 10px; border-radius: 999px; font-size: 11.5px; margin-left: 8px; }

/* ============================================================
   FLOATING ACTIONS (chatbot / scroll-top) — Popover top-layer
   ============================================================ */
.fab-stack { position: fixed; right: 22px; bottom: 22px; z-index: 60; display: flex; flex-direction: column; gap: 12px; align-items: center; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; inset: auto 22px 22px auto; }
.fab {
    width: 56px; height: 56px; border-radius: 50%; border: 0; display: grid; place-items: center;
    font-size: 24px; color: #fff; box-shadow: var(--shadow-lg); transition: transform .2s;
}
.fab:hover { transform: scale(1.08); }
.fab-chat { background: linear-gradient(135deg, var(--brand-600), var(--brand-400)); }
.fab-top { background: var(--ink); width: 46px; height: 46px; font-size: 20px; opacity: 0; pointer-events: none; transition: opacity .3s, transform .2s; }
.fab-top.show { opacity: 1; pointer-events: auto; }

/* Contact speed-dial */
.fab-contact { background: linear-gradient(135deg, var(--brand-600), var(--brand-400)); position: relative; }
.fab-contact .fab-ping { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 0 rgba(37,99,235,.5); animation: fabPing 2.4s infinite; }
@keyframes fabPing { 0% { box-shadow: 0 0 0 0 rgba(37,99,235,.5); } 70% { box-shadow: 0 0 0 16px rgba(37,99,235,0); } 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); } }
.fab-contact i { transition: transform .3s var(--ease); }
.fab-stack.cw-open .fab-contact { background: var(--ink); }
.fab-stack.cw-open .fab-contact i { transform: rotate(135deg); }
.fab-stack.cw-open .fab-contact .fab-ping { display: none; }

.cw-channels { display: flex; flex-direction: column; gap: 12px; align-items: flex-end; margin-bottom: 2px; opacity: 0; visibility: hidden; transform: translateY(12px) scale(.9); transform-origin: bottom right; transition: all .26s var(--ease); pointer-events: none; }
.fab-stack.cw-open .cw-channels { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.cw-item { position: relative; display: inline-flex; }
.cw-btn { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 20px; box-shadow: var(--shadow-lg); transition: transform .18s var(--ease); }
.cw-item:hover .cw-btn { transform: scale(1.12); }
.cw-label { position: absolute; right: 60px; top: 50%; transform: translateY(-50%) translateX(6px); white-space: nowrap; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: 9px; opacity: 0; pointer-events: none; transition: all .2s var(--ease); box-shadow: var(--shadow); }
.cw-label::after { content: ""; position: absolute; right: -5px; top: 50%; transform: translateY(-50%); border: 6px solid transparent; border-left-color: var(--ink); border-right: 0; }
.cw-item:hover .cw-label { opacity: 1; transform: translateY(-50%); }
.fab-stack.cw-open .cw-item { animation: cwPop .32s var(--ease) backwards; }
.fab-stack.cw-open .cw-item:nth-child(1) { animation-delay: .02s; }
.fab-stack.cw-open .cw-item:nth-child(2) { animation-delay: .06s; }
.fab-stack.cw-open .cw-item:nth-child(3) { animation-delay: .10s; }
.fab-stack.cw-open .cw-item:nth-child(4) { animation-delay: .14s; }
.fab-stack.cw-open .cw-item:nth-child(5) { animation-delay: .18s; }
.fab-stack.cw-open .cw-item:nth-child(6) { animation-delay: .22s; }
@keyframes cwPop { from { opacity: 0; transform: scale(.4) translateY(14px); } to { opacity: 1; transform: none; } }

/* ============================================================
   INLINE EDIT (pencil) — admin/editor เท่านั้น
   ============================================================ */
.edit-corner { position: absolute; top: 18px; right: 18px; z-index: 7; }
.section-head-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.edit-chip {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    padding: 7px 14px; border-radius: 999px;
    background: rgba(255,255,255,.96); color: var(--brand-700);
    border: 1px dashed var(--brand-300); box-shadow: var(--shadow-sm);
    font-family: 'Kanit', sans-serif; font-size: 13px; font-weight: 600;
    backdrop-filter: blur(8px); transition: all .2s var(--ease); cursor: pointer;
}
.edit-chip:hover { background: var(--brand-600); color: #fff; border-color: transparent; border-style: solid; transform: translateY(-1px); box-shadow: var(--shadow); }
.edit-chip i { font-size: 13px; }

/* ============================================================
   ANIMATIONS — reveal on scroll
   ============================================================ */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 37%, #eef2f7 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { *, ::before, ::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } .reveal { opacity: 1; transform: none; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .news-feature { grid-template-columns: 1fr; }
    .quick-grid { grid-template-columns: repeat(4, 1fr); }
    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 28px; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
    .layout-sidebar, .layout-sidebar.right { grid-template-columns: 1fr; }
    .sidebar-aside { order: 2; }
}
@media (max-width: 768px) {
    .nav-menu { display: none; }
    .nav-toggle { display: grid; }
    .nav-login span { display: none; }
    .nav-login { padding: 10px 13px; }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .section { padding: 44px 0; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .topbar-left .topbar-item:not(:first-child) { display: none; }
}
@media (max-width: 480px) {
    .quick-grid { grid-template-columns: repeat(2, 1fr); padding: 16px; gap: 10px; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column-reverse; text-align: center; }
    .hero-arrow { display: none; }
    .container { padding: 0 16px; }
}
