/* app.css — design tokens + override เฉพาะระบบ Event
   โทนน้ำเงินทันสมัย · มือถือเป็นหลัก · ทุกค่าใช้ผ่าน var()
   contrast ผ่าน WCAG AA (ปุ่มมีตัวอักษร = น้ำเงิน/เขียวเข้ม, เหลือง = accent เท่านั้น) */

:root {
    /* fonts */
    --font-heading: 'Kanit', system-ui, sans-serif;
    --font-body: 'Anuphan', system-ui, sans-serif;

    /* palette — approved */
    --navy-800: #1E3A6E;
    --navy-700: #24479A;
    --blue-600: #2563EB;   /* ปุ่มหลัก (ตัวอักษรขาว = ผ่าน) */
    --blue-500: #4F8DF2;   /* gradient/ตกแต่ง ไม่ใช้เป็นพื้นตัวอักษร */
    --blue-100: #DCEAFD;
    --blue-50:  #F1F7FF;
    --sky-bg:   #F5F9FF;
    --green:    #16A34A;   /* ปุ่มสมัคร (ตัวอักษรขาว = ผ่าน) */
    --green-soft:#DCFCE7;
    --green-ink:#15803D;
    --amber:    #F59E0B;   /* accent เท่านั้น */
    --amber-soft:#FEF3C7;
    --amber-ink:#92600A;
    --ink:      #16233D;
    --muted:    #5A6A85;
    --line:     #E4EBF5;
    --radius:   14px;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--sky-bg);
    color: var(--ink);
}

h1,h2,h3,h4,h5,h6, .navbar-brand { font-family: var(--font-heading); font-weight: 500; }

/* navbar */
.app-navbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.app-navbar .navbar-brand { color: var(--navy-800); }

/* buttons — override Bootstrap primary/success to approved tones */
.btn-primary {
    --bs-btn-bg: var(--blue-600);
    --bs-btn-border-color: var(--blue-600);
    --bs-btn-hover-bg: var(--navy-700);
    --bs-btn-hover-border-color: var(--navy-700);
    --bs-btn-active-bg: var(--navy-700);
}
.btn-success {
    --bs-btn-bg: var(--green);
    --bs-btn-border-color: var(--green);
    --bs-btn-hover-bg: #128038;
    --bs-btn-hover-border-color: #128038;
}

/* amber accent for badges only */
.badge-accent { background: var(--amber-soft); color: var(--amber-ink); }

/* cards */
.card { border-radius: var(--radius); }

/* footer */
.app-footer {
    background: var(--navy-800);
    color: #C6D6F3;
    margin-top: 3rem;
    line-height: 1.9;
}

/* focus visibility (a11y) */
:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; }

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ===== หน้าแรก — hero เต็มกว้าง ===== */
.home-hero {
    position: relative;
    /* ดึงออกจาก .container ให้เต็มกว้างจอ — ใช้ 100% + margin ลบ ไม่ใช้ 100vw (กัน scroll แนวนอน) */
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-top: -1.5rem;
    width: auto;
    min-height: 420px;
    background-image: image-set(
        url('../img/hero-banner.webp') type('image/webp'),
        url('../img/hero-banner.jpg') type('image/jpeg'));
    background-image: url('../img/hero-banner.jpg'); /* fallback */
    background-image: -webkit-image-set(
        url('../img/hero-banner.webp') 1x);
    background-size: cover;
    background-position: center right;
    display: flex;
    align-items: center;
}
/* overlay ไล่เฉดน้ำเงินฝั่งซ้าย ให้ตัวอักษรอ่านออกแม้ภาพสว่าง */
.home-hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(90deg,
        rgba(11,22,54,0.88) 0%,
        rgba(20,40,90,0.66) 38%,
        rgba(20,40,90,0.12) 62%,
        rgba(20,40,90,0) 100%);
}
.home-hero-inner { position: relative; z-index: 1; }
.home-hero-text { max-width: 560px; color: #fff; padding: 2rem 0; }
.home-hero-text h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.15; margin-bottom: .6rem; }
.home-hero-text h1 .accent { color: #FCD34D; }
.home-hero-text .lead-1 { font-size: 1.05rem; color: #EAF1FE; margin-bottom: .2rem; }
.home-hero-text .lead-2 { font-size: .9rem; color: #CBD9F5; margin-bottom: 1.2rem; }
.home-hero-btns { display: flex; gap: .6rem; flex-wrap: wrap; }

/* สถิติใต้ hero */
.home-stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem;
    margin-top: -40px;   /* ลอยทับขอบ hero ให้ดูมีมิติ */
    position: relative; z-index: 3;
}
.home-stats .stat-box {
    background: #fff; border-radius: var(--radius); padding: 1rem .5rem; text-align: center;
    box-shadow: 0 6px 18px rgba(15,27,51,.10);
}
.home-stats .num { font-size: 1.4rem; font-weight: 600; color: var(--navy-800); }
.home-stats .lbl { font-size: .8rem; color: var(--muted); }

@media (max-width: 575.98px) {
    .home-hero { min-height: 320px; }
    .home-hero-text { padding: 1.2rem 0; }
    .home-hero-btns .btn { flex: 1; }
}

/* ===== Sticky footer — footer ชิดล่างเสมอแม้เนื้อหาสั้น ===== */
html, body { height: 100%; }
html { overflow-x: hidden; }  /* กัน scroll แนวนอนจาก element เต็มจอ */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
body > main { flex: 1 0 auto; }
.app-footer { flex-shrink: 0; }

/* ลิงก์ครู/เจ้าหน้าที่ใน footer */
.app-footer-link {
    color: #B9C7E8; font-size: .85rem; text-decoration: none;
    border: 1px solid rgba(255,255,255,.25); border-radius: 6px;
    padding: 2px 12px; transition: all .15s;
}
.app-footer-link:hover { color: #fff; border-color: rgba(255,255,255,.6); }

/* เมนูลัด 3 ปุ่มเท่ากัน (ใต้ hero) */
.home-quicknav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* เท่ากันเป๊ะ 3 ช่อง */
    gap: 16px;
    max-width: 1140px;
    margin: -36px auto 0;   /* ดึงขึ้นทับขอบ hero */
    padding: 0 12px;
    position: relative;
    z-index: 3;
}
.quicknav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 130px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(16, 42, 92, .10);
    text-decoration: none;
    color: #1e293b;
    font-weight: 700;
    transition: transform .15s, box-shadow .15s;
    border: 1px solid #eef2f9;
    padding: 12px;
    text-align: center;
}
.quicknav-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(16, 42, 92, .16);
    color: #1d4ed8;
}
.quicknav-card .ic { font-size: 2.2rem; line-height: 1; margin-bottom: 4px; }
.quicknav-card .tx { font-size: 1.05rem; }
.quicknav-card .sub { font-size: .8rem; font-weight: 400; color: #94a3b8; }

/* มือถือ: เรียงลงเป็นแถวเดียว (1 คอลัมน์ กว้างเต็ม กดง่าย) */
@media (max-width: 767.98px) {
    .home-quicknav {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 16px;
    }
    .quicknav-card {
        flex-direction: row;
        justify-content: flex-start;
        min-height: 64px;
        gap: 14px;
        text-align: left;
    }
    .quicknav-card .ic { font-size: 1.8rem; margin-bottom: 0; }
    .quicknav-card .tx { font-size: 1rem; }
    .quicknav-card .sub { display: none; }  /* ซ่อนคำอธิบายบนมือถือ ให้กระชับ */
}

/* การ์ดกิจกรรม: ยกขึ้นเล็กน้อย + เงาเข้มขึ้นตอน hover */
.hover-lift {
    transition: transform .18s ease, box-shadow .18s ease;
}
.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 32px rgba(16, 42, 92, .18) !important;
}
/* ปิด effect บนอุปกรณ์สัมผัส (มือถือ hover ไม่มีจริง) */
@media (hover: none) {
    .hover-lift:hover { transform: none; }
}
